@@ -54,7 +54,7 @@ android { | |||
ndk { | |||
//选择要添加的对应cpu类型的.so库。 | |||
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a' | |||
// abiFilters 'armeabi-v7a','x86_64' | |||
// abiFilters 'armeabi-v7a','x86_64' | |||
} | |||
} | |||
@@ -55,7 +55,7 @@ | |||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | |||
android:hardwareAccelerated="true" | |||
android:launchMode="singleTop" | |||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" | |||
android:theme="@style/LaunchTheme" | |||
android:usesCleartextTraffic="true" | |||
android:windowSoftInputMode="adjustResize"> | |||
@@ -165,8 +165,8 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN | |||
// map.put("secret_key", "123456"); | |||
//客户测试 | |||
// map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn84198689 | |||
// map.put("master_id", "13376168"); | |||
// map.put("domain", "https://api.douchaoren.com/");//45678910,api.zhios.cn84198689 | |||
// map.put("master_id", "26065184"); | |||
// map.put("secret_key", "123456"); | |||
// map.put("token", "123465"); | |||
@@ -17,7 +17,12 @@ | |||
</style> | |||
<!-- Base application theme. --> | |||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> | |||
<item name="android:windowBackground">@drawable/normal_background</item> | |||
<!--这个是预先设置的背景图片--> | |||
<item name="android:windowBackground">@mipmap/start</item> | |||
<!--设置过渡效果,禁用窗口的预览动画--> | |||
<item name="android:windowDisablePreview">true</item> | |||
<item name="android:windowNoTitle">true</item> | |||
<item name="android:statusBarColor">@android:color/transparent</item> | |||
</style> | |||
<style name="FullscreenTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |||
@@ -24,7 +24,7 @@ import 'package:zhiying_equity_card/zhiying_equity_card.dart'; | |||
import 'package:zhiying_official/register.dart'; | |||
import 'package:zhiying_base_widget/zhiying_base_widget.dart'; | |||
import 'package:zhiying_acquisition/register.dart'; | |||
import 'package:zhiying_credit_card/register.dart'; | |||
//import 'package:zhiying_credit_card/register.dart'; | |||
void main() { | |||
FlutterError.onError = (FlutterErrorDetails details) { | |||
@@ -68,19 +68,24 @@ class _MyAppState extends State<MyApp> { | |||
EquityCardRegister.init(); | |||
OfficialRegister.init(); | |||
AcquisitionRegister.init(); | |||
CreditCardRegister.init(); | |||
print('初始化百川'); | |||
// CreditCardRegister.init(); | |||
// print('初始化百川'); | |||
FlutterAlibc.initAlibc(version: "", appName: "").then((result) { | |||
print("百川" + '${result.errorCode} ${result.errorMessage}'); | |||
}); | |||
MobPushUtil.setCanPush(); | |||
// MobPushUtil.setCanPush(); | |||
// | |||
// EventUtil.instance.on().listen((event) {}); | |||
// | |||
// initUpdate(); | |||
} | |||
EventUtil.instance.on().listen((event) {}); | |||
const bool inProduction = const bool.fromEnvironment("dart.vm.product"); | |||
if (!inProduction) { | |||
//debug app不更新 app更新插件 | |||
AppUpdateUtil.initXUpdate(); | |||
} | |||
initUpdate() async { | |||
// const bool inProduction = const bool.fromEnvironment("dart.vm.product"); | |||
// if (!inProduction) { | |||
// //debug app不更新 app更新插件 | |||
// AppUpdateUtil.initXUpdate(); | |||
// } | |||
} | |||
@override | |||
@@ -34,26 +34,26 @@ dev_dependencies: | |||
path: ../../zhiying_official | |||
zhiying_acquisition: | |||
path: ../../zhiying_acquisition | |||
zhiying_credit_card: | |||
path: ../../zhiying_credit_card | |||
# zhiying_credit_card: | |||
# path: ../../zhiying_credit_card | |||
#微信导师 | |||
zhiying_wechat_teacher: | |||
path: ../../zhiying_wechat_teacher | |||
# git: | |||
# ref: 0.0.2 | |||
# url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_wechat_teacher.git | |||
# path: ../../zhiying_wechat_teacher | |||
git: | |||
ref: 0.0.2 | |||
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_wechat_teacher.git | |||
#朋友圈 | |||
zhiying_moments: | |||
path: ../../zhiying_moments | |||
# git: | |||
# ref: 0.2.2 | |||
# url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_moments.git | |||
# path: ../../zhiying_moments | |||
git: | |||
ref: 0.2.2 | |||
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_moments.git | |||
#会员升级 | |||
zhiying_member_upgrade: | |||
path: ../../Zhiying_Member_Upgrade | |||
# git: | |||
# ref: 0.0.6 | |||
# url: http://192.168.0.138:3000/FnuoOS_ZhiYing/Zhiying_Member_Upgrade.git | |||
# path: ../../Zhiying_Member_Upgrade | |||
git: | |||
ref: 0.0.6 | |||
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/Zhiying_Member_Upgrade.git | |||
plugin_platform_interface: "1.0.2" | |||
permission_handler_platform_interface: "2.0.1" | |||
@@ -28,6 +28,8 @@ 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 '../../models/app_config_model.dart'; | |||
class HomeCenterPage extends StatefulWidget { | |||
@override | |||
_HomeCenterPageState createState() => _HomeCenterPageState(); | |||
@@ -91,6 +93,7 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti | |||
///渲染完第一帧后调用 | |||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | |||
int delay = ((num.tryParse(AppConfigModel.appStartDelay) ?? 0.5) * 1000).toInt(); | |||
print("延时" + AppConfigModel.appStartDelay.toString()); | |||
Timer(Duration(milliseconds: delay), () { | |||
NativeUtil.notifyInitSuccess(); | |||
}); | |||
@@ -179,11 +182,6 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti | |||
super.didChangeAppLifecycleState(state); | |||
} | |||
@override | |||
void didUpdateWidget(covariant HomePage oldWidget) { | |||
super.didUpdateWidget(oldWidget); | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
ScreenUtil.init(context, width: 750, height: 1334); | |||
@@ -366,8 +364,15 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti | |||
// 活动弹窗 | |||
await AdvertisingDialog.show(context); | |||
// 检查app更新 | |||
await AppUpdateUtil.updateApp(context); | |||
await Future.delayed(Duration(milliseconds: 600),() async { | |||
const bool inProduction = const bool.fromEnvironment("dart.vm.product"); | |||
if (!inProduction) { | |||
//debug app不更新 app更新插件 | |||
await AppUpdateUtil.initXUpdate(); | |||
// 检查app更新 | |||
await AppUpdateUtil.updateApp(context); | |||
} | |||
}); | |||
IntellectCreate.checkAndCreateFirst(context); | |||
} | |||
@@ -25,7 +25,7 @@ import 'package:zhiying_base_widget/utils/contants.dart'; | |||
import 'package:zhiying_comm/util/shared_prefe_util.dart'; | |||
import 'package:package_info/package_info.dart'; | |||
import 'package:fluttertoast/fluttertoast.dart'; | |||
import 'package:zhiying_comm/util/update/app_update_util.dart'; | |||
// 启动页,页面初始化等操作~跟原生启动页保持一致,防止白屏问题 | |||
class LaunchPage extends StatefulWidget { | |||
final WidgetBuilder builder; | |||
@@ -56,16 +56,18 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin { | |||
///检查是否覆盖安装 | |||
//取masterId | |||
String lasterMasterId = await SharedPreferencesUtil.getStringValue(Constants.masterId, defaultVal: "1"); | |||
Map setting = await NativeUtil.getSetting(); | |||
String masterId = setting['master_id']; | |||
if (lasterMasterId != "1") { | |||
if (masterId != lasterMasterId) { | |||
await SharedPreferencesUtil.clean(); | |||
String lasterMasterId = await SharedPreferencesUtil.getStringValue(Constants.masterId, defaultVal: "1"); | |||
Map setting = await NativeUtil.getSetting(); | |||
String masterId = setting['master_id']; | |||
if (lasterMasterId != "1") { | |||
if (masterId != lasterMasterId) { | |||
await SharedPreferencesUtil.clean(); | |||
} | |||
} | |||
} | |||
SharedPreferencesUtil.setStringValue(Constants.masterId, masterId); | |||
SharedPreferencesUtil.setStringValue(Constants.masterId, masterId); | |||
Application.init().then((_) async { | |||
///引导页 | |||
@@ -82,7 +84,9 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin { | |||
} else { | |||
// Navigator.of(context).pushReplacement( | |||
// CupertinoPageRoute(builder: (context) => HomePage())); | |||
print("打开首页"); | |||
Navigator.of(context).pushReplacementNamed('/homePage'); | |||
} | |||
}).catchError((err, s) async { | |||
print(s); | |||
@@ -98,6 +98,7 @@ import 'widgets/search_result/search_input/search_result_input.dart'; | |||
import 'package:zhiying_comm/util/mob_util/mob_util.dart'; | |||
import 'package:zhiying_comm/util/taobao/taobao_auth.dart'; | |||
import 'package:package_info/package_info.dart'; | |||
import 'package:flutter_alibc/flutter_alibc.dart'; | |||
class BaseWidgetRegister { | |||
/// 初始化方法 | |||
@@ -116,57 +117,65 @@ class BaseWidgetRegister { | |||
Application.addMethod(() async { | |||
AppConfigModel config = await AppConfigModel.init(isGetCache: true); | |||
PackageInfo packageInfo = await PackageInfo.fromPlatform(); | |||
String appname = packageInfo.appName; | |||
if (Platform.isIOS) { | |||
TaobaoAuth.setParams(name: appname, alibcAppKey: config.keys.taobao.iosKey); | |||
} else { | |||
TaobaoAuth.setParams(name: appname, alibcAppKey: config.keys.taobao.androidKey); | |||
} | |||
if (config == null) { | |||
Logger.debug('app 初始化失败'); | |||
return; | |||
} | |||
ShareSDKRegister register = ShareSDKRegister(); | |||
// ================ Weixin | |||
register.setupWechat(config.keys?.weixin?.appId ?? '', | |||
config.keys?.weixin?.secret ?? '', config.keys?.weixin?.universalLink ?? ''); | |||
register.setupSinaWeibo(config.keys?.weibo?.appkey ?? '', config.keys?.weibo?.secret ?? '', config.keys?.weibo?.redirectUrl ?? '',config.keys?.weibo?.universalLink??'templink'); | |||
register.setupQQ(config.keys?.qq?.appId ?? '', config.keys?.qq?.appkey ?? ''); | |||
// ================ jd | |||
SharesdkPlugin.regist(register); | |||
///微信支付初始化 | |||
registerWxApi( | |||
appId: config?.keys?.weixin?.appId, | |||
universalLink: config?.keys?.weixin?.universalLink); | |||
///高德定位注册 | |||
AMapFlutterLocation.setApiKey( | |||
config?.keys?.gd?.androidKey ?? "", config?.keys?.gd?.iosKey); | |||
if (Platform.isIOS) { | |||
Jdsdk.init( | |||
appKey: config.keys?.jdIos?.appkey ?? '', | |||
appSecret: config.keys?.jdIos?.secret ?? ''); | |||
} else if (Platform.isAndroid) { | |||
Jdsdk.init( | |||
appKey: config.keys?.jdAndroid?.appkey ?? '', | |||
appSecret: config.keys?.jdAndroid?.secret ?? ''); | |||
} | |||
Future.delayed(Duration(milliseconds: 2000),()async{ | |||
print("初始化各种SDK"); | |||
ShareSDKRegister register = ShareSDKRegister(); | |||
// ================ Weixin | |||
register.setupWechat(config.keys?.weixin?.appId ?? '', config.keys?.weixin?.secret ?? '', config.keys?.weixin?.universalLink ?? ''); | |||
register.setupSinaWeibo(config.keys?.weibo?.appkey ?? '', config.keys?.weibo?.secret ?? '', config.keys?.weibo?.redirectUrl ?? '',config.keys?.weibo?.universalLink??'templink'); | |||
register.setupQQ(config.keys?.qq?.appId ?? '', config.keys?.qq?.appkey ?? ''); | |||
// ================ jd | |||
SharesdkPlugin.regist(register); | |||
///微信支付初始化 | |||
registerWxApi(appId: config?.keys?.weixin?.appId, universalLink: config?.keys?.weixin?.universalLink); | |||
///高德定位注册 | |||
AMapFlutterLocation.setApiKey(config?.keys?.gd?.androidKey ?? "", config?.keys?.gd?.iosKey); | |||
if (Platform.isIOS) { | |||
Jdsdk.init(appKey: config.keys?.jdIos?.appkey ?? '', appSecret: config.keys?.jdIos?.secret ?? ''); | |||
} else if (Platform.isAndroid) { | |||
Jdsdk.init(appKey: config.keys?.jdAndroid?.appkey ?? '', appSecret: config.keys?.jdAndroid?.secret ?? ''); | |||
} | |||
PackageInfo packageInfo = await PackageInfo.fromPlatform(); | |||
String appname = packageInfo.appName; | |||
if (Platform.isIOS) { | |||
TaobaoAuth.setParams(name: appname, alibcAppKey: config.keys.taobao.iosKey); | |||
} else { | |||
TaobaoAuth.setParams(name: appname, alibcAppKey: config.keys.taobao.androidKey); | |||
} | |||
// MOB 秒验 | |||
MobUtil.init(); | |||
MobPushUtil.setCanPush(); | |||
// 初始化百川sdk | |||
FlutterAlibc.initAlibc(version: "", appName: "").then((result) { | |||
Logger.debug('初始化百川sdk ${result.errorCode} ${result.errorMessage}'); | |||
}); | |||
}); | |||
// MOB 秒验 | |||
MobUtil.init(); | |||
return null; | |||
}); | |||
MobPushUtil.setCanPush(); | |||
// 缓存可能用到的数据,预加载 | |||
Application.addMethod(() { | |||
// 缓存可能用到的数据,预加载 | |||
// // 精选的数据 | |||
// NetUtil.post('/api/v1/rec/featured?page=1', method: NetMethod.GET, cache: true, showToast: false); | |||
// // 淘宝的数据 | |||
@@ -185,7 +194,6 @@ class BaseWidgetRegister { | |||
FlutterUserAgent.init(force: true); | |||
return null; | |||
}); | |||
// 延迟一秒 | |||