| | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:flutter/services.dart'; |
| | | import 'package:fluwx_no_pay/fluwx_no_pay.dart'; |
| | | import 'package:flutter_baidu_mapapi_base/src/map/bmf_map_sdk.dart'; |
| | | import 'package:flutter_baidu_mapapi_base/src/map/bmf_types.dart'; |
| | | import 'package:flutter/services.dart'; |
| | | import 'package:jpush_flutter/jpush_flutter.dart'; |
| | | import 'package:locations/api/http.dart'; |
| | | import 'package:locations/model/user/user_info.dart'; |
| | | import 'package:locations/ui/main/location.dart'; |
| | | import 'package:locations/ui/sos/sos.dart'; |
| | | import 'package:locations/utils/event_bus_util.dart'; |
| | | import 'package:locations/utils/pageutils.dart'; |
| | | import 'package:locations/utils/user_util.dart'; |
| | | |
| | |
| | | if (type == "sos") { |
| | | //SOS |
| | | NavigatorUtil.navigateToNextPagePush(SOSPage(title: "")); |
| | | } else if (type == "requestLocation") { |
| | | } else if (type == "locationInvite") { |
| | | //请求定位 |
| | | LocationPage.getLocationInvite(navigatorKey.currentState!.context); |
| | | eventBus.fire(LocationInviteEventBus()); |
| | | } |
| | | }, onReceiveMessage: (Map<String, dynamic> message) async { |
| | | print("flutter onReceiveMessage: ${message["message"]}"); |
| | | var data = jsonDecode(message["message"]); |
| | | print("flutter onReceiveMessage: $data"); |
| | | var type = data["type"]; |
| | | if (type == "sos") { |
| | | //SOS |
| | | NavigatorUtil.navigateToNextPagePush(SOSPage(title: "")); |
| | | } else if (type == "locationInvite") { |
| | | eventBus.fire(LocationInviteEventBus()); |
| | | } |
| | | }, onReceiveNotificationAuthorization: |
| | | (Map<String, dynamic> message) async { |
| | | print("flutter onReceiveNotificationAuthorization: $message"); |
| | |
| | | bool isLogin = await UserUtil.isLogin(); |
| | | if (isLogin) { |
| | | UserInfo? user = await UserUtil.getUserInfo(); |
| | | await setAlias(user!.id!.toString()); |
| | | setAlias(user!.id!.toString()); |
| | | } |
| | | } |
| | | |
| | | ///添加alias |
| | | static Future setAlias(String alias) async { |
| | | await _jpush.setAlias(alias); |
| | | try { |
| | | await _jpush.setAlias(alias); |
| | | } catch (e) {} |
| | | } |
| | | |
| | | //删除alias |