Skip to content

Commit

Permalink
[auth-swift] Restore Objective-C defined public globals and typedefs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Jan 2, 2024
1 parent 15aec98 commit b383d4e
Show file tree
Hide file tree
Showing 25 changed files with 712 additions and 381 deletions.
1 change: 1 addition & 0 deletions FirebaseAuth.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ supports email and password accounts, as well as several 3rd party authenticatio
source = 'FirebaseAuth/Sources/'
s.source_files = [
source + 'Swift/**/*.swift',
source + 'ObjC/**/*.m', # Implementations for deprecated global symbols
source + 'Public/FirebaseAuth/*.h'
]
s.public_header_files = source + 'Public/FirebaseAuth/*.h'
Expand Down
19 changes: 19 additions & 0 deletions FirebaseAuth/Sources/ObjC/FIRAuth.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

const NSNotificationName FIRAuthStateDidChangeNotification = @"FIRAuthStateDidChangeNotification";
36 changes: 36 additions & 0 deletions FirebaseAuth/Sources/ObjC/FIRAuthErrorUtils.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

NSString *const FIRAuthErrorDomain = @"FIRAuthErrorDomain";

NSString *const FIRAuthInternalErrorDomain = @"FIRAuthInternalErrorDomain";

NSString *const FIRAuthErrorUserInfoDeserializedResponseKey =
@"FIRAuthErrorUserInfoDeserializedResponseKey";

NSString *const FIRAuthErrorUserInfoDataKey = @"FIRAuthErrorUserInfoDataKey";

NSString *const FIRAuthErrorUserInfoEmailKey = @"FIRAuthErrorUserInfoEmailKey";

NSString *const FIRAuthErrorUserInfoUpdatedCredentialKey =
@"FIRAuthErrorUserInfoUpdatedCredentialKey";

NSString *const FIRAuthErrorUserInfoNameKey = @"FIRAuthErrorUserInfoNameKey";

NSString *const FIRAuthErrorUserInfoMultiFactorResolverKey =
@"FIRAuthErrorUserInfoMultiFactorResolverKey";
66 changes: 66 additions & 0 deletions FirebaseAuth/Sources/ObjC/FIRAuthProvider.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

#pragma mark - Provider ID constants

// Declared 'extern' in FIRGoogleAuthProvider.h
NSString *const FIRGoogleAuthProviderID = @"google.com";

// Declared 'extern' in FIRFacebookAuthProvider.h
NSString *const FIRFacebookAuthProviderID = @"facebook.com";

// Declared 'extern' in FIREmailAuthProvider.h
NSString *const FIREmailAuthProviderID = @"password";

// Declared 'extern' in FIRTwitterAuthProvider.h
NSString *const FIRTwitterAuthProviderID = @"twitter.com";

// Declared 'extern' in FIRGitHubAuthProvider.h
NSString *const FIRGitHubAuthProviderID = @"github.com";

// Declared 'extern' in FIRPhoneAuthProvider.h
NSString *const FIRPhoneAuthProviderID = @"phone";

// Declared 'extern' in FIRGameCenterAuthProvider.h
NSString *const FIRGameCenterAuthProviderID = @"gc.apple.com";

#pragma mark - sign-in methods constants

// Declared 'extern' in FIRGoogleAuthProvider.h
NSString *const FIRGoogleAuthSignInMethod = @"google.com";

// Declared 'extern' in FIREmailAuthProvider.h
NSString *const FIREmailPasswordAuthSignInMethod = @"password";

// Declared 'extern' in FIREmailAuthProvider.h
NSString *const FIREmailLinkAuthSignInMethod = @"emailLink";

// Declared 'extern' in FIRTwitterAuthProvider.h
NSString *const FIRTwitterAuthSignInMethod = @"twitter.com";

// Declared 'extern' in FIRFacebookAuthProvider.h
NSString *const FIRFacebookAuthSignInMethod = @"facebook.com";

// Declared 'extern' in FIRGitHubAuthProvider.h
NSString *const FIRGitHubAuthSignInMethod = @"github.com";

// Declared 'extern' in FIRPhoneAuthProvider.h
NSString *const FIRPhoneAuthSignInMethod = @"phone";

// Declared 'extern' in FIRGameCenterAuthProvider.h
NSString *const FIRGameCenterAuthSignInMethod = @"gc.apple.com";
27 changes: 27 additions & 0 deletions FirebaseAuth/Sources/ObjC/FIRMultiFactorConstants.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2019 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <TargetConditionals.h>
#if TARGET_OS_IOS

#import <Foundation/Foundation.h>

#pragma mark - Multi Factor ID constants

NSString *const FIRPhoneMultiFactorID = @"phone";
NSString *const FIRTOTPMultiFactorID = @"totp";

#endif
60 changes: 60 additions & 0 deletions FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuthErrors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
@brief The Firebase Auth error domain.
*/
extern NSString *const FIRAuthErrorDomain NS_SWIFT_NAME(AuthErrorDomain);

/**
@brief The name of the key for the error short string of an error code.
*/
extern NSString *const FIRAuthErrorUserInfoNameKey NS_SWIFT_NAME(AuthErrorUserInfoNameKey);

/**
@brief Errors with one of the following three codes:
- `AuthErrorCodeAccountExistsWithDifferentCredential`
- `AuthErrorCodeCredentialAlreadyInUse`
- `AuthErrorCodeEmailAlreadyInUse`
may contain an `NSError.userInfo` dictinary object which contains this key. The value
associated with this key is an NSString of the email address of the account that already
exists.
*/
extern NSString *const FIRAuthErrorUserInfoEmailKey NS_SWIFT_NAME(AuthErrorUserInfoEmailKey);

/**
@brief The key used to read the updated Auth credential from the userInfo dictionary of the
NSError object returned. This is the updated auth credential the developer should use for
recovery if applicable.
*/
// clang-format off
// clang-format12 will merge lines and exceed 100 character limit.
extern NSString *const FIRAuthErrorUserInfoUpdatedCredentialKey
NS_SWIFT_NAME(AuthErrorUserInfoUpdatedCredentialKey);

/**
@brief The key used to read the MFA resolver from the userInfo dictionary of the NSError object
returned when 2FA is required for sign-incompletion.
*/
extern NSString *const FIRAuthErrorUserInfoMultiFactorResolverKey
NS_SWIFT_NAME(AuthErrorUserInfoMultiFactorResolverKey);
// clang-format on

NS_ASSUME_NONNULL_END
39 changes: 39 additions & 0 deletions FirebaseAuth/Sources/Public/FirebaseAuth/FIREmailAuthProvider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
/**
@brief A string constant identifying the email & password identity provider.
*/
extern NSString *const FIREmailAuthProviderID NS_SWIFT_NAME(EmailAuthProviderID);

/**
@brief A string constant identifying the email-link sign-in method.
*/
extern NSString *const FIREmailLinkAuthSignInMethod NS_SWIFT_NAME(EmailLinkAuthSignInMethod);

/**
@brief A string constant identifying the email & password sign-in method.
*/
// clang-format off
// clang-format12 merges the next two lines.
extern NSString *const FIREmailPasswordAuthSignInMethod
NS_SWIFT_NAME(EmailPasswordAuthSignInMethod);
// clang-format on

NS_ASSUME_NONNULL_END
33 changes: 33 additions & 0 deletions FirebaseAuth/Sources/Public/FirebaseAuth/FIRFacebookAuthProvider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

@class FIRAuthCredential;

NS_ASSUME_NONNULL_BEGIN

/**
@brief A string constant identifying the Facebook identity provider.
*/
extern NSString *const FIRFacebookAuthProviderID NS_SWIFT_NAME(FacebookAuthProviderID);

/**
@brief A string constant identifying the Facebook sign-in method.
*/
extern NSString *const _Nonnull FIRFacebookAuthSignInMethod NS_SWIFT_NAME(FacebookAuthSignInMethod);

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

@class FIRAuthCredential;

NS_ASSUME_NONNULL_BEGIN

/** @typedef FIRAuthCredentialCallback
@brief The type of block invoked when obtaining an auth credential.
@param credential The credential obtained.
@param error The error that occurred if any.
*/
typedef void (^FIRAuthCredentialCallback)(FIRAuthCredential *_Nullable credential,
NSError *_Nullable error)
NS_SWIFT_UNAVAILABLE("Use Swift's closure syntax instead.");

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2018 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

@class FIRAuthCredential;

NS_ASSUME_NONNULL_BEGIN

/**
@brief A string constant identifying the Game Center identity provider.
*/
extern NSString *const FIRGameCenterAuthProviderID NS_SWIFT_NAME(GameCenterAuthProviderID);

/**
@brief A string constant identifying the Game Center sign-in method.
*/
extern NSString *const _Nonnull FIRGameCenterAuthSignInMethod NS_SWIFT_NAME(
GameCenterAuthSignInMethod);

/** @typedef FIRGameCenterCredentialCallback
@brief The type of block invoked when the Game Center credential code has finished.
@param credential On success, the credential will be provided, nil otherwise.
@param error On error, the error that occurred, nil otherwise.
*/
typedef void (^FIRGameCenterCredentialCallback)(FIRAuthCredential *_Nullable credential,
NSError *_Nullable error)
NS_SWIFT_UNAVAILABLE("Use Swift's closure syntax instead.");

NS_ASSUME_NONNULL_END
Loading

0 comments on commit b383d4e

Please sign in to comment.