Skip to content

Commit 6c33b7c

Browse files
authored
Merge pull request #283 from BranchMetrics/ios-warnings
Suppress some warnings with Xcode 9
2 parents 5434a1d + 850674b commit 6c33b7c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ios/RNBranch.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ extern NSString * _Nonnull const RNBranchLinkOpenedNotificationLinkPropertiesKey
1717

1818
+ (void)initSessionWithLaunchOptions:(NSDictionary * _Nullable)launchOptions isReferrable:(BOOL)isReferrable;
1919
+ (BOOL)handleDeepLink:(NSURL * _Nonnull)url __deprecated_msg("Please use [RNBranch.branch application:openURL:options] or [RNBranch.branch application:openURL:sourceApplication:annotation:] instead.");
20+
#pragma clang diagnostic push
21+
#pragma clang diagnostic ignored "-Wpartial-availability"
2022
+ (BOOL)continueUserActivity:(NSUserActivity * _Nonnull)userActivity;
23+
#pragma clang diagnostic pop
2124

2225
// Must be called before any other static method below
2326
+ (void)useTestInstance;

ios/RNBranch.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,12 @@ + (BOOL)handleDeepLink:(NSURL *)url {
159159
return handled;
160160
}
161161

162+
#pragma clang diagnostic push
163+
#pragma clang diagnostic ignored "-Wpartial-availability"
162164
+ (BOOL)continueUserActivity:(NSUserActivity *)userActivity {
163165
return [self.branch continueUserActivity:userActivity];
164166
}
167+
#pragma clang diagnostic pop
165168

166169
#pragma mark - Object lifecycle
167170

@@ -186,8 +189,13 @@ - (void) dealloc {
186189
- (UIViewController *)currentViewController
187190
{
188191
UIViewController *current = [UIApplication sharedApplication].keyWindow.rootViewController;
189-
while (current.presentedViewController && ![current.presentedViewController isKindOfClass:UIAlertController.class]) {
190-
current = current.presentedViewController;
192+
if (@available(iOS 8.0, *)) {
193+
while (current.presentedViewController && ![current.presentedViewController isKindOfClass:UIAlertController.class]) {
194+
current = current.presentedViewController;
195+
}
196+
} else {
197+
// RN Requires iOS 8. Nothing to do here. Still.
198+
while (current.presentedViewController) current = current.presentedViewController;
191199
}
192200
return current;
193201
}

0 commit comments

Comments
 (0)