Sfoglia il codice sorgente

Merge branch 'master' of http://git.wmzhubo.com/guadoutech/YY-Hotel-Business-ER

jiangwei 4 mesi fa
parent
commit
806ca12523

+ 88 - 88
app/lib/jpush/jpush_receive.dart

@@ -1,88 +1,88 @@
-import 'dart:convert';
-
-import 'package:jpush_flutter/jpush_flutter.dart';
-import 'package:plugin_basic/constants/app_constant.dart';
-import 'package:plugin_basic/service/user_service.dart';
-import 'package:shared/utils/log_utils.dart';
-
-
-/// 处理极光推送的逻辑
-class JPushReceive {
-  JPushReceive._internal();
-
-  //保存单例
-  static final JPushReceive _singleton = JPushReceive._internal();
-
-  //工厂构造函数
-  factory JPushReceive() => _singleton;
-
-  /// 初始化极光推送,并设置监听回调
-  void init() {
-    JPush jpush = JPush();
-
-    jpush.addEventHandler(
-      // 接收通知回调方法。
-      onReceiveNotification: (Map<String, dynamic> message) async {
-        Log.d("flutter-jpush: onReceiveNotification: $message");
-      },
-      // 点击通知回调方法。
-      onOpenNotification: (Map<String, dynamic> message) async {
-        Log.d("flutter-jpush: onOpenNotification: $message");
-
-        //拿到后端设置的内容Json对象
-        dynamic extrasJson = message['extras'];
-        dynamic extrasChildJson = extrasJson['cn.jpush.android.EXTRA'];
-        Map<String, dynamic> jsonMap = jsonDecode(extrasChildJson.toString());
-
-        //根据后端返回的type类型跳转到不同的路由页面
-
-      },
-      // 接收自定义消息回调方法。
-      onReceiveMessage: (Map<String, dynamic> message) async {
-        Log.d("flutter-jpush: onReceiveMessage: $message");
-      },
-      // 通知授权的回调
-      onReceiveNotificationAuthorization: (Map<String, dynamic> message) async {
-        Log.d("flutter-jpush: onReceiveNotificationAuthorization: $message");
-        if (message.containsKey('isEnabled')) {
-
-          //不管有没有开启通知权限,通知开关,先拿到 RegistrationId 赋值了再说
-          final registrationId = await getRegistrationId();
-          Log.d('flutter-jpush: 获取到registrationId:$registrationId');
-
-          //设置给 RxString 对象,并保存到 UserService 中。
-          UserService.to.registrationId.value = registrationId;
-        } else {
-          Log.d("flutter-jpush: onReceiveNotificationAuthorization 没有isEnable字段");
-        }
-      },
-
-      // // 通知不显示的回调
-      // onNotifyMessageUnShow: (Map<String, dynamic> message) async {
-      //   Log.d("flutter-refruiter: onNotifyMessageUnShow: $message");
-      // },
-      // // 极光推送连接的回调
-      // onConnected: (Map<String, dynamic> message) async {
-      //   Log.d("flutter-refruiter: onConnected: $message");
-      // },
-    );
-
-    jpush.setup(
-      appKey: "23dedb30175208f894d3756f",
-      channel: "developer-default",
-      production: AppConstant.inProduction,
-      debug: !AppConstant.inProduction, // 设置是否打印 debug 日志
-    );
-
-    //申请iOS授权
-    jpush.applyPushAuthority(const NotificationSettingsIOS(sound: true, alert: true, badge: true));
-  }
-
-  /// 获取极光推送的id
-  Future<String> getRegistrationId() async {
-    JPush jpush = JPush();
-    return jpush.getRegistrationID();
-  }
-}
-
-var jpush = JPushReceive();
+// import 'dart:convert';
+//
+// import 'package:jpush_flutter/jpush_flutter.dart';
+// import 'package:plugin_basic/constants/app_constant.dart';
+// import 'package:plugin_basic/service/user_service.dart';
+// import 'package:shared/utils/log_utils.dart';
+//
+//
+// /// 处理极光推送的逻辑
+// class JPushReceive {
+//   JPushReceive._internal();
+//
+//   //保存单例
+//   static final JPushReceive _singleton = JPushReceive._internal();
+//
+//   //工厂构造函数
+//   factory JPushReceive() => _singleton;
+//
+//   /// 初始化极光推送,并设置监听回调
+//   void init() {
+//     JPush jpush = JPush();
+//
+//     jpush.addEventHandler(
+//       // 接收通知回调方法。
+//       onReceiveNotification: (Map<String, dynamic> message) async {
+//         Log.d("flutter-jpush: onReceiveNotification: $message");
+//       },
+//       // 点击通知回调方法。
+//       onOpenNotification: (Map<String, dynamic> message) async {
+//         Log.d("flutter-jpush: onOpenNotification: $message");
+//
+//         //拿到后端设置的内容Json对象
+//         dynamic extrasJson = message['extras'];
+//         dynamic extrasChildJson = extrasJson['cn.jpush.android.EXTRA'];
+//         Map<String, dynamic> jsonMap = jsonDecode(extrasChildJson.toString());
+//
+//         //根据后端返回的type类型跳转到不同的路由页面
+//
+//       },
+//       // 接收自定义消息回调方法。
+//       onReceiveMessage: (Map<String, dynamic> message) async {
+//         Log.d("flutter-jpush: onReceiveMessage: $message");
+//       },
+//       // 通知授权的回调
+//       onReceiveNotificationAuthorization: (Map<String, dynamic> message) async {
+//         Log.d("flutter-jpush: onReceiveNotificationAuthorization: $message");
+//         if (message.containsKey('isEnabled')) {
+//
+//           //不管有没有开启通知权限,通知开关,先拿到 RegistrationId 赋值了再说
+//           final registrationId = await getRegistrationId();
+//           Log.d('flutter-jpush: 获取到registrationId:$registrationId');
+//
+//           //设置给 RxString 对象,并保存到 UserService 中。
+//           UserService.to.registrationId.value = registrationId;
+//         } else {
+//           Log.d("flutter-jpush: onReceiveNotificationAuthorization 没有isEnable字段");
+//         }
+//       },
+//
+//       // // 通知不显示的回调
+//       // onNotifyMessageUnShow: (Map<String, dynamic> message) async {
+//       //   Log.d("flutter-refruiter: onNotifyMessageUnShow: $message");
+//       // },
+//       // // 极光推送连接的回调
+//       // onConnected: (Map<String, dynamic> message) async {
+//       //   Log.d("flutter-refruiter: onConnected: $message");
+//       // },
+//     );
+//
+//     jpush.setup(
+//       appKey: "23dedb30175208f894d3756f",
+//       channel: "developer-default",
+//       production: AppConstant.inProduction,
+//       debug: !AppConstant.inProduction, // 设置是否打印 debug 日志
+//     );
+//
+//     //申请iOS授权
+//     jpush.applyPushAuthority(const NotificationSettingsIOS(sound: true, alert: true, badge: true));
+//   }
+//
+//   /// 获取极光推送的id
+//   Future<String> getRegistrationId() async {
+//     JPush jpush = JPush();
+//     return jpush.getRegistrationID();
+//   }
+// }
+//
+// var jpush = JPushReceive();

+ 2 - 3
app/lib/main.dart

@@ -7,7 +7,6 @@ import 'package:cpt_labour/router/page_router.dart';
 import 'package:cpt_report/router/report_service_impl.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
-import 'package:flutter_bugly/flutter_bugly.dart';
 import 'package:flutter_localizations/flutter_localizations.dart';
 import 'package:initializer/global_services_injection.dart';
 import 'package:initializer/app_initializer.dart';
@@ -31,7 +30,7 @@ import 'router/page_router.dart';
 
 void main() {
   //运行App
-  FlutterBugly.postCatchedException(() async {
+  // FlutterBugly.postCatchedException(() async {
     //交给初始化构造器去统一初始化
     AppInitializer.initializeRunalone();
 
@@ -44,7 +43,7 @@ void main() {
     });
 
     runApp(MyApp());
-  });
+  // });
 }
 
 class MyApp extends StatelessWidget {

+ 14 - 15
app/lib/modules/splash/splash_controller.dart

@@ -1,4 +1,3 @@
-import 'package:flutter_bugly/flutter_bugly.dart';
 import 'package:get/get.dart';
 
 import 'package:app/jpush/jpush_receive.dart';
@@ -22,20 +21,20 @@ class SplashController extends GetxController {
 
 
 void _gotoNextPage() async {
-  await AppInitializer.delayInitialize(futureTasks: [
-    () async {
-      await FlutterBugly.init(
-        androidAppId: "12345678",
-        iOSAppId: "12345678",
-      );
-    },
-  ], normalTasks: [
-    () {
-      if (DeviceUtils.isIOS || DeviceUtils.isAndroid) {
-        jpush.init();
-      }
-    },
-  ]);
+  // await AppInitializer.delayInitialize(futureTasks: [
+  //   () async {
+  //     await FlutterBugly.init(
+  //       androidAppId: "12345678",
+  //       iOSAppId: "12345678",
+  //     );
+  //   },
+  // ], normalTasks: [
+  //   () {
+  //     if (DeviceUtils.isIOS || DeviceUtils.isAndroid) {
+  //       jpush.init();
+  //     }
+  //   },
+  // ]);
 
   // 先查询原生平台有没有保存需要跳转的子路由
   // String routerName = await AppChannel.getNativeRouterName();

+ 2 - 2
app/pubspec.yaml

@@ -54,10 +54,10 @@ dependencies:
 
 
   # 极光推送  https://github.com/jpush/jpush-flutter-plugin
-  jpush_flutter: 2.5.1
+#  jpush_flutter: 2.5.1
 
   #  https://pub-web.flutter-io.cn/packages/flutter_bugly
-  flutter_bugly: 0.4.4
+#  flutter_bugly: 0.4.4
 
 
 #  开发环境依赖的库