mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-23 02:07:26 +08:00
Analytics: Allow calls to logEvent even if we haven't been initialzed
This commit is contained in:
@ -136,7 +136,7 @@ class Analytics {
|
||||
return _global!;
|
||||
}
|
||||
|
||||
static Analytics get instance => _global!;
|
||||
static Analytics? get instance => _global!;
|
||||
|
||||
Future<void> log({
|
||||
required Event e,
|
||||
@ -168,6 +168,6 @@ class Analytics {
|
||||
}
|
||||
|
||||
void logEvent(Event event, {Map<String, String> parameters = const {}}) {
|
||||
Analytics.instance.log(e: event, parameters: parameters);
|
||||
Analytics.instance?.log(e: event, parameters: parameters);
|
||||
Log.d("$event", props: parameters);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ class AnalyticsRouteObserver extends RouteObserver<PageRoute<dynamic>> {
|
||||
}
|
||||
|
||||
try {
|
||||
await Analytics.instance.setCurrentScreen(screenName: screenName);
|
||||
await Analytics.instance?.setCurrentScreen(screenName: screenName);
|
||||
} catch (e, stackTrace) {
|
||||
Log.e("AnalyticsRouteObserver", ex: e, stacktrace: stackTrace);
|
||||
}
|
||||
|
@ -97,7 +97,8 @@ class JournalApp extends StatefulWidget {
|
||||
));
|
||||
}
|
||||
|
||||
static void _enableAnalyticsIfPossible(AppSettings appSettings) async {
|
||||
static Future<void> _enableAnalyticsIfPossible(
|
||||
AppSettings appSettings) async {
|
||||
JournalApp.isInDebugMode = foundation.kDebugMode;
|
||||
|
||||
var isPhysicalDevice = true;
|
||||
|
@ -152,7 +152,7 @@ class GitJournalRepo with ChangeNotifier {
|
||||
Log.i("Branch $_currentBranch");
|
||||
|
||||
// Makes it easier to filter the analytics
|
||||
Analytics.instance.setUserProperty(
|
||||
Analytics.instance?.setUserProperty(
|
||||
name: 'onboarded',
|
||||
value: remoteGitRepoConfigured.toString(),
|
||||
);
|
||||
|
Reference in New Issue
Block a user