diff --git a/example/lib/main.dart b/example/lib/main.dart index 55fb6f1..30a305c 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -131,12 +131,15 @@ class _MyAppState extends State { _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--'); + }), _buildAppletItem(appletId, "finishRunningApplet", () { Mop.instance.finishRunningApplet(appletId, true); @@ -184,8 +187,8 @@ class MyAppletHandler extends AppletHandler { @override bool customCapsuleMoreButtonClick(String appId) { print("customCapsuleMoreButtonClick---"); - toAppMessageChannel.invokeMethod("showCustomMoreView", {"appId": appId}); - return true; + // toAppMessageChannel.invokeMethod("showCustomMoreView", {"appId": appId}); + return false; } @override @@ -195,14 +198,23 @@ class MyAppletHandler extends AppletHandler { @override Future> getCustomMenus(String appId) { - List customMenus = []; + 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('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'), + ]; return Future.value(customMenus); } @override - Future getMobileNumber(Function(dynamic params) param0) { + Future getMobileNumber(Function(dynamic params) callback) { // TODO: implement getMobileNumber - throw UnimplementedError(); + Map result = {"phone": '18607180143',"other":'abc123'}; + print('getMobileNumber:' + result.toString()); + callback(result); + return Future.value(null); } @override diff --git a/example/pubspec.lock b/example/pubspec.lock index d519ee1..6e09cf6 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -115,7 +115,7 @@ packages: path: ".." relative: true source: path - version: "2.40.9" + version: "2.40.11" path: dependency: transitive description: diff --git a/ios/Classes/Api/MOPAppletDelegate.m b/ios/Classes/Api/MOPAppletDelegate.m index 57f10ef..43a8c13 100644 --- a/ios/Classes/Api/MOPAppletDelegate.m +++ b/ios/Classes/Api/MOPAppletDelegate.m @@ -180,8 +180,9 @@ static NSString *scheme = @"fatae55433be2f62915";//App对应的scheme NSDictionary *params = @{@"name":@"getPhoneNumber"}; FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel]; + self.bindGetPhoneNumbers = bindGetPhoneNumber; + NSLog(@"getPhoneNumberWithAppletInfo"); [channel invokeMethod:@"extensionApi:getPhoneNumber" arguments:params result:^(id _Nullable result) { - self.bindGetPhoneNumbers = bindGetPhoneNumber; // !self.bindGetPhoneNumbers?: bindGetPhoneNumber(result); }]; diff --git a/ios/Classes/MopPlugin.m b/ios/Classes/MopPlugin.m index 95c2fb8..18ba4a9 100644 --- a/ios/Classes/MopPlugin.m +++ b/ios/Classes/MopPlugin.m @@ -127,12 +127,13 @@ static MopPlugin *_instance; } else if ([@"getPhoneNumberResult" isEqualToString:call.method]) { if ([MOPAppletDelegate instance].bindGetPhoneNumbers) { - NSDictionary *dic = [[NSDictionary alloc] initWithDictionary:call.arguments]; - NSString *jsonString = [dic[@"phone"] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; - NSError *error; - NSDictionary *jsonDic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; - [MOPAppletDelegate instance].bindGetPhoneNumbers(jsonDic); + [MOPAppletDelegate instance].bindGetPhoneNumbers(call.arguments); + // NSDictionary *dic = [[NSDictionary alloc] initWithDictionary:call.arguments]; + // NSString *jsonString = [dic[@"phone"] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + // NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; + // NSError *error; + // NSDictionary *jsonDic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; + // [MOPAppletDelegate instance].bindGetPhoneNumbers(jsonDic); } } else { diff --git a/ios/mop.podspec b/ios/mop.podspec index db6e01b..b1a0d35 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.9' - s.dependency 'FinAppletExt' , '2.40.9' + s.dependency 'FinApplet' , '2.41.0-alpha20230602v12' + s.dependency 'FinAppletExt' , '2.41.0-alpha20230602v12' end