From 1b566ef884b5b1282a0e946c519845bc7e8e9363 Mon Sep 17 00:00:00 2001 From: Sean Date: Mon, 20 Nov 2023 13:56:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E7=A8=8Bxj?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Classes/Api/MOPAppletDelegate.m | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/ios/Classes/Api/MOPAppletDelegate.m b/ios/Classes/Api/MOPAppletDelegate.m index 5d5a66c..da7c6cd 100644 --- a/ios/Classes/Api/MOPAppletDelegate.m +++ b/ios/Classes/Api/MOPAppletDelegate.m @@ -47,25 +47,39 @@ - (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(CFRunLoopGetMain()); +// CFRunLoopStop(CFRunLoopGetMain()); + 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(CFRunLoopGetMain()); +// CFRunLoopStop(CFRunLoopGetMain()); + CFRunLoopStop(runLoop); + if ([result isKindOfClass:[NSNumber class]]) { flag = [result boolValue]; } }]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + CFRunLoopStop(runLoop); + }); + CFRunLoopRun(); return flag; @@ -74,14 +88,20 @@ - (NSArray> *)customMenusInApplet:(FATAppletInfo *)appletInfo atPath:(NSString *)path { 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(CFRunLoopGetMain()); + CFRunLoopStop(runLoop); if ([result isKindOfClass:[NSArray class]]) { list = result; NSLog(@"customMenusInApplet2222:list=%@",list); } }]; + 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);