diff --git a/android/build.gradle b/android/build.gradle index 0ba8d31..b7e2f95 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.41.0-alpha20230408v01' - implementation 'com.finogeeks.mop:plugins:2.41.0-alpha20230408v01' + implementation 'com.finogeeks.lib:finapplet:2.40.4-dev20230417v01' + implementation 'com.finogeeks.mop:plugins:2.40.4-dev20230417v01' } \ 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 a19b4db..097b636 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 @@ -12,7 +12,7 @@ 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.modules.log.FLog; import com.finogeeks.lib.applet.interfaces.FinCallback; import com.finogeeks.lib.applet.page.view.moremenu.MoreMenuItem; import com.finogeeks.lib.applet.page.view.moremenu.MoreMenuType; @@ -58,7 +58,7 @@ public class AppletHandlerModule extends BaseApi { public void invoke(String event, Map param, ICallback callback) { if ("getPhoneNumberResult".equals(event)) { - FinAppTrace.d("AppletHandlerModule", "getPhoneNumberResult"); + FLog.d("AppletHandlerModule", "getPhoneNumberResult"); getPhoneNumberResult(event, param, callback); return; } @@ -203,13 +203,13 @@ public class AppletHandlerModule extends BaseApi { @Override public void error(String errorCode, String errorMessage, Object errorDetails) { - FinAppTrace.e(TAG, "getCustomMenus errorCode : " + errorCode + " errorMessage : " + errorMessage); + FLog.e(TAG, "getCustomMenus errorCode : " + errorCode + " errorMessage : " + errorMessage); latch.countDown(); } @Override public void notImplemented() { - FinAppTrace.d(TAG, "getCustomMenus notImplemented"); + FLog.d(TAG, "getCustomMenus notImplemented"); latch.countDown(); } }); @@ -219,7 +219,7 @@ public class AppletHandlerModule extends BaseApi { } catch (InterruptedException e) { e.printStackTrace(); } - FinAppTrace.d(TAG, "getRegisteredMoreMenuItems moreMenuItems : " + moreMenuItems + " size : " + moreMenuItems.size()); + FLog.d(TAG, "getRegisteredMoreMenuItems moreMenuItems : " + moreMenuItems + " size : " + moreMenuItems.size()); return moreMenuItems; } @@ -234,19 +234,19 @@ public class AppletHandlerModule extends BaseApi { channel.invokeMethod("extensionApi:onCustomMenuClick", params, new MethodChannel.Result() { @Override public void success(Object result) { - FinAppTrace.d(TAG, "onCustomMenuClick success"); + FLog.d(TAG, "onCustomMenuClick success"); iAppletCallback.onSuccess(null); } @Override public void error(String errorCode, String errorMessage, Object errorDetails) { - FinAppTrace.e(TAG, "onCustomMenuClick errorCode : " + errorCode + " errorMessage : " + errorMessage); + FLog.e(TAG, "onCustomMenuClick errorCode : " + errorCode + " errorMessage : " + errorMessage); iAppletCallback.onFailure(); } @Override public void notImplemented() { - FinAppTrace.d(TAG, "onCustomMenuClick notImplemented"); + FLog.d(TAG, "onCustomMenuClick notImplemented"); iAppletCallback.onFailure(); } }); @@ -303,20 +303,20 @@ public class AppletHandlerModule extends BaseApi { channel.invokeMethod("extensionApi:getPhoneNumber", params, new MethodChannel.Result() { @Override public void success(Object result) { - FinAppTrace.d(TAG, "onCustomMenuClick success"); + FLog.d(TAG, "onCustomMenuClick success"); // callback.onSuccess(null); phoneNumberCallback = callback; } @Override public void error(String errorCode, String errorMessage, Object errorDetails) { - FinAppTrace.e(TAG, "onCustomMenuClick errorCode : " + errorCode + " errorMessage : " + errorMessage); + FLog.e(TAG, "onCustomMenuClick errorCode : " + errorCode + " errorMessage : " + errorMessage); callback.onFailure(); } @Override public void notImplemented() { - FinAppTrace.d(TAG, "onCustomMenuClick notImplemented"); + FLog.d(TAG, "onCustomMenuClick notImplemented"); callback.onFailure(); } }); @@ -368,7 +368,7 @@ public class AppletHandlerModule extends BaseApi { } private void getPhoneNumberResult(String event, Map param, ICallback callback) { - FinAppTrace.d("AppletHandlerModule", "getPhoneNumberResult,param:" + param.toString()); + FLog.d("AppletHandlerModule", "getPhoneNumberResult,param:" + param.toString()); callback.onSuccess(null); if (phoneNumberCallback != null) { try { diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/ExtensionApiModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/ExtensionApiModule.java index 3e07c59..6f8bac6 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/ExtensionApiModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/ExtensionApiModule.java @@ -6,7 +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.lib.applet.modules.log.FLog; import com.finogeeks.mop.api.BaseApi; import com.finogeeks.mop.interfaces.ICallback; import com.finogeeks.mop.service.MopPluginService; @@ -57,7 +57,7 @@ public class ExtensionApiModule extends BaseApi { @Override public void success(Object result) { String json = GsonUtil.gson.toJson(result); - FinAppTrace.d(ExtensionApiModule.TAG, "channel invokeMethod:" + name + FLog.d(ExtensionApiModule.TAG, "channel invokeMethod:" + name + " success, result=" + result + ", json=" + json); JSONObject ret = null; if (json != null && !json.equals("null")) { @@ -80,7 +80,7 @@ public class ExtensionApiModule extends BaseApi { @Override public void error(String errorCode, String errorMessage, Object errorDetails) { - FinAppTrace.e(ExtensionApiModule.TAG, "channel invokeMethod:" + name + FLog.e(ExtensionApiModule.TAG, "channel invokeMethod:" + name + " error, errorCode=" + errorCode + ", errorMessage=" + errorMessage + ", errorDetails=" + errorDetails); @@ -114,7 +114,7 @@ public class ExtensionApiModule extends BaseApi { @Override public void success(Object result) { String json = GsonUtil.gson.toJson(result); - FinAppTrace.d(ExtensionApiModule.TAG, "channel invokeMethod:" + name + FLog.d(ExtensionApiModule.TAG, "channel invokeMethod:" + name + " success, result=" + result + ", json=" + json); JSONObject ret = null; if (json != null && !json.equals("null")) { @@ -137,7 +137,7 @@ public class ExtensionApiModule extends BaseApi { @Override public void error(String errorCode, String errorMessage, Object errorDetails) { - FinAppTrace.e(ExtensionApiModule.TAG, "channel invokeMethod:" + name + FLog.e(ExtensionApiModule.TAG, "channel invokeMethod:" + name + " error, errorCode=" + errorCode + ", errorMessage=" + errorMessage + ", errorDetails=" + errorDetails); diff --git a/example/android/app/src/main/java/com/finogeeks/mop_example/CustomLoadingPage.java b/example/android/app/src/main/java/com/finogeeks/mop_example/CustomLoadingPage.java new file mode 100644 index 0000000..3ce5f7f --- /dev/null +++ b/example/android/app/src/main/java/com/finogeeks/mop_example/CustomLoadingPage.java @@ -0,0 +1,40 @@ +package com.finogeeks.mop_example; + +import android.content.Context; +import android.widget.TextView; + +import com.finogeeks.lib.applet.modules.appletloadinglayout.IFinAppletLoadingPage; + +import androidx.annotation.NonNull; + +public class CustomLoadingPage extends IFinAppletLoadingPage { + public CustomLoadingPage(@NonNull Context context) { + super(context); + } + + @Override + public int getFailureLayoutRes() { + return R.layout.layout_custom_loading_page_failure; + } + + @Override + public int getLoadingLayoutRes() { + return R.layout.layout_custom_loading_page; + } + + @Override + public void onLoadingFailure(@NonNull String s) { + ((TextView)getFailureLayout().findViewById(R.id.failMsg)).setText(s); + } + + @Override + public void onLoadingFailure(@NonNull String s, @NonNull String s1) { + ((TextView)getFailureLayout().findViewById(R.id.failTitle)).setText(s); + ((TextView)getFailureLayout().findViewById(R.id.failMsg)).setText(s1); + } + + @Override + public void onUpdate(@NonNull String s, @NonNull String s1) { + ((TextView)getLoadingLayout().findViewById(R.id.loadingTitle)).setText(s); + } +} diff --git a/example/android/app/src/main/java/com/finogeeks/mop_example/MainApplication.java b/example/android/app/src/main/java/com/finogeeks/mop_example/MainApplication.java index 254851f..a481089 100644 --- a/example/android/app/src/main/java/com/finogeeks/mop_example/MainApplication.java +++ b/example/android/app/src/main/java/com/finogeeks/mop_example/MainApplication.java @@ -1,6 +1,8 @@ package com.finogeeks.mop_example; +import android.app.AlertDialog; import android.app.Application; +import android.app.Dialog; import android.content.Context; // import android.support.annotation.NonNull; import androidx.annotation.NonNull; @@ -27,11 +29,16 @@ public class MainApplication extends Application { FinAppProcessClient.INSTANCE.getAppletProcessApiManager().setAppletProcessHandler(new IAppletProcessHandler(){ @Override public boolean onNavigationBarMoreButtonClicked(@NonNull Context context, @NonNull String appId) { - // 返回true表示要自行处理更多视图;返回false表示使用默认的更多视图 - // 在这里弹出自定义的更多视图 - - return false; + new AlertDialog.Builder(context) + .setTitle("更多视图") + .setMessage(appId) + .setPositiveButton("菜单", null) + .setNegativeButton("取消", null) + .show(); + + // 返回true表示要自行处理更多视图;返回false表示使用默认的更多视图 + return true; } }); } diff --git a/example/android/app/src/main/res/layout/layout_custom_loading_page.xml b/example/android/app/src/main/res/layout/layout_custom_loading_page.xml new file mode 100644 index 0000000..d25e23b --- /dev/null +++ b/example/android/app/src/main/res/layout/layout_custom_loading_page.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/example/android/app/src/main/res/layout/layout_custom_loading_page_failure.xml b/example/android/app/src/main/res/layout/layout_custom_loading_page_failure.xml new file mode 100644 index 0000000..6722426 --- /dev/null +++ b/example/android/app/src/main/res/layout/layout_custom_loading_page_failure.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 9197f2f..03fe68c 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,11 +1,11 @@ PODS: - - FinApplet (2.40.1) - - FinAppletExt (2.40.1): - - FinApplet (= 2.40.1) + - FinApplet (2.40.3) + - FinAppletExt (2.40.3): + - FinApplet (= 2.40.3) - Flutter (1.0.0) - mop (0.1.1): - - FinApplet (= 2.40.1) - - FinAppletExt (= 2.40.1) + - FinApplet (= 2.40.3) + - FinAppletExt (= 2.40.3) - Flutter DEPENDENCIES: @@ -24,10 +24,10 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/mop/ios" SPEC CHECKSUMS: - FinApplet: 053df5db21b766a8705a6fb809731ec19f75578e - FinAppletExt: 45c9fece1524d9eafa25e6bcd0fe492060492e3a + FinApplet: a76ded99df163388bb4de129df20c0ff44abe37c + FinAppletExt: 5c53d5c3554ce1be014871214a5c7a06f0bf9177 Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a - mop: 8dffe3317decd528a199f7a8695d74174fded976 + mop: 4881eb2c1d365d9cf148b5dc7f8eca2b7018121d PODFILE CHECKSUM: 2317ba7584871ae8cd67fd0244fbd5e96fd06167 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index eaf0ffd..bdbee1c 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + A8C6E1F329E2FFEC00E3B446 /* LoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C6E1F229E2FFEC00E3B446 /* LoadingView.m */; }; + A8C6E1F629E3E71400E3B446 /* FlutterMethodChannelHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C6E1F529E3E71400E3B446 /* FlutterMethodChannelHandler.m */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -46,6 +48,10 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A8C6E1F129E2FFEC00E3B446 /* LoadingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoadingView.h; sourceTree = ""; }; + A8C6E1F229E2FFEC00E3B446 /* LoadingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoadingView.m; sourceTree = ""; }; + A8C6E1F429E3E71400E3B446 /* FlutterMethodChannelHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FlutterMethodChannelHandler.h; sourceTree = ""; }; + A8C6E1F529E3E71400E3B446 /* FlutterMethodChannelHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlutterMethodChannelHandler.m; sourceTree = ""; }; B691CF78BE1464D3451E07AF /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -120,6 +126,10 @@ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + A8C6E1F129E2FFEC00E3B446 /* LoadingView.h */, + A8C6E1F229E2FFEC00E3B446 /* LoadingView.m */, + A8C6E1F429E3E71400E3B446 /* FlutterMethodChannelHandler.h */, + A8C6E1F529E3E71400E3B446 /* FlutterMethodChannelHandler.m */, ); path = Runner; sourceTree = ""; @@ -272,6 +282,8 @@ buildActionMask = 2147483647; files = ( 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + A8C6E1F329E2FFEC00E3B446 /* LoadingView.m in Sources */, + A8C6E1F629E3E71400E3B446 /* FlutterMethodChannelHandler.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift index 70693e4..8c4081e 100644 --- a/example/ios/Runner/AppDelegate.swift +++ b/example/ios/Runner/AppDelegate.swift @@ -3,10 +3,16 @@ import Flutter @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { + + var channelHander : FlutterMethodChannelHandler? + override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { + + let controller : FlutterViewController = window?.rootViewController as! FlutterViewController + channelHander = FlutterMethodChannelHandler(messenger: controller) GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/example/ios/Runner/FlutterMethodChannelHandler.h b/example/ios/Runner/FlutterMethodChannelHandler.h new file mode 100644 index 0000000..3673c7d --- /dev/null +++ b/example/ios/Runner/FlutterMethodChannelHandler.h @@ -0,0 +1,16 @@ +// +// FlutterMethodChannelHandler.h +// Runner +// +// Created by Haley on 2023/4/10. +// + +#import +#import + +@interface FlutterMethodChannelHandler : NSObject + +- (instancetype)initWithMessenger:(NSObject *)messenger; + +@end + diff --git a/example/ios/Runner/FlutterMethodChannelHandler.m b/example/ios/Runner/FlutterMethodChannelHandler.m new file mode 100644 index 0000000..a1effd5 --- /dev/null +++ b/example/ios/Runner/FlutterMethodChannelHandler.m @@ -0,0 +1,53 @@ +// +// FlutterMethodChannelHandler.m +// Runner +// +// Created by Haley on 2023/4/10. +// + +#import "FlutterMethodChannelHandler.h" + +#import + +@interface FlutterMethodChannelHandler () + +@property (nonatomic,strong) FlutterMethodChannel *channel; + +@end + +@implementation FlutterMethodChannelHandler + +- (instancetype)initWithMessenger:(NSObject*)messenger +{ + self = [super init]; + if (self) { + [self setupChannelWithMessenger:messenger]; + } + + return self; +} + +- (void)setupChannelWithMessenger:(NSObject*)messenger +{ + _channel = [FlutterMethodChannel methodChannelWithName:@"com.message.flutter_to_app" binaryMessenger:messenger]; + + [_channel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) { + NSLog(@"收到Flutter消息:%@", call.method); + if ([call.method isEqualToString:@"showCustomMoreView"]) { + NSString *appId = call.arguments[@"appId"]; + // 弹出自定义的更多视图 + UIViewController *viewController = [[UIApplication sharedApplication] fat_topViewController]; + + UIAlertController *alertViewController = [UIAlertController alertControllerWithTitle:@"更多视图" message:appId preferredStyle:UIAlertControllerStyleActionSheet]; + [alertViewController addAction:[UIAlertAction actionWithTitle:@"转发" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + + }]]; + [alertViewController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + + }]]; + [viewController presentViewController:alertViewController animated:YES completion:nil]; + } + }]; +} + +@end diff --git a/example/ios/Runner/LoadingView.h b/example/ios/Runner/LoadingView.h new file mode 100644 index 0000000..450ec8e --- /dev/null +++ b/example/ios/Runner/LoadingView.h @@ -0,0 +1,16 @@ +// +// LoadingView.h +// Runner +// +// Created by Haley on 2023/4/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface LoadingView : FATBaseLoadingView + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/Runner/LoadingView.m b/example/ios/Runner/LoadingView.m new file mode 100644 index 0000000..859e546 --- /dev/null +++ b/example/ios/Runner/LoadingView.m @@ -0,0 +1,29 @@ +// +// LoadingView.m +// Runner +// +// Created by Haley on 2023/4/9. +// + +#import "LoadingView.h" + +@implementation LoadingView + +- (instancetype)initWithFrame:(CGRect)frame { + if ([super initWithFrame:frame]) { + self.loadingView.padding = 5; + self.loadingView.dotView.backgroundColor = [UIColor redColor]; + self.loadingView.animation.duration = 2; + self.titleLabel.textColor = [UIColor redColor]; + } + return self; +} +- (void)layoutSubviews +{ + [super layoutSubviews]; + + // 修改小程序logo应该是从管理后台上传新的小程序图标,因为更多面板、关于页面也会展示小程序logo,只改这里只是loding页面生效 + self.bottomImageView.hidden = YES; +} + +@end diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/example/ios/Runner/Runner-Bridging-Header.h index 308a2a5..de72694 100644 --- a/example/ios/Runner/Runner-Bridging-Header.h +++ b/example/ios/Runner/Runner-Bridging-Header.h @@ -1 +1,2 @@ #import "GeneratedPluginRegistrant.h" +#import "FlutterMethodChannelHandler.h" diff --git a/example/lib/main.dart b/example/lib/main.dart index 17d8685..32604b4 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -3,6 +3,7 @@ import 'dart:ffi'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:mop/api.dart'; import 'dart:async'; import 'dart:io'; @@ -10,6 +11,8 @@ import 'package:mop/mop.dart'; void main() => runApp(MyApp()); +const toAppMessageChannel = MethodChannel("com.message.flutter_to_app"); + class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); @@ -41,6 +44,7 @@ class _MyAppState extends State { List storeConfigs = [storeConfigA]; Config config = Config(storeConfigs); config.language = LanguageType.English; + config.baseLoadingViewClass = "LoadingView"; UIConfig uiconfig = UIConfig(); uiconfig.isAlwaysShowBackInDefaultNavigationBar = false; @@ -54,6 +58,7 @@ class _MyAppState extends State { // capsuleConfig.capsuleRightMargin = 25; uiconfig.capsuleConfig = capsuleConfig; uiconfig.appletText = "applet"; + uiconfig.loadingLayoutCls = "com.finogeeks.mop_example.CustomLoadingPage"; // if (Platform.isIOS) { // final res = await Mop.instance.initialize( @@ -174,7 +179,9 @@ class MyAppletHandler extends AppletHandler { @override bool customCapsuleMoreButtonClick(String appId) { - return false; + print("customCapsuleMoreButtonClick---"); + toAppMessageChannel.invokeMethod("showCustomMoreView", {"appId": appId}); + return true; } @override diff --git a/ios/Classes/Api/MOP_initSDK.m b/ios/Classes/Api/MOP_initSDK.m index 1603fc8..443b5a1 100644 --- a/ios/Classes/Api/MOP_initSDK.m +++ b/ios/Classes/Api/MOP_initSDK.m @@ -72,8 +72,8 @@ NSError* error = nil; FATUIConfig *uiconfig = [[FATUIConfig alloc]init]; - uiconfig.autoAdaptDarkMode = YES; if (_uiConfig) { + // 导航栏配置 if (_uiConfig[@"navigationTitleTextAttributes"]) { uiconfig.navigationTitleTextAttributes = _uiConfig[@"navigationTitleTextAttributes"]; } @@ -91,28 +91,20 @@ if (_uiConfig[@"navigationBarBackBtnDarkColor"]) { uiconfig.navigationBarBackBtnDarkColor = [MOPTools colorWithRGBHex:[_uiConfig[@"navigationBarBackBtnDarkColor"] intValue]]; } + + // 更多视图配置 uiconfig.moreMenuStyle = [_uiConfig[@"moreMenuStyle"] integerValue]; uiconfig.hideBackToHomePriority = [_uiConfig[@"isHideBackHomePriority"] integerValue]; - uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue]; uiconfig.hideBackToHome = [_uiConfig[@"isHideBackHome"] boolValue]; - uiconfig.hideForwardMenu = [_uiConfig[@"isHideForwardMenu"] boolValue]; uiconfig.hideShareAppletMenu = [_uiConfig[@"isHideShareAppletMenu"] boolValue]; - uiconfig.hideRefreshMenu = [_uiConfig[@"isHideRefreshMenu"] boolValue]; - uiconfig.hideTransitionCloseButton = [_uiConfig[@"hideTransitionCloseButton"] boolValue]; - uiconfig.disableSlideCloseAppletGesture = [_uiConfig[@"disableSlideCloseAppletGesture"] boolValue]; - if (_uiConfig[@"webViewProgressBarColor"]) { - uiconfig.progressBarColor = [MOPTools colorWithRGBHex:[_uiConfig[@"webViewProgressBarColor"] intValue]]; - } - - uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue]; uiconfig.hideForwardMenu = [_uiConfig[@"isHideForwardMenu"] boolValue]; - uiconfig.autoAdaptDarkMode = [_uiConfig[@"autoAdaptDarkMode"] boolValue]; uiconfig.hideSettingMenu = [_uiConfig[@"isHideSettingMenu"] boolValue]; + uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue]; + uiconfig.hideRefreshMenu = [_uiConfig[@"isHideRefreshMenu"] boolValue]; uiconfig.hideFavoriteMenu = [_uiConfig[@"isHideFavoriteMenu"] boolValue]; uiconfig.hideAddToDesktopMenu = [_uiConfig[@"isHideAddToDesktopMenu"] boolValue]; - - uiconfig.appletText = _uiConfig[@"appletText"]; - uiconfig.disableSlideCloseAppletGesture = [_uiConfig[@"disableSlideCloseAppletGesture"] boolValue]; + + // 胶囊配置 if (_uiConfig[@"capsuleConfig"]) { NSDictionary *capsuleConfigDic = _uiConfig[@"capsuleConfig"]; FATCapsuleConfig *capsuleConfig = [[FATCapsuleConfig alloc]init]; @@ -134,8 +126,8 @@ capsuleConfig.capsuleDividerLightColor = [MOPTools colorWithRGBHex:[capsuleConfigDic[@"capsuleDividerLightColor"] intValue]]; capsuleConfig.capsuleDividerDarkColor = [MOPTools colorWithRGBHex:[capsuleConfigDic[@"capsuleDividerDarkColor"] intValue]]; uiconfig.capsuleConfig = capsuleConfig; - } + uiconfig.hideTransitionCloseButton = [_uiConfig[@"hideTransitionCloseButton"] boolValue]; if (_uiConfig[@"navHomeConfig"]) { NSDictionary *navHomeConfigDic = _uiConfig[@"navHomeConfig"]; @@ -244,15 +236,19 @@ uiconfig.authViewConfig = authViewConfig; } - uiconfig.appendingCustomUserAgent = _uiConfig[@"customWebViewUserAgent"]; - uiconfig.hideWebViewProgressBar = [_uiConfig[@"hideWebViewProgressBar"] boolValue]; - uiconfig.autoAdaptDarkMode = [_uiConfig[@"autoAdaptDarkMode"] boolValue]; uiconfig.transtionStyle = [_uiConfig[@"transtionStyle"] integerValue]; + uiconfig.disableSlideCloseAppletGesture = [_uiConfig[@"disableSlideCloseAppletGesture"] boolValue]; + if (_uiConfig[@"webViewProgressBarColor"]) { + uiconfig.progressBarColor = [MOPTools colorWithRGBHex:[_uiConfig[@"webViewProgressBarColor"] intValue]]; + } + uiconfig.hideWebViewProgressBar = [_uiConfig[@"hideWebViewProgressBar"] boolValue]; + + uiconfig.appletText = _uiConfig[@"appletText"]; + uiconfig.appendingCustomUserAgent = _uiConfig[@"customWebViewUserAgent"]; + uiconfig.autoAdaptDarkMode = [_uiConfig[@"autoAdaptDarkMode"] boolValue]; + uiconfig.useNativeLiveComponent = [_uiConfig[@"useNativeLiveComponent"] boolValue]; } - - - // uiconfig.moreMenuStyle = FATMoreViewStyleNormal; [[FATClient sharedClient] initWithConfig:config uiConfig:uiconfig error:&error]; if (error) { failure(@"初始化失败"); @@ -268,8 +264,6 @@ [[FATClient sharedClient].logManager initLogWithLogDir:logDir logLevel:logLevel consoleLog:YES]; } - - [[FATClient sharedClient] setEnableLog:YES]; success(@{}); diff --git a/ios/Classes/Api/MOP_initialize.m b/ios/Classes/Api/MOP_initialize.m index a731e7f..ef11dc4 100644 --- a/ios/Classes/Api/MOP_initialize.m +++ b/ios/Classes/Api/MOP_initialize.m @@ -76,7 +76,6 @@ NSError* error = nil; FATUIConfig *uiconfig = [[FATUIConfig alloc]init]; - uiconfig.autoAdaptDarkMode = YES; if (_uiConfig) { if (_uiConfig[@"navigationTitleTextAttributes"]) { uiconfig.navigationTitleTextAttributes = _uiConfig[@"navigationTitleTextAttributes"]; diff --git a/ios/Classes/Api/MOP_registerAppletHandler.m b/ios/Classes/Api/MOP_registerAppletHandler.m index 69e137e..a1a0b63 100644 --- a/ios/Classes/Api/MOP_registerAppletHandler.m +++ b/ios/Classes/Api/MOP_registerAppletHandler.m @@ -16,7 +16,6 @@ { NSLog(@"MOP_registerAppletHandler"); [FATClient sharedClient].delegate = [MOPAppletDelegate instance]; - [FATClient sharedClient].shareItemDelegate = [MOPAppletDelegate instance]; } @end diff --git a/ios/mop.podspec b/ios/mop.podspec index c24d121..a83d88e 100644 --- a/ios/mop.podspec +++ b/ios/mop.podspec @@ -17,7 +17,7 @@ A finclip miniprogram flutter sdk. s.dependency 'Flutter' s.ios.deployment_target = '9.0' - s.dependency 'FinApplet' , '2.40.1' - s.dependency 'FinAppletExt' , '2.40.1' + s.dependency 'FinApplet' , '2.40.4-dev20230422v01' + s.dependency 'FinAppletExt' , '2.40.4-dev20230422v01' end diff --git a/lib/mop.dart b/lib/mop.dart index fd2d20a..80a00a3 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -338,6 +338,10 @@ class UIConfig { // 是否自适应暗黑模式。如果设置为true,则更多页面、关于等原生页面会随着手机切换暗黑,也自动调整为暗黑模式 bool autoAdaptDarkMode = false; + // 是否使用内置的live组件,默认为false。(目前仅iOS支持) + // 配置为true时,需要依赖Live扩展SDK。 + bool useNativeLiveComponent = false; + // 要拼接的userAgent字符串 String? appendingCustomUserAgent; @@ -399,6 +403,7 @@ class UIConfig { "moreMenuStyle": moreMenuStyle, "isHideBackHomePriority": isHideBackHomePriority.index, "autoAdaptDarkMode": autoAdaptDarkMode, + "useNativeLiveComponent": useNativeLiveComponent, "appendingCustomUserAgent": appendingCustomUserAgent, "transtionStyle": transtionStyle.index, "disableSlideCloseAppletGesture": disableSlideCloseAppletGesture,