mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-14 23:40:30 +08:00
Don't even touch the firebase code if analytics are disabled
The anlaytics fuctions do not do anything when analytics collection is disabled, and I've verified that I do not get any events in the firebase dashboard. However, to be on the safer side lets not even touch the code. Related to #506
This commit is contained in:
@ -146,8 +146,10 @@ class Analytics {
|
|||||||
Map<String, String> parameters = const {},
|
Map<String, String> parameters = const {},
|
||||||
}) async {
|
}) async {
|
||||||
String name = _eventToString(e);
|
String name = _eventToString(e);
|
||||||
if (Platform.isAndroid || Platform.isIOS) {
|
if (enabled) {
|
||||||
await firebase.logEvent(name: name, parameters: parameters);
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
|
await firebase.logEvent(name: name, parameters: parameters);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
captureErrorBreadcrumb(name: name, parameters: parameters);
|
captureErrorBreadcrumb(name: name, parameters: parameters);
|
||||||
}
|
}
|
||||||
@ -160,13 +162,21 @@ class Analytics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setCurrentScreen({required String screenName}) async {
|
Future<void> setCurrentScreen({required String screenName}) async {
|
||||||
|
if (!enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Platform.isAndroid || Platform.isIOS) {
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
await firebase.setCurrentScreen(screenName: screenName);
|
await firebase.setCurrentScreen(screenName: screenName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setUserProperty(
|
Future<void> setUserProperty({
|
||||||
{required String name, required String value}) async {
|
required String name,
|
||||||
|
required String value,
|
||||||
|
}) async {
|
||||||
|
if (!enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Platform.isAndroid || Platform.isIOS) {
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
await firebase.setUserProperty(name: name, value: value);
|
await firebase.setUserProperty(name: name, value: value);
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,10 @@ void captureErrorBreadcrumb({
|
|||||||
required String name,
|
required String name,
|
||||||
required Map<String, String> parameters,
|
required Map<String, String> parameters,
|
||||||
}) {
|
}) {
|
||||||
|
if (!reportCrashes) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var b = Breadcrumb(
|
var b = Breadcrumb(
|
||||||
message: name,
|
message: name,
|
||||||
timestamp: DateTime.now(),
|
timestamp: DateTime.now(),
|
||||||
|
Reference in New Issue
Block a user