自定义菜单iOS支持网络图片
parent
c3017a967e
commit
5f88cf1c91
|
@ -129,16 +129,14 @@ class _MyAppState extends State<MyApp> {
|
||||||
// physics: NeverScrollableScrollPhysics(),
|
// physics: NeverScrollableScrollPhysics(),
|
||||||
children: [
|
children: [
|
||||||
_buildAppletItem(appletId, "打开小程序", () {
|
_buildAppletItem(appletId, "打开小程序", () {
|
||||||
// Mop.instance.openApplet(appletId,
|
TranstionStyle style = TranstionStyle.TranstionStyleUp;
|
||||||
// path: 'pages/index/index', query: '');
|
if (appletId == "5f72e3559a6a7900019b5baa") {
|
||||||
// TranstionStyle style = TranstionStyle.TranstionStyleUp;
|
style = TranstionStyle.TranstionStylePush;
|
||||||
// if (appletId == "5f72e3559a6a7900019b5baa") {
|
}
|
||||||
// style = TranstionStyle.TranstionStylePush;
|
RemoteAppletRequest request = RemoteAppletRequest(apiServer: 'https://api.finclip.com', appletId: appletId, transitionStyle: style);
|
||||||
// }
|
Mop.instance.startApplet(request);
|
||||||
// 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", () {
|
_buildAppletItem(appletId, "finishRunningApplet", () {
|
||||||
|
@ -198,9 +196,18 @@ class MyAppletHandler extends AppletHandler {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<CustomMenu>> getCustomMenus(String appId) {
|
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 = [
|
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('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('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'),
|
// CustomMenu('WXShareAPPMoments', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7cO4KB4e5-Ugdcq4pIyWunliH7LZRZzguKQ&usqp=CAU', '微信朋友圈', 'common'),
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
NSString *imageUrl = data[@"image"];
|
NSString *imageUrl = data[@"image"];
|
||||||
if ([imageUrl hasPrefix:@"http"]) {
|
if ([imageUrl hasPrefix:@"http"]) {
|
||||||
// 需要异步加载,待优化!
|
// 需要异步加载,待优化!
|
||||||
model.menuIconImage = [UIImage fat_getImageWithUrl:imageUrl];
|
model.menuIconUrl = imageUrl;
|
||||||
} else {
|
} else {
|
||||||
model.menuIconImage = [UIImage imageNamed:imageUrl];
|
model.menuIconImage = [UIImage imageNamed:imageUrl];
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,56 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface MopCustomMenuModel : NSObject <FATAppletMenuProtocol>
|
@interface MopCustomMenuModel : NSObject <FATAppletMenuProtocol>
|
||||||
|
|
||||||
|
/**
|
||||||
|
菜单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
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
|
@ -9,15 +9,16 @@
|
||||||
|
|
||||||
@implementation MopCustomMenuModel
|
@implementation MopCustomMenuModel
|
||||||
|
|
||||||
@synthesize menuId, menuIconImage, menuTitle, menuType;
|
|
||||||
|
|
||||||
- (id)copyWithZone:(NSZone *)zone
|
- (id)copyWithZone:(NSZone *)zone
|
||||||
{
|
{
|
||||||
MopCustomMenuModel *model = [[MopCustomMenuModel allocWithZone:zone] init];
|
MopCustomMenuModel *model = [[MopCustomMenuModel allocWithZone:zone] init];
|
||||||
model.menuId = self.menuId;
|
model.menuId = self.menuId;
|
||||||
model.menuIconImage = self.menuIconImage;
|
model.menuIconImage = self.menuIconImage;
|
||||||
|
model.menuIconDarkImage = self.menuIconDarkImage;
|
||||||
model.menuTitle = self.menuTitle;
|
model.menuTitle = self.menuTitle;
|
||||||
model.menuType = self.menuType;
|
model.menuType = self.menuType;
|
||||||
|
model.menuIconUrl = self.menuIconUrl;
|
||||||
|
model.menuDarkIconUrl = self.menuDarkIconUrl;
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ A finclip miniprogram flutter sdk.
|
||||||
s.dependency 'Flutter'
|
s.dependency 'Flutter'
|
||||||
s.ios.deployment_target = '9.0'
|
s.ios.deployment_target = '9.0'
|
||||||
|
|
||||||
s.dependency 'FinApplet' , '2.41.0-alpha20230602v12'
|
s.dependency 'FinApplet' , '2.40.12-dev20230608v03'
|
||||||
s.dependency 'FinAppletExt' , '2.41.0-alpha20230602v12'
|
s.dependency 'FinAppletExt' , '2.40.12-dev20230608v03'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue