Merge branch 'phiz_2.42.7.12' of https://git-dev.xyue.zip:8443/phiz/mop-flutter-sdk into phiz_2.42.7.11
# Conflicts: # ios/Classes/Api/MOPAppletDelegate.mphiz_2.42.7.11
commit
5f907e9b4f
|
@ -37,44 +37,70 @@
|
||||||
if([result isKindOfClass:[FlutterError class]]|| [result isKindOfClass:[FlutterMethodNotImplemented class] ])
|
if([result isKindOfClass:[FlutterError class]]|| [result isKindOfClass:[FlutterMethodNotImplemented class] ])
|
||||||
{
|
{
|
||||||
completion(FATExtensionCodeFailure,nil);
|
completion(FATExtensionCodeFailure,nil);
|
||||||
} else {
|
}else
|
||||||
|
{
|
||||||
completion(FATExtensionCodeSuccess,result);
|
completion(FATExtensionCodeSuccess,result);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)appletInfo:(FATAppletInfo *)appletInfo didClickMoreBtnAtPath:(NSString *)path {
|
- (NSDictionary *)getUserInfoWithAppletInfo:(FATAppletInfo *)appletInfo {
|
||||||
NSLog(@"appletInfo:didClickMoreBtnAtPath");
|
NSLog(@"getUserInfoWithAppletInfo");
|
||||||
__block BOOL flag = NO;
|
__block NSDictionary *userInfo;
|
||||||
|
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
|
||||||
|
|
||||||
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||||
|
[channel invokeMethod:@"extensionApi:getUserInfo" arguments:nil result:^(id _Nullable result) {
|
||||||
|
CFRunLoopStop(runLoop);
|
||||||
|
userInfo = result;
|
||||||
|
}];
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
CFRunLoopStop(runLoop);
|
||||||
|
});
|
||||||
|
CFRunLoopRun();
|
||||||
|
return userInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)appletInfo:(FATAppletInfo *)appletInfo didClickMoreBtnAtPath:(NSString *)path {
|
||||||
|
__block BOOL flag;
|
||||||
|
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
|
||||||
|
|
||||||
|
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||||
|
NSLog(@"appletInfo:didClickMoreBtnAtPath,appId=%@,path=%@,channel=%@",appletInfo.appId,path,channel);
|
||||||
[channel invokeMethod:@"extensionApi:customCapsuleMoreButtonClick" arguments:@{@"appId": appletInfo.appId} result:^(id _Nullable result) {
|
[channel invokeMethod:@"extensionApi:customCapsuleMoreButtonClick" arguments:@{@"appId": appletInfo.appId} result:^(id _Nullable result) {
|
||||||
|
CFRunLoopStop(runLoop);
|
||||||
|
|
||||||
if ([result isKindOfClass:[NSNumber class]]) {
|
if ([result isKindOfClass:[NSNumber class]]) {
|
||||||
flag = [result boolValue];
|
flag = [result boolValue];
|
||||||
}
|
}
|
||||||
CFRunLoopStop(CFRunLoopGetMain());
|
|
||||||
}];
|
}];
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
CFRunLoopStop(CFRunLoopGetMain());
|
CFRunLoopStop(runLoop);
|
||||||
});
|
});
|
||||||
|
|
||||||
CFRunLoopRun();
|
CFRunLoopRun();
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray<id<FATAppletMenuProtocol>> *)customMenusInApplet:(FATAppletInfo *)appletInfo atPath:(NSString *)path {
|
- (NSArray<id<FATAppletMenuProtocol>> *)customMenusInApplet:(FATAppletInfo *)appletInfo atPath:(NSString *)path {
|
||||||
NSLog(@"customMenusInApplet");
|
NSLog(@"customMenusInApplet:%@,appletInfo=%@",path,appletInfo);
|
||||||
__block NSArray *list = @[];
|
__block NSArray *list;
|
||||||
|
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
|
||||||
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||||
[channel invokeMethod:@"extensionApi:getCustomMenus" arguments:@{@"appId": appletInfo.appId} result:^(id _Nullable result) {
|
[channel invokeMethod:@"extensionApi:getCustomMenus" arguments:@{@"appId": appletInfo.appId} result:^(id _Nullable result) {
|
||||||
CFRunLoopStop(CFRunLoopGetMain());
|
CFRunLoopStop(runLoop);
|
||||||
if ([result isKindOfClass:[NSArray class]]) {
|
if ([result isKindOfClass:[NSArray class]]) {
|
||||||
list = result;
|
list = result;
|
||||||
|
NSLog(@"customMenusInApplet2222:list=%@",list);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
CFRunLoopStop(CFRunLoopGetMain());
|
CFRunLoopStop(runLoop);
|
||||||
});
|
});
|
||||||
|
|
||||||
CFRunLoopRun();
|
CFRunLoopRun();
|
||||||
|
NSLog(@"customMenusInApplet:%@,list=%@",path,list);
|
||||||
|
|
||||||
NSMutableArray *models = [NSMutableArray array];
|
NSMutableArray *models = [NSMutableArray array];
|
||||||
for (NSDictionary<NSString *, NSString *> *data in list) {
|
for (NSDictionary<NSString *, NSString *> *data in list) {
|
||||||
MopCustomMenuModel *model = [[MopCustomMenuModel alloc] init];
|
MopCustomMenuModel *model = [[MopCustomMenuModel alloc] init];
|
||||||
|
@ -100,11 +126,13 @@
|
||||||
}
|
}
|
||||||
[models addObject:model];
|
[models addObject:model];
|
||||||
}
|
}
|
||||||
|
|
||||||
return models;
|
return models;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)clickCustomItemMenuWithInfo:(NSDictionary *)contentInfo inApplet:(FATAppletInfo *)appletInfo completion:(void (^)(FATExtensionCode code, NSDictionary *result))completion {
|
- (void)clickCustomItemMenuWithInfo:(NSDictionary *)contentInfo inApplet:(FATAppletInfo *)appletInfo completion:(void (^)(FATExtensionCode code, NSDictionary *result))completion {
|
||||||
|
NSLog(@"HJH1,clickCustomItemMenuWithInfo");
|
||||||
NSError *parseError = nil;
|
NSError *parseError = nil;
|
||||||
NSMutableDictionary *shareDic = [[NSMutableDictionary alloc] initWithDictionary:[self dictionaryRepresentation:appletInfo]];
|
NSMutableDictionary *shareDic = [[NSMutableDictionary alloc] initWithDictionary:[self dictionaryRepresentation:appletInfo]];
|
||||||
[shareDic setValue:@{@"desc" : shareDic[@"originalInfo"][@"customData"][@"detailDescription"]} forKey:@"params"];
|
[shareDic setValue:@{@"desc" : shareDic[@"originalInfo"][@"customData"][@"detailDescription"]} forKey:@"params"];
|
||||||
|
@ -112,19 +140,20 @@
|
||||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:shareDic options:NSJSONWritingPrettyPrinted error:&parseError];
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:shareDic options:NSJSONWritingPrettyPrinted error:&parseError];
|
||||||
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||||
NSDictionary *arguments = @{
|
NSDictionary *arguments = @{
|
||||||
@"appId": contentInfo[@"appId"],
|
@"appId": contentInfo[@"appId"],
|
||||||
@"path": contentInfo[@"path"],
|
@"path": contentInfo[@"path"],
|
||||||
@"menuId": contentInfo[@"menuId"],
|
@"menuId": contentInfo[@"menuId"],
|
||||||
@"appInfo": jsonString
|
@"appInfo": jsonString
|
||||||
};
|
};
|
||||||
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||||
[channel invokeMethod:@"extensionApi:onCustomMenuClick" arguments:arguments result:^(id _Nullable result) {
|
[channel invokeMethod:@"extensionApi:onCustomMenuClick" arguments:arguments result:^(id _Nullable result) {
|
||||||
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if ([@"Desktop" isEqualToString:contentInfo[@"menuId"]]) {
|
if ([@"Desktop" isEqualToString:contentInfo[@"menuId"]]) {
|
||||||
[self addToDesktopItemClick:appletInfo path:contentInfo[@"path"]];
|
[self addToDesktopItemClick:appletInfo path:contentInfo[@"path"]];
|
||||||
}
|
}
|
||||||
|
NSLog(@"HJH2,clickCustomItemMenuWithInfo");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *)dictionaryRepresentation:(FATAppletInfo *)object {
|
- (NSDictionary *)dictionaryRepresentation:(FATAppletInfo *)object {
|
||||||
|
@ -149,7 +178,7 @@
|
||||||
NSDictionary *params = @{@"appId":appletId};
|
NSDictionary *params = @{@"appId":appletId};
|
||||||
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||||
[channel invokeMethod:@"extensionApi:appletDidOpen" arguments:params result:^(id _Nullable result) {
|
[channel invokeMethod:@"extensionApi:appletDidOpen" arguments:params result:^(id _Nullable result) {
|
||||||
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,9 +197,9 @@ static NSString *scheme = @"fatae55433be2f62915";//App对应的scheme
|
||||||
[url appendFormat:@"?iconpath=%@", appInfo.appAvatar];
|
[url appendFormat:@"?iconpath=%@", appInfo.appAvatar];
|
||||||
[url appendFormat:@"&apptitle=%@", appInfo.appTitle.fat_encodeString];
|
[url appendFormat:@"&apptitle=%@", appInfo.appTitle.fat_encodeString];
|
||||||
[url appendFormat:@"&linkhref=%@", herf];
|
[url appendFormat:@"&linkhref=%@", herf];
|
||||||
|
|
||||||
NSLog(@"跳转到中间页面:%@", url);
|
NSLog(@"跳转到中间页面:%@", url);
|
||||||
|
|
||||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
|
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +223,7 @@ static NSString *scheme = @"fatae55433be2f62915";//App对应的scheme
|
||||||
NSString *album = [MOPTools fat_currentLanguageIsEn] ? @"Album" : @"从相册选择";
|
NSString *album = [MOPTools fat_currentLanguageIsEn] ? @"Album" : @"从相册选择";
|
||||||
UIAlertAction *chooseAlbumAction = [UIAlertAction actionWithTitle:album style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
|
UIAlertAction *chooseAlbumAction = [UIAlertAction actionWithTitle:album style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
|
||||||
NSDictionary *params = @{@"name":@"chooseAvatarAlbum"};
|
NSDictionary *params = @{@"name":@"chooseAvatarAlbum"};
|
||||||
|
|
||||||
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||||
[channel invokeMethod:@"extensionApi:chooseAvatarAlbum" arguments:params result:^(id _Nullable result) {
|
[channel invokeMethod:@"extensionApi:chooseAvatarAlbum" arguments:params result:^(id _Nullable result) {
|
||||||
!bindChooseAvatar?: bindChooseAvatar(result);
|
!bindChooseAvatar?: bindChooseAvatar(result);
|
||||||
|
@ -203,7 +232,7 @@ static NSString *scheme = @"fatae55433be2f62915";//App对应的scheme
|
||||||
NSString *camera = [MOPTools fat_currentLanguageIsEn] ? @"Camera" : @"拍照";
|
NSString *camera = [MOPTools fat_currentLanguageIsEn] ? @"Camera" : @"拍照";
|
||||||
UIAlertAction *photoAction = [UIAlertAction actionWithTitle:camera style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
|
UIAlertAction *photoAction = [UIAlertAction actionWithTitle:camera style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) {
|
||||||
NSDictionary *params = @{@"name":@"chooseAvatarPhoto"};
|
NSDictionary *params = @{@"name":@"chooseAvatarPhoto"};
|
||||||
|
|
||||||
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||||
[channel invokeMethod:@"extensionApi:chooseAvatarPhoto" arguments:params result:^(id _Nullable result) {
|
[channel invokeMethod:@"extensionApi:chooseAvatarPhoto" arguments:params result:^(id _Nullable result) {
|
||||||
!bindChooseAvatar?: bindChooseAvatar(result);
|
!bindChooseAvatar?: bindChooseAvatar(result);
|
||||||
|
|
Loading…
Reference in New Issue