phiz_2.42.1.2
Sean 2023-11-20 13:56:58 +08:00
parent 8574fc53c0
commit 1b566ef884
1 changed files with 23 additions and 3 deletions

View File

@ -47,25 +47,39 @@
- (NSDictionary *)getUserInfoWithAppletInfo:(FATAppletInfo *)appletInfo { - (NSDictionary *)getUserInfoWithAppletInfo:(FATAppletInfo *)appletInfo {
NSLog(@"getUserInfoWithAppletInfo"); NSLog(@"getUserInfoWithAppletInfo");
__block NSDictionary *userInfo; __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) { [channel invokeMethod:@"extensionApi:getUserInfo" arguments:nil result:^(id _Nullable result) {
CFRunLoopStop(CFRunLoopGetMain()); // CFRunLoopStop(CFRunLoopGetMain());
CFRunLoopStop(runLoop);
userInfo = result; userInfo = result;
}]; }];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
CFRunLoopStop(runLoop);
});
CFRunLoopRun(); CFRunLoopRun();
return userInfo; return userInfo;
} }
- (BOOL)appletInfo:(FATAppletInfo *)appletInfo didClickMoreBtnAtPath:(NSString *)path { - (BOOL)appletInfo:(FATAppletInfo *)appletInfo didClickMoreBtnAtPath:(NSString *)path {
__block BOOL flag; __block BOOL flag;
CFRunLoopRef runLoop = CFRunLoopGetCurrent();
FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel]; FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel];
NSLog(@"appletInfo:didClickMoreBtnAtPath,appId=%@,path=%@,channel=%@",appletInfo.appId,path,channel); 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(CFRunLoopGetMain()); // CFRunLoopStop(CFRunLoopGetMain());
CFRunLoopStop(runLoop);
if ([result isKindOfClass:[NSNumber class]]) { if ([result isKindOfClass:[NSNumber class]]) {
flag = [result boolValue]; flag = [result boolValue];
} }
}]; }];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
CFRunLoopStop(runLoop);
});
CFRunLoopRun(); CFRunLoopRun();
return flag; return flag;
@ -74,14 +88,20 @@
- (NSArray<id<FATAppletMenuProtocol>> *)customMenusInApplet:(FATAppletInfo *)appletInfo atPath:(NSString *)path { - (NSArray<id<FATAppletMenuProtocol>> *)customMenusInApplet:(FATAppletInfo *)appletInfo atPath:(NSString *)path {
NSLog(@"customMenusInApplet:%@,appletInfo=%@",path,appletInfo); 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(CFRunLoopGetMain());
CFRunLoopStop(runLoop);
if ([result isKindOfClass:[NSArray class]]) { if ([result isKindOfClass:[NSArray class]]) {
list = result; list = result;
NSLog(@"customMenusInApplet2222:list=%@",list); NSLog(@"customMenusInApplet2222:list=%@",list);
} }
}]; }];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
CFRunLoopStop(runLoop);
});
CFRunLoopRun(); CFRunLoopRun();
NSLog(@"customMenusInApplet:%@,list=%@",path,list); NSLog(@"customMenusInApplet:%@,list=%@",path,list);