|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:thinking_analytics/td_analytics.dart';
|
|
|
|
|
|
|
|
import '../config/app_environment_config.dart';
|
|
|
|
import '../constants/app_const.dart';
|
|
|
|
import '../logging/app_logger.dart';
|
|
...
|
...
|
@@ -13,17 +16,35 @@ class ThinkingDataService { |
|
|
|
'ThinkingData init appId=${_environment.thinkingDataAppId} '
|
|
|
|
'url=${AppConst.thinkingDataServerUrl}',
|
|
|
|
);
|
|
|
|
TDAnalytics.init(
|
|
|
|
_environment.thinkingDataAppId, AppConst.thinkingDataServerUrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
void login(int userId) {
|
|
|
|
void login(String userId) {
|
|
|
|
AppLogger.i('ThinkingData login $userId');
|
|
|
|
TDAnalytics.login(userId);
|
|
|
|
}
|
|
|
|
|
|
|
|
void logout() {
|
|
|
|
AppLogger.i('ThinkingData logout');
|
|
|
|
TDAnalytics.logout();
|
|
|
|
}
|
|
|
|
|
|
|
|
void userSet(Map<String, Object?> properties) {
|
|
|
|
AppLogger.i('ThinkingData userSet $properties');
|
|
|
|
TDAnalytics.setSuperProperties(properties);
|
|
|
|
}
|
|
|
|
|
|
|
|
void timeEvent(String s) {
|
|
|
|
TDAnalytics.timeEvent(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void track(String s, {Map<String, dynamic>? properties}) {
|
|
|
|
TDAnalytics.track(s, properties: properties);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ThinkingDataService get instance => Get.find<ThinkingDataService>();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Global shorthand to access [ThinkingDataService]
|
|
|
|
ThinkingDataService get ta => Get.find<ThinkingDataService>(); |
...
|
...
|
|