# Conflicts:
#	ios/mop.podspec
master
luojian 2022-04-25 10:36:18 +08:00
commit 47ddb93685
8 changed files with 102 additions and 38 deletions

View File

@ -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'
}

View File

@ -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<String, Object> params = new HashMap<>();
params.put("appletInfo", GsonUtil.gson.fromJson(s, new TypeToken<Map<String, Object>>() {
}.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<String, String>[] ret = new Map[1];
Map<String, String> params = new HashMap<String, String>();
params.put("appParameter", appParameter);
handler.post(() -> {
channel.invokeMethod("extensionApi:launchApp", params, new MethodChannel.Result() {
@Override
public void success(Object result) {
ret[0] = (Map<String, String>) 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);
}

View File

@ -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");

View File

@ -83,8 +83,23 @@ public class BaseModule extends BaseApi {
Gson gson = new Gson();
List<FinStoreConfig> finStoreConfigs = null;
if (param.get("finStoreConfigs") != null) {
finStoreConfigs = gson.fromJson(gson.toJson(param.get("finStoreConfigs")), new TypeToken<List<FinStoreConfig>>() {
}.getType());
finStoreConfigs = new ArrayList<>();
List<Map<String, Object>> configs = (List<Map<String, Object>>) param.get("finStoreConfigs");
for (Map<String, Object> 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) {

View File

@ -84,11 +84,11 @@
return models;
}
- (void)customMenu:(id<FATAppletMenuProtocol>)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"]];
}

View File

@ -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];

View File

@ -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

View File

@ -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: