Conflicts:
	android/build.gradle
	example/pubspec.lock
	lib/mop.dart
master
wangyong 2023-04-08 02:00:50 +08:00
commit a66803c56e
29 changed files with 328 additions and 121 deletions

1
.gitignore vendored
View File

@ -23,6 +23,7 @@ doc/api/
*.js_
*.js.deps
*.js.map
*.lock
*.iml
.gradle

3
.vscode/settings.json vendored 100644
View File

@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>

View File

@ -1,11 +1,11 @@
arguments=
arguments=--init-script /var/folders/tv/dbm7kt650fvdxrtf0k7xgxcm0000gn/T/d146c9752a26f79b52047fb6dc6ed385d064e120494f96f08ca63a317c41f94c.gradle --init-script /var/folders/tv/dbm7kt650fvdxrtf0k7xgxcm0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.0-rc-1))
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.4.2))
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=C\:/Program Files/Eclipse Foundation/jdk-11.0.12.7-hotspot
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true

View File

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

View File

@ -10,6 +10,7 @@ import android.util.Log;
import androidx.annotation.NonNull;
import com.finogeeks.lib.applet.client.FinAppProcessClient;
import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppTrace;
import com.finogeeks.lib.applet.interfaces.FinCallback;

View File

@ -141,6 +141,9 @@ public class AppletModule extends BaseApi {
String appId = String.valueOf(param.get("appletId"));
Integer sequence = (Integer) param.get("sequence");
Map<String, String> params = (Map) param.get("startParams");
if (params == null) {
params = new HashMap<>();
}
String apiServer = (String) param.get("apiServer");
String offlineMiniprogramZipPath = (String) param.get("offlineMiniprogramZipPath");
String offlineFrameworkZipPath = (String) param.get("offlineFrameworkZipPath");

View File

@ -19,6 +19,7 @@ import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Locale;
public class InitSDKModule extends BaseApi {
@ -183,6 +184,12 @@ public class InitSDKModule extends BaseApi {
if (appletText != null) {
configBuilder.setAppletText(appletText);
}
Integer languageInteger = (Integer) configMap.get("language");
if (languageInteger == 1) {
configBuilder.setLocale(Locale.ENGLISH);
} else {
configBuilder.setLocale(Locale.SIMPLIFIED_CHINESE);
}
// uiConfig
FinAppConfig.UIConfig uiConfig = InitUtils.createUIConfigFromMap(uiConfigMap);

View File

@ -7,6 +7,23 @@ import java.util.Map;
public class InitUtils {
private static float covertNumToFloat(Object obj) {
if (obj instanceof Float) {
return ((Float) obj).floatValue();
} else if (float.class.isInstance(obj)) {
return (float) obj;
} else if (obj instanceof Double) {
return ((Double) obj).floatValue();
} else if (double.class.isInstance(obj)) {
return (float) obj;
} else if (obj instanceof Integer) {
return ((Integer) obj).floatValue();
} else if (int.class.isInstance(obj)) {
return (float) obj;
}
throw new IllegalArgumentException("Unsupported argument type " + obj.getClass().getName());
}
public static FinAppConfig.UIConfig createUIConfigFromMap(Map<Object, Object> map) {
if (map != null) {
FinAppConfig.UIConfig uiConfig = new FinAppConfig.UIConfig();
@ -28,11 +45,11 @@ public class InitUtils {
Map<Object, Object> capsuleConfigMap = (Map<Object, Object>) map.get("capsuleConfig");
if (capsuleConfigMap != null) {
FinAppConfig.UIConfig.CapsuleConfig capsuleConfig = new FinAppConfig.UIConfig.CapsuleConfig();
capsuleConfig.capsuleWidth = (float) capsuleConfigMap.get("capsuleWidth");
capsuleConfig.capsuleHeight = (float) capsuleConfigMap.get("capsuleHeight");
capsuleConfig.capsuleRightMargin = (float) capsuleConfigMap.get("capsuleRightMargin");
capsuleConfig.capsuleCornerRadius = (float) capsuleConfigMap.get("capsuleCornerRadius");
capsuleConfig.capsuleBorderWidth = (float) capsuleConfigMap.get("capsuleBorderWidth");
capsuleConfig.capsuleWidth = covertNumToFloat(capsuleConfigMap.get("capsuleWidth"));
capsuleConfig.capsuleHeight = covertNumToFloat(capsuleConfigMap.get("capsuleHeight"));
capsuleConfig.capsuleRightMargin = covertNumToFloat(capsuleConfigMap.get("capsuleRightMargin"));
capsuleConfig.capsuleCornerRadius = covertNumToFloat(capsuleConfigMap.get("capsuleCornerRadius"));
capsuleConfig.capsuleBorderWidth = covertNumToFloat(capsuleConfigMap.get("capsuleBorderWidth"));
capsuleConfig.capsuleBgLightColor = (int) capsuleConfigMap.get("capsuleBgLightColor");
capsuleConfig.capsuleBgDarkColor = (int) capsuleConfigMap.get("capsuleBgDarkColor");
capsuleConfig.capsuleBorderLightColor = (int) capsuleConfigMap.get("capsuleBorderLightColor");
@ -47,8 +64,8 @@ public class InitUtils {
if (moreDarkImage != null) {
capsuleConfig.moreDarkImage = moreDarkImage;
}
capsuleConfig.moreBtnWidth = (float) capsuleConfigMap.get("moreBtnWidth");
capsuleConfig.moreBtnLeftMargin = (float) capsuleConfigMap.get("moreBtnLeftMargin");
capsuleConfig.moreBtnWidth = covertNumToFloat(capsuleConfigMap.get("moreBtnWidth"));
capsuleConfig.moreBtnLeftMargin = covertNumToFloat(capsuleConfigMap.get("moreBtnLeftMargin"));
Integer closeLightImage = (Integer) capsuleConfigMap.get("closeLightImage");
if (closeLightImage != null) {
capsuleConfig.closeLightImage = closeLightImage;
@ -57,18 +74,18 @@ public class InitUtils {
if (closeDarkImage != null) {
capsuleConfig.closeDarkImage = closeDarkImage;
}
capsuleConfig.closeBtnWidth = (float) capsuleConfigMap.get("closeBtnWidth");
capsuleConfig.closeBtnLeftMargin = (float) capsuleConfigMap.get("closeBtnLeftMargin");
capsuleConfig.closeBtnWidth = covertNumToFloat(capsuleConfigMap.get("closeBtnWidth"));
capsuleConfig.closeBtnLeftMargin = covertNumToFloat(capsuleConfigMap.get("closeBtnLeftMargin"));
uiConfig.setCapsuleConfig(capsuleConfig);
}
Map<Object, Object> navHomeConfigMap = (Map<Object, Object>) map.get("navHomeConfig");
if (navHomeConfigMap != null) {
FinAppConfig.UIConfig.NavHomeConfig navHomeConfig = new FinAppConfig.UIConfig.NavHomeConfig();
navHomeConfig.width = (float) navHomeConfigMap.get("width");
navHomeConfig.height = (float) navHomeConfigMap.get("height");
navHomeConfig.leftMargin = (float) navHomeConfigMap.get("leftMargin");
navHomeConfig.cornerRadius = (float) navHomeConfigMap.get("cornerRadius");
navHomeConfig.borderWidth = (float) navHomeConfigMap.get("borderWidth");
navHomeConfig.width = covertNumToFloat(navHomeConfigMap.get("width"));
navHomeConfig.height = covertNumToFloat(navHomeConfigMap.get("height"));
navHomeConfig.leftMargin = covertNumToFloat(navHomeConfigMap.get("leftMargin"));
navHomeConfig.cornerRadius = covertNumToFloat(navHomeConfigMap.get("cornerRadius"));
navHomeConfig.borderWidth = covertNumToFloat(navHomeConfigMap.get("borderWidth"));
navHomeConfig.borderLightColor = (int) navHomeConfigMap.get("borderLightColor");
navHomeConfig.borderDarkColor = (int) navHomeConfigMap.get("borderDarkColor");
navHomeConfig.bgLightColor = (int) navHomeConfigMap.get("bgLightColor");
@ -78,19 +95,19 @@ public class InitUtils {
Map<Object, Object> authViewConfigMap = (Map<Object, Object>) map.get("authViewConfig");
if (authViewConfigMap != null) {
FinAppConfig.UIConfig.AuthViewConfig authViewConfig = new FinAppConfig.UIConfig.AuthViewConfig();
authViewConfig.appletNameTextSize = (float) authViewConfigMap.get("appletNameTextSize");
authViewConfig.appletNameTextSize = covertNumToFloat(authViewConfigMap.get("appletNameTextSize"));
authViewConfig.appletNameLightColor = (int) authViewConfigMap.get("appletNameLightColor");
authViewConfig.appletNameDarkColor = (int) authViewConfigMap.get("appletNameDarkColor");
authViewConfig.authorizeTitleTextSize = (float) authViewConfigMap.get("authorizeTitleTextSize");
authViewConfig.authorizeTitleTextSize = covertNumToFloat(authViewConfigMap.get("authorizeTitleTextSize"));
authViewConfig.authorizeTitleLightColor = (int) authViewConfigMap.get("authorizeTitleLightColor");
authViewConfig.authorizeTitleDarkColor = (int) authViewConfigMap.get("authorizeTitleDarkColor");
authViewConfig.authorizeDescriptionTextSize = (float) authViewConfigMap.get("authorizeDescriptionTextSize");
authViewConfig.authorizeDescriptionTextSize = covertNumToFloat(authViewConfigMap.get("authorizeDescriptionTextSize"));
authViewConfig.authorizeDescriptionLightColor = (int) authViewConfigMap.get("authorizeDescriptionLightColor");
authViewConfig.authorizeDescriptionDarkColor = (int) authViewConfigMap.get("authorizeDescriptionDarkColor");
authViewConfig.agreementTitleTextSize = (float) authViewConfigMap.get("agreementTitleTextSize");
authViewConfig.agreementTitleTextSize = covertNumToFloat(authViewConfigMap.get("agreementTitleTextSize"));
authViewConfig.agreementTitleLightColor = (int) authViewConfigMap.get("agreementTitleLightColor");
authViewConfig.agreementTitleDarkColor = (int) authViewConfigMap.get("agreementTitleDarkColor");
authViewConfig.agreementDescriptionTextSize = (float) authViewConfigMap.get("agreementDescriptionTextSize");
authViewConfig.agreementDescriptionTextSize = covertNumToFloat(authViewConfigMap.get("agreementDescriptionTextSize"));
authViewConfig.agreementDescriptionLightColor = (int) authViewConfigMap.get("agreementDescriptionLightColor");
authViewConfig.agreementDescriptionDarkColor = (int) authViewConfigMap.get("agreementDescriptionDarkColor");
authViewConfig.linkLightColor = (int) authViewConfigMap.get("linkLightColor");

View File

@ -16,12 +16,12 @@
</natures>
<filteredResources>
<filter>
<id>1633860434667</id>
<id>1680241888118</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>

View File

@ -1,11 +1,11 @@
arguments=
arguments=--init-script /var/folders/tv/dbm7kt650fvdxrtf0k7xgxcm0000gn/T/d146c9752a26f79b52047fb6dc6ed385d064e120494f96f08ca63a317c41f94c.gradle --init-script /var/folders/tv/dbm7kt650fvdxrtf0k7xgxcm0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=C\:/Program Files/Eclipse Foundation/jdk-11.0.12.7-hotspot
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>

View File

@ -22,12 +22,12 @@
</natures>
<filteredResources>
<filter>
<id>1633860434672</id>
<id>1680241888252</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>

View File

@ -25,8 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
@ -34,7 +33,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.finogeeks.finclip.demo"
applicationId "com.finogeeks.finosprite"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
@ -48,8 +47,30 @@ android {
signingConfig signingConfigs.debug
}
}
packagingOptions {
// libsdkcore.solibyuvutil.so
doNotStrip "*/x86/libsdkcore.so"
doNotStrip "*/x86_64/libsdkcore.so"
doNotStrip "*/armeabi/libsdkcore.so"
doNotStrip "*/armeabi-v7a/libsdkcore.so"
doNotStrip "*/arm64-v8a/libsdkcore.so"
doNotStrip "*/x86/libfin-yuvutil.so"
doNotStrip "*/x86_64/libfin-yuvutil.so"
doNotStrip "*/armeabi/libfin-yuvutil.so"
doNotStrip "*/armeabi-v7a/libfin-yuvutil.so"
doNotStrip "*/arm64-v8a/libfin-yuvutil.so"
exclude 'META-INF/beans.xml'
}
}
flutter {
source '../..'
}
dependencies {
def sdk_version = "2.40.1"
compileOnly "com.finogeeks.lib:finapplet:${sdk_version}"
implementation "com.finogeeks.mop:plugins:${sdk_version}"
}

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.finogeeks.mop_example">
<application
android:name=".MainApplication"
android:label="mop_example"
android:icon="@mipmap/ic_launcher">
<activity

View File

@ -0,0 +1,38 @@
package com.finogeeks.mop_example;
import android.app.Application;
import android.content.Context;
// import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppProcessClient;
import com.finogeeks.lib.applet.sdk.api.IAppletProcessApiManager;
import com.finogeeks.lib.applet.sdk.api.IAppletProcessHandler;
public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
initProcessHandler();
}
private void initProcessHandler() {
if (!FinAppClient.INSTANCE.isFinAppProcess(this)) {
return;
}
FinAppProcessClient.INSTANCE.getAppletProcessApiManager().setAppletProcessHandler(new IAppletProcessHandler(){
@Override
public boolean onNavigationBarMoreButtonClicked(@NonNull Context context, @NonNull String appId) {
// truefalse使
//
return false;
}
});
}
}

View File

@ -6,7 +6,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
}
}

View File

@ -1,11 +1,11 @@
PODS:
- FinApplet (2.34.11)
- FinAppletExt (2.34.11):
- FinApplet (= 2.34.11)
- FinApplet (2.40.1)
- FinAppletExt (2.40.1):
- FinApplet (= 2.40.1)
- Flutter (1.0.0)
- mop (0.1.1):
- FinApplet (= 2.34.11)
- FinAppletExt (= 2.34.11)
- FinApplet (= 2.40.1)
- FinAppletExt (= 2.40.1)
- Flutter
DEPENDENCIES:
@ -24,11 +24,11 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/mop/ios"
SPEC CHECKSUMS:
FinApplet: 975a76c8de4c9ddf64d6b4bfcd946ad6830f54f6
FinAppletExt: 9489276a84f908b60a75a71d09b0b4397e070bee
FinApplet: 053df5db21b766a8705a6fb809731ec19f75578e
FinAppletExt: 45c9fece1524d9eafa25e6bcd0fe492060492e3a
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
mop: 9a49a0b917e4016aa897c76656fddb69ad69b118
mop: 8dffe3317decd528a199f7a8695d74174fded976
PODFILE CHECKSUM: 2317ba7584871ae8cd67fd0244fbd5e96fd06167
COCOAPODS: 1.11.2
COCOAPODS: 1.11.3

View File

@ -357,11 +357,13 @@
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = finclip_example;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.finogeeks.finclip.demo;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.finogeeks.finosprite;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
@ -484,11 +486,13 @@
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = finclip_example;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.finogeeks.finclip.demo;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.finogeeks.finosprite;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -506,11 +510,13 @@
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = finclip_example;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.finogeeks.finclip.demo;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.finogeeks.finosprite;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;

View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
@ -41,7 +43,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>

View File

@ -3,6 +3,7 @@
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:mop/api.dart';
import 'dart:async';
import 'dart:io';
import 'package:mop/mop.dart';
@ -23,50 +24,56 @@ class _MyAppState extends State<MyApp> {
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> init() async {
UIConfig uiconfig = UIConfig();
//
//
FinStoreConfig storeConfigA = FinStoreConfig(
"2LyZEib0gLTQdU3MUauATBwgfnTCJjdr7FCnywmAEM=",
"bdfd76cae24d4313",
"https://api.finclip.com",
"22LyZEib0gLTQdU3MUauAfJ/xujwNfM6OvvEqQyH4igA",
"703b9026be3d6bc5",
"https://api.finclip.com",
cryptType: "SM",
);
FinStoreConfig storeConfigB = FinStoreConfig(
"2LyZEib0gLTQdU3MUauATBwgfnTCJjdr7FCnywmAEM=",
"bdfd76cae24d4313",
"https://finchat-mop-b.finogeeks.club",
"https://finchat-mop-b.finogeeks.club",
"22LyZEib0gLTQdU3MUauAfJ/xujwNfM6OvvEqQyH4igA",
"703b9026be3d6bc5",
"https://finchat-mop-b.finogeeks.club"
);
List<FinStoreConfig> storeConfigs = [storeConfigA];
Config config = Config(storeConfigs);
config.language = LanguageType.English;
UIConfig uiconfig = UIConfig();
uiconfig.isAlwaysShowBackInDefaultNavigationBar = false;
uiconfig.isClearNavigationBarNavButtonBackground = false;
uiconfig.isHideFeedbackAndComplaints = true;
uiconfig.isHideBackHome = true;
uiconfig.isHideForwardMenu = true;
uiconfig.hideTransitionCloseButton = true;
uiconfig.disableSlideCloseAppletGesture = true;
CapsuleConfig capsuleConfig = CapsuleConfig();
capsuleConfig.capsuleBgLightColor = 0x33ff00ee;
capsuleConfig.capsuleRightMargin = 25;
// capsuleConfig.capsuleBgLightColor = 0x33ff00ee;
capsuleConfig.capsuleCornerRadius = 16;
// capsuleConfig.capsuleRightMargin = 25;
uiconfig.capsuleConfig = capsuleConfig;
uiconfig.appletText = "applet";
if (Platform.isIOS) {
final res = await Mop.instance.initialize(
'22LyZEib0gLTQdU3MUauATBwgfnTCJjdr7FCnywmAEM=', 'bdfd76cae24d4313',
apiServer: 'https://api.finclip.com',
apiPrefix: '/api/v1/mop',
uiConfig: uiconfig,
finStoreConfigs: storeConfigs);
print(res);
} else if (Platform.isAndroid) {
final res = await Mop.instance.initialize(
'22LyZEib0gLTQdU3MUauATBwgfnTCJjdr7FCnywmAEM=', 'bdfd76cae24d4313',
apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
print(res);
}
// if (Platform.isIOS) {
// final res = await Mop.instance.initialize(
// '22LyZEib0gLTQdU3MUauATBwgfnTCJjdr7FCnywmAEM=', 'bdfd76cae24d4313',
// apiServer: 'https://api.finclip.com',
// apiPrefix: '/api/v1/mop',
// uiConfig: uiconfig,
// finStoreConfigs: storeConfigs);
// print(res);
// } else if (Platform.isAndroid) {
// final res = await Mop.instance.initialize(
// '22LyZEib0gLTQdU3MUauATBwgfnTCJjdr7FCnywmAEM=', 'bdfd76cae24d4313',
// apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
// print(res);
// }
final res = await Mop.instance.initSDK(config, uiConfig: uiconfig);
print(res);
Mop.instance.registerAppletHandler(MyAppletHandler());
if (!mounted) return;
}
@ -117,8 +124,10 @@ class _MyAppState extends State<MyApp> {
// physics: NeverScrollableScrollPhysics(),
children: [
_buildAppletItem(appletId, "打开小程序", () {
Mop.instance.openApplet(appletId,
path: 'pages/index/index', query: '');
// Mop.instance.openApplet(appletId,
// path: 'pages/index/index', query: '');
RemoteAppletRequest request = RemoteAppletRequest(apiServer: 'https://api.finclip.com', appletId: appletId);
Mop.instance.startApplet(request);
}),
_buildAppletItem(appletId, "finishRunningApplet", () {
Mop.instance.finishRunningApplet(appletId, true);
@ -148,7 +157,7 @@ class _MyAppState extends State<MyApp> {
body: Column(
children: <Widget>[
_buildAppletWidget("5facb3a52dcbff00017469bd", "画图小程序"),
_buildAppletWidget("5fa214a29a6a7900019b5cc1", "官方小程序"),
_buildAppletWidget("5f72e3559a6a7900019b5baa", "官方小程序"),
_buildAppletWidget("5fa215459a6a7900019b5cc3", "我的对账单"),
],
),
@ -156,3 +165,45 @@ class _MyAppState extends State<MyApp> {
);
}
}
class MyAppletHandler extends AppletHandler {
@override
Future<void> appletDidOpen(String appId) async {
print("appletDidOpen appId:$appId");
}
@override
bool customCapsuleMoreButtonClick(String appId) {
return false;
}
@override
void forwardApplet(Map<String, dynamic> appletInfo) {
print("forwardApplet ---");
}
@override
Future<List<CustomMenu>> getCustomMenus(String appId) {
List<CustomMenu> customMenus = [];
return Future.value(customMenus);
}
@override
Future<void> getMobileNumber(Function(dynamic params) param0) {
// TODO: implement getMobileNumber
throw UnimplementedError();
}
@override
Future<Map<String, dynamic>> getUserInfo() {
// TODO: implement getUserInfo
throw UnimplementedError();
}
@override
Future<void> onCustomMenuClick(String appId, String path, String menuId, String appInfo) {
// TODO: implement onCustomMenuClick
throw UnimplementedError();
}
}

View File

@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.9.0"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
@ -21,14 +21,21 @@ packages:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.1"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
version: "1.1.0"
collection:
dependency: transitive
description:
@ -42,14 +49,14 @@ packages:
name: cupertino_icons
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
version: "1.0.5"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
version: "1.3.0"
flutter:
dependency: "direct main"
description: flutter
@ -68,7 +75,7 @@ packages:
name: flutter_plugin_android_lifecycle
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.5"
version: "2.0.9"
flutter_test:
dependency: "direct dev"
description: flutter
@ -87,35 +94,35 @@ packages:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.12"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.5"
version: "0.1.4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
version: "1.7.0"
mop:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "2.39.11"
version: "2.40.1"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.2"
version: "1.8.1"
sky_engine:
dependency: transitive
description: flutter
@ -127,7 +134,7 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.0"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
@ -148,21 +155,21 @@ packages:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.12"
version: "0.4.9"
vector_math:
dependency: transitive
description:
@ -172,4 +179,4 @@ packages:
version: "2.1.2"
sdks:
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.2.3"
flutter: ">=3.0.0"

View File

@ -56,6 +56,21 @@
return userInfo;
}
- (BOOL)appletInfo:(FATAppletInfo *)appletInfo didClickMoreBtnAtPath:(NSString *)path {
NSLog(@"appletInfo:didClickMoreBtnAtPath");
__block BOOL flag;
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
[channel invokeMethod:@"extensionApi:customCapsuleMoreButtonClick" arguments:@{@"appId": appletInfo.appId} result:^(id _Nullable result) {
CFRunLoopStop(CFRunLoopGetMain());
if ([result isKindOfClass:[NSNumber class]]) {
flag = [result boolValue];
}
}];
CFRunLoopRun();
return flag;
}
- (NSArray<id<FATAppletMenuProtocol>> *)customMenusInApplet:(FATAppletInfo *)appletInfo atPath:(NSString *)path {
NSLog(@"customMenusInApplet");
__block NSArray *list;

View File

@ -62,6 +62,12 @@
config.h5AjaxHookRequestKey = self.config[@"h5AjaxHookRequestKey"];
config.pageCountLimit = [self.config[@"pageCountLimit"] integerValue];
config.schemes = self.config[@"schemes"];
NSInteger languageInteger = [self.config[@"language"] integerValue];
if (languageInteger == 1) {
config.language = FATPreferredLanguageEnglish;
} else {
config.language = FATPreferredLanguageSimplifiedChinese;
}
NSError* error = nil;

View File

@ -16,6 +16,7 @@
{
NSLog(@"MOP_registerAppletHandler");
[FATClient sharedClient].delegate = [MOPAppletDelegate instance];
[FATClient sharedClient].shareItemDelegate = [MOPAppletDelegate instance];
}
@end

View File

@ -28,6 +28,9 @@ abstract class AppletHandler {
///
Future<Map<String, dynamic>> getUserInfo();
/// iOS
bool customCapsuleMoreButtonClick(String appId);
///
Future<List<CustomMenu>> getCustomMenus(String appId);

View File

@ -202,6 +202,9 @@ class Config {
///
bool enablePreNewProcess = true;
/// SDK
LanguageType language = LanguageType.Chinese;
/// Android
/// 使tbs
bool useLocalTbsCore = false;
@ -251,6 +254,7 @@ class Config {
"logMaxAliveSec": logMaxAliveSec,
"logDir": logDir,
"enablePreNewProcess": enablePreNewProcess,
"language":language.index,
"useLocalTbsCore": useLocalTbsCore,
"tbsCoreUrl": tbsCoreUrl,
};
@ -349,7 +353,7 @@ class UIConfig {
/// ServiceSDK
bool hideTransitionCloseButton = false;
/// NO
/// false
///
bool disableSlideCloseAppletGesture = false;
@ -419,14 +423,20 @@ class CapsuleConfig {
/// 5
double capsuleCornerRadius = 5;
/// 0.8
/// 1
double capsuleBorderWidth = 1;
// ///
// int capsuleBgLightColor = 0x80ffffff;
// ///
// int capsuleBgDarkColor = 0x33000000;
///
int capsuleBgLightColor = 0x33000000;
int capsuleBgLightColor = Platform.isAndroid ? 0x33000000 : 0x80ffffff;
///
int capsuleBgDarkColor = 0x80ffffff;
int capsuleBgDarkColor = Platform.isAndroid ? 0x80ffffff : 0x33000000;
///
int capsuleBorderLightColor = 0x80ffffff;
@ -446,11 +456,11 @@ class CapsuleConfig {
/// 使
int? moreDarkImage;
///
double moreBtnWidth = 32;
/// android32ios20
double moreBtnWidth = Platform.isAndroid ? 32 : 20;
///
double moreBtnLeftMargin = 6;
/// android6ios12
double moreBtnLeftMargin = Platform.isAndroid ? 6 : 12;
/// 使
int? closeLightImage;
@ -458,11 +468,11 @@ class CapsuleConfig {
/// 使
int? closeDarkImage;
///
double closeBtnWidth = 32;
/// android32ios20
double closeBtnWidth = Platform.isAndroid ? 32 : 20;
///
double closeBtnLeftMargin = 6;
/// android6ios12
double closeBtnLeftMargin = Platform.isAndroid ? 6 : 12;
Map<String, dynamic> toMap() {
return {
@ -772,6 +782,7 @@ class RemoteAppletRequest {
String appletId;
//
// key 'path' 'query'
Map<String, String>? startParams;
//
@ -867,6 +878,11 @@ enum BOOLState {
BOOLStateForbidden, // vconsoleapi
}
enum LanguageType {
Chinese, //
English, //
}
enum LogLevel {
LEVEL_ERROR, // ERROR
LEVEL_WARNING, // ERRORWARNING
@ -1128,6 +1144,9 @@ class Mop {
_appletHandlerApis["getUserInfo"] = (params) {
return handler.getUserInfo();
};
_appletHandlerApis["customCapsuleMoreButtonClick"] = (params) async {
return handler.customCapsuleMoreButtonClick(params["appId"]);
};
_appletHandlerApis["getCustomMenus"] = (params) async {
final res = await handler.getCustomMenus(params["appId"]);
List<Map<String, dynamic>> list = [];

View File

@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.9.0"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
@ -21,14 +21,21 @@ packages:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.1"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
version: "1.1.0"
collection:
dependency: transitive
description:
@ -42,7 +49,7 @@ packages:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
version: "1.3.0"
flutter:
dependency: "direct main"
description: flutter
@ -80,28 +87,28 @@ packages:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.12"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.5"
version: "0.1.4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.2"
version: "1.8.1"
sky_engine:
dependency: transitive
description: flutter
@ -113,7 +120,7 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.0"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
@ -134,21 +141,21 @@ packages:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.12"
version: "0.4.9"
vector_math:
dependency: transitive
description:

View File

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