From 5f88cf1c918f11604ca5612058aa792943a4bf4a Mon Sep 17 00:00:00 2001 From: wanghualei Date: Fri, 9 Jun 2023 16:43:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=8F=9C=E5=8D=95iO?= =?UTF-8?q?S=E6=94=AF=E6=8C=81=E7=BD=91=E7=BB=9C=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/lib/main.dart | 27 ++++++++------ ios/Classes/Api/MOPAppletDelegate.m | 2 +- ios/Classes/Model/MopCustomMenuModel.h | 50 ++++++++++++++++++++++++++ ios/Classes/Model/MopCustomMenuModel.m | 5 +-- ios/mop.podspec | 4 +-- 5 files changed, 73 insertions(+), 15 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 30a305c..20b97b3 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -129,16 +129,14 @@ class _MyAppState extends State { // physics: NeverScrollableScrollPhysics(), children: [ _buildAppletItem(appletId, "打开小程序", () { - // Mop.instance.openApplet(appletId, - // path: 'pages/index/index', query: ''); - // TranstionStyle style = TranstionStyle.TranstionStyleUp; - // if (appletId == "5f72e3559a6a7900019b5baa") { - // style = TranstionStyle.TranstionStylePush; - // } - // RemoteAppletRequest request = RemoteAppletRequest(apiServer: 'https://api.finclip.com', appletId: appletId, transitionStyle: style); - // Mop.instance.startApplet(request); + TranstionStyle style = TranstionStyle.TranstionStyleUp; + if (appletId == "5f72e3559a6a7900019b5baa") { + style = TranstionStyle.TranstionStylePush; + } + RemoteAppletRequest request = RemoteAppletRequest(apiServer: 'https://api.finclip.com', appletId: appletId, transitionStyle: style); + Mop.instance.startApplet(request); - Mop.instance.qrcodeOpenApplet('https://api.finclip.com/api/v1/mop/runtime/applet/-f-MGYzN2Q1YTYzMmI2MWIyZg--'); + // Mop.instance.qrcodeOpenApplet('https://api.finclip.com/api/v1/mop/runtime/applet/-f-MGYzN2Q1YTYzMmI2MWIyZg--'); }), _buildAppletItem(appletId, "finishRunningApplet", () { @@ -198,9 +196,18 @@ class MyAppletHandler extends AppletHandler { @override Future> getCustomMenus(String appId) { + String icon1 = 'https://img1.baidu.com/it/u=2878938773,1765835171&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'; + if (Platform.isIOS) { + icon1 = 'minipro_list_service'; + } + List customMenus = [ CustomMenu('WXShareAPPFriends', 'https://img1.baidu.com/it/u=2878938773,1765835171&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', '微信好朋友', 'common'), - CustomMenu('WXShareAPPMoments', 'https://img2.baidu.com/it/u=3113705544,436318069&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', '微信朋友圈', 'common'), + CustomMenu('WXShareAPPMoments', 'minipro_list_collect', '微信朋友圈', 'common'), + CustomMenu('MyFriends', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSpvugSNLs9R7iopz_noeotAelvgzYj-74iCg&usqp=CAU', '我的好友', 'common'), + + // CustomMenu('WXShareAPPFriends', 'https://img1.baidu.com/it/u=2878938773,1765835171&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', '微信好朋友', 'common'), + // CustomMenu('WXShareAPPMoments', 'https://img2.baidu.com/it/u=3113705544,436318069&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', '微信朋友圈', 'common'), // CustomMenu('WXShareAPPFriends', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSpvugSNLs9R7iopz_noeotAelvgzYj-74iCg&usqp=CAU', '微信好朋友', 'common'), // CustomMenu('WXShareAPPMoments', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7cO4KB4e5-Ugdcq4pIyWunliH7LZRZzguKQ&usqp=CAU', '微信朋友圈', 'common'), diff --git a/ios/Classes/Api/MOPAppletDelegate.m b/ios/Classes/Api/MOPAppletDelegate.m index 43a8c13..08c416f 100644 --- a/ios/Classes/Api/MOPAppletDelegate.m +++ b/ios/Classes/Api/MOPAppletDelegate.m @@ -91,7 +91,7 @@ NSString *imageUrl = data[@"image"]; if ([imageUrl hasPrefix:@"http"]) { // 需要异步加载,待优化! - model.menuIconImage = [UIImage fat_getImageWithUrl:imageUrl]; + model.menuIconUrl = imageUrl; } else { model.menuIconImage = [UIImage imageNamed:imageUrl]; } diff --git a/ios/Classes/Model/MopCustomMenuModel.h b/ios/Classes/Model/MopCustomMenuModel.h index 416aea9..1a0d008 100644 --- a/ios/Classes/Model/MopCustomMenuModel.h +++ b/ios/Classes/Model/MopCustomMenuModel.h @@ -12,6 +12,56 @@ NS_ASSUME_NONNULL_BEGIN @interface MopCustomMenuModel : NSObject +/** + 菜单id + */ +@property (nonatomic, copy) NSString *menuId; + +/** + 菜单的icon图标 + 我们固定菜单的大小:3倍图:90*90 + 图标中间小logo与图标宽度比是 5:8。 + 注意:菜单图标显示优先级:后台配置icon > APP注入icon + */ +@property (nonatomic, strong) UIImage *menuIconImage; + +/** + 菜单的icon图标网络链接地址 + 我们固定菜单的大小:3倍图:90*90 + 图标中间小logo与图标宽度比是 5:8,供参考 + 注意:菜单图标显示优先级:后台配置的icon path > App注入的icon + */ +@property (nonatomic, copy) NSString *menuIconUrl; + +/** + 菜单在黑暗模式下的icon图标 + 我们固定菜单的大小:3倍图:90*90 + 图标中间小logo与图标宽度比是 5:8。 + 注意:菜单图标显示优先级:后台配置icon > APP注入icon + */ +@property (nonatomic, strong) UIImage *menuIconDarkImage; + +/** + 菜单的暗黑模式icon图标网络链接地址 + 我们固定菜单的大小:3倍图:90*90 + 图标中间小logo与图标宽度比是 5:8,供参考 + 注意:菜单图标显示优先级:后台配置的darkIcon path > App注入的icon + */ +@property (nonatomic, copy) NSString *menuDarkIconUrl; + +/** + 菜单的标题 + 注意:菜单标题显示优先级:后台配置标题 > APP注入标题 + */ +@property (nonatomic, copy) NSString *menuTitle; + +/** + 菜单的类型 + FATAppletMenuStyleCommon:通用的按钮,不需要小程序提供额外信息就可以调用的,比如收藏; + FATAppletMenuStyleOnMiniProgram:需要小程序配合实现的按钮,也就是说需要小程序提供额外调用参数的按钮,比如分享到微信 + */ +@property (nonatomic, assign) FATAppletMenuStyle menuType; + @end NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Model/MopCustomMenuModel.m b/ios/Classes/Model/MopCustomMenuModel.m index bfea6fc..a937019 100644 --- a/ios/Classes/Model/MopCustomMenuModel.m +++ b/ios/Classes/Model/MopCustomMenuModel.m @@ -9,15 +9,16 @@ @implementation MopCustomMenuModel -@synthesize menuId, menuIconImage, menuTitle, menuType; - - (id)copyWithZone:(NSZone *)zone { MopCustomMenuModel *model = [[MopCustomMenuModel allocWithZone:zone] init]; model.menuId = self.menuId; model.menuIconImage = self.menuIconImage; + model.menuIconDarkImage = self.menuIconDarkImage; model.menuTitle = self.menuTitle; model.menuType = self.menuType; + model.menuIconUrl = self.menuIconUrl; + model.menuDarkIconUrl = self.menuDarkIconUrl; return model; } diff --git a/ios/mop.podspec b/ios/mop.podspec index b1a0d35..6deaa11 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.41.0-alpha20230602v12' - s.dependency 'FinAppletExt' , '2.41.0-alpha20230602v12' + s.dependency 'FinApplet' , '2.40.12-dev20230608v03' + s.dependency 'FinAppletExt' , '2.40.12-dev20230608v03' end