Merge branch 'master' into null-safe

master
Weicheng Zhu 2021-08-31 09:13:10 +08:00 committed by GitHub
commit 91f98547b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 52 additions and 15 deletions

View File

@ -91,6 +91,6 @@ kapt {
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.finogeeks.lib:finapplet:2.33.3'
implementation 'com.finogeeks.mop:plugins:2.33.3'
implementation 'com.finogeeks.lib:finapplet:2.33.11'
implementation 'com.finogeeks.mop:plugins:2.33.11'
}

View File

@ -71,6 +71,8 @@ public class BaseModule extends BaseApi {
if (encryptServerData == null) encryptServerData = false;
Boolean debug = (Boolean) param.get("debug");
if (debug == null) debug = false;
Boolean bindAppletWithMainProcess = (Boolean) param.get("bindAppletWithMainProcess");
if (bindAppletWithMainProcess == null) bindAppletWithMainProcess = false;
FinAppConfig config = new FinAppConfig.Builder()
.setSdkKey(appkey)
@ -82,6 +84,7 @@ public class BaseModule extends BaseApi {
.setUserId(userId)
.setDebugMode(debug)
.setDisableRequestPermissions(disablePermission)
.setBindAppletWithMainProcess(bindAppletWithMainProcess)
.build();
final Application application = MopPluginService.getInstance().getActivity().getApplication();

View File

@ -6,6 +6,7 @@ import android.os.Looper;
import android.util.Log;
import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppTrace;
import com.finogeeks.mop.api.BaseApi;
import com.finogeeks.mop.interfaces.ICallback;
import com.finogeeks.mop.service.MopPluginService;
@ -22,6 +23,8 @@ import io.flutter.plugin.common.MethodChannel;
public class ExtensionApiModule extends BaseApi {
private static final String TAG = "ExtensionApiModule";
private Handler handler = new Handler(Looper.getMainLooper());
public ExtensionApiModule(Context context) {
@ -52,18 +55,33 @@ public class ExtensionApiModule extends BaseApi {
@Override
public void success(Object result) {
String json = GsonUtil.gson.toJson(result);
FinAppTrace.d(ExtensionApiModule.TAG, "channel invokeMethod:" + name
+ " success, result=" + result + ", json=" + json);
JSONObject ret = null;
if (json != null && !json.equals("null"))
if (json != null && !json.equals("null")) {
try {
ret = new JSONObject(json);
if (ret.has("errMsg")) {
String errMsg = ret.getString("errMsg");
if (errMsg.startsWith(name + ":fail")) {
iCallback.onFail(ret);
return;
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
iCallback.onSuccess(ret);
}
@Override
public void error(String errorCode, String errorMessage, Object errorDetails) {
FinAppTrace.e(ExtensionApiModule.TAG, "channel invokeMethod:" + name
+ " error, errorCode=" + errorCode
+ ", errorMessage=" + errorMessage
+ ", errorDetails=" + errorDetails);
iCallback.onFail();
}

View File

@ -1 +1,2 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/weichengzhu/dev/flutter/mop-flutter-sdk/","dependencies":[]}],"android":[{"name":"mop","path":"/Users/weichengzhu/dev/flutter/mop-flutter-sdk/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"mop","dependencies":[]}],"date_created":"2021-08-18 22:10:00.612245","version":"2.2.3"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/beetle/Desktop/finogeeks/gitlab/finosprite/finclip-flutter-sdk/","dependencies":[]}],"android":[{"name":"mop","path":"/Users/beetle/Desktop/finogeeks/gitlab/finosprite/finclip-flutter-sdk/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"mop","dependencies":[]}],"date_created":"2021-08-19 15:38:17.756101","version":"2.2.2"}

View File

@ -22,15 +22,28 @@
NSString* api = [@"extensionApi:" stringByAppendingString:self.name];
[channel invokeMethod:api arguments:param result:^(id _Nullable result) {
NSLog(@"extensionApi reslut:%@",result);
if([result isKindOfClass:[FlutterError class]] || result == FlutterMethodNotImplemented)
{
// flutter
BOOL isFlutterError = [result isKindOfClass:[FlutterError class]] || result == FlutterMethodNotImplemented;
if (isFlutterError) {
NSLog(@"extensionApi reslut:fail");
callback(FATExtensionCodeFailure,nil);
}else
{
return;
}
//
BOOL hasError = [[result allKeys] containsObject:@"errMsg"];
if (hasError) {
NSString *errMsg = result[@"errMsg"];
NSString *errPrefix = [NSString stringWithFormat:@"%@:fail", self.name];
BOOL isFail = [errMsg hasPrefix:errPrefix];
if (isFail) {
NSLog(@"extensionApi reslut:fail");
callback(FATExtensionCodeFailure,nil);
return;
}
}
//
NSLog(@"extensionApi callback:%@",result);
callback(FATExtensionCodeSuccess,result);
}
}];
}];
success(@{});

View File

@ -17,7 +17,7 @@ A finclip miniprogram flutter sdk.
s.dependency 'Flutter'
s.ios.deployment_target = '9.0'
s.dependency 'FinApplet' , '2.33.3'
s.dependency 'FinAppletExt' , '2.33.3'
s.dependency 'FinApplet' , '2.33.11'
s.dependency 'FinAppletExt' , '2.33.11'
end

View File

@ -76,7 +76,8 @@ class Mop {
bool? disablePermission,
String? userId,
bool encryptServerData = false,
bool debug = false}) async {
bool debug = false,
bool bindAppletWithMainProcess = false}) async {
final Map ret = await _channel.invokeMethod('initialize', {
'appkey': appkey,
'secret': secret,
@ -86,7 +87,8 @@ class Mop {
'disablePermission': disablePermission,
'userId': userId,
"encryptServerData": encryptServerData,
"debug": debug
"debug": debug,
"bindAppletWithMainProcess": bindAppletWithMainProcess
});
return ret;
}

View File

@ -1,6 +1,6 @@
name: mop
description: A Finogeeks MiniProgram Flutter SDK.
version: '2.33.3'
version: '2.33.11'
homepage: https://github.com/finogeeks/mop-flutter-sdk
environment: