Skip to content

Commit

Permalink
Add mixpanel events for submit app flow (#1252)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmohsin7 authored Nov 5, 2024
2 parents 795748d + c0077d0 commit fd5e913
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/lib/pages/apps/add_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:friend_private/backend/preferences.dart';
import 'package:friend_private/pages/apps/providers/add_app_provider.dart';
import 'package:friend_private/pages/apps/widgets/external_trigger_fields_widget.dart';
import 'package:friend_private/utils/analytics/mixpanel.dart';
import 'package:friend_private/widgets/confirmation_dialog.dart';
import 'package:gradient_borders/gradient_borders.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -69,6 +70,7 @@ class _AddAppPageState extends State<AddAppPage> {
children: [
GestureDetector(
onTap: () {
MixpanelManager().pageOpened('App Submission Help');
launchUrl(Uri.parse('https://omi.me/apps/introduction'));
},
child: Container(
Expand Down Expand Up @@ -548,8 +550,20 @@ class _AddAppPageState extends State<AddAppPage> {
}
},
onConfirm: () async {
if (provider.privacyLevel == 'private') {
MixpanelManager().privateAppSubmitted({
'app_name': provider.appNameController.text,
'app_category': provider.appCategory,
'app_capabilities': provider.capabilities,
});
} else {
MixpanelManager().publicAppSubmitted({
'app_name': provider.appNameController.text,
'app_category': provider.appCategory,
'app_capabilities': provider.capabilities,
});
}
SharedPreferencesUtil().showSubmitAppConfirmation = showSubmitAppConfirmation;

Navigator.pop(context);
await provider.submitApp();
},
Expand Down
2 changes: 2 additions & 0 deletions app/lib/pages/apps/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:friend_private/pages/apps/list_item.dart';
import 'package:friend_private/pages/chat/widgets/animated_mini_banner.dart';
import 'package:friend_private/providers/connectivity_provider.dart';
import 'package:friend_private/providers/app_provider.dart';
import 'package:friend_private/utils/analytics/mixpanel.dart';
import 'package:friend_private/utils/other/temp.dart';
import 'package:friend_private/widgets/dialog.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -59,6 +60,7 @@ class _AppsPageState extends State<AppsPage> with AutomaticKeepAliveClientMixin
),
InkWell(
onTap: () {
MixpanelManager().pageOpened('Submit App');
routeToPage(context, const AddAppPage());
},
child: AnimatedMiniBanner(
Expand Down
4 changes: 4 additions & 0 deletions app/lib/utils/analytics/mixpanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class MixpanelManager {
setUserProperty('Apps Enabled Count', _preferences.enabledAppsCount);
}

void privateAppSubmitted(Map<String, dynamic> properties) => track('Private App Submitted', properties: properties);

void publicAppSubmitted(Map<String, dynamic> properties) => track('Public App Submitted', properties: properties);

void appDisabled(String appId) {
track('App Disabled', properties: {'app_id': appId});
setUserProperty('Apps Enabled Count', _preferences.enabledAppsCount);
Expand Down

0 comments on commit fd5e913

Please sign in to comment.