Skip to content

Commit 4661bff

Browse files
committed
Fixed Catalina issues
1 parent 5bccfe1 commit 4661bff

File tree

4 files changed

+69
-63
lines changed

4 files changed

+69
-63
lines changed

MusaicFM.xcodeproj/project.pbxproj

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
E1FA39741DDA3FBE00186BE2 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E1FA39721DDA3FBE00186BE2 /* MainMenu.xib */; };
6262
E1FA39791DDA3FF300186BE2 /* PreferencesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E129C5321DD900A300F93950 /* PreferencesViewController.xib */; };
6363
E1FA397A1DDA3FF300186BE2 /* PreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E129C5351DD9020300F93950 /* PreferencesViewController.m */; };
64+
E1FF4D9C2350B9BA00B89371 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E13191BA1DE1C4CA005EFA47 /* WebKit.framework */; };
6465
/* End PBXBuildFile section */
6566

6667
/* Begin PBXFileReference section */
@@ -119,6 +120,7 @@
119120
files = (
120121
E1472E541DD8D1C70007E945 /* Foundation.framework in Frameworks */,
121122
E1472E521DD8D1C10007E945 /* Cocoa.framework in Frameworks */,
123+
E1FF4D9C2350B9BA00B89371 /* WebKit.framework in Frameworks */,
122124
08413D7CBB6FF19716237235 /* libPods-MusaicFM.a in Frameworks */,
123125
);
124126
runOnlyForDeploymentPostprocessing = 0;
@@ -320,6 +322,7 @@
320322
TargetAttributes = {
321323
E1CF25981DD7D8D500441255 = {
322324
CreatedOnToolsVersion = 8.1;
325+
DevelopmentTeam = YE33ZK7Z99;
323326
ProvisioningStyle = Automatic;
324327
};
325328
E1FA39671DDA3FBE00186BE2 = {
@@ -496,7 +499,7 @@
496499
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
497500
GCC_WARN_UNUSED_FUNCTION = YES;
498501
GCC_WARN_UNUSED_VARIABLE = YES;
499-
MACOSX_DEPLOYMENT_TARGET = 10.11;
502+
MACOSX_DEPLOYMENT_TARGET = 10.12;
500503
MTL_ENABLE_DEBUG_INFO = YES;
501504
ONLY_ACTIVE_ARCH = YES;
502505
SDKROOT = macosx;
@@ -538,7 +541,7 @@
538541
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
539542
GCC_WARN_UNUSED_FUNCTION = YES;
540543
GCC_WARN_UNUSED_VARIABLE = YES;
541-
MACOSX_DEPLOYMENT_TARGET = 10.11;
544+
MACOSX_DEPLOYMENT_TARGET = 10.12;
542545
MTL_ENABLE_DEBUG_INFO = NO;
543546
SDKROOT = macosx;
544547
};
@@ -550,12 +553,12 @@
550553
buildSettings = {
551554
CODE_SIGN_IDENTITY = "Mac Developer";
552555
COMBINE_HIDPI_IMAGES = YES;
553-
CURRENT_PROJECT_VERSION = 8;
554-
DEVELOPMENT_TEAM = "";
556+
CURRENT_PROJECT_VERSION = 9;
557+
DEVELOPMENT_TEAM = YE33ZK7Z99;
555558
INFOPLIST_FILE = MusaicFM/Info.plist;
556559
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
557-
MACOSX_DEPLOYMENT_TARGET = 10.11;
558-
MARKETING_VERSION = 1.1.4;
560+
MACOSX_DEPLOYMENT_TARGET = 10.12;
561+
MARKETING_VERSION = 1.1.5;
559562
PRODUCT_BUNDLE_IDENTIFIER = com.obrhoff.MusaicFM;
560563
PRODUCT_NAME = "$(TARGET_NAME)";
561564
WRAPPER_EXTENSION = saver;
@@ -568,12 +571,12 @@
568571
buildSettings = {
569572
CODE_SIGN_IDENTITY = "Mac Developer";
570573
COMBINE_HIDPI_IMAGES = YES;
571-
CURRENT_PROJECT_VERSION = 8;
572-
DEVELOPMENT_TEAM = "";
574+
CURRENT_PROJECT_VERSION = 9;
575+
DEVELOPMENT_TEAM = YE33ZK7Z99;
573576
INFOPLIST_FILE = MusaicFM/Info.plist;
574577
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
575-
MACOSX_DEPLOYMENT_TARGET = 10.11;
576-
MARKETING_VERSION = 1.1.4;
578+
MACOSX_DEPLOYMENT_TARGET = 10.12;
579+
MARKETING_VERSION = 1.1.5;
577580
PRODUCT_BUNDLE_IDENTIFIER = com.obrhoff.MusaicFM;
578581
PRODUCT_NAME = "$(TARGET_NAME)";
579582
WRAPPER_EXTENSION = saver;
@@ -591,7 +594,7 @@
591594
DEVELOPMENT_TEAM = "";
592595
INFOPLIST_FILE = MusaicFMPreferences/Info.plist;
593596
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
594-
MACOSX_DEPLOYMENT_TARGET = 10.11;
597+
MACOSX_DEPLOYMENT_TARGET = 10.12;
595598
MARKETING_VERSION = 1.1.4;
596599
PRODUCT_BUNDLE_IDENTIFIER = com.obrhoff.MusaicFMPreferences;
597600
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -609,7 +612,7 @@
609612
DEVELOPMENT_TEAM = "";
610613
INFOPLIST_FILE = MusaicFMPreferences/Info.plist;
611614
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
612-
MACOSX_DEPLOYMENT_TARGET = 10.11;
615+
MACOSX_DEPLOYMENT_TARGET = 10.12;
613616
MARKETING_VERSION = 1.1.4;
614617
PRODUCT_BUNDLE_IDENTIFIER = com.obrhoff.MusaicFMPreferences;
615618
PRODUCT_NAME = "$(TARGET_NAME)";

MusaicFM/PreferencesViewController.m

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#import "Constants.h"
1818
#import "Factory.h"
1919

20-
@interface PreferencesViewController () <WebFrameLoadDelegate, WebPolicyDelegate>
20+
@interface PreferencesViewController () <WKNavigationDelegate>
2121

2222
@property (nonatomic, readwrite, weak) IBOutlet NSButton *doneButton;
2323
@property (nonatomic, readwrite, weak) IBOutlet NSPopUpButton *rowButton;
@@ -36,7 +36,7 @@ @interface PreferencesViewController () <WebFrameLoadDelegate, WebPolicyDelegate
3636

3737
@property (nonatomic, readwrite, weak) IBOutlet NSPopUpButton *lastFmWeeklyButton;
3838

39-
@property (nonatomic, readwrite, weak) IBOutlet WebView *webView;
39+
@property (nonatomic, readwrite, weak) IBOutlet WKWebView *webView;
4040
@property (nonatomic, readwrite, weak) IBOutlet NSView *settingsView;
4141
@property (nonatomic, readwrite, weak) IBOutlet NSView *containerView;
4242

@@ -122,7 +122,8 @@ - (IBAction)loginSpotify:(NSButton *)sender {
122122
else {
123123
self.webView.hidden = NO;
124124
self.settingsView.hidden = YES;
125-
[self.webView.mainFrame loadRequest:[NSURLRequest requestWithURL:[Factory spotifyAuthentification].URL]];
125+
NSURLRequest *request = [NSURLRequest requestWithURL:[Factory spotifyAuthentification].URL];
126+
[self.webView loadRequest:request];
126127
}
127128
}
128129

@@ -152,30 +153,32 @@ - (NSString *)windowNibName {
152153
return @"PreferencesViewController";
153154
}
154155

155-
- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request
156-
frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener {
157-
NSURLComponents *components = [NSURLComponents componentsWithURL:request.URL resolvingAgainstBaseURL:NO];
158-
NSURLComponents *callbackComponents = [NSURLComponents componentsWithString:spotifyRedirectUrl];
156+
-(void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
159157

160-
if (![components.scheme isEqualToString:callbackComponents.scheme]) {
161-
[listener use];
162-
return;
163-
}
158+
NSURLComponents *components = [NSURLComponents componentsWithURL:webView.URL resolvingAgainstBaseURL:NO];
159+
NSURLComponents *callbackComponents = [NSURLComponents componentsWithString:spotifyRedirectUrl];
160+
161+
if (![components.scheme isEqualToString:callbackComponents.scheme]) {
162+
decisionHandler(WKNavigationActionPolicyAllow);
163+
return;
164+
}
165+
166+
NSPredicate *filter = [NSPredicate predicateWithFormat:@"name == %@", @"code"];
167+
NSString *code = [[components.queryItems filteredArrayUsingPredicate:filter].firstObject value];
168+
typeof(self) weakSelf = self;
169+
170+
dispatch_block_t dismiss = ^{
171+
[weakSelf configure];
172+
decisionHandler(WKNavigationActionPolicyCancel);
173+
};
174+
if (!code.length) {
175+
dismiss();
176+
return;
177+
}
178+
[self.manager performSpotifyToken:code completionHandler:dismiss andFailure:^(NSError *error) {
179+
dismiss();
180+
}];
164181

165-
NSPredicate *filter = [NSPredicate predicateWithFormat:@"name == %@", @"code"];
166-
NSString *code = [[components.queryItems filteredArrayUsingPredicate:filter].firstObject value];
167-
typeof(self) weakSelf = self;
168-
dispatch_block_t dismiss = ^{
169-
[weakSelf configure];
170-
};
171-
if (!code.length) {
172-
dismiss();
173-
return;
174-
}
175-
[self.manager performSpotifyToken:code completionHandler:dismiss andFailure:^(NSError *error) {
176-
dismiss();
177-
}];
178182
}
179183

180-
181184
@end

0 commit comments

Comments
 (0)