fix: 将极光推送分开
This commit is contained in:
parent
ba0b9c0fab
commit
443ea7731b
@ -29,6 +29,7 @@ class F {
|
||||
static String get name => appFlavor?.name ?? '';
|
||||
|
||||
static bool get isXHJ => appFlavor == Flavor.xhj;
|
||||
static bool get isSKY => appFlavor == Flavor.sky;
|
||||
|
||||
//便捷判断并返回值
|
||||
static dynamic sw(
|
||||
|
||||
@ -51,7 +51,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
Storage.saveLoginData(entity.data);
|
||||
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
|
||||
eventBus.fire(MineInfoChangeRefreshUI());
|
||||
XSJPushProvider().initJPushService();
|
||||
XSJPushProvider().bindDeviceID();
|
||||
XSJPushProvider().initLocalNotification(isCancelLocalPush: false);
|
||||
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
||||
BlueManage().scanDevices.clear(); //清除设备缓存
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/tools/bugly/bugly_tool.dart';
|
||||
import 'package:star_lock/tools/device_info_service.dart';
|
||||
import 'package:star_lock/tools/platform_info_services.dart';
|
||||
import 'package:star_lock/tools/xs_jPhush.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
import 'app.dart';
|
||||
@ -27,6 +28,8 @@ FutureOr<void> main() async {
|
||||
// bugly错误日志监控
|
||||
await BuglyTool.init();
|
||||
|
||||
await XSJPushProvider().initJPushService();
|
||||
|
||||
runApp(const MyApp());
|
||||
|
||||
if (AppPlatform.isAndroid) {
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:jpush_flutter/jpush_flutter.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_entity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
@ -22,8 +23,15 @@ class XSJPushProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
String appKey;
|
||||
if (F.isSKY) {
|
||||
appKey = '7ff37d174c1a568a89e98dad';
|
||||
} else {
|
||||
appKey = '251fc8074820d122b6de58d2';
|
||||
}
|
||||
|
||||
jpush.setup(
|
||||
appKey: '251fc8074820d122b6de58d2',
|
||||
appKey: appKey,
|
||||
channel: 'flutter_channel',
|
||||
production: false,
|
||||
debug: true,
|
||||
@ -34,25 +42,24 @@ class XSJPushProvider {
|
||||
);
|
||||
|
||||
addJPushEventHandler();
|
||||
bindDeviceID();
|
||||
}
|
||||
|
||||
//极光推送事件处理方法
|
||||
void addJPushEventHandler() {
|
||||
jpush.addEventHandler(
|
||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onReceiveNotification: $message');
|
||||
},
|
||||
onOpenNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onOpenNotification: $message');
|
||||
},
|
||||
onReceiveMessage: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onReceiveMessage: $message');
|
||||
},
|
||||
onReceiveNotificationAuthorization: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onReceiveNotificationAuthorization: $message');
|
||||
},
|
||||
);
|
||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onReceiveNotification: $message');
|
||||
}, onOpenNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onOpenNotification: $message');
|
||||
}, onReceiveMessage: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onReceiveMessage: $message');
|
||||
//这里接收自定义消息
|
||||
}, onReceiveNotificationAuthorization:
|
||||
(Map<String, dynamic> message) async {
|
||||
AppLog.log('onReceiveNotificationAuthorization: $message');
|
||||
}, onInAppMessageShow: (Map<String, dynamic> message) async {
|
||||
AppLog.log('onInAppMessageShow: $message');
|
||||
});
|
||||
}
|
||||
|
||||
//绑定设备ID
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user