Skip to content

Resolve deprecations warnings #683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ - (void)reauthenticateWithProvider:(NSString *)providerID
return;
}
[self.delegate.auth.currentUser
reauthenticateAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable reauthError) {
reauthenticateWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable reauthError) {
[self.delegate decrementActivity];
if (result) {
result(self.delegate.auth.currentUser, reauthError);
Expand Down
18 changes: 9 additions & 9 deletions Auth/FirebaseAuthUI/FUIAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ - (void)signInWithProviderUI:(id<FUIAuthProvider>)providerUI
credential:credential
resultCallback:result];
} else {
[self.auth signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self.auth signInWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
if (error && error.code == FIRAuthErrorCodeAccountExistsWithDifferentCredential) {
NSString *email = error.userInfo[kErrorUserInfoEmailKey];
[self.emailAuthProvider handleAccountLinkingForEmail:email
Expand Down Expand Up @@ -230,9 +230,9 @@ - (void)autoUpgradeAccountWithProviderUI:(id<FUIAuthProvider>)providerUI
credential:(nullable FIRAuthCredential *)credential
resultCallback:(nullable FIRAuthResultCallback)callback {
[self.auth.currentUser
linkAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError * _Nullable error) {
linkWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError * _Nullable error) {
if (error) {
// Check for "credential in use" conflict error and handle appropriately.
if (error.code == FIRAuthErrorCodeCredentialAlreadyInUse) {
Expand Down Expand Up @@ -283,9 +283,9 @@ - (void)autoUpgradeAccountWithProviderUI:(id<FUIAuthProvider>)providerUI
return;
}

[authResult.user linkAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *authResult,
NSError *linkError) {
[authResult.user linkWithCredential:credential
completion:^(FIRAuthDataResult *authResult,
NSError *linkError) {
if (linkError) {
[self completeSignInWithResult:nil
error:linkError
Expand Down
10 changes: 7 additions & 3 deletions Auth/FirebaseAuthUI/FUIAuthUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/* Name of the FirebaseAuthUI resource bundle. */
extern NSString *const FUIAuthBundleName;

Expand All @@ -31,27 +33,29 @@ extern NSString *const FUIAuthBundleName;
@param bundleName Name of the bundle to retreive. If nil, this returns the default bundle for
FirebaseUI.
*/
+ (NSBundle *)bundleNamed:(nullable NSString *)bundleName;
+ (nullable NSBundle *)bundleNamed:(nullable NSString *)bundleName;

/** @fn imageNamed:fromBundle:
@brief Gets a UIImage with the given name, assuming it's a png.
@param name Name of the image to retreive.
@param bundleNameOrNil Name of the bundle to retreive. If nil, this method will look into the
default FirebaseUI framework bundle.
*/
+ (UIImage *)imageNamed:(NSString *)name fromBundleNameOrNil:(nullable NSString *)bundleNameOrNil;
+ (nullable UIImage *)imageNamed:(NSString *)name fromBundleNameOrNil:(nullable NSString *)bundleNameOrNil;

/** @fn imageNamed:fromBundle:
@brief Gets a UIImage with the given name, assuming it's a png.
@param name Name of the image to retreive.
@param bundle The bundle to retrieve the image from. If nil, this method will look into the
default FirebaseUI framework bundle.
*/
+ (UIImage *)imageNamed:(NSString *)name fromBundle:(nullable NSBundle *)bundle;
+ (nullable UIImage *)imageNamed:(NSString *)name fromBundle:(nullable NSBundle *)bundle;

/** @fn isFirebasePerformanceAvailable
* @brief Used to work around https://github.com/firebase/firebase-ios-sdk/issues/2283
*/
+ (BOOL)isFirebasePerformanceAvailable;

@end

NS_ASSUME_NONNULL_END
6 changes: 3 additions & 3 deletions Auth/FirebaseAuthUI/FUIAuthUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@implementation FUIAuthUtils

+ (NSBundle *)bundleNamed:(NSString *)bundleName {
+ (nullable NSBundle *)bundleNamed:(nullable NSString *)bundleName {
NSBundle *frameworkBundle = nil;
if (!bundleName) {
bundleName = FUIAuthBundleName;
Expand All @@ -37,7 +37,7 @@ + (NSBundle *)bundleNamed:(NSString *)bundleName {
return frameworkBundle;
}

+ (UIImage *)imageNamed:(NSString *)name fromBundle:(NSBundle *)bundle {
+ (nullable UIImage *)imageNamed:(NSString *)name fromBundle:(nullable NSBundle *)bundle {
if (!bundle) {
bundle = [self bundleNamed:nil];
}
Expand All @@ -48,7 +48,7 @@ + (UIImage *)imageNamed:(NSString *)name fromBundle:(NSBundle *)bundle {
return [UIImage imageWithContentsOfFile:path];
}

+ (UIImage *)imageNamed:(NSString *)name fromBundleNameOrNil:(nullable NSString *)bundleNameOrNil {
+ (nullable UIImage *)imageNamed:(NSString *)name fromBundleNameOrNil:(nullable NSString *)bundleNameOrNil {
NSString *path = [[FUIAuthUtils bundleNamed:bundleNameOrNil] pathForResource:name ofType:@"png"];
if (!path) {
NSLog(@"Warning: Unable to find asset %@ in bundle named %@.", name, bundleNameOrNil);
Expand Down
8 changes: 4 additions & 4 deletions EmailAuth/FirebaseEmailAuthUI/FUIConfirmEmailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ - (void)onNext:(NSString *)emailText {
presentingViewController:self];
};

[self.auth signInAndRetrieveDataWithCredential:credential completion:completeSignInBlock];
[self.auth signInWithCredential:credential completion:completeSignInBlock];
}

- (void)textFieldDidChange {
Expand Down Expand Up @@ -280,9 +280,9 @@ - (void)signInWithProvider:(id<FUIAuthProvider>)provider email:(NSString *)email
return;
}

[self.auth signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self.auth signInWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self decrementActivity];
if (result) {
result(authResult.user, error);
Expand Down
33 changes: 17 additions & 16 deletions EmailAuth/FirebaseEmailAuthUI/FUIEmailAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,15 @@ - (void)handleUnverifiedProviderLinking:(NSString *)providerID
presentingViewController:nil];
};

[self.authUI.auth signInAndRetrieveDataWithCredential:emailLinkCredential
completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) {
[self.authUI.auth signInWithCredential:emailLinkCredential
completion:^(FIRAuthDataResult * _Nullable authResult,
NSError * _Nullable error) {
if (error) {
[FUIAuthBaseViewController showAlertWithMessage:error.description];
return;
}

[authResult.user linkAndRetrieveDataWithCredential:unverifiedProviderCredential completion:completeSignInBlock];
[authResult.user linkWithCredential:unverifiedProviderCredential completion:completeSignInBlock];
}];
}
}
Expand Down Expand Up @@ -357,9 +358,9 @@ - (void)handleAnonymousUpgrade:(NSString *)anonymousUserID email:(NSString *)ema
};

[self.authUI.auth.currentUser
linkAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
linkWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
if (error) {
if (error.code == FIRAuthErrorCodeEmailAlreadyInUse) {
NSDictionary *userInfo = @{ FUIAuthCredentialKey : credential };
Expand Down Expand Up @@ -418,7 +419,7 @@ - (void)handleEmaiLinkSignIn:(NSString *)email {
presentingViewController:nil];
};

[self.authUI.auth signInAndRetrieveDataWithCredential:credential completion:completeSignInBlock];
[self.authUI.auth signInWithCredential:credential completion:completeSignInBlock];
}

- (void)handleDifferentDevice {
Expand Down Expand Up @@ -555,9 +556,9 @@ - (void)signInWithEmailHint:(NSString *)emailHint
return;
}

[tempAuth signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[tempAuth signInWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
if (error) {
if (completion) {
completion(nil, error, nil);
Expand Down Expand Up @@ -743,9 +744,9 @@ - (void)handleAccountLinkingForEmail:(NSString *)email
return;
}

[self.authUI.auth signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult*_Nullable authResult,
NSError *_Nullable error) {
[self.authUI.auth signInWithCredential:credential
completion:^(FIRAuthDataResult*_Nullable authResult,
NSError *_Nullable error) {
if (error) {
[self.authUI invokeResultCallbackWithAuthDataResult:nil URL:nil error:error];
if (result) {
Expand All @@ -755,9 +756,9 @@ - (void)handleAccountLinkingForEmail:(NSString *)email
}

FIRUser *user = authResult.user;
[user linkAndRetrieveDataWithCredential:newCredential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[user linkWithCredential:newCredential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
if (result) {
result(authResult.user, error);
}
Expand Down
6 changes: 3 additions & 3 deletions EmailAuth/FirebaseEmailAuthUI/FUIEmailEntryViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ - (void)signInWithProvider:(id<FUIAuthProvider>)provider email:(NSString *)email
return;
}

[self.auth signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self.auth signInWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self decrementActivity];
if (result) {
result(authResult.user, error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ - (void)signInWithDefaultValue:(NSString *)email andPassword:(NSString *)passwor
// Check for the presence of an anonymous user and whether automatic upgrade is enabled.
if (self.auth.currentUser.isAnonymous && self.authUI.shouldAutoUpgradeAnonymousUsers) {
[self.auth.currentUser
linkAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
linkWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
if (error) {
if (error.code == FIRAuthErrorCodeEmailAlreadyInUse) {
NSDictionary *userInfo = @{ FUIAuthCredentialKey : credential };
Expand All @@ -196,7 +196,7 @@ - (void)signInWithDefaultValue:(NSString *)email andPassword:(NSString *)passwor
completeSignInBlock(authResult, nil);
}];
} else {
[self.auth signInAndRetrieveDataWithCredential:credential completion:completeSignInBlock];
[self.auth signInWithCredential:credential completion:completeSignInBlock];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ - (void)signUpWithEmail:(NSString *)email
FIRAuthCredential *credential =
[FIREmailAuthProvider credentialWithEmail:email password:password];
[self.auth.currentUser
linkAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError * _Nullable error) {
linkWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError * _Nullable error) {
if (error) {
[self decrementActivity];
[self finishSignUpWithAuthDataResult:nil error:error];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,19 @@ - (void)verifyPassword:(NSString *)password {

FIRAuthCredential *credential =
[FIREmailAuthProvider credentialWithEmail:_email password:password];
[self.auth signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self.auth signInWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
if (error) {
[self decrementActivity];

[self showAlertWithMessage:FUILocalizedString(kStr_WrongPasswordError)];
return;
}

[authResult.user linkAndRetrieveDataWithCredential:self->_newCredential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[authResult.user linkWithCredential:self->_newCredential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self decrementActivity];

// Ignore any error (shouldn't happen) and treat the user as successfully signed in.
Expand Down
8 changes: 4 additions & 4 deletions FacebookAuth/FirebaseFacebookAuthUI/FUIFacebookAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ - (void)signInWithDefaultValue:(nullable NSString *)defaultValue
_pendingSignInCallback = completion;
_presentingViewController = presentingViewController;

[_loginManager logInWithReadPermissions:_scopes
fromViewController:presentingViewController
handler:^(FBSDKLoginManagerLoginResult *result,
NSError *error) {
[_loginManager logInWithPermissions:_scopes
fromViewController:presentingViewController
handler:^(FBSDKLoginManagerLoginResult *result,
NSError *error) {
if (error) {
NSError *newError =
[FUIAuthErrorUtils providerErrorWithUnderlyingError:error
Expand Down
4 changes: 2 additions & 2 deletions PhoneAuth/FirebasePhoneAuthUI/CountryCode/FUIPhoneNumber.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
@class FUICountryCodeInfo;
@class FUICountryCodes;

NS_ASSUME_NONNULL_BEGIN

FOUNDATION_EXPORT NSString * const FUIPhoneNumberValidationErrorDomain;

typedef NS_ENUM(NSInteger, FUIPhoneNumberValidationError) {
Expand All @@ -27,8 +29,6 @@ typedef NS_ENUM(NSInteger, FUIPhoneNumberValidationError) {
FUIPhoneNumberValidationErrorMissingNumber = 2,
};

NS_ASSUME_NONNULL_BEGIN

/** Encapsulates a phone number with the raw and the normalized representations */
@interface FUIPhoneNumber : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ - (void)viewWillAppear:(BOOL)animated {
}

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self unregisterFromNotifications];
}

Expand Down
7 changes: 0 additions & 7 deletions samples/objc/FirebaseUI-demo-objc/FUIAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ - (BOOL)application:(UIApplication *)app
return [self handleOpenUrl:url sourceApplication:sourceApplication];
}

- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(nullable NSString *)sourceApplication
annotation:(id)annotation {
return [self handleOpenUrl:url sourceApplication:sourceApplication];
}

- (BOOL)application:(UIApplication *)application
continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:
Expand Down
2 changes: 1 addition & 1 deletion samples/objc/FirebaseUI-demo-objc/FUISample.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

typedef UIViewController *(^FIRControllerBlock)();
typedef UIViewController *(^FIRControllerBlock)(void);

@interface FUISample : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Webp.net-resizeimage.png",
"scale" : "1x"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ - (void)authUI:(FUIAuth *)authUI
if (error.code == FUIAuthErrorCodeMergeConflict) {
FIRAuthCredential *credential = error.userInfo[FUIAuthCredentialKey];
[[FUIAuth defaultAuthUI].auth
signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
signInWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
if (error) {
[self showAlertWithTitlte:@"Sign-In error" message:error.description];
NSLog(@"%@",error.description);
Expand Down