add facebook

This commit is contained in:
admin
2026-06-05 17:45:10 +08:00
parent be490bd322
commit 52eb40b190
6 changed files with 198 additions and 55 deletions

View File

@@ -11,6 +11,8 @@ import 'package:adjust_sdk/adjust_session_failure.dart';
import 'package:adjust_sdk/adjust_session_success.dart';
import 'package:freecell/utils/report.dart';
import '../facebook/facebook_service.dart';
typedef EventParams = Map<String, dynamic>;
class AdjustService {
@@ -34,7 +36,7 @@ class AdjustService {
return double.tryParse('$v');
}
Future<void> init(String appToken, [bool isProd = true]) async{
Future<void> init(String appToken, [bool isProd = true]) async {
developer.log(appToken, name: 'Adjust');
if (_inited) {
@@ -51,7 +53,7 @@ class AdjustService {
final config = AdjustConfig(appToken, environment);
config.isCostDataInAttributionEnabled = true;
config.attributionCallback = (AdjustAttribution a) async {
debugPrint('Adjust attribution: ${a.toString()}');
ReportService.I.attribution = a;
@@ -86,12 +88,15 @@ class AdjustService {
debugPrint('call trackEventWithName eventName $eventName params $params');
// 你可以在这里做个映射eventName -> eventToken
// 也可以直接让外部传 eventToken 过来
ReportService.I.report(eventName, params);
await FacebookService.instance.trackEvent(eventName, params);
final eventToken = _eventNameToToken[eventName];
if (eventToken == null) {
debugPrint('not find eventToken $eventName');
return;
}
ReportService.I.report(eventName, params);
await trackEvent(eventToken, params);
}