diff --git a/android/build.gradle b/android/build.gradle index a9b12d8..e55b09a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -91,6 +91,6 @@ kapt { } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.finogeeks.lib:finapplet:2.35.11' - implementation 'com.finogeeks.mop:plugins:2.35.11' + implementation 'com.finogeeks.lib:finapplet:2.36.3' + implementation 'com.finogeeks.mop:plugins:2.36.3' } \ No newline at end of file diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/AppletHandlerModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/AppletHandlerModule.java index 168373e..8b65c24 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/AppletHandlerModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/AppletHandlerModule.java @@ -2,6 +2,7 @@ package com.finogeeks.mop.api.mop; import android.content.Context; import android.graphics.Bitmap; +import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.util.Log; @@ -20,13 +21,14 @@ import com.google.gson.reflect.TypeToken; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.json.JSONObject; +import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; -import java.io.ByteArrayOutputStream; import io.flutter.plugin.common.MethodChannel; @@ -61,10 +63,12 @@ public class AppletHandlerModule extends BaseApi { Map params = new HashMap<>(); params.put("appletInfo", GsonUtil.gson.fromJson(s, new TypeToken>() { }.getType())); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); - byte[] data = baos.toByteArray(); - params.put("bitmap", data); + if (bitmap != null) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); + byte[] data = baos.toByteArray(); + params.put("bitmap", data); + } handler.post(() -> { channel.invokeMethod("extensionApi:forwardApplet", params, new MethodChannel.Result() { @Override @@ -205,6 +209,63 @@ public class AppletHandlerModule extends BaseApi { public void onNavigationBarCloseButtonClicked(@NotNull String s) { } + + @Override + public boolean launchApp(@Nullable String appParameter) { + /*Log.d("AppletHandlerModule", "getUserInfo"); + CountDownLatch latch = new CountDownLatch(1); + final Map[] ret = new Map[1]; + Map params = new HashMap(); + params.put("appParameter", appParameter); + handler.post(() -> { + channel.invokeMethod("extensionApi:launchApp", params, new MethodChannel.Result() { + @Override + public void success(Object result) { + ret[0] = (Map) result; + latch.countDown(); + } + + @Override + public void error(String errorCode, String errorMessage, Object errorDetails) { + latch.countDown(); + } + + @Override + public void notImplemented() { + latch.countDown(); + } + }); + }); + try { + latch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (ret[0].size() > 0) + return ret[0]; + else + return null;*/ + return false; + } + + @Override + public void getPhoneNumber(@NotNull IAppletCallback callback) { + } + + @Override + public void chooseAvatar(@NotNull IAppletCallback callback) { + } + + @Override + public boolean contact(@NotNull JSONObject json) { + return false; + } + + @Override + public boolean feedback(@NotNull Bundle bundle) { + return false; + } + }); callback.onSuccess(null); } diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/AppletManageModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/AppletManageModule.java index df67b0e..1903dce 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/AppletManageModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/AppletManageModule.java @@ -31,7 +31,7 @@ public class AppletManageModule extends BaseApi { @Override public String[] apis() { return new String[]{"currentApplet", "closeAllApplets", "clearApplets", "removeUsedApplet", "closeApplet", - "setActivityTransitionAnim", "sendCustomEvent", "callJS"}; + "setActivityTransitionAnim", "sendCustomEvent", "callJS","finishRunningApplet"}; } @Override @@ -58,6 +58,14 @@ public class AppletManageModule extends BaseApi { } else if (event.equals("closeAllApplets")) { FinAppClient.INSTANCE.getAppletApiManager().closeApplets(); callback.onSuccess(null); + }else if(event.equals("finishRunningApplet")){ + if (param.containsKey("appId") && param.get("appId") instanceof String) { + String appId = (String) param.get("appId"); + FinAppClient.INSTANCE.getAppletApiManager().finishRunningApplet(appId); + callback.onSuccess(null); + } else { + callback.onFail(null); + } } else if (event.equals("closeApplet")) { if (param.containsKey("appId") && param.get("appId") instanceof String) { String appId = (String) param.get("appId"); diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java index 1db0bb0..7f5d87b 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java @@ -83,8 +83,23 @@ public class BaseModule extends BaseApi { Gson gson = new Gson(); List finStoreConfigs = null; if (param.get("finStoreConfigs") != null) { - finStoreConfigs = gson.fromJson(gson.toJson(param.get("finStoreConfigs")), new TypeToken>() { - }.getType()); + finStoreConfigs = new ArrayList<>(); + List> configs = (List>) param.get("finStoreConfigs"); + for (Map config : configs) { + for (String key : config.keySet()) { + String sdkKey = (String) config.get("sdkKey"); + String sdkSecret = (String) config.get("sdkSecret"); + String apiUrl = (String) config.get("apiServer"); + String apmUrl = (String) config.get("apmServer"); + if (apmUrl == null) apmUrl = ""; + String fingerprint = (String) config.get("fingerprint"); + if (fingerprint == null) fingerprint = ""; + String encryptType = (String) config.get("cryptType"); + Boolean encryptServerData1 = (Boolean) config.get("encryptServerData"); + if (encryptServerData1 == null) encryptServerData1 = false; + finStoreConfigs.add(new FinStoreConfig(sdkKey, sdkSecret, apiUrl, apmUrl, "", fingerprint, encryptType, encryptServerData1)); + } + } } FinAppConfig.UIConfig uiConfig = null; if (param.get("uiConfig") != null) { diff --git a/ios/Classes/Api/MOPAppletDelegate.m b/ios/Classes/Api/MOPAppletDelegate.m index dab0502..00322f6 100644 --- a/ios/Classes/Api/MOPAppletDelegate.m +++ b/ios/Classes/Api/MOPAppletDelegate.m @@ -84,11 +84,11 @@ return models; } -- (void)customMenu:(id)customMenu inApplet:(FATAppletInfo *)appletInfo didClickAtPath:(NSString *)path { +- (void)clickCustomItemMenuWithInfo:(NSDictionary *)contentInfo inApplet:(FATAppletInfo *)appletInfo completion:(void (^)(FATExtensionCode code, NSDictionary *result))completion { NSDictionary *arguments = @{ - @"appId": appletInfo.appId, - @"path": path, - @"menuId": customMenu.menuId, + @"appId": contentInfo[@"appId"], + @"path": contentInfo[@"path"], + @"menuId": contentInfo[@"menuId"], @"appInfo": appletInfo.description }; FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel]; @@ -96,26 +96,6 @@ }]; - if ([@"Desktop" isEqualToString:customMenu.menuId]) { - [self addToDesktopItemClick:appletInfo path:path]; - } - -} - -- (void)clickCustomItemMenuWithInfo:(NSDictionary *)contentInfo completion:(void (^)(FATExtensionCode code, NSDictionary *result))completion { - NSDictionary *arguments = @{ - @"appId": contentInfo[@"appId"], - @"path": contentInfo[@"path"], - @"menuId": contentInfo[@"menuId"], - @"appInfo": [NSString stringWithFormat:@"{'title': '%@', 'description': '%@', 'imageUrl': '%@'}", contentInfo[@"title"], contentInfo[@"description"], contentInfo[@"imageUrl"]] - }; - FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel]; - [channel invokeMethod:@"extensionApi:onCustomMenuClick" arguments:arguments result:^(id _Nullable result) { - - }]; -} - -- (void)clickCustomItemMenuWithInfo:(NSDictionary *)contentInfo inApplet:(FATAppletInfo *)appletInfo completion:(void (^)(FATExtensionCode code, NSDictionary *result))completion { if ([@"Desktop" isEqualToString:contentInfo[@"menuId"]]) { [self addToDesktopItemClick:appletInfo path:contentInfo[@"path"]]; } diff --git a/ios/Classes/Api/MOP_initialize.m b/ios/Classes/Api/MOP_initialize.m index a84fa05..8786ad0 100644 --- a/ios/Classes/Api/MOP_initialize.m +++ b/ios/Classes/Api/MOP_initialize.m @@ -91,7 +91,7 @@ uiconfig.appletText = _uiConfig[@"appletText"]; uiconfig.hideTransitionCloseButton = [_uiConfig[@"hideTransitionCloseButton"] boolValue]; - uiconfig.disableSlideCloseAppletGesture = _uiConfig[@"disableSlideCloseAppletGesture"]; + uiconfig.disableSlideCloseAppletGesture = [_uiConfig[@"disableSlideCloseAppletGesture"] boolValue]; if (_uiConfig[@"capsuleConfig"]) { NSDictionary *capsuleConfigDic = _uiConfig[@"capsuleConfig"]; FATCapsuleConfig *capsuleConfig = [[FATCapsuleConfig alloc]init]; diff --git a/publish.sh b/publish.sh index d05023b..d80f7c2 100755 --- a/publish.sh +++ b/publish.sh @@ -1,4 +1,4 @@ + flutter packages pub publish --dry-run --server=https://pub.dartlang.org -flutter packages pub publish --server=https://pub.dartlang.org - +flutter packages pub publish --server=https://pub.dartlang.org --force \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 3f09934..8dec4ab 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: mop description: A Finogeeks MiniProgram Flutter SDK. -version: '2.35.11' +version: '2.36.3' homepage: https://github.com/finogeeks/mop-flutter-sdk environment: