自定义菜单iOS支持网络图片

master
wanghualei 2023-06-09 16:43:26 +08:00
parent c3017a967e
commit 5f88cf1c91
5 changed files with 73 additions and 15 deletions

View File

@ -129,16 +129,14 @@ class _MyAppState extends State<MyApp> {
// 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<List<CustomMenu>> 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<CustomMenu> 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'),

View File

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

View File

@ -12,6 +12,56 @@ NS_ASSUME_NONNULL_BEGIN
@interface MopCustomMenuModel : NSObject <FATAppletMenuProtocol>
/**
id
*/
@property (nonatomic, copy) NSString *menuId;
/**
icon
390*90
logo 5:8
icon > APPicon
*/
@property (nonatomic, strong) UIImage *menuIconImage;
/**
icon
390*90
logo 5:8
icon path > Appicon
*/
@property (nonatomic, copy) NSString *menuIconUrl;
/**
icon
390*90
logo 5:8
icon > APPicon
*/
@property (nonatomic, strong) UIImage *menuIconDarkImage;
/**
icon
390*90
logo 5:8
darkIcon path > Appicon
*/
@property (nonatomic, copy) NSString *menuDarkIconUrl;
/**
> APP
*/
@property (nonatomic, copy) NSString *menuTitle;
/**
FATAppletMenuStyleCommon
FATAppletMenuStyleOnMiniProgram
*/
@property (nonatomic, assign) FATAppletMenuStyle menuType;
@end
NS_ASSUME_NONNULL_END

View File

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

View File

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