Merge branch 'master' into major
# Conflicts: # ios/Classes/Api/MOP_initialize.m # ios/mop.podspecmaster
commit
3cf123b887
|
@ -91,6 +91,6 @@ kapt {
|
|||
}
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.finogeeks.lib:finapplet:2.34.9'
|
||||
implementation 'com.finogeeks.mop:plugins:2.34.9'
|
||||
implementation 'com.finogeeks.lib:finapplet:2.35.0-alpha20211229v09'
|
||||
implementation 'com.finogeeks.mop:plugins:2.35.0-alpha20211229v01'
|
||||
}
|
|
@ -5,6 +5,7 @@ import android.text.TextUtils;
|
|||
import android.util.Log;
|
||||
|
||||
import com.finogeeks.lib.applet.client.FinAppClient;
|
||||
import com.finogeeks.lib.applet.interfaces.FinCallback;
|
||||
import com.finogeeks.lib.applet.sdk.model.StartAppletDecryptRequest;
|
||||
import com.finogeeks.mop.api.BaseApi;
|
||||
import com.finogeeks.mop.interfaces.ICallback;
|
||||
|
@ -28,7 +29,7 @@ public class AppletModule extends BaseApi {
|
|||
|
||||
@Override
|
||||
public String[] apis() {
|
||||
return new String[]{"openApplet", "scanOpenApplet"};
|
||||
return new String[]{"openApplet", "scanOpenApplet","qrcodeOpenApplet"};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,6 +38,8 @@ public class AppletModule extends BaseApi {
|
|||
openApplet(param, callback);
|
||||
} else if ("scanOpenApplet".equals(event)) {
|
||||
scanOpenApplet(param, callback);
|
||||
} else if ("qrcodeOpenApplet".equals(event)){
|
||||
qrcodeOpenApplet(param,callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,4 +112,28 @@ public class AppletModule extends BaseApi {
|
|||
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, new StartAppletDecryptRequest(info));
|
||||
callback.onSuccess(new HashMap());
|
||||
}
|
||||
|
||||
private void qrcodeOpenApplet(Map param, ICallback callback){
|
||||
String qrcode = String.valueOf(param.get("qrcode"));
|
||||
FinAppClient.INSTANCE.getAppletApiManager().startAppletByQrcode(mContext, qrcode, new FinCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
callback.onSuccess(new HashMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int i, String s) {
|
||||
callback.onFail(new HashMap(){
|
||||
{
|
||||
put("info",s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int i, String s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/beetle/Desktop/finogeeks/gitlab/finosprite/finclip-flutter-sdk/","dependencies":[]}],"android":[{"name":"mop","path":"/Users/beetle/Desktop/finogeeks/gitlab/finosprite/finclip-flutter-sdk/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"mop","dependencies":[]}],"date_created":"2021-11-15 23:44:20.482386","version":"2.2.2"}
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/haley/Documents/Finogeeks/Gitlab/finclip-flutter-sdk/","dependencies":[]}],"android":[{"name":"mop","path":"/Users/haley/Documents/Finogeeks/Gitlab/finclip-flutter-sdk/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"mop","dependencies":[]}],"date_created":"2021-12-29 10:07:33.662750","version":"2.3.0-1.0.pre.169"}
|
|
@ -2,6 +2,6 @@
|
|||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
#import "MopPlugin.h"
|
||||
#import "MopCustomMenuModel.h"
|
||||
|
||||
@interface NSString (FATEncode)
|
||||
- (NSString *)fat_encodeString;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation MOPAppletDelegate
|
||||
|
||||
+ (instancetype)instance
|
||||
|
@ -70,6 +76,9 @@
|
|||
FATAppletMenuStyle style = [typeString isEqualToString:@"onMiniProgram"] ? FATAppletMenuStyleOnMiniProgram : FATAppletMenuStyleCommon;
|
||||
model.menuType = style;
|
||||
}
|
||||
if ([@"Desktop" isEqualToString:model.menuId] && FATAppletVersionTypeRelease != appletInfo.appletVersionType) {
|
||||
continue;
|
||||
}
|
||||
[models addObject:model];
|
||||
}
|
||||
|
||||
|
@ -87,6 +96,11 @@
|
|||
[channel invokeMethod:@"extensionApi:onCustomMenuClick" arguments:arguments result:^(id _Nullable result) {
|
||||
|
||||
}];
|
||||
|
||||
if ([@"Desktop" isEqualToString:customMenu.menuId]) {
|
||||
[self addToDesktopItemClick:appletInfo path:path];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)clickCustomItemMenuWithInfo:(NSDictionary *)contentInfo completion:(void (^)(FATExtensionCode code, NSDictionary *result))completion {
|
||||
|
@ -102,6 +116,12 @@
|
|||
}];
|
||||
}
|
||||
|
||||
- (void)clickCustomItemMenuWithInfo:(NSDictionary *)contentInfo inApplet:(FATAppletInfo *)appletInfo completion:(void (^)(FATExtensionCode code, NSDictionary *result))completion {
|
||||
if ([@"Desktop" isEqualToString:contentInfo[@"menuId"]]) {
|
||||
[self addToDesktopItemClick:appletInfo path:contentInfo[@"path"]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applet:(NSString *)appletId didOpenCompletion:(NSError *)error {
|
||||
if (!appletId) {
|
||||
return;
|
||||
|
@ -113,4 +133,34 @@
|
|||
}];
|
||||
}
|
||||
|
||||
static NSString *scheme = @"fatae55433be2f62915";//App对应的scheme
|
||||
|
||||
- (void)addToDesktopItemClick:(FATAppletInfo *)appInfo path:(NSString *)path {
|
||||
NSMutableString *herf = [NSString stringWithFormat:@"%@://applet/appid/%@?", scheme, appInfo.appId].mutableCopy;
|
||||
NSString *query = [NSString stringWithFormat:@"apiServer=%@&path=%@",appInfo.apiServer, path];
|
||||
|
||||
if ([appInfo.startParams[@"query"] length]) {
|
||||
query = [NSString stringWithFormat:@"%@&query=%@",query, appInfo.startParams[@"query"]];
|
||||
}
|
||||
[herf appendString:query.fat_encodeString];
|
||||
|
||||
NSMutableString *url = [NSMutableString stringWithFormat:@"%@/mop/scattered-page/#/desktopicon", appInfo.apiServer];
|
||||
[url appendFormat:@"?iconpath=%@", appInfo.appAvatar];
|
||||
[url appendFormat:@"&apptitle=%@", appInfo.appTitle.fat_encodeString];
|
||||
[url appendFormat:@"&linkhref=%@", herf];
|
||||
|
||||
NSLog(@"跳转到中间页面:%@", url);
|
||||
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSString (FATEncode)
|
||||
|
||||
- (NSString *)fat_encodeString {
|
||||
return (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes( NULL, (__bridge CFStringRef)self, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// MOP_scanOpenApplet.h
|
||||
// mop
|
||||
//
|
||||
// Created by beetle_92 on 2021/6/7.
|
||||
//
|
||||
|
||||
#import "MOPBaseApi.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MOP_qrcodeOpenApplet : MOPBaseApi
|
||||
|
||||
@property (nonatomic,copy) NSString *qrcode;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// MOP_scanOpenApplet.m
|
||||
// mop
|
||||
//
|
||||
// Created by beetle_92 on 2021/6/7.
|
||||
//
|
||||
|
||||
#import "MOP_qrcodeOpenApplet.h"
|
||||
#import "MOPTools.h"
|
||||
#import <FinApplet/FinApplet.h>
|
||||
|
||||
@implementation MOP_qrcodeOpenApplet
|
||||
|
||||
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *,id> * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel {
|
||||
NSLog(@"MOP_qrcodeOpenApplet:%@", self.qrcode);
|
||||
FATAppletQrCodeRequest *qrcodeRequest = [[FATAppletQrCodeRequest alloc] init];
|
||||
qrcodeRequest.qrCode = self.qrcode;
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
UIViewController *currentVC = [MOPTools topViewController];
|
||||
[[FATClient sharedClient] startAppletWithQrCodeRequest:qrcodeRequest inParentViewController:currentVC requestBlock:^(BOOL result, FATError *error) {
|
||||
NSLog(@"请求完成:%@", error);
|
||||
} completion:^(BOOL result, FATError *error) {
|
||||
NSLog(@"打开完成:%@", error);
|
||||
if (result){
|
||||
success(@{});
|
||||
} else {
|
||||
failure(error.description);
|
||||
}
|
||||
} closeCompletion:^{
|
||||
NSLog(@"关闭");
|
||||
}];
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@end
|
|
@ -88,6 +88,11 @@ static MopPlugin *_instance;
|
|||
|
||||
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *, id> *)options
|
||||
{
|
||||
if (![FATClient sharedClient].inited) {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[[FATClient sharedClient] handleOpenURL:url];
|
||||
});
|
||||
}
|
||||
return [[FATClient sharedClient] handleOpenURL:url];
|
||||
}
|
||||
|
||||
|
|
|
@ -178,6 +178,11 @@ class Mop {
|
|||
return await _channel.invokeMapMethod("scanOpenApplet", params);
|
||||
}
|
||||
|
||||
Future qrcodeOpenApplet(String qrcode) async {
|
||||
Map<String, Object> params = {'qrcode': qrcode};
|
||||
return await _channel.invokeMapMethod("qrcodeOpenApplet", params);
|
||||
}
|
||||
|
||||
///
|
||||
/// 根据微信QrCode信息解析小程序信息
|
||||
///
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: mop
|
||||
description: A Finogeeks MiniProgram Flutter SDK.
|
||||
version: '2.34.9'
|
||||
version: '2.34.12'
|
||||
homepage: https://github.com/finogeeks/mop-flutter-sdk
|
||||
|
||||
environment:
|
||||
|
|
Loading…
Reference in New Issue