diff --git a/assets/images/empty/3.0x/empty.png b/assets/images/empty/3.0x/empty.png deleted file mode 100644 index 8f8a5f2..0000000 Binary files a/assets/images/empty/3.0x/empty.png and /dev/null differ diff --git a/assets/images/launch_image/launch_image.png b/assets/images/launch_image/launch_image.png deleted file mode 100644 index a5f9062..0000000 Binary files a/assets/images/launch_image/launch_image.png and /dev/null differ diff --git a/assets/images/loading/loading.gif b/assets/images/loading/loading.gif deleted file mode 100644 index ef1bf55..0000000 Binary files a/assets/images/loading/loading.gif and /dev/null differ diff --git a/assets/images/occupation_map/occupation_map.png b/assets/images/occupation_map/occupation_map.png deleted file mode 100644 index d4f1fb6..0000000 Binary files a/assets/images/occupation_map/occupation_map.png and /dev/null differ diff --git a/assets/images/qrcode/default_qrcode.png b/assets/images/qrcode/default_qrcode.png deleted file mode 100644 index 948ced4..0000000 Binary files a/assets/images/qrcode/default_qrcode.png and /dev/null differ diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 2acdd0b..d898097 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -107,34 +107,34 @@ android { } - //应用信息配置 - productFlavors { - // 智夜生活 - zhiying { - applicationId "cn.zhios.zhiying" - versionCode 25 - dimension "app" - versionName '1.2.5' - // 签名信息 - signingConfig signingConfigs.zhiying - } - } - - // 打包脚本 - android.applicationVariants.all { variant -> - if (variant.buildType.name != "debug") { - variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk") - } - - variant.outputs.all { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith('.apk')) { - //这里修改apk文件名 - def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" - outputFileName = fileName - } - } - } + // 应用信息配置 +// productFlavors { +// // 智夜生活 +// zhiying { +// applicationId "cn.zhios.zhiying" +// versionCode 22 +// dimension "app" +// versionName '1.2.2' +// // 签名信息 +// signingConfig signingConfigs.zhiying +// } +// } +// +// // 打包脚本 +// android.applicationVariants.all { variant -> +// if (variant.buildType.name != "debug") { +// variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk") +// } +// +// variant.outputs.all { output -> +// def outputFile = output.outputFile +// if (outputFile != null && outputFile.name.endsWith('.apk')) { +// //这里修改apk文件名 +// def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" +// outputFileName = fileName +// } +// } +// } configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> diff --git a/example/lib/main.dart b/example/lib/main.dart index f49cc08..30c9725 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -53,6 +53,7 @@ class _MyAppState extends State { FlutterAlibc.initAlibc(version: "", appName: "").then((result) { print("白川" + '${result.errorCode} ${result.errorMessage}'); }); + MobPushUtil.setCanPush(); // app更新插件 diff --git a/lib/pages/home_page/home_page.dart b/lib/pages/home_page/home_page.dart index 9673b8d..62bb0d2 100644 --- a/lib/pages/home_page/home_page.dart +++ b/lib/pages/home_page/home_page.dart @@ -32,6 +32,9 @@ import 'package:zhiying_comm/zhiying_comm.dart'; import 'package:zhiying_comm/util/event_util/login_success_event.dart'; import 'package:zhiying_comm/util/event_util/event_util.dart'; import 'package:zhiying_comm/util/event_util/log_out.dart'; +import 'package:zhiying_comm/util/event_util/login_success_event.dart'; +import 'package:zhiying_comm/util/event_util/event_util.dart'; +import 'package:zhiying_comm/util/event_util/log_out.dart'; import 'package:package_info/package_info.dart'; class HomePage extends StatefulWidget { @@ -118,6 +121,19 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker // 监听开始(传递监听到原生端,用户监听场景还原的数据回传回来) _eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError); + MobPushUtil.addPushReceiver(); + EventUtil.instance.on().listen((event) { + UserInfoModel userInfo = UserInfoNotifier?.staitcUserInfo; + Logger.log("我的TOKEN5: " + userInfo?.userId); + if (!EmptyUtil.isEmpty(userInfo.userId)) { + MobPushUtil.setAlias(userInfo.userId); + } + }); + + EventUtil.instance.on().listen((event) { + MobPushUtil.deleteAlias(); + }); + super.initState(); MobPushUtil.addPushReceiver(); EventUtil.instance.on().listen((event) async { UserInfoModel userInfo = UserInfoNotifier?.staitcUserInfo; @@ -138,6 +154,7 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker } } + @override void dispose() { WidgetsBinding.instance.removeObserver(this); diff --git a/lib/pages/launch_page/launch_page.dart b/lib/pages/launch_page/launch_page.dart index d74c5fd..895efbd 100644 --- a/lib/pages/launch_page/launch_page.dart +++ b/lib/pages/launch_page/launch_page.dart @@ -1,3 +1,4 @@ +import 'dart:convert'; import 'dart:async'; import 'dart:typed_data'; @@ -5,6 +6,9 @@ import 'package:connectivity/connectivity.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:mobpush_plugin/mobpush_custom_message.dart'; +import 'package:mobpush_plugin/mobpush_notify_message.dart'; +import 'package:mobpush_plugin/mobpush_plugin.dart'; import 'package:flutter/services.dart'; import 'package:zhiying_base_widget/dialog/tip_dialog/tip_dialog.dart'; import 'package:mobpush_plugin/mobpush_custom_message.dart'; @@ -21,6 +25,7 @@ import 'package:zhiying_comm/util/shared_prefe_util.dart'; import 'package:package_info/package_info.dart'; import 'package:fluttertoast/fluttertoast.dart'; + // 启动页,页面初始化等操作~跟原生启动页保持一致,防止白屏问题 class LaunchPage extends StatefulWidget { final WidgetBuilder builder; @@ -31,6 +36,8 @@ class LaunchPage extends StatefulWidget { _LaunchPageState createState() => _LaunchPageState(); } +class _LaunchPageState extends State { + final GlobalKey navigatorKey = new GlobalKey(); class _LaunchPageState extends State with TickerProviderStateMixin { final GlobalKey navigatorKey = new GlobalKey(); diff --git a/lib/utils/mob_push_util.dart b/lib/utils/mob_push_util.dart index 0a937eb..c2ddf02 100644 --- a/lib/utils/mob_push_util.dart +++ b/lib/utils/mob_push_util.dart @@ -102,8 +102,7 @@ class MobPushUtil { //设置远程推送环境,向用户授权(仅 iOS) MobpushPlugin.setCustomNotification(); // 开发环境 false, 线上环境 true - const bool inProduction = const bool.fromEnvironment("dart.vm.product"); - MobpushPlugin.setAPNsForProduction(inProduction); + MobpushPlugin.setAPNsForProduction(true); } //上传隐私协议许可 MobpushPlugin.updatePrivacyPermissionStatus(true);