m3_lightmeter/lib/data/analytics/analytics.dart
Vadim a52efcd341
ML-130 Integrate Firebase Remote Config (#132)
* implemented `RemoteConfigService`

* added alternative translations

* typo

* added `firebase_analytics`

* dim paid features list tiles

* log list tile tap instead of dialog

* implemented `RemoteConfigProvider`

* typo
2023-10-31 18:42:25 +01:00

34 lines
910 B
Dart

import 'dart:async';
import 'dart:developer';
import 'package:flutter/foundation.dart';
import 'package:lightmeter/data/analytics/api/analytics_api_interface.dart';
import 'package:lightmeter/data/analytics/entity/analytics_event.dart';
class LightmeterAnalytics {
final ILightmeterAnalyticsApi _api;
const LightmeterAnalytics({required ILightmeterAnalyticsApi api}) : _api = api;
Future<void> logEvent(
LightmeterAnalyticsEvent event, {
Map<String, dynamic>? parameters,
}) async {
if (kDebugMode) {
log('<LightmeterAnalytics> logEvent: ${event.name} / $parameters');
return;
}
return _api.logEvent(
event: event,
parameters: parameters,
);
}
Future<void> logUnlockProFeatures(String listTileTitle) async {
return logEvent(
LightmeterAnalyticsEvent.unlockProFeatures,
parameters: {"listTileTitle": listTileTitle},
);
}
}