Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
34 changes: 7 additions & 27 deletions FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@

#import <AvailabilityMacros.h>
#import <Foundation/Foundation.h>
#import <TargetConditionals.h>

#import "FIRAuthErrors.h"

#if TARGET_OS_IOS
#import "FIRAuthAPNSTokenType.h"
#endif

@class FIRActionCodeSettings;
@class FIRApp;
Expand Down Expand Up @@ -87,26 +86,12 @@ typedef void (^FIRIDTokenDidChangeListenerBlock)(FIRAuth *auth, FIRUser *_Nullab
typedef void (^FIRAuthDataResultCallback)(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error)
NS_SWIFT_NAME(AuthDataResultCallback);

#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
/**
@brief The name of the `NSNotificationCenter` notification which is posted when the auth state
changes (for example, a new token has been produced, a user signs in or signs out). The
object parameter of the notification is the sender `FIRAuth` instance.
*/
extern const NSNotificationName FIRAuthStateDidChangeNotification NS_SWIFT_NAME(AuthStateDidChange);
#else
/**
@brief The name of the `NSNotificationCenter` notification which is posted when the auth state
changes (for example, a new token has been produced, a user signs in or signs out). The
object parameter of the notification is the sender `FIRAuth` instance.
*/
// clang-format off
// clang-format12 merges the next two lines.
extern NSString *const FIRAuthStateDidChangeNotification
NS_SWIFT_NAME(AuthStateDidChangeNotification);
// clang-format off
#endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0

/** @typedef FIRAuthResultCallback
@brief The type of block invoked when sign-in related events complete.
Expand Down Expand Up @@ -362,15 +347,13 @@ NS_SWIFT_NAME(Auth)
*/
@property(nonatomic, copy, nullable) NSString *tenantID;

#if TARGET_OS_IOS
/** @property APNSToken
@brief The APNs token used for phone number authentication. The type of the token (production
or sandbox) will be attempted to be automatcially detected.
@remarks If swizzling is disabled, the APNs Token must be set for phone number auth to work,
by either setting this property or by calling `setAPNSToken:type:`
*/
@property(nonatomic, strong, nullable) NSData *APNSToken;
#endif
@property(nonatomic, strong, nullable) NSData *APNSToken API_UNAVAILABLE(macos, tvos, watchos);

/** @fn init
@brief Please access auth instances using `FIRAuth.auth` and `FIRAuth.authForApp:`.
Expand Down Expand Up @@ -505,7 +488,7 @@ NS_SWIFT_NAME(Auth)
UIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
completion:(nullable void (^)(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error))completion
API_UNAVAILABLE(watchos);
API_UNAVAILABLE(macosx, watchos);

/** @fn signInWithCredential:completion:
@brief Asynchronously signs in to Firebase with the given 3rd-party credentials (e.g. a Facebook
Expand Down Expand Up @@ -828,8 +811,6 @@ NS_SWIFT_NAME(Auth)
*/
- (void)useEmulatorWithHost:(NSString *)host port:(NSInteger)port;

#if TARGET_OS_IOS

/** @fn canHandleURL:
@brief Whether the specific URL is handled by `FIRAuth` .
@param URL The URL received by the application delegate from any of the openURL method.
Expand All @@ -840,14 +821,15 @@ NS_SWIFT_NAME(Auth)
@remarks If swizzling is disabled, URLs received by the application delegate must be forwarded
to this method for phone number auth to work.
*/
- (BOOL)canHandleURL:(nonnull NSURL *)URL;
- (BOOL)canHandleURL:(nonnull NSURL *)URL API_UNAVAILABLE(macos, tvos, watchos);

/** @fn setAPNSToken:type:
@brief Sets the APNs token along with its type.
@remarks If swizzling is disabled, the APNs Token must be set for phone number auth to work,
by either setting calling this method or by setting the `APNSToken` property.
*/
- (void)setAPNSToken:(NSData *)token type:(FIRAuthAPNSTokenType)type;
- (void)setAPNSToken:(NSData *)token
type:(FIRAuthAPNSTokenType)type API_UNAVAILABLE(macos, tvos, watchos);

/** @fn canHandleNotification:
@brief Whether the specific remote notification is handled by `FIRAuth` .
Expand All @@ -860,9 +842,7 @@ NS_SWIFT_NAME(Auth)
@remarks If swizzling is disabled, related remote notifications must be forwarded to this method
for phone number auth to work.
*/
- (BOOL)canHandleNotification:(NSDictionary *)userInfo;

#endif // TARGET_OS_IOS
- (BOOL)canHandleNotification:(NSDictionary *)userInfo API_UNAVAILABLE(macos, tvos, watchos);

#pragma mark - User sharing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
* limitations under the License.
*/

#import <TargetConditionals.h>
#if !TARGET_OS_OSX

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -38,8 +35,6 @@ typedef NS_ENUM(NSInteger, FIRAuthAPNSTokenType) {
/** Production token type.
*/
FIRAuthAPNSTokenTypeProd,
} NS_SWIFT_NAME(AuthAPNSTokenType);
} NS_SWIFT_NAME(AuthAPNSTokenType) API_UNAVAILABLE(macosx);

NS_ASSUME_NONNULL_END

#endif
8 changes: 1 addition & 7 deletions FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuthUIDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
* limitations under the License.
*/

#import <TargetConditionals.h>
#if !TARGET_OS_OSX

#import <Foundation/Foundation.h>

@class UIViewController;
Expand All @@ -26,8 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
/** @protocol FIRAuthUIDelegate
@brief A protocol to handle user interface interactions for Firebase Auth.
*/
NS_SWIFT_NAME(AuthUIDelegate)
@protocol FIRAuthUIDelegate <NSObject>
NS_SWIFT_NAME(AuthUIDelegate) API_UNAVAILABLE(macosx, watchos) @protocol FIRAuthUIDelegate<NSObject>

/** @fn presentViewController:animated:completion:
@brief If implemented, this method will be invoked when Firebase Auth needs to display a view
Expand Down Expand Up @@ -55,5 +51,3 @@ NS_SWIFT_NAME(AuthUIDelegate)
@end

NS_ASSUME_NONNULL_END

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

#import <Foundation/Foundation.h>

#if TARGET_OS_IOS
#import "FIRAuthUIDelegate.h"
#endif // TARGET_OS_IOS

@class FIRAuthCredential;

Expand All @@ -39,7 +37,6 @@ typedef void (^FIRAuthCredentialCallback)(FIRAuthCredential *_Nullable credentia
NSError *_Nullable error)
NS_SWIFT_NAME(AuthCredentialCallback);

#if TARGET_OS_IOS
/** @fn getCredentialWithUIDelegate:completion:
@brief Used to obtain an auth credential via a mobile web flow.
@param UIDelegate An optional UI delegate used to presenet the mobile web flow.
Expand All @@ -48,8 +45,8 @@ typedef void (^FIRAuthCredentialCallback)(FIRAuthCredential *_Nullable credentia
*/
- (void)getCredentialWithUIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
completion:(nullable void (^)(FIRAuthCredential *_Nullable credential,
NSError *_Nullable error))completion;
#endif // TARGET_OS_IOS
NSError *_Nullable error))completion
API_UNAVAILABLE(macos, tvos, watchos);

@end

Expand Down
14 changes: 5 additions & 9 deletions FirebaseAuth/Sources/Public/FirebaseAuth/FIRMultiFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
* limitations under the License.
*/

#import <TargetConditionals.h>
#if TARGET_OS_IOS

#import <Foundation/Foundation.h>

#import "FIRAuth.h"
Expand All @@ -33,19 +30,20 @@ NS_ASSUME_NONNULL_BEGIN
*/
typedef void (^FIRMultiFactorSessionCallback)(FIRMultiFactorSession *_Nullable session,
NSError *_Nullable error)
NS_SWIFT_NAME(MultiFactorSessionCallback);
NS_SWIFT_NAME(MultiFactorSessionCallback) API_UNAVAILABLE(macos, tvos, watchos);

/**
@brief The string identifier for second factors. e.g. "phone".
*/
extern NSString *const _Nonnull FIRPhoneMultiFactorID NS_SWIFT_NAME(PhoneMultiFactorID);
extern NSString *const _Nonnull FIRPhoneMultiFactorID NS_SWIFT_NAME(PhoneMultiFactorID)
API_UNAVAILABLE(macos, tvos, watchos);

/** @class FIRMultiFactor
@brief The interface defining the multi factor related properties and operations pertaining to a
user.
*/
NS_SWIFT_NAME(MultiFactor)
@interface FIRMultiFactor : NSObject
NS_SWIFT_NAME(MultiFactor) API_UNAVAILABLE(macos, tvos, watchos) @interface FIRMultiFactor
: NSObject

@property(nonatomic, readonly) NSArray<FIRMultiFactorInfo *> *enrolledFactors;

Expand Down Expand Up @@ -86,5 +84,3 @@ NS_SWIFT_NAME(MultiFactor)
@end

NS_ASSUME_NONNULL_END

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
* limitations under the License.
*/

#import <TargetConditionals.h>
#if TARGET_OS_IOS

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -25,8 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
@brief The base class for asserting ownership of a second factor. This is equivalent to the
AuthCredential class.
*/
NS_SWIFT_NAME(MultiFactorAssertion)
@interface FIRMultiFactorAssertion : NSObject
NS_SWIFT_NAME(MultiFactorAssertion) API_UNAVAILABLE(macos, tvos, watchos)
@interface FIRMultiFactorAssertion : NSObject

/**
@brief The second factor identifier for this opaque object asserting a second factor.
Expand All @@ -36,5 +33,3 @@ NS_SWIFT_NAME(MultiFactorAssertion)
@end

NS_ASSUME_NONNULL_END

#endif
9 changes: 2 additions & 7 deletions FirebaseAuth/Sources/Public/FirebaseAuth/FIRMultiFactorInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@
* limitations under the License.
*/

#import <TargetConditionals.h>
#if TARGET_OS_IOS

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/** @class FIRMultiFactorInfo
@brief Safe public structure used to represent a second factor entity from a client perspective.
*/
NS_SWIFT_NAME(MultiFactorInfo)
@interface FIRMultiFactorInfo : NSObject
NS_SWIFT_NAME(MultiFactorInfo) API_UNAVAILABLE(macos, tvos, watchos) @interface FIRMultiFactorInfo
: NSObject

/**
@brief The multi-factor enrollment ID.
Expand All @@ -50,5 +47,3 @@ NS_SWIFT_NAME(MultiFactorInfo)
@end

NS_ASSUME_NONNULL_END

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
* limitations under the License.
*/

#import <TargetConditionals.h>
#if TARGET_OS_IOS

#import "FIRMultiFactor.h"

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -25,8 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
@brief The data structure used to help developers resolve 2nd factor requirements on users that
have opted in to 2 factor authentication.
*/
NS_SWIFT_NAME(MultiFactorResolver)
@interface FIRMultiFactorResolver : NSObject
NS_SWIFT_NAME(MultiFactorResolver) API_UNAVAILABLE(macos, tvos, watchos)
@interface FIRMultiFactorResolver : NSObject

/**
@brief The opaque session identifier for the current sign-in flow.
Expand Down Expand Up @@ -56,5 +53,3 @@ NS_SWIFT_NAME(MultiFactorResolver)
@end

NS_ASSUME_NONNULL_END

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
* limitations under the License.
*/

#import <TargetConditionals.h>
#if TARGET_OS_IOS

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -25,11 +22,9 @@ NS_ASSUME_NONNULL_BEGIN
@brief Opaque object that identifies the current session to enroll a second factor or to
complete sign in when previously enrolled.
*/
NS_SWIFT_NAME(MultiFactorSession)
@interface FIRMultiFactorSession : NSObject
NS_SWIFT_NAME(MultiFactorSession) API_UNAVAILABLE(macos, tvos, watchos)
@interface FIRMultiFactorSession : NSObject

@end

NS_ASSUME_NONNULL_END

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
* limitations under the License.
*/

#import <TargetConditionals.h>
#if TARGET_OS_IOS

#import <Foundation/Foundation.h>

#import "FIRAuthCredential.h"
Expand All @@ -26,8 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
/** @class FIRPhoneAuthCredential
@brief Implementation of FIRAuthCredential for Phone Auth credentials.
*/
NS_SWIFT_NAME(PhoneAuthCredential)
@interface FIRPhoneAuthCredential : FIRAuthCredential <NSSecureCoding>
NS_SWIFT_NAME(PhoneAuthCredential) API_UNAVAILABLE(macos, tvos, watchos)
@interface FIRPhoneAuthCredential : FIRAuthCredential<NSSecureCoding>

/** @fn init
@brief This class is not supposed to be instantiated directly.
Expand All @@ -37,5 +34,3 @@ NS_SWIFT_NAME(PhoneAuthCredential)
@end

NS_ASSUME_NONNULL_END

#endif
Loading