Skip to content

Commit fab5071

Browse files
committed
style(lint, ios): fix flagged issues from Xcode
mostly nullability and deprecation items
1 parent 395d592 commit fab5071

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

ios/RNAppleAuthentication/RNAppleAuthASAuthorizationDelegates.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
@interface RNAppleAuthASAuthorizationDelegates : NSObject <ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding>
2525

2626
@property(nonatomic, strong, nullable) NSString *nonce;
27-
@property(nonatomic, strong, nullable) void (^completion)(NSError *, NSDictionary *);
27+
@property(nonatomic, strong, nullable) void (^completion)(NSError *_Nullable, NSDictionary *_Nullable);
2828

29-
- (instancetype)initWithCompletion:(void (^)(NSError *error, NSDictionary *authorizationCredential))completion andNonce:(NSString *)nonce;
29+
- (instancetype _Nullable )initWithCompletion:(void (^_Nonnull)(NSError * _Nullable error, NSDictionary * _Nullable authorizationCredential))completion andNonce:(NSString *_Nullable)nonce;
3030

31-
- (void)performRequestsForAuthorizationController:(ASAuthorizationController *)authorizationController;
31+
- (void)performRequestsForAuthorizationController:(ASAuthorizationController *_Nonnull)authorizationController;
3232

3333
@end
3434

ios/RNAppleAuthentication/RNAppleAuthASAuthorizationDelegates.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
@implementation RNAppleAuthASAuthorizationDelegates
2929

30-
- (instancetype)initWithCompletion:(void (^)(NSError *error, NSDictionary *authorizationCredential))completion andNonce:(NSString *)nonce {
30+
- (instancetype)initWithCompletion:(nonnull void (^)(NSError *error, NSDictionary *authorizationCredential))completion andNonce:(NSString *)nonce {
3131
if (self = [super init]) {
3232
_completion = completion;
3333
_nonce = nonce;
@@ -54,6 +54,9 @@ - (ASPresentationAnchor)presentationAnchorForAuthorizationController:(ASAuthoriz
5454
}
5555
return window;
5656
#else
57+
// I believe the vision OS one above is actually the best way to handle the deprecation:
58+
// Apple Auth not supported until iOS13 anyway, so the solution above should be using avaliable APIs (13+)
59+
// iPadOS optimal solution also relies on using activation state vs just using last connected Scene
5760
return [[UIApplication sharedApplication] keyWindow];
5861
#endif
5962
#endif
@@ -70,7 +73,7 @@ - (void)authorizationController:(ASAuthorizationController *)controller didCompl
7073

7174
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error {
7275
NSLog(@"RNAppleAuth -> didCompleteWithError");
73-
NSLog(error.localizedDescription);
76+
NSLog(@"%@", error.localizedDescription);
7477
_completion(error, nil);
7578
_completion = nil;
7679
}

ios/RNAppleAuthentication/RNAppleAuthModule.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,17 @@ + (BOOL)requiresMainQueueSetup {
3939
}
4040

4141
- (NSDictionary *)constantsToExport {
42+
bool supported = false;
43+
if (@available(iOS 13.0, macOS 10.15, *)) {
44+
supported = true;
45+
}
46+
bool signUpButtonSupported = false;
47+
if (@available(iOS 13.2, macOS 10.15.1, *)) {
48+
signUpButtonSupported = true;
49+
}
4250
return @{
43-
@"isSupported": @available(iOS 13.0, macOS 10.15, *) ? @(YES) : @(NO),
44-
@"isSignUpButtonSupported": @available(iOS 13.2, macOS 10.15.1, *) ? @(YES) : @(NO),
51+
@"isSupported": @(supported),
52+
@"isSignUpButtonSupported": @(signUpButtonSupported),
4553
};
4654
}
4755

0 commit comments

Comments
 (0)