Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maybe fixes this share flow #27992

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions shared/ios/KeybaseShare/ShareViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,32 @@ - (void)didReceiveMemoryWarning {
}

- (void) openApp {
NSURL * url = [NSURL URLWithString:@"keybase://incoming-share"];
NSURL *url = [NSURL URLWithString:@"keybase://incoming-share"];
UIResponder *responder = self;
while (responder){
if ([responder respondsToSelector: @selector(openURL:)]){
[responder performSelector: @selector(openURL:) withObject: url];
return;
}
responder = [responder nextResponder];
while (responder) {
if ([responder respondsToSelector: @selector(openURL:)]){
@try {
// This is needed by ios18+ to function now on the new xcode. This FAILs in the simulator but seems
// to work on device
NSMethodSignature *signature = [responder methodSignatureForSelector:@selector(openURL:options:completionHandler:)];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:responder];
[invocation setSelector:@selector(openURL:options:completionHandler:)];

NSDictionary *options = @{};
void (^completionHandler)(BOOL success) = nil;

[invocation setArgument:&url atIndex:2];
[invocation setArgument:&options atIndex:3];
[invocation setArgument:&completionHandler atIndex:4];
[invocation invoke];
return;
}
@catch (NSException *exception) {
NSLog(@"Exception occurred while opening URL to share");
}
}
responder = [responder nextResponder];
}
}

Expand Down