完善config和uiConfig初始化参数

master
zhongweiguang 2023-03-21 17:46:50 +08:00
parent 18efa39500
commit 48f1feb493
7 changed files with 397 additions and 447 deletions

View File

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

View File

@ -8,6 +8,7 @@ import com.finogeeks.mop.api.mop.AppletManageModule;
import com.finogeeks.mop.api.mop.AppletModule; import com.finogeeks.mop.api.mop.AppletModule;
import com.finogeeks.mop.api.mop.BaseModule; import com.finogeeks.mop.api.mop.BaseModule;
import com.finogeeks.mop.api.mop.ExtensionApiModule; import com.finogeeks.mop.api.mop.ExtensionApiModule;
import com.finogeeks.mop.api.mop.InitSDKModule;
import com.finogeeks.mop.api.mop.VersionModule; import com.finogeeks.mop.api.mop.VersionModule;
import com.finogeeks.mop.api.mop.SmSignModule; import com.finogeeks.mop.api.mop.SmSignModule;
import com.finogeeks.mop.api.mop.WXQrCodeModule; import com.finogeeks.mop.api.mop.WXQrCodeModule;
@ -65,6 +66,7 @@ public class ApisManager {
} }
private void initSdkApi(Activity activity) { private void initSdkApi(Activity activity) {
add(new InitSDKModule(activity));
add(new BaseModule(activity)); add(new BaseModule(activity));
add(new AppletModule(activity)); add(new AppletModule(activity));
add(new AppletManageModule(activity)); add(new AppletManageModule(activity));

View File

@ -4,7 +4,6 @@ import android.app.Application;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
import com.finogeeks.lib.applet.BuildConfig;
import com.finogeeks.lib.applet.client.FinAppClient; import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppConfig; import com.finogeeks.lib.applet.client.FinAppConfig;
import com.finogeeks.lib.applet.client.FinStoreConfig; import com.finogeeks.lib.applet.client.FinStoreConfig;
@ -14,7 +13,6 @@ import com.finogeeks.mop.interfaces.ICallback;
import com.finogeeks.mop.service.MopPluginService; import com.finogeeks.mop.service.MopPluginService;
import com.finogeeks.xlog.XLogLevel; import com.finogeeks.xlog.XLogLevel;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -22,7 +20,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class BaseModule extends BaseApi { public class BaseModule extends BaseApi {
private final static String TAG = BaseModule.class.getSimpleName(); private final static String TAG = "BaseModule";
public BaseModule(Context context) { public BaseModule(Context context) {
super(context); super(context);

View File

@ -0,0 +1,77 @@
package com.finogeeks.mop.api.mop;
import android.app.Application;
import android.content.Context;
import android.util.Log;
import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppConfig;
import com.finogeeks.lib.applet.interfaces.FinCallback;
import com.finogeeks.mop.api.BaseApi;
import com.finogeeks.mop.interfaces.ICallback;
import com.finogeeks.mop.service.MopPluginService;
import com.google.gson.Gson;
import java.util.Map;
public class InitSDKModule extends BaseApi {
private final static String TAG = "InitSDKModule";
public InitSDKModule(Context context) {
super(context);
}
@Override
public String[] apis() {
return new String[]{"initSDK"};
}
@Override
public void invoke(String event, Map param, ICallback callback) {
if (FinAppClient.INSTANCE.isFinAppProcess(super.getContext())) {
//
return;
}
Log.d(TAG, "param:" + param);
if (param.get("config") == null) {
callback.onFail("config不能为空");
return;
}
Gson gson = new Gson();
FinAppConfig config = gson.fromJson(gson.toJson(param.get("config")), FinAppConfig.class);
FinAppConfig.UIConfig uiConfig = null;
if (param.containsKey("uiConfig")) {
uiConfig = gson.fromJson(gson.toJson(param.get("uiConfig")), FinAppConfig.UIConfig.class);
}
// FinAppConfig config = builder.build();
// Log.d(TAG, "config:" + gson.toJson(config));
final Application application = MopPluginService.getInstance().getActivity().getApplication();
// SDKSDK
FinCallback<Object> cb = new FinCallback<Object>() {
@Override
public void onSuccess(Object result) {
// SDK
callback.onSuccess(null);
}
@Override
public void onError(int code, String error) {
// SDK
callback.onFail(null);
}
@Override
public void onProgress(int status, String error) {
}
};
FinAppClient.INSTANCE.init(application, config, cb);
}
}

View File

@ -17,7 +17,7 @@
return; return;
} }
FATConfig *config; FATConfig *config;
NSArray *storeConfigList = self.config[@"storeConfigs"]; NSArray *storeConfigList = self.config[@"finStoreConfigs"];
if (storeConfigList && storeConfigList.count > 0) { if (storeConfigList && storeConfigList.count > 0) {
NSMutableArray *storeArrayM = [NSMutableArray array]; NSMutableArray *storeArrayM = [NSMutableArray array];
for (NSDictionary *dict in storeConfigList) { for (NSDictionary *dict in storeConfigList) {
@ -41,9 +41,9 @@
return; return;
} }
config.currentUserId = self.config[@"currentUserId"]; config.currentUserId = self.config[@"userId"];
config.productIdentification = self.config[@"productIdentification"]; config.productIdentification = self.config[@"productIdentification"];
config.disableAuthorize = [self.config[@"disableAuthorize"] boolValue]; config.disableAuthorize = [self.config[@"disableRequestPermissions"] boolValue];
config.appletAutoAuthorize = [self.config[@"appletAutoAuthorize"] boolValue]; config.appletAutoAuthorize = [self.config[@"appletAutoAuthorize"] boolValue];
config.disableGetSuperviseInfo = [self.config[@"disableGetSuperviseInfo"] boolValue]; config.disableGetSuperviseInfo = [self.config[@"disableGetSuperviseInfo"] boolValue];
config.ignoreWebviewCertAuth = [self.config[@"ignoreWebviewCertAuth"] boolValue]; config.ignoreWebviewCertAuth = [self.config[@"ignoreWebviewCertAuth"] boolValue];
@ -51,7 +51,7 @@
config.startCrashProtection = [self.config[@"startCrashProtection"] boolValue]; config.startCrashProtection = [self.config[@"startCrashProtection"] boolValue];
config.enableApmDataCompression = [self.config[@"enableApmDataCompression"] boolValue]; config.enableApmDataCompression = [self.config[@"enableApmDataCompression"] boolValue];
config.encryptServerData = [self.config[@"encryptServerData"] boolValue]; config.encryptServerData = [self.config[@"encryptServerData"] boolValue];
config.enableAppletDebug = [self.config[@"enableAppletDebug"] integerValue]; config.enableAppletDebug = [self.config[@"appletDebugMode"] integerValue];
config.enableWatermark = [self.config[@"enableWatermark"] boolValue]; config.enableWatermark = [self.config[@"enableWatermark"] boolValue];
config.watermarkPriority = [self.config[@"watermarkPriority"] integerValue]; config.watermarkPriority = [self.config[@"watermarkPriority"] integerValue];
config.baseLoadingViewClass = self.config[@"baseLoadingViewClass"]; config.baseLoadingViewClass = self.config[@"baseLoadingViewClass"];
@ -86,7 +86,7 @@
uiconfig.navigationBarBackBtnDarkColor = [MOPTools colorWithRGBHex:[_uiConfig[@"navigationBarBackBtnDarkColor"] intValue]]; uiconfig.navigationBarBackBtnDarkColor = [MOPTools colorWithRGBHex:[_uiConfig[@"navigationBarBackBtnDarkColor"] intValue]];
} }
uiconfig.moreMenuStyle = [_uiConfig[@"moreMenuStyle"] integerValue]; uiconfig.moreMenuStyle = [_uiConfig[@"moreMenuStyle"] integerValue];
uiconfig.hideBackToHomePriority = [_uiConfig[@"hideBackToHomePriority"] integerValue]; uiconfig.hideBackToHomePriority = [_uiConfig[@"isHideBackHomePriority"] integerValue];
uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue]; uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue];
uiconfig.hideBackToHome = [_uiConfig[@"isHideBackHome"] boolValue]; uiconfig.hideBackToHome = [_uiConfig[@"isHideBackHome"] boolValue];
uiconfig.hideForwardMenu = [_uiConfig[@"isHideForwardMenu"] boolValue]; uiconfig.hideForwardMenu = [_uiConfig[@"isHideForwardMenu"] boolValue];
@ -94,8 +94,8 @@
uiconfig.hideRefreshMenu = [_uiConfig[@"isHideRefreshMenu"] boolValue]; uiconfig.hideRefreshMenu = [_uiConfig[@"isHideRefreshMenu"] boolValue];
uiconfig.hideTransitionCloseButton = [_uiConfig[@"hideTransitionCloseButton"] boolValue]; uiconfig.hideTransitionCloseButton = [_uiConfig[@"hideTransitionCloseButton"] boolValue];
uiconfig.disableSlideCloseAppletGesture = [_uiConfig[@"disableSlideCloseAppletGesture"] boolValue]; uiconfig.disableSlideCloseAppletGesture = [_uiConfig[@"disableSlideCloseAppletGesture"] boolValue];
if (_uiConfig[@"progressBarColor"]) { if (_uiConfig[@"webViewProgressBarColor"]) {
uiconfig.progressBarColor = [MOPTools colorWithRGBHex:[_uiConfig[@"progressBarColor"] intValue]]; uiconfig.progressBarColor = [MOPTools colorWithRGBHex:[_uiConfig[@"webViewProgressBarColor"] intValue]];
} }
uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue]; uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue];
@ -154,7 +154,7 @@
if (_uiConfig[@"authViewConfig"]) { if (_uiConfig[@"authViewConfig"]) {
NSDictionary *authViewConfigDic = _uiConfig[@"authViewConfig"]; NSDictionary *authViewConfigDic = _uiConfig[@"authViewConfig"];
FATAuthViewConfig *authViewConfig = [[FATAuthViewConfig alloc]init]; FATAuthViewConfig *authViewConfig = [[FATAuthViewConfig alloc]init];
authViewConfig.appletNameFont = [UIFont systemFontOfSize:[authViewConfigDic[@"appletNameFont"] integerValue]]; authViewConfig.appletNameFont = [UIFont systemFontOfSize:[authViewConfigDic[@"appletNameTextSize"] floatValue]];
if (authViewConfigDic[@"appletNameLightColor"]) { if (authViewConfigDic[@"appletNameLightColor"]) {
authViewConfig.appletNameLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"appletNameLightColor"] intValue]]; authViewConfig.appletNameLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"appletNameLightColor"] intValue]];
} }
@ -163,7 +163,7 @@
authViewConfig.appletNameDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"appletNameDarkColor"] intValue]]; authViewConfig.appletNameDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"appletNameDarkColor"] intValue]];
} }
authViewConfig.authorizeTitleFont = [UIFont systemFontOfSize:[authViewConfigDic[@"authorizeTitleFont"] integerValue] weight:UIFontWeightMedium]; authViewConfig.authorizeTitleFont = [UIFont systemFontOfSize:[authViewConfigDic[@"authorizeTitleTextSize"] floatValue] weight:UIFontWeightMedium];
if (authViewConfigDic[@"authorizeTitleLightColor"]) { if (authViewConfigDic[@"authorizeTitleLightColor"]) {
authViewConfig.authorizeTitleLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeTitleLightColor"] intValue]]; authViewConfig.authorizeTitleLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeTitleLightColor"] intValue]];
@ -173,7 +173,7 @@
authViewConfig.authorizeTitleDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeTitleDarkColor"] intValue]]; authViewConfig.authorizeTitleDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeTitleDarkColor"] intValue]];
} }
authViewConfig.authorizeDescriptionFont = [UIFont systemFontOfSize:[authViewConfigDic[@"authorizeDescriptionFont"] integerValue]]; authViewConfig.authorizeDescriptionFont = [UIFont systemFontOfSize:[authViewConfigDic[@"authorizeDescriptionTextSize"] floatValue]];
if (authViewConfigDic[@"authorizeDescriptionLightColor"]) { if (authViewConfigDic[@"authorizeDescriptionLightColor"]) {
authViewConfig.authorizeDescriptionLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeDescriptionLightColor"] intValue]]; authViewConfig.authorizeDescriptionLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeDescriptionLightColor"] intValue]];
@ -183,7 +183,7 @@
authViewConfig.authorizeDescriptionDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeDescriptionDarkColor"] intValue]]; authViewConfig.authorizeDescriptionDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeDescriptionDarkColor"] intValue]];
} }
authViewConfig.agreementTitleFont = [UIFont systemFontOfSize:[authViewConfigDic[@"agreementTitleFont"] integerValue]]; authViewConfig.agreementTitleFont = [UIFont systemFontOfSize:[authViewConfigDic[@"agreementTitleTextSize"] floatValue]];
if (authViewConfigDic[@"agreementTitleLightColor"]) { if (authViewConfigDic[@"agreementTitleLightColor"]) {
authViewConfig.agreementTitleLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementTitleLightColor"] intValue]]; authViewConfig.agreementTitleLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementTitleLightColor"] intValue]];
@ -193,7 +193,7 @@
authViewConfig.agreementTitleDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementTitleDarkColor"] intValue]]; authViewConfig.agreementTitleDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementTitleDarkColor"] intValue]];
} }
authViewConfig.agreementDescriptionFont = [UIFont systemFontOfSize:[authViewConfigDic[@"agreementDescriptionFont"] integerValue]]; authViewConfig.agreementDescriptionFont = [UIFont systemFontOfSize:[authViewConfigDic[@"agreementDescriptionTextSize"] floatValue]];
if (authViewConfigDic[@"agreementDescriptionLightColor"]) { if (authViewConfigDic[@"agreementDescriptionLightColor"]) {
authViewConfig.agreementDescriptionLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementDescriptionLightColor"] intValue]]; authViewConfig.agreementDescriptionLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementDescriptionLightColor"] intValue]];

View File

@ -81,8 +81,8 @@
if (_uiConfig[@"navigationTitleTextAttributes"]) { if (_uiConfig[@"navigationTitleTextAttributes"]) {
uiconfig.navigationTitleTextAttributes = _uiConfig[@"navigationTitleTextAttributes"]; uiconfig.navigationTitleTextAttributes = _uiConfig[@"navigationTitleTextAttributes"];
} }
if (_uiConfig[@"progressBarColor"]) { if (_uiConfig[@"webViewProgressBarColor"]) {
uiconfig.progressBarColor = [MOPTools colorWithRGBHex:[_uiConfig[@"progressBarColor"] intValue]]; uiconfig.progressBarColor = [MOPTools colorWithRGBHex:[_uiConfig[@"webViewProgressBarColor"] intValue]];
} }
uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue]; uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue];
uiconfig.hideForwardMenu = [_uiConfig[@"isHideForwardMenu"] boolValue]; uiconfig.hideForwardMenu = [_uiConfig[@"isHideForwardMenu"] boolValue];

File diff suppressed because it is too large Load Diff