mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-24 16:30:40 +00:00
35 lines
910 B
Dart
35 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},
|
||
|
);
|
||
|
}
|
||
|
}
|