From 2330711a22c6a92e1964ff74303eaf1626d0ed38 Mon Sep 17 00:00:00 2001 From: Miguel Vanhove Date: Mon, 14 Dec 2015 20:02:33 +0100 Subject: [PATCH] Added osX support --- InterAppCommunication/IACClient.h | 0 InterAppCommunication/IACClient.m | 4 ++++ InterAppCommunication/IACDelegate.h | 0 InterAppCommunication/IACManager.h | 0 InterAppCommunication/IACManager.m | 22 ++++++++++++++++++- InterAppCommunication/IACRequest.h | 0 InterAppCommunication/IACRequest.m | 0 .../NSString+IACExtensions.h | 0 .../NSString+IACExtensions.m | 0 9 files changed, 25 insertions(+), 1 deletion(-) mode change 100644 => 100755 InterAppCommunication/IACClient.h mode change 100644 => 100755 InterAppCommunication/IACClient.m mode change 100644 => 100755 InterAppCommunication/IACDelegate.h mode change 100644 => 100755 InterAppCommunication/IACManager.h mode change 100644 => 100755 InterAppCommunication/IACManager.m mode change 100644 => 100755 InterAppCommunication/IACRequest.h mode change 100644 => 100755 InterAppCommunication/IACRequest.m mode change 100644 => 100755 InterAppCommunication/NSString+IACExtensions.h mode change 100644 => 100755 InterAppCommunication/NSString+IACExtensions.m diff --git a/InterAppCommunication/IACClient.h b/InterAppCommunication/IACClient.h old mode 100644 new mode 100755 diff --git a/InterAppCommunication/IACClient.m b/InterAppCommunication/IACClient.m old mode 100644 new mode 100755 index dcd038a..48d9185 --- a/InterAppCommunication/IACClient.m +++ b/InterAppCommunication/IACClient.m @@ -39,7 +39,11 @@ - (NSInteger)NSErrorCodeForXCUErrorCode:(NSString*)code { } - (BOOL)isAppInstalled { +#ifdef TARGET_OS_X + return false; +#else return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@://Test", self.URLScheme]]]; +#endif } - (void)performAction:(NSString*)action { diff --git a/InterAppCommunication/IACDelegate.h b/InterAppCommunication/IACDelegate.h old mode 100644 new mode 100755 diff --git a/InterAppCommunication/IACManager.h b/InterAppCommunication/IACManager.h old mode 100644 new mode 100755 diff --git a/InterAppCommunication/IACManager.m b/InterAppCommunication/IACManager.m old mode 100644 new mode 100755 index 2de3ce5..222a9a3 --- a/InterAppCommunication/IACManager.m +++ b/InterAppCommunication/IACManager.m @@ -136,10 +136,18 @@ - (BOOL)handleOpenURL:(NSURL*)url { IACSuccessBlock success = ^(NSDictionary *returnParams, BOOL cancelled) { if (cancelled) { if (parameters[kXCUCancel]) { +#ifdef TARGET_OS_X + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:parameters[kXCUCancel]]]; +#else [[UIApplication sharedApplication] openURL:[NSURL URLWithString:parameters[kXCUCancel]]]; +#endif } } else if (parameters[kXCUSuccess]) { +#ifdef TARGET_OS_X + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[parameters[kXCUSuccess] stringByAppendingURLParams:returnParams]]]; +#else [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[parameters[kXCUSuccess] stringByAppendingURLParams:returnParams]]]; +#endif } }; @@ -149,7 +157,11 @@ - (BOOL)handleOpenURL:(NSURL*)url { kXCUErrorMessage: [error localizedDescription], kIACErrorDomain: [error domain] }; +#ifdef TARGET_OS_X + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[parameters[kXCUError] stringByAppendingURLParams:errorParams]]]; +#else [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[parameters[kXCUError] stringByAppendingURLParams:errorParams]]]; +#endif } }; @@ -173,7 +185,11 @@ - (BOOL)handleOpenURL:(NSURL*)url { kXCUErrorMessage: [NSString stringWithFormat:NSLocalizedString(@"'%@' is not an x-callback-url action supported by %@", nil), action, [self localizedAppName]], kIACErrorDomain: IACErrorDomain }; +#ifdef TARGET_OS_X + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[parameters[kXCUError] stringByAppendingURLParams:errorParams]]]; +#else [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[parameters[kXCUError] stringByAppendingURLParams:errorParams]]]; +#endif return YES; } } @@ -220,8 +236,12 @@ - (void)sendIACRequest:(IACRequest*)request { } sessions[request.requestID] = request; - + +#ifdef TARGET_OS_X + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:final_url]]; +#else [[UIApplication sharedApplication] openURL:[NSURL URLWithString:final_url]]; +#endif } diff --git a/InterAppCommunication/IACRequest.h b/InterAppCommunication/IACRequest.h old mode 100644 new mode 100755 diff --git a/InterAppCommunication/IACRequest.m b/InterAppCommunication/IACRequest.m old mode 100644 new mode 100755 diff --git a/InterAppCommunication/NSString+IACExtensions.h b/InterAppCommunication/NSString+IACExtensions.h old mode 100644 new mode 100755 diff --git a/InterAppCommunication/NSString+IACExtensions.m b/InterAppCommunication/NSString+IACExtensions.m old mode 100644 new mode 100755