From c0077d0f7ede96d48b29faacb3d43f96a462ed11 Mon Sep 17 00:00:00 2001 From: Mohammed Mohsin <59914433+mdmohsin7@users.noreply.github.com> Date: Tue, 5 Nov 2024 17:40:44 +0530 Subject: [PATCH] add mixpanel events for submit app flow --- app/lib/pages/apps/add_app.dart | 16 +++++++++++++++- app/lib/pages/apps/page.dart | 2 ++ app/lib/utils/analytics/mixpanel.dart | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/lib/pages/apps/add_app.dart b/app/lib/pages/apps/add_app.dart index 80c028b13..536ac6a2f 100644 --- a/app/lib/pages/apps/add_app.dart +++ b/app/lib/pages/apps/add_app.dart @@ -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'; @@ -69,6 +70,7 @@ class _AddAppPageState extends State { children: [ GestureDetector( onTap: () { + MixpanelManager().pageOpened('App Submission Help'); launchUrl(Uri.parse('https://omi.me/apps/introduction')); }, child: Container( @@ -548,8 +550,20 @@ class _AddAppPageState extends State { } }, 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(); }, diff --git a/app/lib/pages/apps/page.dart b/app/lib/pages/apps/page.dart index d8d2c703f..e0c946ec5 100644 --- a/app/lib/pages/apps/page.dart +++ b/app/lib/pages/apps/page.dart @@ -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'; @@ -59,6 +60,7 @@ class _AppsPageState extends State with AutomaticKeepAliveClientMixin ), InkWell( onTap: () { + MixpanelManager().pageOpened('Submit App'); routeToPage(context, const AddAppPage()); }, child: AnimatedMiniBanner( diff --git a/app/lib/utils/analytics/mixpanel.dart b/app/lib/utils/analytics/mixpanel.dart index abeeac951..1b84c1113 100644 --- a/app/lib/utils/analytics/mixpanel.dart +++ b/app/lib/utils/analytics/mixpanel.dart @@ -102,6 +102,10 @@ class MixpanelManager { setUserProperty('Apps Enabled Count', _preferences.enabledAppsCount); } + void privateAppSubmitted(Map properties) => track('Private App Submitted', properties: properties); + + void publicAppSubmitted(Map properties) => track('Public App Submitted', properties: properties); + void appDisabled(String appId) { track('App Disabled', properties: {'app_id': appId}); setUserProperty('Apps Enabled Count', _preferences.enabledAppsCount);