diff --git a/android/src/main/java/cn/zhios/zhiying_comm/ZhiyingFlutterCommNativable.java b/android/src/main/java/cn/zhios/zhiying_comm/ZhiyingFlutterCommNativable.java index fbe9d30..92ea98f 100644 --- a/android/src/main/java/cn/zhios/zhiying_comm/ZhiyingFlutterCommNativable.java +++ b/android/src/main/java/cn/zhios/zhiying_comm/ZhiyingFlutterCommNativable.java @@ -16,4 +16,6 @@ public interface ZhiyingFlutterCommNativable { /* 普通方法(交互) */ public void invokeMethod(String method, Map params, ZhiyingFlutterCommHandler handler); + + public void initSuccess(); } diff --git a/android/src/main/java/cn/zhios/zhiying_comm/ZhiyingFlutterCommNative.java b/android/src/main/java/cn/zhios/zhiying_comm/ZhiyingFlutterCommNative.java index a895905..74325a0 100644 --- a/android/src/main/java/cn/zhios/zhiying_comm/ZhiyingFlutterCommNative.java +++ b/android/src/main/java/cn/zhios/zhiying_comm/ZhiyingFlutterCommNative.java @@ -91,6 +91,15 @@ public class ZhiyingFlutterCommNative implements MethodCallHandler { return; } + if(call.method.equals("notifyInitSuccess")){ + if(nat!=null){ + nat.initSuccess(); + } + result.success("success"); + return; + + } + /* 调用原生方法 */ if (call.method.equals("invokeMethod")) { if (nat != null) { @@ -106,8 +115,7 @@ public class ZhiyingFlutterCommNative implements MethodCallHandler { return; } - } else { - + } else{ result.notImplemented(); return; } diff --git a/lib/models/base/base_setting_model.dart b/lib/models/base/base_setting_model.dart index 481cc61..edb1a93 100644 --- a/lib/models/base/base_setting_model.dart +++ b/lib/models/base/base_setting_model.dart @@ -44,13 +44,11 @@ class BaseSettingModel { static Future init({bool isGetCache}) async { try { ///判断是否获取缓存 - if (isGetCache != null && isGetCache) { - String configData = await SharedPreferencesUtil.getStringValue(GlobalConfig.MAIN_CONFIG, defaultVal: '1'); - if (configData != "1") { - createBaseSet(json.decode(configData)); - Logger.debug('基础设置初始化'); - } + String configData = await SharedPreferencesUtil.getStringValue(GlobalConfig.MAIN_CONFIG, defaultVal: '1'); + if (isGetCache != null && isGetCache && configData != "1") { + createBaseSet(json.decode(configData)); + Logger.debug('基础设置初始化'); NetUtil.request('/api/v1/new/config.json',onSuccess: (data){ print(data); var cacheString=json.encode(data); @@ -62,6 +60,8 @@ class BaseSettingModel { Map result = await NetUtil.post('/api/v1/new/config.json', method: NetMethod.GET); var data = result['data']; + var cacheString=json.encode(data); + SharedPreferencesUtil.setNetCacheResult(GlobalConfig.MAIN_CONFIG, cacheString); createBaseSet(data); return _setting; }