Compare commits
2 Commits
8274fe3aaf
...
5f907e9b4f
Author | SHA1 | Date |
---|---|---|
Stewen | 5f907e9b4f | |
Sean | 1b566ef884 |
|
@ -37,43 +37,69 @@
|
|||
if([result isKindOfClass:[FlutterError class]]|| [result isKindOfClass:[FlutterMethodNotImplemented class] ])
|
||||
{
|
||||
completion(FATExtensionCodeFailure,nil);
|
||||
} else {
|
||||
}else
|
||||
{
|
||||
completion(FATExtensionCodeSuccess,result);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (BOOL)appletInfo:(FATAppletInfo *)appletInfo didClickMoreBtnAtPath:(NSString *)path {
|
||||
NSLog(@"appletInfo:didClickMoreBtnAtPath");
|
||||
__block BOOL flag = NO;
|
||||
- (NSDictionary *)getUserInfoWithAppletInfo:(FATAppletInfo *)appletInfo {
|
||||
NSLog(@"getUserInfoWithAppletInfo");
|
||||
__block NSDictionary *userInfo;
|
||||
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
|
||||
|
||||
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) {
|
||||
CFRunLoopStop(runLoop);
|
||||
|
||||
if ([result isKindOfClass:[NSNumber class]]) {
|
||||
flag = [result boolValue];
|
||||
}
|
||||
CFRunLoopStop(CFRunLoopGetMain());
|
||||
}];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
CFRunLoopStop(CFRunLoopGetMain());
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
CFRunLoopStop(runLoop);
|
||||
});
|
||||
|
||||
CFRunLoopRun();
|
||||
return flag;
|
||||
}
|
||||
|
||||
- (NSArray<id<FATAppletMenuProtocol>> *)customMenusInApplet:(FATAppletInfo *)appletInfo atPath:(NSString *)path {
|
||||
NSLog(@"customMenusInApplet");
|
||||
__block NSArray *list = @[];
|
||||
NSLog(@"customMenusInApplet:%@,appletInfo=%@",path,appletInfo);
|
||||
__block NSArray *list;
|
||||
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
|
||||
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||
[channel invokeMethod:@"extensionApi:getCustomMenus" arguments:@{@"appId": appletInfo.appId} result:^(id _Nullable result) {
|
||||
CFRunLoopStop(CFRunLoopGetMain());
|
||||
CFRunLoopStop(runLoop);
|
||||
if ([result isKindOfClass:[NSArray class]]) {
|
||||
list = result;
|
||||
NSLog(@"customMenusInApplet2222:list=%@",list);
|
||||
}
|
||||
}];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
CFRunLoopStop(CFRunLoopGetMain());
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
CFRunLoopStop(runLoop);
|
||||
});
|
||||
|
||||
CFRunLoopRun();
|
||||
NSLog(@"customMenusInApplet:%@,list=%@",path,list);
|
||||
|
||||
NSMutableArray *models = [NSMutableArray array];
|
||||
for (NSDictionary<NSString *, NSString *> *data in list) {
|
||||
|
@ -104,7 +130,9 @@
|
|||
return models;
|
||||
}
|
||||
|
||||
|
||||
- (void)clickCustomItemMenuWithInfo:(NSDictionary *)contentInfo inApplet:(FATAppletInfo *)appletInfo completion:(void (^)(FATExtensionCode code, NSDictionary *result))completion {
|
||||
NSLog(@"HJH1,clickCustomItemMenuWithInfo");
|
||||
NSError *parseError = nil;
|
||||
NSMutableDictionary *shareDic = [[NSMutableDictionary alloc] initWithDictionary:[self dictionaryRepresentation:appletInfo]];
|
||||
[shareDic setValue:@{@"desc" : shareDic[@"originalInfo"][@"customData"][@"detailDescription"]} forKey:@"params"];
|
||||
|
@ -112,10 +140,10 @@
|
|||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:shareDic options:NSJSONWritingPrettyPrinted error:&parseError];
|
||||
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||
NSDictionary *arguments = @{
|
||||
@"appId": contentInfo[@"appId"],
|
||||
@"path": contentInfo[@"path"],
|
||||
@"menuId": contentInfo[@"menuId"],
|
||||
@"appInfo": jsonString
|
||||
@"appId": contentInfo[@"appId"],
|
||||
@"path": contentInfo[@"path"],
|
||||
@"menuId": contentInfo[@"menuId"],
|
||||
@"appInfo": jsonString
|
||||
};
|
||||
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
|
||||
[channel invokeMethod:@"extensionApi:onCustomMenuClick" arguments:arguments result:^(id _Nullable result) {
|
||||
|
@ -125,6 +153,7 @@
|
|||
if ([@"Desktop" isEqualToString:contentInfo[@"menuId"]]) {
|
||||
[self addToDesktopItemClick:appletInfo path:contentInfo[@"path"]];
|
||||
}
|
||||
NSLog(@"HJH2,clickCustomItemMenuWithInfo");
|
||||
}
|
||||
|
||||
- (NSDictionary *)dictionaryRepresentation:(FATAppletInfo *)object {
|
||||
|
|
Loading…
Reference in New Issue