Skip to content

Commit

Permalink
feat: add analytics (#423)
Browse files Browse the repository at this point in the history
* feat: add analytics

* fix: build error

* fix: naming error

* refactor: logEvent

* fix: 'id' was assigned -1

* feat: add page source enum

* refactor: get name and parameter function

* refactor: page source enum's order

* chore: update dependencies

* feat: add analytics

* feat: add analystics

* chore: upgrade Podfile.lock

* feat: add router observer

* chore(deps): remove flutter_hooks

* feat: add analytics repository helper

* feat: add AutoRouteObserver

* feat: add pageview event for feed page

* feat: add pageview event for category page

* feat: add pageview event for main bottom tab navigator

* feat: add pageview event for profile page

* feat: add pageview event for list page

* fix: remove null event parameter

* feat: add pageview event for search page

* feat: add pageview event for write body page

* feat: click back button event

* feat: add pageview event for detail page

* feat: add pageview event for notice edit page

* feat: add pageview event for write config page

* feat: add pageview event for add hashtag page

* feat: add pageview event for write config preview page

* feat: add pageview event for notice write consent page

* feat: add pageview event for notice edit body page

* feat: add pageview event for notice edit additional page

* feat: add pageview event for notice edit preview page

* feat: add pageview event for profile setting page

* feat: add pageview event for profile setting information page

* refactor: remove unused imports

* feat: add analytics

* fix: language toggle merge error

* fix: always invoke ai translation click event even if condition is not met

* fix: additional notice event condition

* refactor: separate analytics repositories

* fix: wrong import

* refactor: cleanup import

* feat: link firebase analytics repository to MultipleAnalyticsRepository

* chore(deps): add amplitude

* feat: use amplitude analytics

* feat: register FirebaseAnalyticsRepository to injectable

* chore(deps): add flutter_smartlook

* feat: integrate smartlook

* chore(deps): add flutter_dotenv

* feat: use dotenv

* chore(ci/cd): copy dotenv

* chore: update Podfile.lock

* refactor: analytics instance getting

* chore: remove logging in FirebaseAnalyticsRepository

* fix: try~catch in MultipleAnalyticsRepository

* refactor: use injected AnalyticsRepository

* feat: add ai translation action event

* fix: make activated language button non clickable

* fix: wrong condition for ai translation

* refactor: bottom navigation page click action

* fix: notice can be null issue in detail page

* fix: notice can be null issue in notice edit page

* refactor: string -> Language enum

* fix: ai translate condition

* fix: add type parameter in publish agree event

* fix: don't render child of single notice shell layout if no data in bloc

* refactor: make camelToSnake as global function not method

* feat: deadline selector view event

---------

Co-authored-by: 2paperstar <[email protected]>
  • Loading branch information
GwanLiZa and 2paperstar authored Oct 3, 2024
1 parent c61b3d0 commit dac6567
Show file tree
Hide file tree
Showing 49 changed files with 1,459 additions and 347 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ jobs:
bundler-cache: true
working-directory: ${{ env.directory }}

- name: Copy dotenv
if: env.run == 'true'
run: cat ${{ secrets.DOTENV }} > .env

- name: Generate files
if: env.run == 'true'
run: |
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ jobs:
~/Library/Caches/CocoaPods
key: cocoapods-${{ hashFiles('ios/Podfile.lock') }}

- name: Copy dotenv
if: env.run == 'true'
run: cat ${{ secrets.DOTENV }} > .env

- name: Generate files
run: |
dart run slang
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ app.*.map.json
*.freezed.dart
*.gen.dart
locator.config.dart

# env
.env
138 changes: 79 additions & 59 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,61 +1,65 @@
PODS:
- device_info_plus (0.0.1):
- Amplitude (8.18.0):
- AnalyticsConnector (~> 1.0.0)
- amplitude_flutter (0.0.1):
- Amplitude (= 8.18.0)
- Flutter
- Firebase/Analytics (11.0.0):
- AnalyticsConnector (1.0.3)
- Firebase/Analytics (11.2.0):
- Firebase/Core
- Firebase/Core (11.0.0):
- Firebase/Core (11.2.0):
- Firebase/CoreOnly
- FirebaseAnalytics (~> 11.0.0)
- Firebase/CoreOnly (11.0.0):
- FirebaseCore (= 11.0.0)
- Firebase/Crashlytics (11.0.0):
- FirebaseAnalytics (~> 11.2.0)
- Firebase/CoreOnly (11.2.0):
- FirebaseCore (= 11.2.0)
- Firebase/Crashlytics (11.2.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 11.0.0)
- Firebase/Messaging (11.0.0):
- FirebaseCrashlytics (~> 11.2.0)
- Firebase/Messaging (11.2.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 11.0.0)
- firebase_analytics (11.3.0):
- Firebase/Analytics (= 11.0.0)
- FirebaseMessaging (~> 11.2.0)
- firebase_analytics (11.3.3):
- Firebase/Analytics (= 11.2.0)
- firebase_core
- Flutter
- firebase_core (3.4.1):
- Firebase/CoreOnly (= 11.0.0)
- firebase_core (3.6.0):
- Firebase/CoreOnly (= 11.2.0)
- Flutter
- firebase_crashlytics (4.1.0):
- Firebase/Crashlytics (= 11.0.0)
- firebase_crashlytics (4.1.3):
- Firebase/Crashlytics (= 11.2.0)
- firebase_core
- Flutter
- firebase_messaging (15.1.0):
- Firebase/Messaging (= 11.0.0)
- firebase_messaging (15.1.3):
- Firebase/Messaging (= 11.2.0)
- firebase_core
- Flutter
- FirebaseAnalytics (11.0.0):
- FirebaseAnalytics/AdIdSupport (= 11.0.0)
- FirebaseAnalytics (11.2.0):
- FirebaseAnalytics/AdIdSupport (= 11.2.0)
- FirebaseCore (~> 11.0)
- FirebaseInstallations (~> 11.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- FirebaseAnalytics/AdIdSupport (11.0.0):
- FirebaseAnalytics/AdIdSupport (11.2.0):
- FirebaseCore (~> 11.0)
- FirebaseInstallations (~> 11.0)
- GoogleAppMeasurement (= 11.0.0)
- GoogleAppMeasurement (= 11.2.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- FirebaseCore (11.0.0):
- FirebaseCore (11.2.0):
- FirebaseCoreInternal (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/Logger (~> 8.0)
- FirebaseCoreExtension (11.1.0):
- FirebaseCoreExtension (11.3.0):
- FirebaseCore (~> 11.0)
- FirebaseCoreInternal (11.1.0):
- FirebaseCoreInternal (11.3.0):
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- FirebaseCrashlytics (11.0.0):
- FirebaseCrashlytics (11.2.0):
- FirebaseCore (~> 11.0)
- FirebaseInstallations (~> 11.0)
- FirebaseRemoteConfigInterop (~> 11.0)
Expand All @@ -64,12 +68,12 @@ PODS:
- GoogleUtilities/Environment (~> 8.0)
- nanopb (~> 3.30910.0)
- PromisesObjC (~> 2.4)
- FirebaseInstallations (11.1.0):
- FirebaseInstallations (11.3.0):
- FirebaseCore (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- PromisesObjC (~> 2.4)
- FirebaseMessaging (11.0.0):
- FirebaseMessaging (11.2.0):
- FirebaseCore (~> 11.0)
- FirebaseInstallations (~> 11.0)
- GoogleDataTransport (~> 10.0)
Expand All @@ -78,8 +82,8 @@ PODS:
- GoogleUtilities/Reachability (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0)
- nanopb (~> 3.30910.0)
- FirebaseRemoteConfigInterop (11.1.0)
- FirebaseSessions (11.1.0):
- FirebaseRemoteConfigInterop (11.3.0)
- FirebaseSessions (11.3.0):
- FirebaseCore (~> 11.0)
- FirebaseCoreExtension (~> 11.0)
- FirebaseInstallations (~> 11.0)
Expand All @@ -96,29 +100,31 @@ PODS:
- flutter_inappwebview/Core (0.0.1):
- Flutter
- OrderedSet (~> 5.0)
- flutter_keyboard_visibility (0.0.1):
- flutter_keyboard_visibility_temp_fork (0.0.1):
- Flutter
- flutter_local_notifications (0.0.1):
- Flutter
- flutter_secure_storage (6.0.0):
- Flutter
- flutter_smartlook (4.1.24):
- Flutter
- flutter_web_auth_2 (3.0.0):
- Flutter
- GoogleAppMeasurement (11.0.0):
- GoogleAppMeasurement/AdIdSupport (= 11.0.0)
- GoogleAppMeasurement (11.2.0):
- GoogleAppMeasurement/AdIdSupport (= 11.2.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/AdIdSupport (11.0.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 11.0.0)
- GoogleAppMeasurement/AdIdSupport (11.2.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 11.2.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/WithoutAdIdSupport (11.0.0):
- GoogleAppMeasurement/WithoutAdIdSupport (11.2.0):
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
- GoogleUtilities/MethodSwizzler (~> 8.0)
- GoogleUtilities/Network (~> 8.0)
Expand Down Expand Up @@ -185,6 +191,8 @@ PODS:
- PromisesObjC (2.4.0)
- PromisesSwift (2.4.0):
- PromisesObjC (= 2.4.0)
- quill_native_bridge (0.0.1):
- Flutter
- share_plus (0.0.1):
- Flutter
- sqflite (0.0.3):
Expand All @@ -196,30 +204,34 @@ PODS:
- Flutter

DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- amplitude_flutter (from `.symlinks/plugins/amplitude_flutter/ios`)
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- FirebaseMessaging
- Flutter (from `Flutter`)
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_keyboard_visibility_temp_fork (from `.symlinks/plugins/flutter_keyboard_visibility_temp_fork/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- flutter_smartlook (from `.symlinks/plugins/flutter_smartlook/ios`)
- flutter_web_auth_2 (from `.symlinks/plugins/flutter_web_auth_2/ios`)
- GoogleUtilities
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- quill_native_bridge (from `.symlinks/plugins/quill_native_bridge/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
trunk:
- Amplitude
- AnalyticsConnector
- Firebase
- FirebaseAnalytics
- FirebaseCore
Expand All @@ -239,8 +251,8 @@ SPEC REPOS:
- PromisesSwift

EXTERNAL SOURCES:
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
amplitude_flutter:
:path: ".symlinks/plugins/amplitude_flutter/ios"
firebase_analytics:
:path: ".symlinks/plugins/firebase_analytics/ios"
firebase_core:
Expand All @@ -253,12 +265,14 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_inappwebview:
:path: ".symlinks/plugins/flutter_inappwebview/ios"
flutter_keyboard_visibility:
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
flutter_keyboard_visibility_temp_fork:
:path: ".symlinks/plugins/flutter_keyboard_visibility_temp_fork/ios"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
flutter_smartlook:
:path: ".symlinks/plugins/flutter_smartlook/ios"
flutter_web_auth_2:
:path: ".symlinks/plugins/flutter_web_auth_2/ios"
image_picker_ios:
Expand All @@ -269,6 +283,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
quill_native_bridge:
:path: ".symlinks/plugins/quill_native_bridge/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
sqflite:
Expand All @@ -279,28 +295,31 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
Firebase: 9f574c08c2396885b5e7e100ed4293d956218af9
firebase_analytics: 1a66fe8d4375eccff44671ea37897683a78b2675
firebase_core: ba84e940cf5cbbc601095f86556560937419195c
firebase_crashlytics: e4f04180f443d5a8b56fbc0685bdbd7d90dd26f0
firebase_messaging: 15d8b557010f3bb7b98d0302e1c7c8fbcd244425
FirebaseAnalytics: 27eb78b97880ea4a004839b9bac0b58880f5a92a
FirebaseCore: 3cf438f431f18c12cdf2aaf64434648b63f7e383
FirebaseCoreExtension: aa5c9779c2d0d39d83f1ceb3fdbafe80c4feecfa
FirebaseCoreInternal: adefedc9a88dbe393c4884640a73ec9e8e790f8c
FirebaseCrashlytics: 745d8f0221fe49c62865391d1bf56f5a12eeec0b
FirebaseInstallations: d0a8fea5a6fa91abc661591cf57c0f0d70863e57
FirebaseMessaging: d2d1d9c62c46dd2db49a952f7deb5b16ad2c9742
FirebaseRemoteConfigInterop: abf8b1bbc0bf1b84abd22b66746926410bf91a87
FirebaseSessions: 78f137e68dc01ca71606169ba4ac73b98c13752a
Amplitude: 184def4f87aa26f94a93a7faa334e06b1cae704d
amplitude_flutter: 0f617f89d62b10c40a0ab14849e660a7c12e4e46
AnalyticsConnector: a53214d38ae22734c6266106c0492b37832633a9
Firebase: 98e6bf5278170668a7983e12971a66b2cd57fc8c
firebase_analytics: fbc57838bdb94eef1e0ff504f127d974ff2981ad
firebase_core: 2bedc3136ec7c7b8561c6123ed0239387b53f2af
firebase_crashlytics: 37d104d457b51760b48504a93a12b3bf70995d77
firebase_messaging: 15d114e1a41fc31e4fbabcd48d765a19eec94a38
FirebaseAnalytics: c36efd5710c60c17558650fa58c2066eca7e9265
FirebaseCore: a282032ae9295c795714ded2ec9c522fc237f8da
FirebaseCoreExtension: 30bb063476ef66cd46925243d64ad8b2c8ac3264
FirebaseCoreInternal: ac26d09a70c730e497936430af4e60fb0c68ec4e
FirebaseCrashlytics: cfc69af5b53565dc6a5e563788809b5778ac4eac
FirebaseInstallations: 58cf94dabf1e2bb2fa87725a9be5c2249171cda0
FirebaseMessaging: c9ec7b90c399c7a6100297e9d16f8a27fc7f7152
FirebaseRemoteConfigInterop: c3a5c31b3c22079f41ba1dc645df889d9ce38cb9
FirebaseSessions: 655ff17f3cc1a635cbdc2d69b953878001f9e25b
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_inappwebview: 3d32228f1304635e7c028b0d4252937730bbc6cf
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_keyboard_visibility_temp_fork: 442dadca3b81868a225cd6a2f605bffff1215844
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
flutter_smartlook: 2f8ffb62fb0197739e3a412ddb4e65eb67d8a237
flutter_web_auth_2: 051cf9f5dc366f31b5dcc4e2952c2b954767be8a
GoogleAppMeasurement: 6e49ffac7d3f2c3ded9cc663f912a13b67bbd0de
GoogleAppMeasurement: 76d4f8b36b03bd8381fa9a7fe2cc7f99c0a2e93a
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
Expand All @@ -311,6 +330,7 @@ SPEC CHECKSUMS:
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
quill_native_bridge: e5afa7d49c08cf68c52a5e23bc272eba6925c622
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
Expand Down
9 changes: 8 additions & 1 deletion lib/app/app.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -12,6 +13,7 @@ import 'package:ziggle/app/modules/user/presentation/bloc/auth_bloc.dart';
import 'package:ziggle/app/modules/user/presentation/bloc/developer_option_bloc.dart';
import 'package:ziggle/app/modules/user/presentation/bloc/user_bloc.dart';
import 'package:ziggle/app/router.dart';
import 'package:ziggle/app/router_observer.dart';
import 'package:ziggle/app/values/palette.dart';
import 'package:ziggle/app/values/theme.dart';
import 'package:ziggle/gen/strings.g.dart';
Expand All @@ -31,7 +33,12 @@ class App extends StatelessWidget {
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
child: MaterialApp.router(
theme: AppTheme.theme,
routerConfig: _appRouter.config(),
routerConfig: _appRouter.config(
navigatorObservers: () => [
AutoRouteObserver(),
sl<AppRouterObserver>(),
],
),
locale: TranslationProvider.of(context).flutterLocale,
supportedLocales: AppLocaleUtils.supportedLocales,
localizationsDelegates: GlobalMaterialLocalizations.delegates,
Expand Down
Loading

0 comments on commit dac6567

Please sign in to comment.