changed open mechanics to use 10.10 APIs to try to fix 10.13 launch bugs with chrome

This commit is contained in:
Michael Starke
2018-02-15 23:00:45 +01:00
parent ad6c501fef
commit e45f7b8739

View File

@@ -714,15 +714,17 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
webURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [expandedURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; webURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [expandedURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
} }
NSString *browserBundleID = [[NSUserDefaults standardUserDefaults] objectForKey:kMPSettingsKeyBrowserBundleId]; NSString *browserBundleID = [NSUserDefaults.standardUserDefaults stringForKey:kMPSettingsKeyBrowserBundleId];
NSURL *browserApplicationURL = browserBundleID ? [NSWorkspace.sharedWorkspace URLForApplicationWithBundleIdentifier:browserBundleID] : nil;
BOOL openedURL = NO; BOOL openedURL = NO;
if(browserBundleID) { if(browserApplicationURL) {
openedURL = [[NSWorkspace sharedWorkspace] openURLs:@[webURL] withAppBundleIdentifier:browserBundleID options:NSWorkspaceLaunchAsync additionalEventParamDescriptor:nil launchIdentifiers:NULL]; NSRunningApplication *urlOpeningApplication = [NSWorkspace.sharedWorkspace openURLs:@[webURL] withApplicationAtURL:browserApplicationURL options:NSWorkspaceLaunchDefault configuration:@{} error:nil];
openedURL = nil != urlOpeningApplication;
} }
if(!openedURL) { if(!openedURL) {
openedURL = [[NSWorkspace sharedWorkspace] openURL:webURL]; openedURL = [NSWorkspace.sharedWorkspace openURL:webURL];
} }
if(!openedURL) { if(!openedURL) {
NSLog(@"Unable to open URL %@", webURL); NSLog(@"Unable to open URL %@", webURL);