@@ -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 { | configurations.all { | ||||
resolutionStrategy.eachDependency { DependencyResolveDetails details -> | resolutionStrategy.eachDependency { DependencyResolveDetails details -> | ||||
@@ -53,6 +53,7 @@ class _MyAppState extends State<MyApp> { | |||||
FlutterAlibc.initAlibc(version: "", appName: "").then((result) { | FlutterAlibc.initAlibc(version: "", appName: "").then((result) { | ||||
print("白川" + '${result.errorCode} ${result.errorMessage}'); | print("白川" + '${result.errorCode} ${result.errorMessage}'); | ||||
}); | }); | ||||
MobPushUtil.setCanPush(); | |||||
// app更新插件 | // app更新插件 | ||||
@@ -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/login_success_event.dart'; | ||||
import 'package:zhiying_comm/util/event_util/event_util.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/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'; | import 'package:package_info/package_info.dart'; | ||||
class HomePage extends StatefulWidget { | class HomePage extends StatefulWidget { | ||||
@@ -118,6 +121,19 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver, Ticker | |||||
// 监听开始(传递监听到原生端,用户监听场景还原的数据回传回来) | // 监听开始(传递监听到原生端,用户监听场景还原的数据回传回来) | ||||
_eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError); | _eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError); | ||||
MobPushUtil.addPushReceiver(); | |||||
EventUtil.instance.on<LoginSuccessEvent>().listen((event) { | |||||
UserInfoModel userInfo = UserInfoNotifier?.staitcUserInfo; | |||||
Logger.log("我的TOKEN5: " + userInfo?.userId); | |||||
if (!EmptyUtil.isEmpty(userInfo.userId)) { | |||||
MobPushUtil.setAlias(userInfo.userId); | |||||
} | |||||
}); | |||||
EventUtil.instance.on<LogOut>().listen((event) { | |||||
MobPushUtil.deleteAlias(); | |||||
}); | |||||
super.initState(); | |||||
MobPushUtil.addPushReceiver(); | MobPushUtil.addPushReceiver(); | ||||
EventUtil.instance.on<LoginSuccessEvent>().listen((event) async { | EventUtil.instance.on<LoginSuccessEvent>().listen((event) async { | ||||
UserInfoModel userInfo = UserInfoNotifier?.staitcUserInfo; | UserInfoModel userInfo = UserInfoNotifier?.staitcUserInfo; | ||||
@@ -138,6 +154,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver, Ticker | |||||
} | } | ||||
} | } | ||||
@override | @override | ||||
void dispose() { | void dispose() { | ||||
WidgetsBinding.instance.removeObserver(this); | WidgetsBinding.instance.removeObserver(this); | ||||
@@ -1,3 +1,4 @@ | |||||
import 'dart:convert'; | |||||
import 'dart:async'; | import 'dart:async'; | ||||
import 'dart:typed_data'; | import 'dart:typed_data'; | ||||
@@ -5,6 +6,9 @@ import 'package:connectivity/connectivity.dart'; | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/foundation.dart'; | import 'package:flutter/foundation.dart'; | ||||
import 'package:flutter/material.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:flutter/services.dart'; | ||||
import 'package:zhiying_base_widget/dialog/tip_dialog/tip_dialog.dart'; | import 'package:zhiying_base_widget/dialog/tip_dialog/tip_dialog.dart'; | ||||
import 'package:mobpush_plugin/mobpush_custom_message.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:package_info/package_info.dart'; | ||||
import 'package:fluttertoast/fluttertoast.dart'; | import 'package:fluttertoast/fluttertoast.dart'; | ||||
// 启动页,页面初始化等操作~跟原生启动页保持一致,防止白屏问题 | // 启动页,页面初始化等操作~跟原生启动页保持一致,防止白屏问题 | ||||
class LaunchPage extends StatefulWidget { | class LaunchPage extends StatefulWidget { | ||||
final WidgetBuilder builder; | final WidgetBuilder builder; | ||||
@@ -31,6 +36,8 @@ class LaunchPage extends StatefulWidget { | |||||
_LaunchPageState createState() => _LaunchPageState(); | _LaunchPageState createState() => _LaunchPageState(); | ||||
} | } | ||||
class _LaunchPageState extends State<LaunchPage> { | |||||
final GlobalKey navigatorKey = new GlobalKey(); | |||||
class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin { | class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin { | ||||
final GlobalKey navigatorKey = new GlobalKey(); | final GlobalKey navigatorKey = new GlobalKey(); | ||||
@@ -102,8 +102,7 @@ class MobPushUtil { | |||||
//设置远程推送环境,向用户授权(仅 iOS) | //设置远程推送环境,向用户授权(仅 iOS) | ||||
MobpushPlugin.setCustomNotification(); | MobpushPlugin.setCustomNotification(); | ||||
// 开发环境 false, 线上环境 true | // 开发环境 false, 线上环境 true | ||||
const bool inProduction = const bool.fromEnvironment("dart.vm.product"); | |||||
MobpushPlugin.setAPNsForProduction(inProduction); | |||||
MobpushPlugin.setAPNsForProduction(true); | |||||
} | } | ||||
//上传隐私协议许可 | //上传隐私协议许可 | ||||
MobpushPlugin.updatePrivacyPermissionStatus(true); | MobpushPlugin.updatePrivacyPermissionStatus(true); | ||||