From f56b685aa6983d707dcfc21de263c9b9037430c5 Mon Sep 17 00:00:00 2001 From: sroik Date: Tue, 18 Oct 2022 15:16:31 +0300 Subject: [PATCH 1/4] Fix ssid-change-timer double start Hi. Right now ssid timer starts two times. So I think we need to invalidate it before scheduling. --- Discovery/DiscoveryManager.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Discovery/DiscoveryManager.m b/Discovery/DiscoveryManager.m index 672ce82..cd3b567 100644 --- a/Discovery/DiscoveryManager.m +++ b/Discovery/DiscoveryManager.m @@ -244,6 +244,7 @@ - (void) unregisterDeviceService:(Class)deviceClass withDiscovery:(Class)discove - (void) startSSIDTimer { + [_ssidTimer invalidate]; _ssidTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(detectSSIDChange) userInfo:nil repeats:YES]; [_ssidTimer fire]; } From eb895212f3315882739cde1198540ff35f43e063 Mon Sep 17 00:00:00 2001 From: sroik Date: Tue, 18 Oct 2022 15:22:03 +0300 Subject: [PATCH 2/4] Fixed webView URL retrieval --- Services/Helpers/AirPlayServiceMirrored.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Services/Helpers/AirPlayServiceMirrored.m b/Services/Helpers/AirPlayServiceMirrored.m index 743da29..c40868c 100644 --- a/Services/Helpers/AirPlayServiceMirrored.m +++ b/Services/Helpers/AirPlayServiceMirrored.m @@ -515,7 +515,7 @@ - (BOOL)webView:(WKWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *) - (void)webViewDidFinishLoad:(WKWebView *)webView { - DLog(@"%@", webView.request.URL.absoluteString); + DLog(@"%@", webView.URL.absoluteString); if (self.launchSuccessBlock) self.launchSuccessBlock(nil); @@ -526,7 +526,7 @@ - (void)webViewDidFinishLoad:(WKWebView *)webView - (void)webViewDidStartLoad:(WKWebView *)webView { - DLog(@"%@", webView.request.URL.absoluteString); + DLog(@"%@", webView.URL.absoluteString); } @end From 78245bb3570a004fad888d38e270c931e4e94089 Mon Sep 17 00:00:00 2001 From: sroik Date: Fri, 4 Nov 2022 15:32:39 +0300 Subject: [PATCH 3/4] check for location access before detecting ssid change --- Discovery/DiscoveryManager.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Discovery/DiscoveryManager.m b/Discovery/DiscoveryManager.m index cd3b567..4c13b2d 100644 --- a/Discovery/DiscoveryManager.m +++ b/Discovery/DiscoveryManager.m @@ -38,6 +38,7 @@ #import "AppStateChangeNotifier.h" #import +#import @interface DiscoveryManager() @@ -266,6 +267,11 @@ - (void) detectSSIDChange if ([interface caseInsensitiveCompare:@"en0"] != NSOrderedSame) return; + if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined || + [CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) { + return; + } + CFDictionaryRef cfDict = CNCopyCurrentNetworkInfo((CFStringRef)interface); NSDictionary *info = (NSDictionary *)CFBridgingRelease(cfDict); From e4e2a5f987ef1eb18bcbfbc4a585519f2d5fdf0e Mon Sep 17 00:00:00 2001 From: sroik Date: Sat, 5 Nov 2022 17:21:25 +0300 Subject: [PATCH 4/4] dial service tries to opem youtube without pairing first --- Services/DIALService.m | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/Services/DIALService.m b/Services/DIALService.m index dd3b418..ed89b16 100644 --- a/Services/DIALService.m +++ b/Services/DIALService.m @@ -408,6 +408,9 @@ - (void)launchYouTube:(NSString *)contentId success:(AppLaunchSuccessBlock)succe - (void) launchYouTube:(NSString *)contentId startTime:(float)startTime success:(AppLaunchSuccessBlock)success failure:(FailureBlock)failure { + AppInfo *appInfo = [AppInfo appInfoForId:@"YouTube"]; + appInfo.name = appInfo.id; + NSString *params; if (contentId && contentId.length > 0) { @@ -419,23 +422,30 @@ - (void) launchYouTube:(NSString *)contentId startTime:(float)startTime success: return; } - // YouTube on some platforms requires a pairing code, which may be a random string - NSString *pairingCode = [[CTGuid randomGuid] stringValue]; - - params = [NSString stringWithFormat:@"pairingCode=%@&v=%@&t=%.1f", pairingCode, contentId, startTime]; + params = [NSString stringWithFormat:@"v=%@&t=%.1f", contentId, startTime]; } - AppInfo *appInfo = [AppInfo appInfoForId:@"YouTube"]; - appInfo.name = appInfo.id; - - [self.launcher launchAppWithInfo:appInfo params:(id)params success:^(LaunchSession *launchSession) - { + [self.launcher launchAppWithInfo:appInfo params:(id)params success:^(LaunchSession *launchSession) { if (success) success(launchSession); - } failure:^(NSError *error) - { - if (failure) + } failure:^(NSError *error) { + + if (params) { + // YouTube on some platforms requires a pairing code, which may be a random string. + // Let's retry once more + NSString *pairingCode = [[CTGuid randomGuid] stringValue]; + NSString *paramsWithCode = [NSString stringWithFormat:@"pairingCode=%@&%@", pairingCode, params]; + [self.launcher launchAppWithInfo:appInfo params:(id)paramsWithCode success:^(LaunchSession *launchSession) { + if (success) + success(launchSession); + } failure:^(NSError *error) { + if (failure) + failure(error); + }]; + + } else if (failure) { failure(error); + } }]; }