master
wangzhaoyao 2023-01-11 14:55:08 +08:00
parent ff39439bf7
commit 456b942ebd
6 changed files with 27 additions and 29 deletions

View File

@ -44,8 +44,7 @@
}];
}
- (NSDictionary *)getUserInfoWithAppletInfo:(FATAppletInfo *)appletInfo
{
- (NSDictionary *)getUserInfoWithAppletInfo:(FATAppletInfo *)appletInfo {
NSLog(@"getUserInfoWithAppletInfo");
__block NSDictionary *userInfo;
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
@ -77,8 +76,7 @@
NSString *imageUrl = data[@"image"];
if ([imageUrl hasPrefix:@"http"]) {
//
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]];
model.menuIconImage = [UIImage imageWithData:data];
model.menuIconImage = [UIImage fat_getImageWithUrl:imageUrl];
} else {
model.menuIconImage = [UIImage imageNamed:imageUrl];
}
@ -103,7 +101,8 @@
@"appId": contentInfo[@"appId"],
@"path": contentInfo[@"path"],
@"menuId": contentInfo[@"menuId"],
@"appInfo": jsonString
@"appInfo": jsonString,
@"query" : contentInfo[@"query"]
};
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
[channel invokeMethod:@"extensionApi:onCustomMenuClick" arguments:arguments result:^(id _Nullable result) {

View File

@ -86,7 +86,6 @@ static MopPlugin *_instance;
result(dict);
}
else if ([@"copyFileAsFinFile" isEqualToString:call.method]) {
// NSString *appId = call.arguments[@"appId"];
NSString *path = call.arguments[@"path"];
NSString *fileName = [path componentsSeparatedByString:@"/"].lastObject;
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
@ -94,7 +93,6 @@ static MopPlugin *_instance;
result(dict);
}
else if ([@"showShareAppletDialog" isEqualToString:call.method]) {
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UIImage *image = [[FATClient sharedClient] getDefaultCurrentAppletImage:440.0f];
MopShareView *view = [MopShareView viewWithData:call.arguments];
view.image = image;
@ -102,7 +100,6 @@ static MopPlugin *_instance;
[view setDidSelcetTypeBlock:^(NSString *type) {
result(type);
}];
// });
}
else if ([@"showLoading" isEqualToString:call.method]) {
UIViewController *currentVC = [MOPTools topViewController];
@ -123,15 +120,10 @@ static MopPlugin *_instance;
result([self appInfoDictWithAppId:call.arguments[@"appId"]]);
}
else if ([@"getScreenshot" isEqualToString:call.method]) {
// UIViewController *currentVC = [MOPTools topViewController];
// [currentVC.view fatHideToastActivity];
// [currentVC.view fatHideAllToasts];
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
UIImage *image = [[FATClient sharedClient] getDefaultCurrentAppletImage:0.0f];
NSString *filePtah = [[FATClient sharedClient] saveFile:UIImagePNGRepresentation(image) fileName:[NSString stringWithFormat:@"%@",call.arguments[@"appId"]]];
filePtah = [[FATClient sharedClient] fat_absolutePathWithPath:filePtah];
result(filePtah);
// });
}
else if ([@"getPhoneNumberResult" isEqualToString:call.method]) {
if ([MOPAppletDelegate instance].bindGetPhoneNumbers) {

View File

@ -56,7 +56,7 @@ returnInsets = inset;\
@{@"lightImage":@"share_link",@"title":@"复制链接", @"type":@"links"}];
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4f];
self.shareView = [[UIView alloc] initWithFrame:CGRectMake(52.5 , 46 + kFinoSafeAreaTop, 270, 380)];
self.shareView = [[UIView alloc] initWithFrame:CGRectMake((self.frame.size.width - 270) / 2 , 46 + kFinoSafeAreaTop, 270, 380)];
self.shareView.layer.cornerRadius = 6;
self.shareView.backgroundColor = UIColor.whiteColor;

View File

@ -17,7 +17,7 @@ A finclip miniprogram flutter sdk.
s.dependency 'Flutter'
s.ios.deployment_target = '9.0'
s.dependency 'FinApplet' , '2.39.3'
s.dependency 'FinAppletExt' , '2.39.3'
s.dependency 'FinApplet' , '2.39.4-alpha20230111v01'
s.dependency 'FinAppletExt' , '2.39.4-alpha20230111v01'
end

View File

@ -6,7 +6,8 @@ class CustomMenu {
CustomMenu(this.menuId, this.image, this.title, this.type);
Map<String, dynamic> toJson() => {'menuId': menuId, 'image': image, 'title': title, 'type': type};
Map<String, dynamic> toJson() =>
{'menuId': menuId, 'image': image, 'title': title, 'type': type};
}
abstract class AppletHandler {
@ -32,7 +33,7 @@ abstract class AppletHandler {
///
Future<void> onCustomMenuClick(
String appId, String path, String menuId, String appInfo);
String appId, String path, String menuId, String appInfo, String query);
///
Future<void> appletDidOpen(String appId);

View File

@ -7,7 +7,8 @@ import 'package:mop/api.dart';
typedef MopEventCallback = void Function(dynamic event);
typedef MopEventErrorCallback = void Function(dynamic event);
typedef ExtensionApiHandler = Future<Map<String, dynamic>> Function(dynamic params);
typedef ExtensionApiHandler = Future<Map<String, dynamic>> Function(
dynamic params);
typedef MopAppletHandler = Future Function(dynamic params);
class FinStoreConfig {
@ -235,7 +236,7 @@ class BaseAppletRequest {
this.startParams,
this.animated = true,
this.isSingleProcess = false,
});
});
Map<String, dynamic> toMap() {
return {
@ -275,7 +276,7 @@ class RemoteAppletRequest {
this.offlineFrameworkZipPath,
this.animated = true,
this.isSingleProcess = false,
});
});
@override
Map<String, dynamic> toMap() {
@ -286,8 +287,10 @@ class RemoteAppletRequest {
"isSingleProcess": isSingleProcess,
};
if (startParams != null) result["startParams"] = startParams;
if (offlineMiniprogramZipPath != null) result["offlineMiniprogramZipPath"] = offlineMiniprogramZipPath;
if (offlineFrameworkZipPath != null) result["offlineFrameworkZipPath"] = offlineFrameworkZipPath;
if (offlineMiniprogramZipPath != null)
result["offlineMiniprogramZipPath"] = offlineMiniprogramZipPath;
if (offlineFrameworkZipPath != null)
result["offlineFrameworkZipPath"] = offlineFrameworkZipPath;
if (sequence != null) result["sequence"] = sequence;
return result;
@ -376,7 +379,7 @@ class Mop {
}
final apiHandler = _appletHandlerApis[name];
if (apiHandler != null) {
if (apiHandler != null) {
return await apiHandler(call.arguments);
}
} else if (call.method.startsWith("webExtentionApi:")) {
@ -481,7 +484,6 @@ class Mop {
return ret;
}
Future<Map> startApplet(RemoteAppletRequest request) async {
Map<String, dynamic> params = request.toMap();
final Map ret = await _channel.invokeMethod('startApplet', params);
@ -602,7 +604,12 @@ class Mop {
};
_appletHandlerApis["onCustomMenuClick"] = (params) async {
return handler.onCustomMenuClick(
params["appId"], params["path"], params["menuId"], params["appInfo"]);
params["appId"],
params["path"],
params["menuId"],
params["appInfo"],
params["query"],
);
};
_appletHandlerApis["appletDidOpen"] = (params) async {
return handler.appletDidOpen(params["appId"]);
@ -660,8 +667,7 @@ class Mop {
///
///
Future setActivityTransitionAnim(Anim anim) async {
await _channel
.invokeMethod("setActivityTransitionAnim", {"anim": ""});
await _channel.invokeMethod("setActivityTransitionAnim", {"anim": ""});
return;
}