|
|
@@ -1,4 +1,5 @@
|
|
|
import 'dart:async';
|
|
|
+import 'dart:io';
|
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:injectable/injectable.dart';
|
|
|
@@ -19,6 +20,7 @@ import 'package:location/di/get_it.dart';
|
|
|
import 'package:location/module/main/today_track_helper.dart';
|
|
|
import 'package:location/push_notification/ios_push_notification_service.dart';
|
|
|
import 'package:location/resource/string.gen.dart';
|
|
|
+import 'package:location/sdk/jpush/jpush_helper.dart';
|
|
|
import 'package:location/socket/atmob_location_client.dart';
|
|
|
import 'package:location/utils/async_util.dart';
|
|
|
import 'package:location/utils/atmob_log.dart';
|
|
|
@@ -253,11 +255,14 @@ class AccountRepository {
|
|
|
///请求推送的数据
|
|
|
Future<void> onRequestNotificationReport() async {
|
|
|
// 初始化推送服务
|
|
|
- var tokenStr = await IosPushNotificationService.getDeviceToken();
|
|
|
- print("tokenStrsfsdf---${tokenStr}");
|
|
|
+ String? token;
|
|
|
+ if (Platform.isIOS) {
|
|
|
+ token = await IosPushNotificationService.getDeviceToken();
|
|
|
+ } else if (Platform.isAndroid) {
|
|
|
+ token = await JpushHelper.getRegistrationId();
|
|
|
+ }
|
|
|
return atmobApi
|
|
|
- .notificationReport(
|
|
|
- NotificationReportRequest(deviceToken: tokenStr as String))
|
|
|
+ .notificationReport(NotificationReportRequest(deviceToken: token ?? ''))
|
|
|
.then(HttpHandler.handle(false))
|
|
|
.then((response) {})
|
|
|
.catchError((_) {});
|