diff --git a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift index e55b1e77f5a..5c5eba4085b 100644 --- a/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift +++ b/FirebaseAuth/Sources/Swift/ActionCode/ActionCodeURL.swift @@ -71,9 +71,7 @@ import Foundation languageCode = queryItems["languageCode"] } - // TODO: internal below here. - - @objc public class func parseURL(_ urlString: String) -> [String: String] { + class func parseURL(_ urlString: String) -> [String: String] { guard let linkURL = URLComponents(string: urlString)?.query else { return [:] } diff --git a/FirebaseAuth/Sources/Swift/Auth/Auth.swift b/FirebaseAuth/Sources/Swift/Auth/Auth.swift index 0807a4e0104..dcecd6dbd91 100644 --- a/FirebaseAuth/Sources/Swift/Auth/Auth.swift +++ b/FirebaseAuth/Sources/Swift/Auth/Auth.swift @@ -93,7 +93,7 @@ extension Auth: AuthInterop { strongSelf.autoRefreshTokens = true strongSelf.scheduleAutoTokenRefresh() - #if os(iOS) || os(tvOS) // TODO: Is a similar mechanism needed on macOS? + #if os(iOS) || os(tvOS) // TODO(ObjC): Is a similar mechanism needed on macOS? strongSelf.applicationDidBecomeActiveObserver = NotificationCenter.default.addObserver( forName: UIApplication.didBecomeActiveNotification, @@ -1593,7 +1593,10 @@ extension Auth: AuthInterop { @param listenerHandle The handle for the listener. */ @objc public func removeIDTokenDidChangeListener(_ listenerHandle: NSObjectProtocol) { - // TODO: implement me + NotificationCenter.default.removeObserver(listenerHandle) + objc_sync_enter(Auth.self) + listenerHandles.remove(listenerHandle) + objc_sync_exit(Auth.self) } /** @fn useAppLanguage @@ -1768,10 +1771,6 @@ extension Auth: AuthInterop { } #endif - // TODO: Need to manage breaking change for - // const NSNotificationName FIRAuthStateDidChangeNotification = - // @"FIRAuthStateDidChangeNotification"; - // Move to FIRApp with other Auth notifications? public static let authStateDidChangeNotification = NSNotification.Name(rawValue: "FIRAuthStateDidChangeNotification") diff --git a/FirebaseAuth/Sources/Swift/Auth/AuthComponent.swift b/FirebaseAuth/Sources/Swift/Auth/AuthComponent.swift index 1bc185b52c2..f0be914d6a6 100644 --- a/FirebaseAuth/Sources/Swift/Auth/AuthComponent.swift +++ b/FirebaseAuth/Sources/Swift/Auth/AuthComponent.swift @@ -23,7 +23,8 @@ import Foundation } @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) -@objc(FIRAuthComponent) class AuthComponent: NSObject, Library, AuthProvider { +@objc(FIRAuthComponent) +class AuthComponent: NSObject, Library, AuthProvider, ComponentLifecycleMaintainer { // MARK: - Private Variables /// The app associated with all Auth instances in this container. @@ -85,7 +86,7 @@ import Foundation try? keychain.removeData(forKey: userKey) } DispatchQueue.main.async { - // TODO: Move over to fire an event instead, once ready. + // TODO(ObjC): Move over to fire an event instead, once ready. NotificationCenter.default.post(name: Auth.authStateDidChangeNotification, object: nil) } } diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift index 2b5bab1209e..bce8092a7ac 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift @@ -39,8 +39,6 @@ import Foundation return PhoneAuthProvider(auth: auth) } - // TODO: review/remove public objc - /** @brief Starts the phone number authentication flow by sending a verification code to the specified phone number. diff --git a/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift b/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift index b163dcb3022..ba7bb4e6137 100644 --- a/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift +++ b/FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift @@ -291,7 +291,7 @@ private class AuthBackendRPCImplementation: NSObject, AuthBackendImplementation return } else { // TODO: this was ignored before - fatalError("Internal error") + fatalError("Auth Internal error: RPC call didn't return data or an error.") } } // Try to decode the HTTP response data which may contain either a diff --git a/FirebaseAuth/Sources/Swift/Backend/AuthRequestConfiguration.swift b/FirebaseAuth/Sources/Swift/Backend/AuthRequestConfiguration.swift index 380405f9a01..80ce4a79ac7 100644 --- a/FirebaseAuth/Sources/Swift/Backend/AuthRequestConfiguration.swift +++ b/FirebaseAuth/Sources/Swift/Backend/AuthRequestConfiguration.swift @@ -15,8 +15,6 @@ import Foundation import FirebaseAppCheckInterop -// TODO: Investigate how to directly depend on FIRHeartbeatLogger instead of using a protocol so -// FirebaseCoreExtension can be an implementation only protocol. import FirebaseCoreExtension /** @class FIRAuthRequestConfiguration diff --git a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberResponse.swift b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberResponse.swift index d2ffedf6e48..9ac4821ed37 100644 --- a/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberResponse.swift +++ b/FirebaseAuth/Sources/Swift/Backend/RPC/VerifyPhoneNumberResponse.swift @@ -55,7 +55,7 @@ class VerifyPhoneNumberResponse: AuthRPCResponse { */ var approximateExpirationDate: Date? - // XXX TODO: What might this be? + // XXX TODO(ObjC): What might this be? func expectedKind() -> String? { nil } diff --git a/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredential.swift b/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredential.swift index 413c31b08ed..f44c3952295 100644 --- a/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredential.swift +++ b/FirebaseAuth/Sources/Swift/SystemService/AuthAppCredential.swift @@ -24,21 +24,19 @@ private let kReceiptKey = "receipt" */ private let kSecretKey = "secret" -// TODO: Remove objc public after Sample app is replaced. - /** @class FIRAuthAppCredential @brief A class represents a credential that proves the identity of the app. */ -@objc(FIRAuthAppCredential) public class AuthAppCredential: NSObject, NSSecureCoding { +class AuthAppCredential: NSObject, NSSecureCoding { /** @property receipt @brief The server acknowledgement of receiving client's claim of identity. */ - @objc public var receipt: String + var receipt: String /** @property secret @brief The secret that the client received from server via a trusted channel, if ever. */ - @objc public var secret: String? + var secret: String? /** @fn initWithReceipt:secret: @brief Initializes the instance. @@ -46,7 +44,7 @@ private let kSecretKey = "secret" @param secret The secret that the client received from server via a trusted channel, if ever. @return The initialized instance. */ - @objc public init(receipt: String, secret: String?) { + init(receipt: String, secret: String?) { self.secret = secret self.receipt = receipt } diff --git a/FirebaseAuth/Sources/Swift/User/User.swift b/FirebaseAuth/Sources/Swift/User/User.swift index 86a05d0f27b..7f26ca56e54 100644 --- a/FirebaseAuth/Sources/Swift/User/User.swift +++ b/FirebaseAuth/Sources/Swift/User/User.swift @@ -302,12 +302,11 @@ extension User: NSSecureCoding {} */ @objc(profileChangeRequest) public func createProfileChangeRequest() -> UserProfileChangeRequest { - var result: UserProfileChangeRequest? + var result: UserProfileChangeRequest! kAuthGlobalWorkQueue.sync { result = UserProfileChangeRequest(self) } - // TODO: Is there a way to do without force unwrap? - return result! + return result } /** @property refreshToken diff --git a/FirebaseAuth/Sources/Swift/User/UserMetadata.swift b/FirebaseAuth/Sources/Swift/User/UserMetadata.swift index 533ca24ec4a..38cc1aadade 100644 --- a/FirebaseAuth/Sources/Swift/User/UserMetadata.swift +++ b/FirebaseAuth/Sources/Swift/User/UserMetadata.swift @@ -29,8 +29,7 @@ import Foundation */ @objc public let creationDate: Date? - // TODO: Nothing public below here - @objc public init(withCreationDate creationDate: Date?, lastSignInDate: Date?) { + init(withCreationDate creationDate: Date?, lastSignInDate: Date?) { self.creationDate = creationDate self.lastSignInDate = lastSignInDate } diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift index cb9e3b85e7a..0496997fc33 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift @@ -535,13 +535,12 @@ class AuthErrorUtils: NSObject { } #if os(iOS) - // TODO(ncooke3): Address the optionality of these arguments. static func secondFactorRequiredError(pendingCredential: String?, - hints: [MultiFactorInfo]?, + hints: [MultiFactorInfo], auth: Auth) -> Error { var userInfo: [String: Any] = [:] - if let pendingCredential = pendingCredential, let hints = hints { + if let pendingCredential = pendingCredential { let resolver = MultiFactorResolver(with: pendingCredential, hints: hints, auth: auth) userInfo[AuthErrors.userInfoMultiFactorResolverKey] = resolver } @@ -551,7 +550,7 @@ class AuthErrorUtils: NSObject { #endif // os(iOS) static func recaptchaSDKNotLinkedError() -> Error { - // TODO(chuanr): point the link to GCIP doc once available. + // TODO(chuanr, ObjC): point the link to GCIP doc once available. let message = "The reCAPTCHA SDK is not linked to your app. See " + "https://cloud.google.com/recaptcha-enterprise/docs/instrument-ios-apps" return error(code: .recaptchaSDKNotLinked, message: message) diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthErrors.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthErrors.swift index 780205b351c..81217d470de 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthErrors.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthErrors.swift @@ -1318,7 +1318,7 @@ private let kFIRAuthErrorMessageInvalidRecaptchaVersion = private let kFIRAuthErrorMessageInvalidReqType = "The request is not supported or is invalid." -// TODO(chuanr): point the link to GCIP doc once available. +// TODO(chuanr, ObjC): point the link to GCIP doc once available. private let kFIRAuthErrorMessageRecaptchaSDKNotLinked = "The reCAPTCHA SDK is not linked to your app. See " + "https://cloud.google.com/recaptcha-enterprise/docs/instrument-ios-apps" diff --git a/FirebaseAuth/Sources/Swift/Utilities/AuthRecaptchaVerifier.swift b/FirebaseAuth/Sources/Swift/Utilities/AuthRecaptchaVerifier.swift index efb732c9957..98d837d1d83 100644 --- a/FirebaseAuth/Sources/Swift/Utilities/AuthRecaptchaVerifier.swift +++ b/FirebaseAuth/Sources/Swift/Utilities/AuthRecaptchaVerifier.swift @@ -114,17 +114,17 @@ let customAction = actionClass.init(customAction: actionString) do { let token = try await recaptchaClient?.execute(withAction: customAction) - AuthLog.logInfo(code: "TODO", message: "reCAPTCHA token retrieval succeeded.") + AuthLog.logInfo(code: "I-AUT000100", message: "reCAPTCHA token retrieval succeeded.") guard let token else { AuthLog.logInfo( - code: "TODO", + code: "I-AUT000101", message: "reCAPTCHA token retrieval returned nil. NO_RECAPTCHA sent as the fake code." ) return "NO_RECAPTCHA" } return token } catch { - AuthLog.logInfo(code: "TODO", + AuthLog.logInfo(code: "I-AUT000102", message: "reCAPTCHA token retrieval failed. NO_RECAPTCHA sent as the fake code.") return "NO_RECAPTCHA" } @@ -147,7 +147,7 @@ } let request = GetRecaptchaConfigRequest(requestConfiguration: requestConfiguration) let response = try await AuthBackend.call(with: request) - AuthLog.logInfo(code: "TODO-CODE", message: "reCAPTCHA config retrieval succeeded.") + AuthLog.logInfo(code: "I-AUT000103", message: "reCAPTCHA config retrieval succeeded.") // Response's site key is of the format projects//keys/' guard let keys = response.recaptchaKey?.components(separatedBy: "/"), keys.count == 4 else { diff --git a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/project.pbxproj b/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/project.pbxproj deleted file mode 100644 index f118815609d..00000000000 --- a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,944 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - 400283EA23EA254B0006A298 /* MainViewController+MultiFactor.m in Sources */ = {isa = PBXBuildFile; fileRef = 400283E923EA254A0006A298 /* MainViewController+MultiFactor.m */; }; - DE1865AC245B879B00F8AD70 /* TestsBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1865AB245B879B00F8AD70 /* TestsBase.swift */; }; - DE1865AE245B8A1400F8AD70 /* AnonymousTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1865AD245B8A1400F8AD70 /* AnonymousTests.swift */; }; - DE1865B2245C7A2B00F8AD70 /* EmailPasswordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1865B1245C7A2B00F8AD70 /* EmailPasswordTests.swift */; }; - DE1865B4245C92A600F8AD70 /* GoogleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1865B3245C92A600F8AD70 /* GoogleTests.swift */; }; - DE1865B6245C95DA00F8AD70 /* Credentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1865B5245C95DA00F8AD70 /* Credentials.swift */; }; - DE1865B8245CC6FC00F8AD70 /* FacebookTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1865B7245CC6FC00F8AD70 /* FacebookTests.swift */; }; - DE800B4722A2F8AF00AC9A23 /* MainViewController+Custom.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B1122A2F8AF00AC9A23 /* MainViewController+Custom.m */; }; - DE800B4822A2F8AF00AC9A23 /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B1222A2F8AF00AC9A23 /* SettingsViewController.m */; }; - DE800B4922A2F8AF00AC9A23 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DE800B1322A2F8AF00AC9A23 /* MainViewController.xib */; }; - DE800B4A22A2F8AF00AC9A23 /* GoogleAuthProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B1422A2F8AF00AC9A23 /* GoogleAuthProvider.m */; }; - DE800B4B22A2F8AF00AC9A23 /* MainViewController+User.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B1822A2F8AF00AC9A23 /* MainViewController+User.m */; }; - DE800B4C22A2F8AF00AC9A23 /* MainViewController+GameCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B1922A2F8AF00AC9A23 /* MainViewController+GameCenter.m */; }; - DE800B4D22A2F8AF00AC9A23 /* MainViewController+Phone.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B1A22A2F8AF00AC9A23 /* MainViewController+Phone.m */; }; - DE800B4E22A2F8AF00AC9A23 /* UserTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B1B22A2F8AF00AC9A23 /* UserTableViewCell.m */; }; - DE800B4F22A2F8AF00AC9A23 /* MainViewController+Facebook.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B1C22A2F8AF00AC9A23 /* MainViewController+Facebook.m */; }; - DE800B5022A2F8AF00AC9A23 /* UIViewController+Alerts.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B2022A2F8AF00AC9A23 /* UIViewController+Alerts.m */; }; - DE800B5122A2F8AF00AC9A23 /* MainViewController+Email.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B2222A2F8AF00AC9A23 /* MainViewController+Email.m */; }; - DE800B5222A2F8AF00AC9A23 /* MainViewController+Auth.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B2322A2F8AF00AC9A23 /* MainViewController+Auth.m */; }; - DE800B5422A2F8AF00AC9A23 /* UserInfoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DE800B2822A2F8AF00AC9A23 /* UserInfoViewController.xib */; }; - DE800B5522A2F8AF00AC9A23 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B2922A2F8AF00AC9A23 /* MainViewController.m */; }; - DE800B5622A2F8AF00AC9A23 /* MainViewController+AutoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B2B22A2F8AF00AC9A23 /* MainViewController+AutoTests.m */; }; - DE800B5722A2F8AF00AC9A23 /* MainViewController+OOB.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B2C22A2F8AF00AC9A23 /* MainViewController+OOB.m */; }; - DE800B5822A2F8AF00AC9A23 /* AppManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B2D22A2F8AF00AC9A23 /* AppManager.m */; }; - DE800B5922A2F8AF00AC9A23 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B2E22A2F8AF00AC9A23 /* main.m */; }; - DE800B5A22A2F8AF00AC9A23 /* MainViewController+App.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B2F22A2F8AF00AC9A23 /* MainViewController+App.m */; }; - DE800B5B22A2F8AF00AC9A23 /* MainViewController+OAuth.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B3122A2F8AF00AC9A23 /* MainViewController+OAuth.m */; }; - DE800B5C22A2F8AF00AC9A23 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DE800B3222A2F8AF00AC9A23 /* Images.xcassets */; }; - DE800B5D22A2F8AF00AC9A23 /* UserInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B3422A2F8AF00AC9A23 /* UserInfoViewController.m */; }; - DE800B5E22A2F8AF00AC9A23 /* StaticContentTableViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B3622A2F8AF00AC9A23 /* StaticContentTableViewManager.m */; }; - DE800B5F22A2F8AF00AC9A23 /* MainViewController+Google.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B3922A2F8AF00AC9A23 /* MainViewController+Google.m */; }; - DE800B6022A2F8AF00AC9A23 /* FacebookAuthProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B3B22A2F8AF00AC9A23 /* FacebookAuthProvider.m */; }; - DE800B6122A2F8AF00AC9A23 /* ApplicationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B3C22A2F8AF00AC9A23 /* ApplicationDelegate.m */; }; - DE800B6222A2F8AF00AC9A23 /* CustomTokenDataEntryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B3D22A2F8AF00AC9A23 /* CustomTokenDataEntryViewController.m */; }; - DE800B6322A2F8AF00AC9A23 /* SettingsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DE800B4122A2F8AF00AC9A23 /* SettingsViewController.xib */; }; - DE800B6422A2F8AF00AC9A23 /* AuthProviders.m in Sources */ = {isa = PBXBuildFile; fileRef = DE800B4522A2F8AF00AC9A23 /* AuthProviders.m */; }; - DE800B6722A2FF7300AC9A23 /* GoogleService-Info_multi.plist in Resources */ = {isa = PBXBuildFile; fileRef = DE800B6522A2FF7300AC9A23 /* GoogleService-Info_multi.plist */; }; - DE800B6822A2FF7300AC9A23 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DE800B6622A2FF7300AC9A23 /* GoogleService-Info.plist */; }; - DEBEF60E245247A0005E1A8F /* AccountInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBEF60D245247A0005E1A8F /* AccountInfoTests.swift */; }; - DED400B0243E56F500BF6D56 /* FacebookAuthTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400A4243E56F500BF6D56 /* FacebookAuthTests.m */; }; - DED400B1243E56F500BF6D56 /* generate_refresh_token.sh in Resources */ = {isa = PBXBuildFile; fileRef = DED400A5243E56F500BF6D56 /* generate_refresh_token.sh */; }; - DED400B3243E56F500BF6D56 /* AnonymousAuthTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400A8243E56F500BF6D56 /* AnonymousAuthTests.m */; }; - DED400B5243E56F500BF6D56 /* AccountInfoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400AB243E56F500BF6D56 /* AccountInfoTests.m */; }; - DED400B6243E56F500BF6D56 /* EmailPasswordAuthTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400AC243E56F500BF6D56 /* EmailPasswordAuthTests.m */; }; - DED400B7243E56F500BF6D56 /* CustomAuthTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400AD243E56F500BF6D56 /* CustomAuthTests.m */; }; - DED400B8243E56F500BF6D56 /* GoogleAuthTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400AE243E56F500BF6D56 /* GoogleAuthTests.m */; }; - DED400B9243E56F500BF6D56 /* FIRAuthApiTestsBase.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400AF243E56F500BF6D56 /* FIRAuthApiTestsBase.m */; }; - DED400C1243E571500BF6D56 /* VerifyIOSClientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400BB243E571500BF6D56 /* VerifyIOSClientTests.m */; }; - DED400C2243E571500BF6D56 /* BYOAuthTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400BC243E571500BF6D56 /* BYOAuthTests.m */; }; - DED400C3243E571500BF6D56 /* FIRAuthE2eTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400BE243E571500BF6D56 /* FIRAuthE2eTests.m */; }; - DED400C4243E571500BF6D56 /* FIRAuthE2eTestsBase.m in Sources */ = {isa = PBXBuildFile; fileRef = DED400BF243E571500BF6D56 /* FIRAuthE2eTestsBase.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - DE800B7622A5927C00AC9A23 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DE800AEC22A2F87E00AC9A23 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE800AF322A2F87E00AC9A23; - remoteInfo = AuthSample; - }; - DE800B9A22A5BD1800AC9A23 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DE800AEC22A2F87E00AC9A23 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE800AF322A2F87E00AC9A23; - remoteInfo = AuthSample; - }; - DEBEF6082450EA27005E1A8F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DE800AEC22A2F87E00AC9A23 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DE800AF322A2F87E00AC9A23; - remoteInfo = AuthSample; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 400283E823EA254A0006A298 /* MainViewController+MultiFactor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+MultiFactor.h"; sourceTree = ""; }; - 400283E923EA254A0006A298 /* MainViewController+MultiFactor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+MultiFactor.m"; sourceTree = ""; }; - DE1865AB245B879B00F8AD70 /* TestsBase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestsBase.swift; sourceTree = ""; }; - DE1865AD245B8A1400F8AD70 /* AnonymousTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnonymousTests.swift; sourceTree = ""; }; - DE1865B1245C7A2B00F8AD70 /* EmailPasswordTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailPasswordTests.swift; sourceTree = ""; }; - DE1865B3245C92A600F8AD70 /* GoogleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoogleTests.swift; sourceTree = ""; }; - DE1865B5245C95DA00F8AD70 /* Credentials.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Credentials.swift; sourceTree = ""; }; - DE1865B7245CC6FC00F8AD70 /* FacebookTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FacebookTests.swift; sourceTree = ""; }; - DE800AF422A2F87E00AC9A23 /* AuthSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AuthSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DE800B0E22A2F8AF00AC9A23 /* AppManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppManager.h; sourceTree = ""; }; - DE800B0F22A2F8AF00AC9A23 /* MainViewController+AutoTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+AutoTests.h"; sourceTree = ""; }; - DE800B1022A2F8AF00AC9A23 /* MainViewController+OOB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+OOB.h"; sourceTree = ""; }; - DE800B1122A2F8AF00AC9A23 /* MainViewController+Custom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+Custom.m"; sourceTree = ""; }; - DE800B1222A2F8AF00AC9A23 /* SettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsViewController.m; sourceTree = ""; }; - DE800B1322A2F8AF00AC9A23 /* MainViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainViewController.xib; sourceTree = ""; }; - DE800B1422A2F8AF00AC9A23 /* GoogleAuthProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoogleAuthProvider.m; sourceTree = ""; }; - DE800B1522A2F8AF00AC9A23 /* UserInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInfoViewController.h; sourceTree = ""; }; - DE800B1622A2F8AF00AC9A23 /* MainViewController+OAuth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+OAuth.h"; sourceTree = ""; }; - DE800B1722A2F8AF00AC9A23 /* MainViewController+App.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+App.h"; sourceTree = ""; }; - DE800B1822A2F8AF00AC9A23 /* MainViewController+User.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+User.m"; sourceTree = ""; }; - DE800B1922A2F8AF00AC9A23 /* MainViewController+GameCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+GameCenter.m"; sourceTree = ""; }; - DE800B1A22A2F8AF00AC9A23 /* MainViewController+Phone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+Phone.m"; sourceTree = ""; }; - DE800B1B22A2F8AF00AC9A23 /* UserTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserTableViewCell.m; sourceTree = ""; }; - DE800B1C22A2F8AF00AC9A23 /* MainViewController+Facebook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+Facebook.m"; sourceTree = ""; }; - DE800B1D22A2F8AF00AC9A23 /* CustomTokenDataEntryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomTokenDataEntryViewController.h; sourceTree = ""; }; - DE800B1E22A2F8AF00AC9A23 /* FacebookAuthProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacebookAuthProvider.h; sourceTree = ""; }; - DE800B1F22A2F8AF00AC9A23 /* ApplicationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationDelegate.h; sourceTree = ""; }; - DE800B2022A2F8AF00AC9A23 /* UIViewController+Alerts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+Alerts.m"; sourceTree = ""; }; - DE800B2122A2F8AF00AC9A23 /* MainViewController+Google.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+Google.h"; sourceTree = ""; }; - DE800B2222A2F8AF00AC9A23 /* MainViewController+Email.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+Email.m"; sourceTree = ""; }; - DE800B2322A2F8AF00AC9A23 /* MainViewController+Auth.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+Auth.m"; sourceTree = ""; }; - DE800B2422A2F8AF00AC9A23 /* StaticContentTableViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticContentTableViewManager.h; sourceTree = ""; }; - DE800B2522A2F8AF00AC9A23 /* SampleTemplate.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = SampleTemplate.entitlements; sourceTree = ""; }; - DE800B2622A2F8AF00AC9A23 /* AuthProviders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthProviders.h; sourceTree = ""; }; - DE800B2722A2F8AF00AC9A23 /* ApplicationTemplate.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ApplicationTemplate.plist; sourceTree = ""; }; - DE800B2822A2F8AF00AC9A23 /* UserInfoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UserInfoViewController.xib; sourceTree = ""; }; - DE800B2922A2F8AF00AC9A23 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; - DE800B2A22A2F8AF00AC9A23 /* MainViewController+Custom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+Custom.h"; sourceTree = ""; }; - DE800B2B22A2F8AF00AC9A23 /* MainViewController+AutoTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+AutoTests.m"; sourceTree = ""; }; - DE800B2C22A2F8AF00AC9A23 /* MainViewController+OOB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+OOB.m"; sourceTree = ""; }; - DE800B2D22A2F8AF00AC9A23 /* AppManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppManager.m; sourceTree = ""; }; - DE800B2E22A2F8AF00AC9A23 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - DE800B2F22A2F8AF00AC9A23 /* MainViewController+App.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+App.m"; sourceTree = ""; }; - DE800B3022A2F8AF00AC9A23 /* MainViewController+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+Internal.h"; sourceTree = ""; }; - DE800B3122A2F8AF00AC9A23 /* MainViewController+OAuth.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+OAuth.m"; sourceTree = ""; }; - DE800B3222A2F8AF00AC9A23 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - DE800B3322A2F8AF00AC9A23 /* GoogleAuthProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoogleAuthProvider.h; sourceTree = ""; }; - DE800B3422A2F8AF00AC9A23 /* UserInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserInfoViewController.m; sourceTree = ""; }; - DE800B3522A2F8AF00AC9A23 /* SettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsViewController.h; sourceTree = ""; }; - DE800B3622A2F8AF00AC9A23 /* StaticContentTableViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StaticContentTableViewManager.m; sourceTree = ""; }; - DE800B3722A2F8AF00AC9A23 /* MainViewController+Email.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+Email.h"; sourceTree = ""; }; - DE800B3822A2F8AF00AC9A23 /* MainViewController+Auth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+Auth.h"; sourceTree = ""; }; - DE800B3922A2F8AF00AC9A23 /* MainViewController+Google.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MainViewController+Google.m"; sourceTree = ""; }; - DE800B3A22A2F8AF00AC9A23 /* UIViewController+Alerts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+Alerts.h"; sourceTree = ""; }; - DE800B3B22A2F8AF00AC9A23 /* FacebookAuthProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacebookAuthProvider.m; sourceTree = ""; }; - DE800B3C22A2F8AF00AC9A23 /* ApplicationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationDelegate.m; sourceTree = ""; }; - DE800B3D22A2F8AF00AC9A23 /* CustomTokenDataEntryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomTokenDataEntryViewController.m; sourceTree = ""; }; - DE800B3E22A2F8AF00AC9A23 /* MainViewController+Facebook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+Facebook.h"; sourceTree = ""; }; - DE800B3F22A2F8AF00AC9A23 /* MainViewController+Phone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+Phone.h"; sourceTree = ""; }; - DE800B4022A2F8AF00AC9A23 /* UserTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserTableViewCell.h; sourceTree = ""; }; - DE800B4122A2F8AF00AC9A23 /* SettingsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SettingsViewController.xib; sourceTree = ""; }; - DE800B4222A2F8AF00AC9A23 /* MainViewController+GameCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+GameCenter.h"; sourceTree = ""; }; - DE800B4322A2F8AF00AC9A23 /* MainViewController+User.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MainViewController+User.h"; sourceTree = ""; }; - DE800B4422A2F8AF00AC9A23 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; - DE800B4522A2F8AF00AC9A23 /* AuthProviders.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthProviders.m; sourceTree = ""; }; - DE800B4622A2F8AF00AC9A23 /* AuthCredentialsTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthCredentialsTemplate.h; sourceTree = ""; }; - DE800B6522A2FF7300AC9A23 /* GoogleService-Info_multi.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info_multi.plist"; sourceTree = ""; }; - DE800B6622A2FF7300AC9A23 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; - DE800B6922A2FF8700AC9A23 /* Application.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Application.plist; sourceTree = ""; }; - DE800B6A22A2FF8700AC9A23 /* Sample.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Sample.entitlements; sourceTree = ""; }; - DE800B6C22A2FFFF00AC9A23 /* AuthCredentials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthCredentials.h; sourceTree = ""; }; - DE800B7122A5927C00AC9A23 /* Auth_ApiTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Auth_ApiTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - DE800B9522A5BD1800AC9A23 /* Auth_E2eTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Auth_E2eTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - DEBEF6032450EA27005E1A8F /* SwiftApiTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftApiTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - DEBEF6072450EA27005E1A8F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DEBEF60D245247A0005E1A8F /* AccountInfoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountInfoTests.swift; sourceTree = ""; }; - DED400A3243E56F500BF6D56 /* AuthCredentials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthCredentials.h; sourceTree = ""; }; - DED400A4243E56F500BF6D56 /* FacebookAuthTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacebookAuthTests.m; sourceTree = ""; }; - DED400A5243E56F500BF6D56 /* generate_refresh_token.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = generate_refresh_token.sh; sourceTree = ""; }; - DED400A6243E56F500BF6D56 /* PhoneMultiFactorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhoneMultiFactorTests.swift; sourceTree = ""; }; - DED400A7243E56F500BF6D56 /* AuthCredentialsTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthCredentialsTemplate.h; sourceTree = ""; }; - DED400A8243E56F500BF6D56 /* AnonymousAuthTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnonymousAuthTests.m; sourceTree = ""; }; - DED400A9243E56F500BF6D56 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DED400AA243E56F500BF6D56 /* FIRAuthApiTestsBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FIRAuthApiTestsBase.h; sourceTree = ""; }; - DED400AB243E56F500BF6D56 /* AccountInfoTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AccountInfoTests.m; sourceTree = ""; }; - DED400AC243E56F500BF6D56 /* EmailPasswordAuthTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EmailPasswordAuthTests.m; sourceTree = ""; }; - DED400AD243E56F500BF6D56 /* CustomAuthTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomAuthTests.m; sourceTree = ""; }; - DED400AE243E56F500BF6D56 /* GoogleAuthTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoogleAuthTests.m; sourceTree = ""; }; - DED400AF243E56F500BF6D56 /* FIRAuthApiTestsBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FIRAuthApiTestsBase.m; sourceTree = ""; }; - DED400BA243E571500BF6D56 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DED400BB243E571500BF6D56 /* VerifyIOSClientTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VerifyIOSClientTests.m; sourceTree = ""; }; - DED400BC243E571500BF6D56 /* BYOAuthTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BYOAuthTests.m; sourceTree = ""; }; - DED400BD243E571500BF6D56 /* FIRAuthE2eTestsBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FIRAuthE2eTestsBase.h; sourceTree = ""; }; - DED400BE243E571500BF6D56 /* FIRAuthE2eTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FIRAuthE2eTests.m; sourceTree = ""; }; - DED400BF243E571500BF6D56 /* FIRAuthE2eTestsBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FIRAuthE2eTestsBase.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - DE800AF122A2F87E00AC9A23 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE800B6E22A5927C00AC9A23 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE800B9222A5BD1800AC9A23 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DEBEF6002450EA27005E1A8F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - DE800AEB22A2F87E00AC9A23 = { - isa = PBXGroup; - children = ( - DE800B0D22A2F8AF00AC9A23 /* Sample */, - DE800B7222A5927C00AC9A23 /* Auth_ApiTests */, - DE800B9622A5BD1800AC9A23 /* E2eTests */, - DEBEF6042450EA27005E1A8F /* SwiftApiTests */, - DE800AF522A2F87E00AC9A23 /* Products */, - ); - sourceTree = ""; - }; - DE800AF522A2F87E00AC9A23 /* Products */ = { - isa = PBXGroup; - children = ( - DE800AF422A2F87E00AC9A23 /* AuthSample.app */, - DE800B7122A5927C00AC9A23 /* Auth_ApiTests.xctest */, - DE800B9522A5BD1800AC9A23 /* Auth_E2eTests.xctest */, - DEBEF6032450EA27005E1A8F /* SwiftApiTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - DE800B0D22A2F8AF00AC9A23 /* Sample */ = { - isa = PBXGroup; - children = ( - DE800B6922A2FF8700AC9A23 /* Application.plist */, - DE800B1F22A2F8AF00AC9A23 /* ApplicationDelegate.h */, - DE800B3C22A2F8AF00AC9A23 /* ApplicationDelegate.m */, - DE800B2722A2F8AF00AC9A23 /* ApplicationTemplate.plist */, - DE800B0E22A2F8AF00AC9A23 /* AppManager.h */, - DE800B2D22A2F8AF00AC9A23 /* AppManager.m */, - DE800B6C22A2FFFF00AC9A23 /* AuthCredentials.h */, - DE800B4622A2F8AF00AC9A23 /* AuthCredentialsTemplate.h */, - DE800B2622A2F8AF00AC9A23 /* AuthProviders.h */, - DE800B4522A2F8AF00AC9A23 /* AuthProviders.m */, - DE800B1D22A2F8AF00AC9A23 /* CustomTokenDataEntryViewController.h */, - DE800B3D22A2F8AF00AC9A23 /* CustomTokenDataEntryViewController.m */, - DE800B1E22A2F8AF00AC9A23 /* FacebookAuthProvider.h */, - DE800B3B22A2F8AF00AC9A23 /* FacebookAuthProvider.m */, - DE800B3322A2F8AF00AC9A23 /* GoogleAuthProvider.h */, - DE800B1422A2F8AF00AC9A23 /* GoogleAuthProvider.m */, - DE800B6522A2FF7300AC9A23 /* GoogleService-Info_multi.plist */, - DE800B6622A2FF7300AC9A23 /* GoogleService-Info.plist */, - DE800B3222A2F8AF00AC9A23 /* Images.xcassets */, - DE800B2E22A2F8AF00AC9A23 /* main.m */, - DE800B4422A2F8AF00AC9A23 /* MainViewController.h */, - DE800B2922A2F8AF00AC9A23 /* MainViewController.m */, - DE800B1322A2F8AF00AC9A23 /* MainViewController.xib */, - DE800B1722A2F8AF00AC9A23 /* MainViewController+App.h */, - DE800B2F22A2F8AF00AC9A23 /* MainViewController+App.m */, - DE800B3822A2F8AF00AC9A23 /* MainViewController+Auth.h */, - DE800B2322A2F8AF00AC9A23 /* MainViewController+Auth.m */, - DE800B0F22A2F8AF00AC9A23 /* MainViewController+AutoTests.h */, - DE800B2B22A2F8AF00AC9A23 /* MainViewController+AutoTests.m */, - DE800B2A22A2F8AF00AC9A23 /* MainViewController+Custom.h */, - DE800B1122A2F8AF00AC9A23 /* MainViewController+Custom.m */, - DE800B3722A2F8AF00AC9A23 /* MainViewController+Email.h */, - DE800B2222A2F8AF00AC9A23 /* MainViewController+Email.m */, - DE800B3E22A2F8AF00AC9A23 /* MainViewController+Facebook.h */, - DE800B1C22A2F8AF00AC9A23 /* MainViewController+Facebook.m */, - DE800B4222A2F8AF00AC9A23 /* MainViewController+GameCenter.h */, - DE800B1922A2F8AF00AC9A23 /* MainViewController+GameCenter.m */, - DE800B2122A2F8AF00AC9A23 /* MainViewController+Google.h */, - DE800B3922A2F8AF00AC9A23 /* MainViewController+Google.m */, - DE800B3022A2F8AF00AC9A23 /* MainViewController+Internal.h */, - 400283E823EA254A0006A298 /* MainViewController+MultiFactor.h */, - 400283E923EA254A0006A298 /* MainViewController+MultiFactor.m */, - DE800B1622A2F8AF00AC9A23 /* MainViewController+OAuth.h */, - DE800B3122A2F8AF00AC9A23 /* MainViewController+OAuth.m */, - DE800B1022A2F8AF00AC9A23 /* MainViewController+OOB.h */, - DE800B2C22A2F8AF00AC9A23 /* MainViewController+OOB.m */, - DE800B3F22A2F8AF00AC9A23 /* MainViewController+Phone.h */, - DE800B1A22A2F8AF00AC9A23 /* MainViewController+Phone.m */, - DE800B4322A2F8AF00AC9A23 /* MainViewController+User.h */, - DE800B1822A2F8AF00AC9A23 /* MainViewController+User.m */, - DE800B6A22A2FF8700AC9A23 /* Sample.entitlements */, - DE800B2522A2F8AF00AC9A23 /* SampleTemplate.entitlements */, - DE800B3522A2F8AF00AC9A23 /* SettingsViewController.h */, - DE800B1222A2F8AF00AC9A23 /* SettingsViewController.m */, - DE800B4122A2F8AF00AC9A23 /* SettingsViewController.xib */, - DE800B2422A2F8AF00AC9A23 /* StaticContentTableViewManager.h */, - DE800B3622A2F8AF00AC9A23 /* StaticContentTableViewManager.m */, - DE800B3A22A2F8AF00AC9A23 /* UIViewController+Alerts.h */, - DE800B2022A2F8AF00AC9A23 /* UIViewController+Alerts.m */, - DE800B1522A2F8AF00AC9A23 /* UserInfoViewController.h */, - DE800B3422A2F8AF00AC9A23 /* UserInfoViewController.m */, - DE800B2822A2F8AF00AC9A23 /* UserInfoViewController.xib */, - DE800B4022A2F8AF00AC9A23 /* UserTableViewCell.h */, - DE800B1B22A2F8AF00AC9A23 /* UserTableViewCell.m */, - ); - path = Sample; - sourceTree = SOURCE_ROOT; - }; - DE800B7222A5927C00AC9A23 /* Auth_ApiTests */ = { - isa = PBXGroup; - children = ( - DED400AB243E56F500BF6D56 /* AccountInfoTests.m */, - DED400A8243E56F500BF6D56 /* AnonymousAuthTests.m */, - DED400A3243E56F500BF6D56 /* AuthCredentials.h */, - DED400A7243E56F500BF6D56 /* AuthCredentialsTemplate.h */, - DED400AD243E56F500BF6D56 /* CustomAuthTests.m */, - DED400AC243E56F500BF6D56 /* EmailPasswordAuthTests.m */, - DED400A4243E56F500BF6D56 /* FacebookAuthTests.m */, - DED400AA243E56F500BF6D56 /* FIRAuthApiTestsBase.h */, - DED400AF243E56F500BF6D56 /* FIRAuthApiTestsBase.m */, - DED400A5243E56F500BF6D56 /* generate_refresh_token.sh */, - DED400AE243E56F500BF6D56 /* GoogleAuthTests.m */, - DED400A9243E56F500BF6D56 /* Info.plist */, - DED400A6243E56F500BF6D56 /* PhoneMultiFactorTests.swift */, - ); - name = Auth_ApiTests; - path = ApiTests; - sourceTree = SOURCE_ROOT; - }; - DE800B9622A5BD1800AC9A23 /* E2eTests */ = { - isa = PBXGroup; - children = ( - DED400BC243E571500BF6D56 /* BYOAuthTests.m */, - DED400BE243E571500BF6D56 /* FIRAuthE2eTests.m */, - DED400BD243E571500BF6D56 /* FIRAuthE2eTestsBase.h */, - DED400BF243E571500BF6D56 /* FIRAuthE2eTestsBase.m */, - DED400BA243E571500BF6D56 /* Info.plist */, - DED400BB243E571500BF6D56 /* VerifyIOSClientTests.m */, - ); - path = E2eTests; - sourceTree = SOURCE_ROOT; - }; - DEBEF6042450EA27005E1A8F /* SwiftApiTests */ = { - isa = PBXGroup; - children = ( - DEBEF6072450EA27005E1A8F /* Info.plist */, - DEBEF60D245247A0005E1A8F /* AccountInfoTests.swift */, - DE1865AB245B879B00F8AD70 /* TestsBase.swift */, - DE1865AD245B8A1400F8AD70 /* AnonymousTests.swift */, - DE1865B1245C7A2B00F8AD70 /* EmailPasswordTests.swift */, - DE1865B3245C92A600F8AD70 /* GoogleTests.swift */, - DE1865B5245C95DA00F8AD70 /* Credentials.swift */, - DE1865B7245CC6FC00F8AD70 /* FacebookTests.swift */, - ); - path = SwiftApiTests; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - DE800AF322A2F87E00AC9A23 /* AuthSample */ = { - isa = PBXNativeTarget; - buildConfigurationList = DE800B0A22A2F88000AC9A23 /* Build configuration list for PBXNativeTarget "AuthSample" */; - buildPhases = ( - DE800AF022A2F87E00AC9A23 /* Sources */, - DE800AF122A2F87E00AC9A23 /* Frameworks */, - DE800AF222A2F87E00AC9A23 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = AuthSample; - productName = AuthSample; - productReference = DE800AF422A2F87E00AC9A23 /* AuthSample.app */; - productType = "com.apple.product-type.application"; - }; - DE800B7022A5927C00AC9A23 /* Auth_ApiTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = DE800B7A22A5927C00AC9A23 /* Build configuration list for PBXNativeTarget "Auth_ApiTests" */; - buildPhases = ( - DE800B6D22A5927C00AC9A23 /* Sources */, - DE800B6E22A5927C00AC9A23 /* Frameworks */, - DE800B6F22A5927C00AC9A23 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DE800B7722A5927C00AC9A23 /* PBXTargetDependency */, - ); - name = Auth_ApiTests; - productName = Auth_ApiTests; - productReference = DE800B7122A5927C00AC9A23 /* Auth_ApiTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - DE800B9422A5BD1800AC9A23 /* Auth_E2eTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = DE800B9C22A5BD1800AC9A23 /* Build configuration list for PBXNativeTarget "Auth_E2eTests" */; - buildPhases = ( - DE800B9122A5BD1800AC9A23 /* Sources */, - DE800B9222A5BD1800AC9A23 /* Frameworks */, - DE800B9322A5BD1800AC9A23 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DE800B9B22A5BD1800AC9A23 /* PBXTargetDependency */, - ); - name = Auth_E2eTests; - productName = Auth_E2eTests; - productReference = DE800B9522A5BD1800AC9A23 /* Auth_E2eTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - DEBEF6022450EA27005E1A8F /* SwiftApiTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = DEBEF60A2450EA27005E1A8F /* Build configuration list for PBXNativeTarget "SwiftApiTests" */; - buildPhases = ( - DEBEF5FF2450EA27005E1A8F /* Sources */, - DEBEF6002450EA27005E1A8F /* Frameworks */, - DEBEF6012450EA27005E1A8F /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DEBEF6092450EA27005E1A8F /* PBXTargetDependency */, - ); - name = SwiftApiTests; - productName = SwiftApiTests; - productReference = DEBEF6032450EA27005E1A8F /* SwiftApiTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - DE800AEC22A2F87E00AC9A23 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 1140; - LastUpgradeCheck = 1020; - ORGANIZATIONNAME = Firebase; - TargetAttributes = { - DE800AF322A2F87E00AC9A23 = { - CreatedOnToolsVersion = 10.2; - LastSwiftMigration = 1140; - }; - DE800B7022A5927C00AC9A23 = { - CreatedOnToolsVersion = 10.2; - LastSwiftMigration = 1020; - TestTargetID = DE800AF322A2F87E00AC9A23; - }; - DE800B9422A5BD1800AC9A23 = { - CreatedOnToolsVersion = 10.2; - TestTargetID = DE800AF322A2F87E00AC9A23; - }; - DEBEF6022450EA27005E1A8F = { - CreatedOnToolsVersion = 11.4.1; - TestTargetID = DE800AF322A2F87E00AC9A23; - }; - }; - }; - buildConfigurationList = DE800AEF22A2F87E00AC9A23 /* Build configuration list for PBXProject "AuthSample" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = DE800AEB22A2F87E00AC9A23; - productRefGroup = DE800AF522A2F87E00AC9A23 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - DE800AF322A2F87E00AC9A23 /* AuthSample */, - DE800B7022A5927C00AC9A23 /* Auth_ApiTests */, - DE800B9422A5BD1800AC9A23 /* Auth_E2eTests */, - DEBEF6022450EA27005E1A8F /* SwiftApiTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - DE800AF222A2F87E00AC9A23 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE800B5422A2F8AF00AC9A23 /* UserInfoViewController.xib in Resources */, - DE800B5C22A2F8AF00AC9A23 /* Images.xcassets in Resources */, - DE800B4922A2F8AF00AC9A23 /* MainViewController.xib in Resources */, - DE800B6722A2FF7300AC9A23 /* GoogleService-Info_multi.plist in Resources */, - DE800B6322A2F8AF00AC9A23 /* SettingsViewController.xib in Resources */, - DE800B6822A2FF7300AC9A23 /* GoogleService-Info.plist in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE800B6F22A5927C00AC9A23 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DED400B1243E56F500BF6D56 /* generate_refresh_token.sh in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE800B9322A5BD1800AC9A23 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DEBEF6012450EA27005E1A8F /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - DE800AF022A2F87E00AC9A23 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE800B5722A2F8AF00AC9A23 /* MainViewController+OOB.m in Sources */, - DE800B4E22A2F8AF00AC9A23 /* UserTableViewCell.m in Sources */, - DE800B6422A2F8AF00AC9A23 /* AuthProviders.m in Sources */, - DE800B4F22A2F8AF00AC9A23 /* MainViewController+Facebook.m in Sources */, - DE800B4D22A2F8AF00AC9A23 /* MainViewController+Phone.m in Sources */, - DE800B4722A2F8AF00AC9A23 /* MainViewController+Custom.m in Sources */, - 400283EA23EA254B0006A298 /* MainViewController+MultiFactor.m in Sources */, - DE800B5A22A2F8AF00AC9A23 /* MainViewController+App.m in Sources */, - DE800B6222A2F8AF00AC9A23 /* CustomTokenDataEntryViewController.m in Sources */, - DE800B6122A2F8AF00AC9A23 /* ApplicationDelegate.m in Sources */, - DE800B4A22A2F8AF00AC9A23 /* GoogleAuthProvider.m in Sources */, - DE800B5B22A2F8AF00AC9A23 /* MainViewController+OAuth.m in Sources */, - DE800B6022A2F8AF00AC9A23 /* FacebookAuthProvider.m in Sources */, - DE800B5922A2F8AF00AC9A23 /* main.m in Sources */, - DE800B5222A2F8AF00AC9A23 /* MainViewController+Auth.m in Sources */, - DE800B5F22A2F8AF00AC9A23 /* MainViewController+Google.m in Sources */, - DE800B5D22A2F8AF00AC9A23 /* UserInfoViewController.m in Sources */, - DE800B4B22A2F8AF00AC9A23 /* MainViewController+User.m in Sources */, - DE800B5522A2F8AF00AC9A23 /* MainViewController.m in Sources */, - DE800B5122A2F8AF00AC9A23 /* MainViewController+Email.m in Sources */, - DE800B5022A2F8AF00AC9A23 /* UIViewController+Alerts.m in Sources */, - DE800B5E22A2F8AF00AC9A23 /* StaticContentTableViewManager.m in Sources */, - DE800B4C22A2F8AF00AC9A23 /* MainViewController+GameCenter.m in Sources */, - DE800B4822A2F8AF00AC9A23 /* SettingsViewController.m in Sources */, - DE800B5622A2F8AF00AC9A23 /* MainViewController+AutoTests.m in Sources */, - DE800B5822A2F8AF00AC9A23 /* AppManager.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE800B6D22A5927C00AC9A23 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DED400B0243E56F500BF6D56 /* FacebookAuthTests.m in Sources */, - DED400B5243E56F500BF6D56 /* AccountInfoTests.m in Sources */, - DED400B6243E56F500BF6D56 /* EmailPasswordAuthTests.m in Sources */, - DED400B9243E56F500BF6D56 /* FIRAuthApiTestsBase.m in Sources */, - DED400B3243E56F500BF6D56 /* AnonymousAuthTests.m in Sources */, - DED400B7243E56F500BF6D56 /* CustomAuthTests.m in Sources */, - DED400B8243E56F500BF6D56 /* GoogleAuthTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DE800B9122A5BD1800AC9A23 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DED400C2243E571500BF6D56 /* BYOAuthTests.m in Sources */, - DED400C4243E571500BF6D56 /* FIRAuthE2eTestsBase.m in Sources */, - DED400C1243E571500BF6D56 /* VerifyIOSClientTests.m in Sources */, - DED400C3243E571500BF6D56 /* FIRAuthE2eTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DEBEF5FF2450EA27005E1A8F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DE1865B4245C92A600F8AD70 /* GoogleTests.swift in Sources */, - DE1865AE245B8A1400F8AD70 /* AnonymousTests.swift in Sources */, - DE1865B8245CC6FC00F8AD70 /* FacebookTests.swift in Sources */, - DE1865B6245C95DA00F8AD70 /* Credentials.swift in Sources */, - DE1865B2245C7A2B00F8AD70 /* EmailPasswordTests.swift in Sources */, - DE1865AC245B879B00F8AD70 /* TestsBase.swift in Sources */, - DEBEF60E245247A0005E1A8F /* AccountInfoTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - DE800B7722A5927C00AC9A23 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE800AF322A2F87E00AC9A23 /* AuthSample */; - targetProxy = DE800B7622A5927C00AC9A23 /* PBXContainerItemProxy */; - }; - DE800B9B22A5BD1800AC9A23 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE800AF322A2F87E00AC9A23 /* AuthSample */; - targetProxy = DE800B9A22A5BD1800AC9A23 /* PBXContainerItemProxy */; - }; - DEBEF6092450EA27005E1A8F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DE800AF322A2F87E00AC9A23 /* AuthSample */; - targetProxy = DEBEF6082450EA27005E1A8F /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - DE800B0822A2F88000AC9A23 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - DE800B0922A2F88000AC9A23 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - DE800B0B22A2F88000AC9A23 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Sample/Sample.entitlements; - CODE_SIGN_STYLE = Automatic; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "${SRCROOT}/../../..", - ); - INFOPLIST_FILE = Sample/Application.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.google.FirebaseExperimental1; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - DE800B0C22A2F88000AC9A23 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Sample/Sample.entitlements; - CODE_SIGN_STYLE = Automatic; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "${SRCROOT}/../../..", - ); - INFOPLIST_FILE = Sample/Application.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.google.FirebaseExperimental1; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - DE800B7822A5927C00AC9A23 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = ApiTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.firebase.auth.Auth-ApiTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "../ApiTests/Auth_ApiTests-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AuthSample.app/AuthSample"; - }; - name = Debug; - }; - DE800B7922A5927C00AC9A23 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = ApiTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.firebase.auth.Auth-ApiTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "../ApiTests/Auth_ApiTests-Bridging-Header.h"; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AuthSample.app/AuthSample"; - }; - name = Release; - }; - DE800B9D22A5BD1800AC9A23 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = E2eTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.firebase.auth.Auth-E2eTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AuthSample.app/AuthSample"; - }; - name = Debug; - }; - DE800B9E22A5BD1800AC9A23 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = E2eTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.google.firebase.auth.Auth-E2eTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AuthSample.app/AuthSample"; - }; - name = Release; - }; - DEBEF60B2450EA27005E1A8F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = SwiftApiTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.SwiftApiTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AuthSample.app/AuthSample"; - }; - name = Debug; - }; - DEBEF60C2450EA27005E1A8F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = SwiftApiTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.SwiftApiTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AuthSample.app/AuthSample"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - DE800AEF22A2F87E00AC9A23 /* Build configuration list for PBXProject "AuthSample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DE800B0822A2F88000AC9A23 /* Debug */, - DE800B0922A2F88000AC9A23 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DE800B0A22A2F88000AC9A23 /* Build configuration list for PBXNativeTarget "AuthSample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DE800B0B22A2F88000AC9A23 /* Debug */, - DE800B0C22A2F88000AC9A23 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DE800B7A22A5927C00AC9A23 /* Build configuration list for PBXNativeTarget "Auth_ApiTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DE800B7822A5927C00AC9A23 /* Debug */, - DE800B7922A5927C00AC9A23 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DE800B9C22A5BD1800AC9A23 /* Build configuration list for PBXNativeTarget "Auth_E2eTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DE800B9D22A5BD1800AC9A23 /* Debug */, - DE800B9E22A5BD1800AC9A23 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DEBEF60A2450EA27005E1A8F /* Build configuration list for PBXNativeTarget "SwiftApiTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DEBEF60B2450EA27005E1A8F /* Debug */, - DEBEF60C2450EA27005E1A8F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = DE800AEC22A2F87E00AC9A23 /* Project object */; -} diff --git a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/AuthSample.xcscheme b/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/AuthSample.xcscheme deleted file mode 100644 index adb5894e740..00000000000 --- a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/AuthSample.xcscheme +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/Auth_ApiTests.xcscheme b/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/Auth_ApiTests.xcscheme deleted file mode 100644 index 0579a0247ed..00000000000 --- a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/Auth_ApiTests.xcscheme +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/Auth_E2eTests.xcscheme b/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/Auth_E2eTests.xcscheme deleted file mode 100644 index 8a72476098b..00000000000 --- a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/Auth_E2eTests.xcscheme +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/SwiftApiTests.xcscheme b/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/SwiftApiTests.xcscheme deleted file mode 100644 index 5bbc32956aa..00000000000 --- a/FirebaseAuth/Tests/Sample/AuthSample.xcodeproj/xcshareddata/xcschemes/SwiftApiTests.xcscheme +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FirebaseAuth/Tests/Sample/E2eTests/BYOAuthTests.m b/FirebaseAuth/Tests/Sample/E2eTests/BYOAuthTests.m deleted file mode 100644 index dbe71266b81..00000000000 --- a/FirebaseAuth/Tests/Sample/E2eTests/BYOAuthTests.m +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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 "FIRAuthE2eTestsBase.h" - -/** The url for obtaining a valid custom token string used to test BYOAuth. */ -static NSString *const kCustomTokenUrl = @"https://gcip-testapps.wl.r.appspot.com/token"; - -/** The invalid custom token string for testing BYOAuth. */ -static NSString *const kInvalidCustomToken = @"invalid token."; - -/** The user name string for BYOAuth testing account. */ -static NSString *const kTestingAccountUserID = @"BYU_Test_User_ID"; - -@interface BYOAuthTests : FIRAuthE2eTestsBase - -@end - -@implementation BYOAuthTests - -/** Test sign in with a valid BYOAuth token retrived from a remote server. */ -- (void)testSignInWithValidBYOAuthToken { - NSError *error; - NSString *customToken = [NSString stringWithContentsOfURL:[NSURL URLWithString:kCustomTokenUrl] - encoding:NSUTF8StringEncoding - error:&error]; - if (!customToken) { - GREYFail(@"There was an error retrieving the custom token: %@", error); - } - - [[[EarlGrey selectElementWithMatcher:grey_allOf(grey_text(@"Sign In (BYOAuth)"), - grey_sufficientlyVisible(), nil)] - usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, kShortScrollDistance) - onElementWithMatcher:grey_allOf(grey_scrollView(), grey_kindOfClass([UITableView class]), - nil)] performAction:grey_tap()]; - - [[[EarlGrey selectElementWithMatcher:grey_kindOfClass([UITextView class])] - performAction:grey_replaceText(customToken)] assertWithMatcher:grey_text(customToken)]; - - [[EarlGrey selectElementWithMatcher:grey_text(@"Done")] performAction:grey_tap()]; - - [self waitForElementWithText:@"OK" withDelay:kWaitForElementTimeOut]; - - [[EarlGrey selectElementWithMatcher:grey_text(@"OK")] performAction:grey_tap()]; - - [[[EarlGrey selectElementWithMatcher:grey_allOf(grey_text(kTestingAccountUserID), - grey_sufficientlyVisible(), nil)] - usingSearchAction:grey_scrollInDirection(kGREYDirectionUp, kShortScrollDistance) - onElementWithMatcher:grey_allOf(grey_scrollView(), grey_kindOfClass([UITableView class]), - nil)] assertWithMatcher:grey_sufficientlyVisible()]; -} - -- (void)testSignInWithInvalidBYOAuthToken { - [[[EarlGrey selectElementWithMatcher:grey_allOf(grey_text(@"Sign In (BYOAuth)"), - grey_sufficientlyVisible(), nil)] - usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, kShortScrollDistance) - onElementWithMatcher:grey_allOf(grey_scrollView(), grey_kindOfClass([UITableView class]), - nil)] performAction:grey_tap()]; - - [[[EarlGrey selectElementWithMatcher:grey_kindOfClass([UITextView class])] - performAction:grey_replaceText(kInvalidCustomToken)] - assertWithMatcher:grey_text(kInvalidCustomToken)]; - - [[EarlGrey selectElementWithMatcher:grey_text(@"Done")] performAction:grey_tap()]; - - NSString *invalidTokenErrorMessage = @"Sign-In Error"; - - [self waitForElementWithText:invalidTokenErrorMessage withDelay:kWaitForElementTimeOut]; - - [[EarlGrey selectElementWithMatcher:grey_text(@"OK")] performAction:grey_tap()]; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/E2eTests/FIRAuthE2eTests.m b/FirebaseAuth/Tests/Sample/E2eTests/FIRAuthE2eTests.m deleted file mode 100644 index 50512f53699..00000000000 --- a/FirebaseAuth/Tests/Sample/E2eTests/FIRAuthE2eTests.m +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 "FIRAuthE2eTestsBase.h" - -@interface FIRAuthE2eTests : FIRAuthE2eTestsBase - -@end - -@implementation FIRAuthE2eTests - -- (void)testSignInExistingUser { - NSString *email = @"123@abc.com"; - [[[EarlGrey selectElementWithMatcher:grey_allOf(grey_text(@"Sign in with Email/Password"), - grey_sufficientlyVisible(), nil)] - usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, kShortScrollDistance) - onElementWithMatcher:grey_allOf(grey_scrollView(), grey_kindOfClass([UITableView class]), - nil)] performAction:grey_tap()]; - - id comfirmationButtonMatcher = - grey_allOf(grey_kindOfClass([UILabel class]), grey_accessibilityLabel(@"OK"), nil); - - [[EarlGrey selectElementWithMatcher: - // TODO: Add accessibilityIdentifiers for the elements. - grey_kindOfClass(NSClassFromString(@"_UIAlertControllerView"))] - performAction:grey_typeText(email)]; - - [[EarlGrey selectElementWithMatcher:comfirmationButtonMatcher] performAction:grey_tap()]; - - [[EarlGrey - selectElementWithMatcher:grey_kindOfClass(NSClassFromString(@"_UIAlertControllerView"))] - performAction:grey_typeText(@"password")]; - - [[EarlGrey selectElementWithMatcher:comfirmationButtonMatcher] performAction:grey_tap()]; - - [[[EarlGrey - selectElementWithMatcher:grey_allOf(grey_text(email), grey_sufficientlyVisible(), nil)] - usingSearchAction:grey_scrollInDirection(kGREYDirectionUp, kShortScrollDistance) - onElementWithMatcher:grey_allOf(grey_scrollView(), grey_kindOfClass([UITableView class]), - nil)] assertWithMatcher:grey_sufficientlyVisible()]; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/E2eTests/FIRAuthE2eTestsBase.h b/FirebaseAuth/Tests/Sample/E2eTests/FIRAuthE2eTestsBase.h deleted file mode 100644 index 5c25b0d1194..00000000000 --- a/FirebaseAuth/Tests/Sample/E2eTests/FIRAuthE2eTestsBase.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -extern CGFloat const kShortScrollDistance; - -extern NSTimeInterval const kWaitForElementTimeOut; - -/** Convenience function for EarlGrey tests. */ -id grey_scrollView(void); - -@interface FIRAuthE2eTestsBase : XCTestCase - -/** Sign out current account. */ -- (void)signOut; - -/** Wait for an element with text to appear. */ -- (void)waitForElementWithText:(NSString *)text withDelay:(NSTimeInterval)maxDelay; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/E2eTests/FIRAuthE2eTestsBase.m b/FirebaseAuth/Tests/Sample/E2eTests/FIRAuthE2eTestsBase.m deleted file mode 100644 index 08fc7be79f8..00000000000 --- a/FirebaseAuth/Tests/Sample/E2eTests/FIRAuthE2eTestsBase.m +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 "FIRAuthE2eTestsBase.h" - -CGFloat const kShortScrollDistance = 400; - -NSTimeInterval const kWaitForElementTimeOut = 15; - -/** Convenience function for EarlGrey tests. */ -id grey_scrollView(void) { - return [GREYMatchers matcherForKindOfClass:[UIScrollView class]]; -} - -@implementation FIRAuthE2eTestsBase - -/** To reset the app so that each test sees the app in a clean state. */ -- (void)setUp { - [super setUp]; - - [self signOut]; - - [[EarlGrey selectElementWithMatcher:grey_allOf(grey_scrollView(), - grey_kindOfClass([UITableView class]), nil)] - performAction:grey_scrollToContentEdge(kGREYContentEdgeTop)]; -} - -- (void)tearDown { - [super tearDown]; -} - -/** Sign out current account. */ -- (void)signOut { - NSError *signOutError; - BOOL status = [[FIRAuth auth] signOut:&signOutError]; - - // Just log the error because we don't want to fail the test if signing out fails. - if (!status) { - NSLog(@"Error signing out: %@", signOutError); - } -} - -/** Wait for an element with text to appear. */ -- (void)waitForElementWithText:(NSString *)text withDelay:(NSTimeInterval)maxDelay { - GREYCondition *displayed = - [GREYCondition conditionWithName:@"Wait for element" - block:^BOOL { - NSError *error = nil; - [[EarlGrey selectElementWithMatcher:grey_text(text)] - assertWithMatcher:grey_sufficientlyVisible() - error:&error]; - return !error; - }]; - GREYAssertTrue([displayed waitWithTimeout:maxDelay], @"Failed to wait for element '%@'.", text); -} - -@end diff --git a/FirebaseAuth/Tests/Sample/E2eTests/Info.plist b/FirebaseAuth/Tests/Sample/E2eTests/Info.plist deleted file mode 100644 index 6c6c23c43ad..00000000000 --- a/FirebaseAuth/Tests/Sample/E2eTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/FirebaseAuth/Tests/Sample/E2eTests/VerifyIOSClientTests.m b/FirebaseAuth/Tests/Sample/E2eTests/VerifyIOSClientTests.m deleted file mode 100644 index 131a56430de..00000000000 --- a/FirebaseAuth/Tests/Sample/E2eTests/VerifyIOSClientTests.m +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 "FIRAuthE2eTestsBase.h" - -@interface VerifyIOSClientTests : FIRAuthE2eTestsBase - -@end - -@implementation VerifyIOSClientTests - -/** Test verify ios client*/ -- (void)testVerifyIOSClient { - [[[EarlGrey selectElementWithMatcher:grey_allOf(grey_text(@"Verify iOS client"), - grey_sufficientlyVisible(), nil)] - usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, kShortScrollDistance) - onElementWithMatcher:grey_allOf(grey_scrollView(), grey_kindOfClass([UITableView class]), - nil)] performAction:grey_tap()]; - - [self waitForElementWithText:@"OK" withDelay:kWaitForElementTimeOut]; - - [[EarlGrey selectElementWithMatcher:grey_text(@"OK")] performAction:grey_tap()]; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Podfile b/FirebaseAuth/Tests/Sample/Podfile deleted file mode 100644 index 75c10d0b260..00000000000 --- a/FirebaseAuth/Tests/Sample/Podfile +++ /dev/null @@ -1,36 +0,0 @@ -# Uncomment the next two lines for pre-release testing on internal repo -#source 'sso://cpdc-internal/firebase' -#source 'https://cdn.cocoapods.org/' - -source 'https://github.com/firebase/SpecsDev.git' -source 'https://github.com/firebase/SpecsStaging.git' -source 'https://cdn.cocoapods.org/' - -use_frameworks! - -target 'AuthSample' do - platform :ios, '13.0' - pod 'FirebaseAppCheckInterop', :path => '../../../' - pod 'FirebaseCore', :path => '../../../' - pod 'FirebaseCoreInternal', :path => '../../../' - pod 'FirebaseCoreExtension', :path => '../../../' - pod 'FirebaseAuth', :path => '../../../', :testspecs => ['unit'] - pod 'FirebaseInstallations', :path => '../../..' - pod 'FBSDKLoginKit', '< 13' - pod 'GoogleSignIn', '~> 6' - pod 'GTMSessionFetcher/Core' - pod 'RecaptchaEnterprise', '~> 18.3' - - target 'Auth_ApiTests' do - inherit! :search_paths - end - - target 'SwiftApiTests' do - inherit! :search_paths - end - - target 'Auth_E2eTests' do - inherit! :search_paths - pod 'EarlGrey' - end -end diff --git a/FirebaseAuth/Tests/Sample/README.md b/FirebaseAuth/Tests/Sample/README.md deleted file mode 100644 index 808f1567629..00000000000 --- a/FirebaseAuth/Tests/Sample/README.md +++ /dev/null @@ -1,90 +0,0 @@ -### Running Sample Application - -In order to run this application, you'll need to follow the following steps! - -#### GoogleService-Info.plist files - -You'll need valid `GoogleService-Info.plist` files for those samples. To get your own -`GoogleService-Info.plist` files: -1. Go to the [Firebase Console](https://console.firebase.google.com/) -2. Create a new Firebase project, if you don't already have one -3. For each sample app you want to test, create a new Firebase app with the sample app's bundle -identifier (e.g. `com.google.FirebaseExperimental1.dev`) -4. Download the resulting `GoogleService-Info.plist` and place it in the -[`Sample/` directory](Sample/) - -#### GoogleService-Info\_multi.plist files - -1. Create a second sample app and download its `GoogleService_Info.plist` file. This can be in the -same Firebase project as the one above, or a different one. Use a different app bundle identifier -(e.g. `com.google.FirebaseExperimental2.dev`). -2. Save this plist file as `GoogleService-Info_multi.plist` in -the [`Sample/` directory](Sample/). -This enables testing that FirebaseAuth continues to work after switching the Firebase App in the -runtime. - -#### Getting your own Credential files - -Please follow the instructions in -[Sample/AuthCredentialsTemplate.h](Sample/AuthCredentialsTemplate.h) -to generate the AuthCredentials.h file. - -#### Application.plist file - -Generate the `Sample/Application.plist` file from -[Sample/ApplicationTemplate.plist](Sample/ApplicationTemplate.plist) by replacing `$BUNDLE_ID` and -`$REVERSED_CLIENT_ID` with their values from `GoogleService-Info.plist` and -`$REVERSED_CLIENT_MULTI_ID` with its value from `GoogleService-Info_multi.plist`. - -This could be done in bash via something like this from within the `Sample` directory: -```bash -$ BUNDLE_ID=`xmllint --xpath "/plist/dict/key[.='BUNDLE_ID']/following-sibling::string[1]/text()" GoogleService-Info.plist` -$ REVERSED_CLIENT_ID=`xmllint --xpath "/plist/dict/key[.='REVERSED_CLIENT_ID']/following-sibling::string[1]/text()" GoogleService-Info.plist` -$ REVERSED_CLIENT_MULTI_ID=`xmllint --xpath "/plist/dict/key[.='REVERSED_CLIENT_ID']/following-sibling::string[1]/text()" GoogleService-Info_multi.plist` -$ sed \ - -e 's/\$BUNDLE_ID/'$BUNDLE_ID'/g' \ - -e 's/\$REVERSED_CLIENT_ID/'$REVERSED_CLIENT_ID'/g' \ - -e 's/\$REVERSED_CLIENT_MULTI_ID/'$REVERSED_CLIENT_MULTI_ID'/g' \ - ApplicationTemplate.plist > Application.plist -``` - -#### Sample.entitlements file - -In order to test the "Reset Password In App" feature you will need to create a dynamic link for your -Firebase project in the Dynamic Links section of the Firebase Console. Once the link is created, -please copy the contents of -[Sample/SampleTemplate.entitlements](Sample/SampleTemplate.entitlements) -into a file named `Sample/Sample.entitlements` and replace `$KAPP_LINKS_DOMAIN` with your own -relevant appLinks domain. Your appLinks domains are domains that your app will handle as universal -links, in this particular case you can obtain this domain from the aforementioned Dynamic Links -section of the Firebase Console. - -### Running API tests - -In order to run the API tests, you'll need to follow the following steps! - -#### Getting your own Credential files - -Please follow the instructions in -[ApiTests/AuthCredentialsTemplate.h](ApiTests/AuthCredentialsTemplate.h) -to generate the AuthCredentials.h file. - -#### Console - -In the Firebase conosle for your test project, you'll need to enable the -following auth providers: -* Email/Password -* Google -* Facebook -* Anonymous - -You'll also need to create a user with email -`user+email_existing_user@example.com` and password of `password`. - -## Usage - -``` -$ pod update -$ open Firebase.xcworkspace -``` -Then select an Auth scheme and run. diff --git a/FirebaseAuth/Tests/Sample/Sample/AppManager.h b/FirebaseAuth/Tests/Sample/Sample/AppManager.h deleted file mode 100644 index c1b0cab0fe6..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/AppManager.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 - -@class FIRApp; -@class FIRAuth; -@class FIROptions; -@class FIRPhoneAuthProvider; - -NS_ASSUME_NONNULL_BEGIN - -/** @class AppManager - @brief A manager of global FIRApp instances. - */ -@interface AppManager : NSObject - -/** @property count - @brief The total count of apps under management, including the default app. - */ -@property(nonatomic, assign, readonly) int count; - -/** @property active - @brief The index of the currently active app, 0 being the default app. - */ -@property(nonatomic, assign) int active; - -/** @fn appAtIndex: - @brief Retrieves the app at the given index. - @param index The index of the app to be retrieved, 0 being the default app. - @return The app at the given index. - */ -- (nullable FIRApp *)appAtIndex:(int)index; - -/** @fn recreateAppAtIndex:withOptions:completion: - @brief Deletes the app at the given index, and optionally creates it again with given options. - @param index The index of the app to be recreated, 0 being the default app. - @param options Optionally, the new options with which app should be created. - @param completion The block to call when completes. - */ -- (void)recreateAppAtIndex:(int)index - withOptions:(nullable FIROptions *)options - completion:(void (^)(void))completion; - -/** @fn sharedInstance - @brief Gets a shared instance of the class. - */ -+ (instancetype)sharedInstance; - -/** @fn app - @brief A shortcut to get the currently active app. - */ -+ (FIRApp *)app; - -/** @fn auth - @brief A shortcut to get the auth instance for the currently active app. - */ -+ (FIRAuth *)auth; - -/** @fn phoneAuthProvider - @brief A shortcut to get the phone auth provider for the currently active app. - */ -+ (FIRPhoneAuthProvider *)phoneAuthProvider; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/AppManager.m b/FirebaseAuth/Tests/Sample/Sample/AppManager.m deleted file mode 100644 index f0fb0a5d671..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/AppManager.m +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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 "AppManager.h" - -#import -@import FirebaseAuth; - -NS_ASSUME_NONNULL_BEGIN - -@implementation AppManager { - /** @var _createdAppNames - @brief The set of names of live (created but not deleted) app, to avoid iCore warnings. - */ - NSMutableSet *_liveAppNames; -} - -- (instancetype)init { - self = [super init]; - if (self) { - _count = 2; - _liveAppNames = [[NSMutableSet alloc] initWithCapacity:_count - 1]; - } - return self; -} - -- (nullable FIRApp *)appAtIndex:(int)index { - if (index == 0) { - return [FIRApp defaultApp]; - } - NSString *name = [self appNameWithIndex:index]; - if ([_liveAppNames containsObject:name]) { - return [FIRApp appNamed:[self appNameWithIndex:index]]; - } - return nil; -} - -- (void)recreateAppAtIndex:(int)index - withOptions:(nullable FIROptions *)options - completion:(void (^)(void))completion { - [self deleteAppAtIndex:index completion:^() { - if (index == 0) { - if (options) { - [FIRApp configureWithOptions:options]; - } - } else { - NSString *name = [self appNameWithIndex:index]; - if (options) { - [FIRApp configureWithName:name options:options]; - [self->_liveAppNames addObject:name]; - } else { - [self->_liveAppNames removeObject:name]; - } - } - completion(); - }]; -} - -+ (instancetype)sharedInstance { - static dispatch_once_t onceToken; - static AppManager *sharedInstance; - dispatch_once(&onceToken, ^{ - sharedInstance = [[self alloc] init]; - }); - return sharedInstance; -} - -+ (FIRApp *)app { - AppManager *manager = [self sharedInstance]; - return [manager appAtIndex:manager.active]; -} - -+ (FIRAuth *)auth { - return [FIRAuth authWithApp:[self app]]; -} - -+ (FIRPhoneAuthProvider *)phoneAuthProvider { - return [FIRPhoneAuthProvider providerWithAuth:[self auth]]; -} - -#pragma mark - Helpers - -/** @fn appNameWithIndex: - @brief Gets the app name for the given index. - @param index The index of the app managed by this instance. - @return The app name for the FIRApp instance. - */ -- (NSString *)appNameWithIndex:(int)index { - return [NSString stringWithFormat:@"APP_%02d", index]; -} - -/** @fn deleteAppAtIndex:withOptions:completion: - @brief Deletes the app at the given index. - @param index The index of the app to be deleted, 0 being the default app. - @param completion The block to call when completes. - */ -- (void)deleteAppAtIndex:(int)index - completion:(void (^)(void))completion { - FIRApp *app = [self appAtIndex:index]; - if (app) { - [app deleteApp:^(BOOL success) { - if (success) { - completion(); - } else { - NSLog(@"Failed to delete app '%@'.", app.name); - } - }]; - } else { - completion(); - } -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/ApplicationDelegate.h b/FirebaseAuth/Tests/Sample/Sample/ApplicationDelegate.h deleted file mode 100644 index 176e312ff5f..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/ApplicationDelegate.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 - -NS_ASSUME_NONNULL_BEGIN - -@protocol OpenURLDelegate - -/** @fn handleOpenURL:sourceApplication: - @brief Handles application:openURL:... methods for @c UIApplicationDelegate . - */ -- (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication; - -@end - -/** @class ApplicationDelegate - @brief The sample application's delegate. - */ -@interface ApplicationDelegate : UIResponder - -/** @property window - @brief The sample application's @c UIWindow. - */ -@property(strong, nonatomic) UIWindow *window; - -/** @fn setOpenURLDelegate: - @brief Sets the delegate to handle application:openURL:... methods. - @param openURLDelegate The delegate which is not retained by this method. - */ -+ (void)setOpenURLDelegate:(nullable id)openURLDelegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/ApplicationDelegate.m b/FirebaseAuth/Tests/Sample/Sample/ApplicationDelegate.m deleted file mode 100644 index d1e525a89f3..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/ApplicationDelegate.m +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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 "ApplicationDelegate.h" - -#import -#import -#import - -#import "AuthProviders.h" -#import -#import "GTMSessionFetcherLogging.h" -#import "MainViewController.h" - -/** @var gOpenURLDelegate - @brief The delegate to for application:openURL:... method. - */ -static __weak id gOpenURLDelegate; - -@implementation ApplicationDelegate { - // The main view controller of the sample app. - MainViewController *_sampleAppMainViewController; -} - -+ (void)setOpenURLDelegate:(nullable id)openURLDelegate { - gOpenURLDelegate = openURLDelegate; -} - -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [GTMSessionFetcher setLoggingEnabled:YES]; - [[FIRConfiguration sharedInstance] setLoggerLevel:FIRLoggerLevelInfo]; - - // Configure the default Firebase application: - [FIRApp configure]; - - [[FBSDKApplicationDelegate sharedInstance] application:application - didFinishLaunchingWithOptions:launchOptions]; - - // Load and present the UI: - UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - _sampleAppMainViewController = - [[MainViewController alloc] initWithNibName:NSStringFromClass([MainViewController class]) - bundle:nil]; - _sampleAppMainViewController.navigationItem.title = @"Firebase Auth"; - window.rootViewController = [[UINavigationController alloc] - initWithRootViewController:_sampleAppMainViewController]; - self.window = window; - [self.window makeKeyAndVisible]; - - return YES; -} - -- (BOOL)application:(nonnull UIApplication *)application - openURL:(nonnull NSURL *)url - options:(nonnull NSDictionary *)options { - [[FBSDKApplicationDelegate sharedInstance] application:application - openURL:url - options:options]; - - return [self application:application - openURL:url - sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] - annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]; -} - -- (BOOL)application:(UIApplication *)application - openURL:(NSURL *)url - sourceApplication:(NSString *)sourceApplication - annotation:(id)annotation { - if ([gOpenURLDelegate handleOpenURL:url sourceApplication:sourceApplication]) { - return YES; - } - if ([_sampleAppMainViewController handleIncomingLinkWithURL:url]) { - return YES; - } - return NO; -} - -- (BOOL)application:(UIApplication *)application -continueUserActivity:(NSUserActivity *)userActivity - restorationHandler:(void (^)(NSArray> * _Nullable))restorationHandler { - if (userActivity.webpageURL) { - return [_sampleAppMainViewController handleIncomingLinkWithURL:userActivity.webpageURL]; - } - return NO; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/ApplicationTemplate.plist b/FirebaseAuth/Tests/Sample/Sample/ApplicationTemplate.plist deleted file mode 100644 index d869da000cf..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/ApplicationTemplate.plist +++ /dev/null @@ -1,88 +0,0 @@ - - - - - CFBundleName - ${PRODUCT_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - UIRequiredDeviceCapabilities - - armv7 - - CFBundleVersion - 1.0 - UIBackgroundModes - - remote-notification - - CFBundleExecutable - ${EXECUTABLE_NAME} - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - CFBundleDisplayName - FirebaseAuth Sample - LSApplicationQueriesSchemes - - fbauth2 - - CFBundleURLTypes - - - CFBundleURLName - $REVERSED_CLIENT_ID - CFBundleURLSchemes - - $REVERSED_CLIENT_ID - - CFBundleTypeRole - Editor - - - CFBundleURLName - $REVERSED_CLIENT_MULTI_ID - CFBundleURLSchemes - - $REVERSED_CLIENT_MULTI_ID - - CFBundleTypeRole - Editor - - - CFBundleURLName - $BUNDLE_ID - CFBundleURLSchemes - - $BUNDLE_ID - - CFBundleTypeRole - Editor - - - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleDevelopmentRegion - en - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - CFBundleShortVersionString - 1.0 - - diff --git a/FirebaseAuth/Tests/Sample/Sample/AuthCredentialsTemplate.h b/FirebaseAuth/Tests/Sample/Sample/AuthCredentialsTemplate.h deleted file mode 100644 index 0b593af2599..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/AuthCredentialsTemplate.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ - -/* -Some of the Auth Credentials needs to be populated for the Sample build to work. - -Please follow the following steps to populate the valid AuthCredentials -and copy it to AuthCredentials.h file - -You will need to replace the following values: - -$KFACEBOOK_APP_ID -FACEBOOK_APP_ID is the developer's Facebook app's ID, to be used to test the -'Signing in with Facebook' feature of Firebase Auth. Follow the instructions -on the Facebook developer site: https://developers.facebook.com/docs/apps/register -to obtain such an id. -*/ - -#define KFACEBOOK_APP_ID $KFACEBOOK_APP_ID -#define KCONTINUE_URL $KCONTINUE_URL diff --git a/FirebaseAuth/Tests/Sample/Sample/AuthProviders.h b/FirebaseAuth/Tests/Sample/Sample/AuthProviders.h deleted file mode 100644 index 05b7a083bc2..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/AuthProviders.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 - -@class FIRAuthCredential; - -NS_ASSUME_NONNULL_BEGIN - -/** @typedef AuthCredentialCallback - @brief The type of block invoked when a @c FIRAuthCredential object is ready or an error has - occurred. - @param credential The auth credential if any. - @param error The error which occurred, if any. - */ -typedef void (^AuthCredentialCallback)(FIRAuthCredential *_Nullable credential, - NSError *_Nullable error); -/** @protocol AuthProvider - @brief A common interface for auth providers to be used by the sample app. - */ -@protocol AuthProvider - -/** @fn getAuthCredentialWithPresentingViewController:callback: - @brief Gets a @c FIRAuthCredential instance for use with Firebase headless API by signing in. - @param viewController The view controller to present the UI. - @param callback A block which is invoked when the sign-in flow finishes. Invoked asynchronously - on an unspecified thread in the future. - */ -- (void)getAuthCredentialWithPresentingViewController:(UIViewController *)viewController - callback:(AuthCredentialCallback)callback; - -/** @fn signOut - @brief Logs out the current provider session, which invalidates any cached crendential. - */ -- (void)signOut; - -@end - -/** @class AuthProviders - @brief Namespace for @c AuthProvider instances. - */ -@interface AuthProviders : NSObject - -/** @fn google - @brief Returns a Google auth provider. - */ -+ (id)google; - -/** @fn facebook - @brief Returns a Facebook auth provider. - */ -+ (id)facebook; - -/** @fn init - @brief This class is not supposed to be instantiated. - */ -- (nullable instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/AuthProviders.m b/FirebaseAuth/Tests/Sample/Sample/AuthProviders.m deleted file mode 100644 index a8a88ac49e6..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/AuthProviders.m +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 "AuthProviders.h" - -#import "FacebookAuthProvider.h" -#import "GoogleAuthProvider.h" - -@implementation AuthProviders - -+ (id)google { - static id googleAuthProvider; - if (!googleAuthProvider) { - googleAuthProvider = [[GoogleAuthProvider alloc] init]; - } - return googleAuthProvider; -} - -+ (id)facebook { - static id facebookAuthProvider; - if (!facebookAuthProvider) { - facebookAuthProvider = [[FacebookAuthProvider alloc] init]; - } - return facebookAuthProvider; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/AuthSample-Bridging-Header.h b/FirebaseAuth/Tests/Sample/Sample/AuthSample-Bridging-Header.h deleted file mode 100644 index 229724c7f2c..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/AuthSample-Bridging-Header.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * 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. - */ - diff --git a/FirebaseAuth/Tests/Sample/Sample/CustomTokenDataEntryViewController.h b/FirebaseAuth/Tests/Sample/Sample/CustomTokenDataEntryViewController.h deleted file mode 100644 index c4ba32391c1..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/CustomTokenDataEntryViewController.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 - -NS_ASSUME_NONNULL_BEGIN - -/** @typedef CustomTokenDataEntryViewControllerCompletion - @brief The type of callback block invoked when a @c CustomTokenDataEntryViewController is - dismissed (by either being cancelled or completed by the user.) - @param cancelled Indicates the user cancelled the flow and didn't want to enter a token. - @param userEnteredTokenText The token text the user entered. - */ -typedef void (^CustomTokenDataEntryViewControllerCompletion) - (BOOL cancelled, NSString *_Nullable userEnteredTokenText); - -/** @class CustomTokenDataEntryViewController - @brief Simple view controller to allow data entry of custom BYOAuth tokens. - */ -@interface CustomTokenDataEntryViewController : UIViewController - -/** @fn initWithNibName:bundle: - @brief Please use initWithCompletion: - */ -- (instancetype)initWithNibName:(NSString *_Nullable)nibNameOrNil - bundle:(NSBundle *_Nullable)nibBundleOrNil NS_UNAVAILABLE; - -/** @fn initWithCoder: - @brief Please use initWithCompletion: - */ -- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE; - -/** @fn initWithCompletion: - @brief Designated initializer. - @param completion A block which will be invoked when the user either chooses "cancel" or "done". - */ -- (nullable instancetype)initWithCompletion: - (CustomTokenDataEntryViewControllerCompletion)completion NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/CustomTokenDataEntryViewController.m b/FirebaseAuth/Tests/Sample/Sample/CustomTokenDataEntryViewController.m deleted file mode 100644 index 0b9f9affe24..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/CustomTokenDataEntryViewController.m +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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 "CustomTokenDataEntryViewController.h" - -/** @var navigationBarDefaultHeight - @brief The default height to use for new navigation bars' frames. - */ -static const NSUInteger navigationBarDefaultHeight = 55; - -/** @var navigationBarSystemHeight - @brief Set after a navigation bar has been created to obtain the system-specified height of the - navigation bar. - */ -static NSUInteger navigationBarSystemHeight = navigationBarDefaultHeight; - -/** @var kTitle - @brief The title of the view controller as it appears at the top of the screen in the navigation - bar. - */ -static NSString *const kTitle = @"Enter Token"; - -/** @var kCancel - @brief The text for the "Cancel" button. - */ -static NSString *const kCancel = @"Cancel"; - -/** @var kDone - @brief The text for the "Done" button. - */ -static NSString *const kDone = @"Done"; - -@implementation CustomTokenDataEntryViewController { - /** @var _completion - @brief The block we will call when the user presses the "cancel" or "done" buttons. - @remarks Passed into the initializer. - */ - CustomTokenDataEntryViewControllerCompletion _completion; - - /** @var _tokenTextView - @brief The text view allowing the user to enter their custom token text. - @remarks Constructed and set in the method: @c loadTextView. - */ - __weak UITextView *_Nullable _tokenTextView; -} - -- (nullable instancetype)initWithCompletion: - (CustomTokenDataEntryViewControllerCompletion)completion { - self = [super initWithNibName:nil bundle:nil]; - if (self) { - _completion = completion; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - [self loadHeader]; - [self loadTextView]; -} - -#pragma mark - View - -/** @fn loadHeader - @brief Loads the header bar along the top of the view with "Cancel" and "Done" buttons, as well - as a brief title asking the user to enter the custom token text. - @remarks Updates navigationBarSystemHeight, so should be called before any method which depends - on that variable being updated (like the @c loadTextView method, which uses the value to - determine how much room is left on the screen.) - */ -- (void)loadHeader { - CGRect navBarFrame = CGRectMake(0, 0, self.view.bounds.size.width, navigationBarDefaultHeight); - UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:navBarFrame]; - navBar.autoresizingMask = UIViewAutoresizingFlexibleWidth - | UIViewAutoresizingFlexibleBottomMargin; - - UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:kTitle]; - UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:kCancel - style:UIBarButtonItemStylePlain - target:self - action:@selector(cancelPressed:)]; - UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:kDone - style:UIBarButtonItemStylePlain - target:self - action:@selector(donePressed:)]; - navItem.leftBarButtonItem = cancelButton; - navItem.rightBarButtonItem = doneButton; - - [navBar setItems:@[ navItem ] animated:NO]; - - [self.view addSubview:navBar]; - - // Obtain the system-specified height of the navigation bar. - navigationBarSystemHeight = navBar.frame.size.height; -} - -/** @fn loadTextView - @brief Loads the text field for the user to enter their custom token text. - @remarks Relies on the navigationBarSystemHeight variable being correct. - */ -- (void)loadTextView { - CGRect tokenTextViewFrame = - CGRectMake(0, - navigationBarSystemHeight, - self.view.bounds.size.width, - self.view.bounds.size.height - navigationBarSystemHeight); - UITextView *tokenTextView = [[UITextView alloc] initWithFrame:tokenTextViewFrame]; - tokenTextView.backgroundColor = [UIColor whiteColor]; - tokenTextView.textAlignment = NSTextAlignmentLeft; - - [self.view addSubview:tokenTextView]; - _tokenTextView = tokenTextView; -} - -#pragma mark - Actions - -- (void)cancelPressed:(id)sender { - [self finishByCancelling:YES withUserEnteredTokenText:nil]; -} - -- (void)donePressed:(id)sender { - [self finishByCancelling:NO withUserEnteredTokenText:_tokenTextView.text]; -} - -#pragma mark - Workflow - -- (void)finishByCancelling:(BOOL)cancelled - withUserEnteredTokenText:(nullable NSString *)userEnteredTokenText { - [self dismissViewControllerAnimated:YES completion:^{ - self->_completion(cancelled, - cancelled ? nil : userEnteredTokenText); - }]; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/Dummy.swift b/FirebaseAuth/Tests/Sample/Sample/Dummy.swift deleted file mode 100644 index bddf99ec845..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/Dummy.swift +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * 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 diff --git a/FirebaseAuth/Tests/Sample/Sample/FacebookAuthProvider.h b/FirebaseAuth/Tests/Sample/Sample/FacebookAuthProvider.h deleted file mode 100644 index 8aefca5dad0..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/FacebookAuthProvider.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 - -#import "AuthProviders.h" - -NS_ASSUME_NONNULL_BEGIN - -/** @class FacebookAuthProvider - @brief The implementation for Facebook auth provider related methods. - */ -@interface FacebookAuthProvider : NSObject -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/FacebookAuthProvider.m b/FirebaseAuth/Tests/Sample/Sample/FacebookAuthProvider.m deleted file mode 100644 index 223e26da167..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/FacebookAuthProvider.m +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 "FacebookAuthProvider.h" - -#import -#import - -@import FirebaseAuth; -#import "ApplicationDelegate.h" -#import "AuthCredentials.h" - -/** @var kFacebookAppId - @brief The App ID for the Facebook SDK. - */ -static NSString *const kFacebookAppID = KFACEBOOK_APP_ID; - -@interface FacebookAuthProvider () -@end - -@implementation FacebookAuthProvider { - FBSDKLoginManager *_loginManager; -} - -- (instancetype)init { - self = [super init]; - if (self) { - _loginManager = [[FBSDKLoginManager alloc] init]; - } - return self; -} - -- (void)getAuthCredentialWithPresentingViewController:(UIViewController *)viewController - callback:(AuthCredentialCallback)callback { - [self signOut]; - - [ApplicationDelegate setOpenURLDelegate:self]; - //[FBSDKSettings setAppID:kFacebookAppID]; - [_loginManager logInWithPermissions:@[ @"email" ] - fromViewController:viewController - handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { - [ApplicationDelegate setOpenURLDelegate:nil]; - if (!error && result.isCancelled) { - error = [NSError errorWithDomain:@"com.google.FirebaseAuthSample" code:-1 userInfo:nil]; - } - if (error) { - callback(nil, error); - return; - } - NSString *accessToken = [FBSDKAccessToken currentAccessToken].tokenString; - callback([FIRFacebookAuthProvider credentialWithAccessToken:accessToken], nil); - }]; -} - -- (void)signOut { - [_loginManager logOut]; -} - -- (BOOL)handleOpenURL:(NSURL *)URL sourceApplication:(NSString *)sourceApplication { - return [[FBSDKApplicationDelegate sharedInstance] application:[UIApplication sharedApplication] - openURL:URL - sourceApplication:sourceApplication - annotation:nil]; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/GoogleAuthProvider.h b/FirebaseAuth/Tests/Sample/Sample/GoogleAuthProvider.h deleted file mode 100644 index 05c1bf27fc0..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/GoogleAuthProvider.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 - -#import "AuthProviders.h" - -NS_ASSUME_NONNULL_BEGIN - -/** @class GoogleAuthProvider - @brief The implementation for Google auth provider related methods. - */ -@interface GoogleAuthProvider : NSObject -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/GoogleAuthProvider.m b/FirebaseAuth/Tests/Sample/Sample/GoogleAuthProvider.m deleted file mode 100644 index b405a73f2cc..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/GoogleAuthProvider.m +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 "GoogleAuthProvider.h" - -#import - -#import "AppManager.h" -#import -#import -@import FirebaseAuth; - -@implementation GoogleAuthProvider - -- (void)getAuthCredentialWithPresentingViewController:(UIViewController *)viewController - callback:(AuthCredentialCallback)callback { - [self signOut]; - - GIDSignIn *signIn = GIDSignIn.sharedInstance; - GIDConfiguration *config = [[GIDConfiguration alloc] initWithClientID:[self googleClientID]]; - [signIn signInWithConfiguration:config - presentingViewController:viewController - callback:^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) { - if (error) { - callback(nil, error); - return; - } - GIDAuthentication *auth = user.authentication; - FIRAuthCredential *credential = [FIRGoogleAuthProvider credentialWithIDToken:auth.idToken - accessToken:auth.accessToken]; - callback(credential, error); - }]; -} - -- (void)signOut { - [GIDSignIn.sharedInstance signOut]; -} - -- (NSString *)googleClientID { - return [AppManager app].options.clientID; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/Contents.json b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 9f9548e665e..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "logo_avatar_square_grey_color_1x_ios_21in29dp-1.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "logo_avatar_square_grey_color_2x_ios_21in29dp-1.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "logo_avatar_square_grey_color_3x_ios_21in29dp.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "logo_avatar_square_grey_color_2x_ios_29in40dp-1.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "logo_avatar_square_grey_color_3x_ios_29in40dp-1.png", - "scale" : "3x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "logo_avatar_square_grey_color_1x_ios_42in57dp.png", - "scale" : "1x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "logo_avatar_square_grey_color_2x_ios_42in57dp.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "logo_avatar_square_grey_color_2x_ios_44in60dp.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "logo_avatar_square_grey_color_3x_ios_44in60dp.png", - "scale" : "3x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_1x_ios_21in29dp.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_2x_ios_21in29dp.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_1x_ios_29in40dp-1.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_2x_ios_29in40dp-2.png", - "scale" : "2x" - }, - { - "size" : "50x50", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_1x_ios_38in50dp.png", - "scale" : "1x" - }, - { - "size" : "50x50", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_2x_ios_38in50dp.png", - "scale" : "2x" - }, - { - "size" : "72x72", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_1x_ios_53in72dp.png", - "scale" : "1x" - }, - { - "size" : "72x72", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_2x_ios_53in72dp.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_1x_ios_56in76dp.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "logo_avatar_square_grey_color_2x_ios_56in76dp.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "ItunesArtwork@2x.png", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index 57aa7804cb1..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png deleted file mode 100644 index 03513605f80..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_21in29dp-1.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_21in29dp-1.png deleted file mode 100644 index 2976035cf3d..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_21in29dp-1.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_21in29dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_21in29dp.png deleted file mode 100644 index 2976035cf3d..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_21in29dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_29in40dp-1.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_29in40dp-1.png deleted file mode 100644 index 32684cecce1..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_29in40dp-1.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_38in50dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_38in50dp.png deleted file mode 100644 index 0c98554c0f7..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_38in50dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_42in57dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_42in57dp.png deleted file mode 100644 index 3ef403a58a2..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_42in57dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_53in72dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_53in72dp.png deleted file mode 100644 index ff6c804078e..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_53in72dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_56in76dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_56in76dp.png deleted file mode 100644 index df8a9537087..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_1x_ios_56in76dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_21in29dp-1.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_21in29dp-1.png deleted file mode 100644 index 40670173cd3..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_21in29dp-1.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_21in29dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_21in29dp.png deleted file mode 100644 index 40670173cd3..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_21in29dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_29in40dp-1.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_29in40dp-1.png deleted file mode 100644 index 9452a267c85..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_29in40dp-1.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_29in40dp-2.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_29in40dp-2.png deleted file mode 100644 index 9452a267c85..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_29in40dp-2.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_38in50dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_38in50dp.png deleted file mode 100644 index 436be1042ce..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_38in50dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_42in57dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_42in57dp.png deleted file mode 100644 index e9c869ee2c5..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_42in57dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_44in60dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_44in60dp.png deleted file mode 100644 index 8c5ce9db00b..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_44in60dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_53in72dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_53in72dp.png deleted file mode 100644 index 0ddd7209396..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_53in72dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_56in76dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_56in76dp.png deleted file mode 100644 index 2f028cbfe21..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_2x_ios_56in76dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_3x_ios_21in29dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_3x_ios_21in29dp.png deleted file mode 100644 index 69bb8d3a0f2..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_3x_ios_21in29dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_3x_ios_29in40dp-1.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_3x_ios_29in40dp-1.png deleted file mode 100644 index 7045675f657..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_3x_ios_29in40dp-1.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_3x_ios_44in60dp.png b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_3x_ios_44in60dp.png deleted file mode 100644 index 211ef930e45..00000000000 Binary files a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/AppIcon.appiconset/logo_avatar_square_grey_color_3x_ios_44in60dp.png and /dev/null differ diff --git a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/Contents.json b/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/Contents.json deleted file mode 100644 index da4a164c918..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/Images.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+App.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+App.h deleted file mode 100644 index 624faffefa5..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+App.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (App) - -- (StaticContentTableViewSection *)appSection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+App.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+App.m deleted file mode 100644 index 98b2b9613c6..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+App.m +++ /dev/null @@ -1,190 +0,0 @@ -/* - * 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 "MainViewController+App.h" - -#import "AppManager.h" -@import FirebaseAuth; -#import "MainViewController+Internal.h" -#import - -static NSString *const kTokenRefreshErrorAlertTitle = @"Get Token Error"; - -static NSString *const kTokenRefreshedAlertTitle = @"Token"; - -@implementation MainViewController (App) - -- (StaticContentTableViewSection *)appSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"APP" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Get Token" - action:^{ [weakSelf getUserTokenResultWithForce:NO]; }], - [StaticContentTableViewCell cellWithTitle:@"Get Token Force Refresh" - action:^{ [weakSelf getUserTokenResultWithForce:YES]; }], - [StaticContentTableViewCell cellWithTitle:@"Add Auth State Change Listener" - action:^{ [weakSelf addAuthStateListener]; }], - [StaticContentTableViewCell cellWithTitle:@"Remove Last Auth State Change Listener" - action:^{ [weakSelf removeAuthStateListener]; }], - [StaticContentTableViewCell cellWithTitle:@"Add ID Token Change Listener" - action:^{ [weakSelf addIDTokenListener]; }], - [StaticContentTableViewCell cellWithTitle:@"Remove Last ID Token Change Listener" - action:^{ [weakSelf removeIDTokenListener]; }], - [StaticContentTableViewCell cellWithTitle:@"Verify Client" - action:^{ [weakSelf verifyClient]; }], - [StaticContentTableViewCell cellWithTitle:@"Delete App" - action:^{ [weakSelf deleteApp]; }], - ]]; -} - -- (void)getUserTokenResultWithForce:(BOOL)force { - [[self user] getIDTokenResultForcingRefresh:force - completion:^(FIRAuthTokenResult *_Nullable tokenResult, - NSError *_Nullable error) { - if (error) { - [self showMessagePromptWithTitle:kTokenRefreshErrorAlertTitle - message:error.localizedDescription - showCancelButton:NO - completion:nil]; - [self logFailure:@"refresh token failed" error:error]; - return; - } - [self logSuccess:@"refresh token succeeded."]; - NSString *message = [tokenResult.claims description]; - [self showMessagePromptWithTitle:kTokenRefreshedAlertTitle - message:message - showCancelButton:NO - completion:nil]; - }]; -} - -- (void)addAuthStateListener { - __weak typeof(self) weakSelf = self; - NSUInteger index = self.authStateDidChangeListeners.count; - [self log:[NSString stringWithFormat:@"Auth State Did Change Listener #%lu was added.", - (unsigned long)index]]; - // TODO: restore FIRAuthStateDidChangeListenerHandle - id handle = - [[AppManager auth] addAuthStateDidChangeListener:^(FIRAuth *_Nonnull auth, - FIRUser *_Nullable user) { - [weakSelf log:[NSString stringWithFormat: - @"Auth State Did Change Listener #%lu was invoked on user '%@'.", - (unsigned long)index, user.uid]]; - }]; - [self.authStateDidChangeListeners addObject:handle]; -} - -- (void)removeAuthStateListener { - if (!self.authStateDidChangeListeners.count) { - [self log:@"No remaining Auth State Did Change Listeners."]; - return; - } - NSUInteger index = self.authStateDidChangeListeners.count - 1; - id handle = self.authStateDidChangeListeners.lastObject; - [[AppManager auth] removeAuthStateDidChangeListener:handle]; - [self.authStateDidChangeListeners removeObject:handle]; - NSString *logString = - [NSString stringWithFormat:@"Auth State Did Change Listener #%lu was removed.", - (unsigned long)index]; - [self log:logString]; -} - -- (void)addIDTokenListener { - __weak typeof(self) weakSelf = self; - NSUInteger index = self.IDTokenDidChangeListeners.count; - [self log:[NSString stringWithFormat:@"ID Token Did Change Listener #%lu was added.", - (unsigned long)index]]; - id handle = - [[AppManager auth] addIDTokenDidChangeListener:^(FIRAuth *_Nonnull auth, - FIRUser *_Nullable user) { - [weakSelf log:[NSString stringWithFormat: - @"ID Token Did Change Listener #%lu was invoked on user '%@'.", - (unsigned long)index, user.uid]]; - }]; - [self.IDTokenDidChangeListeners addObject:handle]; -} - -- (void)removeIDTokenListener { - if (!self.IDTokenDidChangeListeners.count) { - [self log:@"No remaining ID Token Did Change Listeners."]; - return; - } - NSUInteger index = self.IDTokenDidChangeListeners.count - 1; - id handle = self.IDTokenDidChangeListeners.lastObject; - [[AppManager auth] removeIDTokenDidChangeListener:handle]; - [self.IDTokenDidChangeListeners removeObject:handle]; - NSString *logString = - [NSString stringWithFormat:@"ID Token Did Change Listener #%lu was removed.", - (unsigned long)index]; - [self log:logString]; -} - -- (void)verifyClient { - [[AppManager auth].tokenManager getTokenWithCallback:^(FIRAuthAPNSToken *_Nullable token, - NSError *_Nullable error) { - if (!token) { - [self logFailure:@"Verify iOS client failed." error:error]; - return; - } - FIRVerifyClientRequest *request = - [[FIRVerifyClientRequest alloc] initWithAppToken:token.string - isSandbox:token.type == FIRAuthAPNSTokenTypeSandbox - requestConfiguration:[AppManager auth].requestConfiguration]; - [FIRAuthBackend2 postWithRequest:request callback:^(FIRVerifyClientResponse *_Nullable response, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"Verify iOS client failed." error:error]; - return; - } - NSTimeInterval timeout = [response.suggestedTimeOutDate timeIntervalSinceNow]; - [[AppManager auth].appCredentialManager - didStartVerificationWithReceipt:response.receipt - timeout:timeout - callback:^(FIRAuthAppCredential *credential) { - if (!credential.secret) { - [self logFailure:@"Failed to receive remote notification to verify app identity." - error:error]; - return; - } - NSString *testPhoneNumber = @"+16509964692"; - FIRSendVerificationCodeRequest *request = - [[FIRSendVerificationCodeRequest alloc] initWithPhoneNumber:testPhoneNumber - appCredential:credential - reCAPTCHAToken:nil - requestConfiguration: - [AppManager auth].requestConfiguration]; - [FIRAuthBackend2 postWithRequest:request - callback:^(FIRSendVerificationCodeResponse *_Nullable response, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"Verify iOS client failed." error:error]; - return; - } else { - [self logSuccess:@"Verify iOS client succeeded."]; - [self showMessagePrompt:@"Verify iOS client succeed."]; - } - }]; - }]; - }]; - }]; -} - -- (void)deleteApp { - [[FIRApp defaultApp] deleteApp:^(BOOL success) { - [self log:success ? @"App deleted successfully." : @"Failed to delete app."]; - }]; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Auth.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Auth.h deleted file mode 100644 index 535448f82ff..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Auth.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -@import FirebaseAuth; -#import "StaticContentTableViewManager.h" - -typedef void (^FIRAuthDataResultCallback)(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error); - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (Auth) - -- (StaticContentTableViewSection *)authSection; - -- (void)signInAnonymouslyWithCallback:(nullable FIRAuthDataResultCallback)callback; - -- (void)setAuthDomain; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Auth.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Auth.m deleted file mode 100644 index 34c77f76ff8..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Auth.m +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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 "MainViewController+Auth.h" - -#import "AppManager.h" -#import "MainViewController+Internal.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation MainViewController (Auth) - -- (StaticContentTableViewSection *)authSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"Auth" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Sign in Anonymously" - action:^{ [weakSelf signInAnonymously]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign out" - action:^{ [weakSelf signOut]; }], - [StaticContentTableViewCell cellWithTitle:@"Initialize Recaptcha Config" - action:^{ [weakSelf initializeRecaptchaConfig]; }], - [StaticContentTableViewCell cellWithTitle:@"Set Auth Domain" - action:^{ [weakSelf setAuthDomain]; }] - ]]; -} - -- (void)signInAnonymously { - [[AppManager auth] signInAnonymouslyWithCompletion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in anonymously failed" error:error]; - } else { - [self logSuccess:@"sign-in anonymously succeeded."]; - [self log:[NSString stringWithFormat:@"User ID : %@", result.user.uid]]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign in Anonymously" error:error]; - }]; -} - -- (void)signInAnonymouslyWithCallback:(nullable FIRAuthDataResultCallback)callback { - FIRAuth *auth = [AppManager auth]; - if (!auth) { - [self logFailedTest:@"Could not obtain auth object."]; - return; - } - [auth signInAnonymouslyWithCompletion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in anonymously failed" error:error]; - [self logFailedTest:@"Recently signed out user should be able to sign in anonymously."]; - return; - } - [self logSuccess:@"sign-in anonymously succeeded."]; - if (callback) { - callback(result, nil); - } - }]; -} - -- (void)signOut { - [[AuthProviders google] signOut]; - [[AuthProviders facebook] signOut]; - [[AppManager auth] signOut:NULL]; -} - -- (void)initializeRecaptchaConfig { - [[AppManager auth] initializeRecaptchaConfigWithCompletion:^(NSError * _Nullable error) { - if (error) { - [self logFailure:@"Initializing Recaptcha config failed" error:error]; - } else { - [self logSuccess:@"Initializing Recaptcha config succeeded."]; - } - }]; -} - -- (void)setAuthDomain { - [self showTextInputPromptWithMessage:@"Auth Domain:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable customAuthDomain) { - if (userPressedOK && customAuthDomain.length) { - FIRAuth *auth = [AppManager auth]; - if(!auth) { - [self logFailedTest:@"Could not obtain auth object."]; - return; - } - auth.customAuthDomain = customAuthDomain; - [self logSuccess:[NSString stringWithFormat:@"Successfully set auth domain to: %@", customAuthDomain]]; - } - return; - }]; -} - - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+AutoTests.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+AutoTests.h deleted file mode 100644 index c3f2110e5de..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+AutoTests.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (AutoTests) - -- (StaticContentTableViewSection *)autoTestsSection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+AutoTests.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+AutoTests.m deleted file mode 100644 index 6791a371901..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+AutoTests.m +++ /dev/null @@ -1,500 +0,0 @@ -/* - * 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 "MainViewController+AutoTests.h" - -#import "AppManager.h" -#import "AuthProviders.h" -#import "MainViewController+Internal.h" -#import "MainViewController+GameCenter.h" -#import "MainViewController+Phone.h" -#import "MainViewController+User.h" -#import "MainViewController+OOB.h" -#import "MainViewController+App.h" -#import "MainViewController+Email.h" -#import "MainViewController+Google.h" -#import "MainViewController+Facebook.h" -#import "MainViewController+Auth.h" -#import "MainViewController+OAuth.h" -#import "MainViewController+Custom.h" -#import "MainViewController+AutoTests.h" - -NS_ASSUME_NONNULL_BEGIN - -static NSString *const kCustomTokenUrl = @"https://gcip-testapps.wl.r.appspot.com/token"; - -static NSString *const kExpiredCustomTokenUrl = @"https://gcip-testapps.wl.r.appspot.com/expired_token"; - -static NSString *const kInvalidCustomToken = @"invalid custom token."; - -static NSString *const kSafariGoogleSignOutMessagePrompt = @"This automated test assumes that no " -"Google account is signed in on Safari, if your are not prompted for a password, sign out on " -"Safari and rerun the test."; - -static NSString *const kSafariFacebookSignOutMessagePrompt = @"This automated test assumes that no " -"Facebook account is signed in on Safari, if your are not prompted for a password, sign out on " -"Safari and rerun the test."; - -static NSString *const kUnlinkAccountMessagePrompt = @"Sign into gmail with an email address " -"that has not been linked to this sample application before. Delete account if necessary."; - -static NSString *const kFakeDisplayPhotoUrl = -@"https://www.gstatic.com/images/branding/product/1x/play_apps_48dp.png"; - -static NSString *const kFakeDisplayName = @"John GoogleSpeed"; - -static NSString *const kFakeEmail = @"firemail@example.com"; - -static NSString *const kFakePassword = @"fakePassword"; - -@implementation MainViewController (AutoTests) - -- (StaticContentTableViewSection *)autoTestsSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"Automated Tests" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"BYOAuth" - action:^{ [weakSelf automatedBYOAuth]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign In With Google" - action:^{ [weakSelf automatedSignInGoogle]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign In With Facebook" - action:^{ [weakSelf automatedSignInFacebook]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign Up With Email/Password" - action:^{ [weakSelf automatedEmailSignUp]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign In Anonymously" - action:^{ [weakSelf automatedAnonymousSignIn]; }], - [StaticContentTableViewCell cellWithTitle:@"Link with Google" - action:^{ [weakSelf automatedAccountLinking]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in With Phone Number" - action:^{ [weakSelf automatedPhoneNumberSignIn]; }] - ]]; -} - -- (void)automatedBYOAuth { - [self log:@"INITIATING AUTOMATED MANUAL TEST FOR BYOAUTH:"]; - [self showSpinner:^{ - NSError *error; - NSString *customToken = [NSString stringWithContentsOfURL:[NSURL URLWithString:kCustomTokenUrl] - encoding:NSUTF8StringEncoding - error:&error]; - NSString *expiredCustomToken = - [NSString stringWithContentsOfURL:[NSURL URLWithString:kExpiredCustomTokenUrl] - encoding:NSUTF8StringEncoding - error:&error]; - [self hideSpinner:^{ - if (error) { - [self log:@"There was an error retrieving the custom token."]; - return; - } - FIRAuth *auth = [AppManager auth]; - [auth signInWithCustomToken:customToken - completion:^(FIRAuthDataResult *_Nullable result, NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with custom token failed" error:error]; - [self logFailedTest:@"A fresh custom token should succeed in signing-in."]; - return; - } - [self logSuccess:@"sign-in with custom token succeeded."]; - [auth.currentUser getIDTokenForcingRefresh:NO - completion:^(NSString *_Nullable token, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"refresh token failed" error:error]; - [self logFailedTest:@"Refresh token should be available."]; - return; - } - [self logSuccess:@"refresh token succeeded."]; - [auth signOut:NULL]; - [auth signInWithCustomToken:expiredCustomToken - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (!error) { - [self logSuccess:@"sign-in with custom token succeeded."]; - [self logFailedTest:@"sign-in with an expired custom token should NOT succeed."]; - return; - } - [self logFailure:@"sign-in with custom token failed" error:error]; - [auth signInWithCustomToken:kInvalidCustomToken - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (!error) { - [self logSuccess:@"sign-in with custom token succeeded."]; - [self logFailedTest:@"sign-in with an invalid custom token should NOT succeed."]; - return; - } - [self logFailure:@"sign-in with custom token failed" error:error]; - //next step of automated test. - [self automatedBYOAuthEmailPassword]; - }]; - }]; - }]; - }]; - }]; - }]; -} - -- (void)automatedSignInGoogle { - [self showMessagePromptWithTitle:@"Sign In With Google" - message:kSafariGoogleSignOutMessagePrompt - showCancelButton:NO - completion:^(BOOL userPressedOK, NSString *_Nullable userInput) { - FIRAuth *auth = [AppManager auth]; - if (!auth) { - [self logFailedTest:@"Could not obtain auth object."]; - return; - } - [auth signOut:NULL]; - [self log:@"INITIATING AUTOMATED MANUAL TEST FOR GOOGLE SIGN IN:"]; - [self signInWithProvider:[AuthProviders google] callback:^{ - [self logSuccess:@"sign-in with Google provider succeeded."]; - [auth signOut:NULL]; - [self signInWithProvider:[AuthProviders google] callback:^{ - [self logSuccess:@"sign-in with Google provider succeeded."]; - [self updateEmailPasswordWithCompletion:^{ - [self automatedSignInGoogleDisplayNamePhotoURL]; - }]; - }]; - }]; - }]; -} - -- (void)automatedSignInGoogleDisplayNamePhotoURL { - [self signInWithProvider:[AuthProviders google] callback:^{ - [self updateDisplayNameAndPhotoURlWithCompletion:^{ - [self log:@"FINISHED AUTOMATED MANUAL TEST FOR SIGN-IN WITH GOOGlE."]; - [self reloadUser]; - }]; - }]; -} - -- (void)automatedSignInFacebook { - [self showMessagePromptWithTitle:@"Sign In With Facebook" - message:kSafariFacebookSignOutMessagePrompt - showCancelButton:NO - completion:^(BOOL userPressedOK, NSString *_Nullable userInput) { - FIRAuth *auth = [AppManager auth]; - if (!auth) { - [self logFailedTest:@"Could not obtain auth object."]; - return; - } - [auth signOut:NULL]; - [self log:@"INITIATING AUTOMATED MANUAL TEST FOR FACEBOOK SIGN IN:"]; - [self signInWithProvider:[AuthProviders facebook] callback:^{ - [self logSuccess:@"sign-in with Facebook provider succeeded."]; - [auth signOut:NULL]; - [self signInWithProvider:[AuthProviders facebook] callback:^{ - [self logSuccess:@"sign-in with Facebook provider succeeded."]; - [self updateEmailPasswordWithCompletion:^{ - [self automatedSignInFacebookDisplayNamePhotoURL]; - }]; - }]; - }]; - }]; -} - -- (void)automatedPhoneNumberSignIn { - [self log:@"Automated phone number sign in"]; - FIRAuth *auth = [AppManager auth]; - if (!auth) { - [self logFailedTest:@"Could not obtain auth object."]; - return; - } - [auth signOut:NULL]; - [self log:@"INITIATING AUTOMATED MANUAL TEST FOR PHONE NUMBER SIGN IN:"]; - [self commonPhoneNumberInputWithTitle:@"Phone for automation" - completion:^(NSString *_Nullable phone) { - [self signInWithPhoneNumber:phone completion:^(NSError *error) { - if (error) { - [self logFailedTest:@"Could not sign in with phone number reCAPTCHA."]; - } - [self logSuccess:@"sign-in with phone number reCAPTCHA test succeeded."]; - [auth signOut:NULL]; - [self signInWithPhoneNumber:phone completion:^(NSError *error) { - if (error) { - [self logFailedTest:@"Could not sign in with phone number reCAPTCHA."]; - } - [self logSuccess:@"second sign-in with phone number reCAPTCHA test succeeded."]; - [self updatePhoneNumber:phone completion:^(NSError *error) { - if (error) { - [self logFailedTest:@"Could not update phone number."]; - } - [self logSuccess:@"update phone number test succeeded."]; - [self unlinkFromProvider:FIRPhoneAuthProvider.id completion:^(NSError *error) { - if (error) { - [self logFailedTest:@"Could not unlink phone number."]; - } - [self logSuccess:@"unlink phone number test succeeded."]; - [self linkPhoneNumber:phone completion:^(NSError *error) { - if (error) { - [self logFailedTest:@"Could not link phone number."]; - } - [self logSuccess:@"link phone number test succeeded."]; - [self log:@"FINISHED AUTOMATED MANUAL TEST FOR PHONE NUMBER SIGN IN."]; - }]; - }]; - }]; - }]; - }]; - }]; -} - -- (void)automatedEmailSignUp { - [self log:@"INITIATING AUTOMATED MANUAL TEST FOR FACEBOOK SIGN IN:"]; - FIRAuth *auth = [AppManager auth]; - if (!auth) { - [self logFailedTest:@"Could not obtain auth object."]; - return; - } - [self signUpNewEmail:kFakeEmail password:kFakePassword callback:^(FIRUser *_Nullable user, - NSError *_Nullable error) { - if (error) { - [self logFailedTest: @" Email/Password Account account creation failed"]; - return; - } - [auth signOut:NULL]; - FIRAuthCredential *credential = [FIREmailAuthProvider credentialWithEmail:kFakeEmail - password:kFakePassword]; - [auth signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with Email/Password failed" error:error]; - [self logFailedTest:@"sign-in with Email/Password should succeed."]; - return; - } - [self logSuccess:@"sign-in with Email/Password succeeded."]; - [self log:@"FINISHED AUTOMATED MANUAL TEST FOR SIGN-IN WITH EMAIL/PASSWORD."]; - // Delete the user so that we can reuse the fake email address for subsequent tests. - [auth.currentUser deleteWithCompletion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"Failed to delete user" error:error]; - [self logFailedTest:@"Deleting a user that was recently signed-in should succeed."]; - return; - } - [self logSuccess:@"User deleted."]; - }]; - }]; - }]; -} - -- (void)automatedAnonymousSignIn { - [self log:@"INITIATING AUTOMATED MANUAL TEST FOR ANONYMOUS SIGN IN:"]; - FIRAuth *auth = [AppManager auth]; - if (!auth) { - [self logFailedTest:@"Could not obtain auth object."]; - return; - } - [auth signOut:NULL]; - [self signInAnonymouslyWithCallback:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (result.user) { - NSString *anonymousUID = result.user.uid; - [self signInAnonymouslyWithCallback:^(FIRAuthDataResult *_Nullable user, - NSError *_Nullable error) { - if (![result.user.uid isEqual:anonymousUID]) { - [self logFailedTest:@"Consecutive anonymous sign-ins should yeild the same User ID"]; - return; - } - [self log:@"FINISHED AUTOMATED MANUAL TEST FOR ANONYMOUS SIGN IN."]; - }]; - } - }]; -} - -- (void)automatedBYOAuthEmailPassword { - [self showSpinner:^{ - NSError *error; - NSString *customToken = [NSString stringWithContentsOfURL:[NSURL URLWithString:kCustomTokenUrl] - encoding:NSUTF8StringEncoding - error:&error]; - [self hideSpinner:^{ - if (error) { - [self log:@"There was an error retrieving the custom token."]; - return; - } - [[AppManager auth] signInWithCustomToken:customToken - completion:^(FIRAuthDataResult *_Nullable user, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with custom token failed" error:error]; - [self logFailedTest:@"A fresh custom token should succeed in signing-in."]; - return; - } - [self logSuccess:@"sign-in with custom token succeeded."]; - [self updateEmailPasswordWithCompletion:^{ - [self automatedBYOAuthDisplayNameAndPhotoURl]; - }]; - }]; - }]; - }]; -} - -- (void)automatedBYOAuthDisplayNameAndPhotoURl { - [self showSpinner:^{ - NSError *error; - NSString *customToken = [NSString stringWithContentsOfURL:[NSURL URLWithString:kCustomTokenUrl] - encoding:NSUTF8StringEncoding - error:&error]; - [self hideSpinner:^{ - if (error) { - [self log:@"There was an error retrieving the custom token."]; - return; - } - [[AppManager auth] signInWithCustomToken:customToken - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with custom token failed" error:error]; - [self logFailedTest:@"A fresh custom token should succeed in signing-in."]; - return; - } - [self logSuccess:@"sign-in with custom token succeeded."]; - [self updateDisplayNameAndPhotoURlWithCompletion:^{ - [self log:@"FINISHED AUTOMATED MANUAL TEST FOR BYOAUTH."]; - [self reloadUser]; - }]; - }]; - }]; - }]; -} - -- (void)updateEmailPasswordWithCompletion:(void(^)(void))completion { - FIRAuth *auth = [AppManager auth]; - [auth.currentUser updateEmail:kFakeEmail completion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"update email failed" error:error]; - [self logFailedTest:@"Update email should succeed when properly signed-in."]; - return; - } - [self logSuccess:@"update email succeeded."]; - [auth.currentUser updatePassword:kFakePassword completion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"update password failed" error:error]; - [self logFailedTest:@"Update password should succeed when properly signed-in."]; - return; - } - [self logSuccess:@"update password succeeded."]; - [auth signOut:NULL]; - FIRAuthCredential *credential = - [FIREmailAuthProvider credentialWithEmail:kFakeEmail password:kFakePassword]; - [auth signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with Email/Password failed" error:error]; - [self logFailedTest:@"sign-in with Email/Password should succeed."]; - return; - } - [self logSuccess:@"sign-in with Email/Password succeeded."]; - // Delete the user so that we can reuse the fake email address for subsequent tests. - [auth.currentUser deleteWithCompletion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"Failed to delete user." error:error]; - [self logFailedTest:@"Deleting a user that was recently signed-in should succeed"]; - return; - } - [self logSuccess:@"User deleted."]; - completion(); - }]; - }]; - }]; - }]; -} - -- (void)updateDisplayNameAndPhotoURlWithCompletion:(void(^)(void))completion { - FIRAuth *auth = [AppManager auth]; - FIRUserProfileChangeRequest *changeRequest = [auth.currentUser profileChangeRequest]; - changeRequest.photoURL = [NSURL URLWithString:kFakeDisplayPhotoUrl]; - [changeRequest commitChangesWithCompletion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"set photo URL failed" error:error]; - [self logFailedTest:@"Change photo Url should succeed when signed-in."]; - return; - } - [self logSuccess:@"set PhotoURL succeeded."]; - FIRUserProfileChangeRequest *changeRequest = [auth.currentUser profileChangeRequest]; - changeRequest.displayName = kFakeDisplayName; - [changeRequest commitChangesWithCompletion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"set display name failed" error:error]; - [self logFailedTest:@"Change display name should succeed when signed-in."]; - return; - } - [self logSuccess:@"set display name succeeded."]; - completion(); - }]; - }]; -} - -- (void)automatedSignInFacebookDisplayNamePhotoURL { - [self signInWithProvider:[AuthProviders facebook] callback:^{ - [self updateDisplayNameAndPhotoURlWithCompletion:^{ - [self log:@"FINISHED AUTOMATED MANUAL TEST FOR SIGN-IN WITH FACEBOOK."]; - [self reloadUser]; - }]; - }]; -} - -- (void)automatedAccountLinking { - [self log:@"INITIATING AUTOMATED MANUAL TEST FOR ACCOUNT LINKING:"]; - FIRAuth *auth = [AppManager auth]; - if (!auth) { - [self logFailedTest:@"Could not obtain auth object."]; - return; - } - [auth signOut:NULL]; - [self signInAnonymouslyWithCallback:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (result.user) { - NSString *anonymousUID = result.user.uid; - [self showMessagePromptWithTitle:@"Sign In Instructions" - message:kUnlinkAccountMessagePrompt - showCancelButton:NO - completion:^(BOOL userPressedOK, NSString *_Nullable userInput) { - [[AuthProviders google] - getAuthCredentialWithPresentingViewController:self - callback:^(FIRAuthCredential *credential, - NSError *error) { - if (credential) { - [result.user linkWithCredential:credential completion:^(FIRAuthDataResult *result, - NSError *error) { - FIRUser *user = result.user; - if (error) { - [self logFailure:@"link auth provider failed" error:error]; - [self logFailedTest:@"Account needs to be linked to complete the test."]; - return; - } - [self logSuccess:@"link auth provider succeeded."]; - if (user.isAnonymous) { - [self logFailure:@"link auth provider failed, user still anonymous" error:error]; - [self logFailedTest:@"Account needs to be linked to complete the test."]; - } - if (![user.uid isEqual:anonymousUID]){ - [self logFailedTest:@"link auth provider failed, UID's are different. Make sure " - "you link an account that has NOT been Linked nor Signed-In before."]; - return; - } - [self log:@"FINISHED AUTOMATED MANUAL TEST FOR ACCOUNT LINKING."]; - }]; - } - }]; - }]; - } - }]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Custom.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Custom.h deleted file mode 100644 index d0fb5994061..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Custom.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (Custom) - -- (StaticContentTableViewSection *)customAuthSection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Custom.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Custom.m deleted file mode 100644 index e86e4e87fca..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Custom.m +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 "MainViewController+Custom.h" - -#import "AppManager.h" -#import "MainViewController+Internal.h" -#import "CustomTokenDataEntryViewController.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation MainViewController (Custom) - -- (StaticContentTableViewSection *)customAuthSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"Custom Auth" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Sign in with Custom Token" - action:^{ [weakSelf signInWithCustomToken]; }], - ]]; -} - -- (void)signInWithCustomToken { - CustomTokenDataEntryViewControllerCompletion action = - ^(BOOL cancelled, NSString *_Nullable userEnteredTokenText) { - if (cancelled) { - [self log:@"CANCELLED:sign-in with custom token cancelled."]; - return; - } - - [self doSignInWithCustomToken:userEnteredTokenText]; - }; - CustomTokenDataEntryViewController *dataEntryViewController = - [[CustomTokenDataEntryViewController alloc] initWithCompletion:action]; - [self presentViewController:dataEntryViewController animated:YES completion:nil]; -} - -- (void)doSignInWithCustomToken:(NSString *_Nullable)userEnteredTokenText { - [[AppManager auth] signInWithCustomToken:userEnteredTokenText - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with custom token failed" error:error]; - [self showMessagePromptWithTitle:kSignInErrorAlertTitle - message:error.localizedDescription - showCancelButton:NO - completion:nil]; - return; - } - [self logSuccess:@"sign-in with custom token succeeded."]; - [self showMessagePromptWithTitle:kSignedInAlertTitle - message:result.user.displayName - showCancelButton:NO - completion:nil]; - }]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Email.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Email.h deleted file mode 100644 index d35485e9510..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Email.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -@import FirebaseAuth; -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (Email) - -- (StaticContentTableViewSection *)emailAuthSection; - -// TODO: restore. -typedef void (^FIRAuthResultCallback)(FIRUser *_Nullable user, NSError *_Nullable error); -- (void)signUpNewEmail:(NSString *)email - password:(NSString *)password - callback:(nullable FIRAuthResultCallback)callback; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Email.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Email.m deleted file mode 100644 index 611f5bf9519..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Email.m +++ /dev/null @@ -1,350 +0,0 @@ -/* - * 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 "MainViewController+Email.h" - -#import "AppManager.h" -@import FirebaseAuth; -#import "MainViewController+Internal.h" - -NS_ASSUME_NONNULL_BEGIN - -typedef void (^ShowEmailDialogCompletion)(FIRAuthCredential *credential); - -@implementation MainViewController (Email) - -- (StaticContentTableViewSection *)emailAuthSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"Email Auth" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Create User" - action:^{ [weakSelf createUser]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in with Email Password" - action:^{ [weakSelf signInEmailPassword]; }], - [StaticContentTableViewCell cellWithTitle:@"Link with Email Password" - action:^{ [weakSelf linkWithEmailPassword]; }], - [StaticContentTableViewCell cellWithTitle:@"Reauthenticate Email Password" - action:^{ [weakSelf reauthenticateEmailPassword]; }], - [StaticContentTableViewCell cellWithTitle:@"Send Email Sign in Link" - action:^{ [weakSelf sendEmailSignInLink]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in with Email Link" - action:^{ [weakSelf signInWithEmailLink]; }], - [StaticContentTableViewCell cellWithTitle:@"Link with Email Link" - action:^{ [weakSelf linkWithEmailLink]; }], - [StaticContentTableViewCell cellWithTitle:@"Unlink from Email" - action:^{ [weakSelf unlinkFromProvider:FIREmailAuthProvider.id - completion:nil]; }], - ]]; -} - -- (void)createUser { - [self showTextInputPromptWithMessage:@"Email:" - keyboardType:UIKeyboardTypeEmailAddress - completionBlock:^(BOOL userPressedOK, NSString *_Nullable email) { - if (!userPressedOK || !email.length) { - return; - } - [self showTextInputPromptWithMessage:@"Password:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable password) { - if (!userPressedOK) { - return; - } - [self showSpinner:^{ - [[AppManager auth] createUserWithEmail:email - password:password - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"create user failed" error:error]; - } else { - [self logSuccess:@"create user succeeded."]; - [self log:result.user.uid]; - } - [self hideSpinner:^{ - [self showTypicalUIForUserUpdateResultsWithTitle:@"Create User" error:error]; - }]; - }]; - }]; - }]; - }]; -} - -- (void)signUpNewEmail:(NSString *)email - password:(NSString *)password - callback:(nullable FIRAuthResultCallback)callback { - [[AppManager auth] createUserWithEmail:email - password:password - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-up with Email/Password failed" error:error]; - if (callback) { - callback(nil, error); - } - } else { - [self logSuccess:@"sign-up with Email/Password succeeded."]; - if (callback) { - callback(result.user, nil); - } - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In" error:error]; - }]; -} - -- (void)signInEmailPassword { - [self showTextInputPromptWithMessage:@"Email Address" - keyboardType:UIKeyboardTypeEmailAddress - completionBlock:^(BOOL userPressedOK, NSString *_Nullable email) { - if (!userPressedOK || !email.length) { - return; - } - [self showTextInputPromptWithMessage:@"Password" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable password) { - if (!userPressedOK) { - return; - } - [self showSpinner:^{ - [[AppManager auth] signInWithEmail:email - password:password - completion:^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - FIRMultiFactorResolver *resolver = error.userInfo[FIRAuthErrors.FIRAuthErrorUserInfoMultiFactorResolverKey]; - NSMutableString *displayNameString = [NSMutableString string]; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - [displayNameString appendString:tmpFactorInfo.displayName]; - [displayNameString appendString:@" "]; - } - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Select factor to sign in\n%@", displayNameString] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable displayName) { - FIRPhoneMultiFactorInfo* selectedHint; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - if ([displayName isEqualToString:tmpFactorInfo.displayName]) { - selectedHint = (FIRPhoneMultiFactorInfo *)tmpFactorInfo; - } - } - [FIRPhoneAuthProvider.provider - verifyPhoneNumberWithMultiFactorInfo:selectedHint - UIDelegate:nil - multiFactorSession:resolver.session - completion:^(NSString * _Nullable verificationID, NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor start sign in failed." error:error]; - } else { - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Verification code for %@", selectedHint.displayName] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable verificationCode) { - FIRPhoneAuthCredential *credential = - [[FIRPhoneAuthProvider provider] credentialWithVerificationID:verificationID - verificationCode:verificationCode]; - FIRMultiFactorAssertion *assertion = [FIRPhoneMultiFactorGenerator assertionWithCredential:credential]; - [resolver resolveSignInWithAssertion:assertion completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor finalize sign in failed." error:error]; - } else { - [self logSuccess:@"Multi factor finalize sign in succeeded."]; - } - }]; - }]; - } - }]; - }]; - } else { - [self logFailure:@"sign-in with Email/Password failed" error:error]; - } - } else { - [self logSuccess:@"sign-in with Email/Password succeeded."]; - [self log:[NSString stringWithFormat:@"UID: %@",authResult.user.uid]]; - } - }]; - }]; - }]; - }]; - }]; -} - -- (void)linkWithEmailPassword { - [self showEmailPasswordDialogWithCompletion:^(FIRAuthCredential *credential) { - [self showSpinner:^{ - [[self user] linkWithCredential:credential - completion:^(FIRAuthDataResult *result, NSError *error) { - if (error) { - [self logFailure:@"link Email Password failed." error:error]; - } else { - [self logSuccess:@"link Email Password succeeded."]; - } - [self hideSpinner:^{ - [self showTypicalUIForUserUpdateResultsWithTitle:@"Link with Email Password" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)reauthenticateEmailPassword { - FIRUser *user = [self user]; - if (!user) { - NSString *title = @"Missing User"; - NSString *message = @"There is no signed-in email/password user."; - [self showMessagePromptWithTitle:title message:message showCancelButton:NO completion:nil]; - return; - } - [self showEmailPasswordDialogWithCompletion:^(FIRAuthCredential *credential) { - [self showSpinner:^{ - [[self user] reauthenticateWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - [self authenticateWithSecondFactorError:error workflow:@"reauthicate"]; - } else { - [self logFailure:@"reauthicate failed" error:error]; - } - } else { - [self logSuccess:@"reauthicate with email password succeeded."]; - } - [self hideSpinner:^{ - [self showTypicalUIForUserUpdateResultsWithTitle:@"Reauthenticate Email Password" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)signInWithEmailLink { - [self showTextInputPromptWithMessage:@"Email Address:" - keyboardType:UIKeyboardTypeEmailAddress - completionBlock:^(BOOL userPressedOK, NSString *_Nullable email) { - if (!userPressedOK || !email.length) { - return; - } - [self showTextInputPromptWithMessage:@"Email Sign-In Link:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable link) { - if (!userPressedOK) { - return; - } - if ([[FIRAuth auth] isSignInWithEmailLink:link]) { - [self showSpinner:^{ - [[AppManager auth] signInWithEmail:email - link:link - completion:^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - [self authenticateWithSecondFactorError:error workflow:@"sign in"]; - } else { - [self logFailure:@"sign-in with Email/Sign-In link failed" error:error]; - } - } else { - [self logSuccess:@"sign-in with Email/Sign-In link succeeded."]; - [self log:[NSString stringWithFormat:@"UID: %@",authResult.user.uid]]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In Error" error:error]; - }]; - }]; - }]; - } else { - [self log:@"The sign-in link is invalid"]; - } - }]; - }]; -} - -- (void)sendEmailSignInLink { - [self showTextInputPromptWithMessage:@"Email:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK) { - return; - } - [self showSpinner:^{ - void (^requestEmailSignInLink)(void (^)(NSError *)) = ^(void (^completion)(NSError *)) { - [[AppManager auth] sendSignInLinkToEmail:userInput - actionCodeSettings:[self actionCodeSettings] - completion:completion]; - }; - requestEmailSignInLink(^(NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Email Link request failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"Email Link request succeeded."]; - [self showMessagePrompt:@"Sent"]; - }]; - }); - }]; - }]; -} - -- (void)linkWithEmailLink { - [self showEmailLinkDialogWithCompletion:^(FIRAuthCredential *credential) { - [self showSpinner:^{ - [[self user] linkWithCredential:credential - completion:^(FIRAuthDataResult *result, NSError *error) { - if (error) { - [self logFailure:@"link Email Link failed." error:error]; - } else { - [self logSuccess:@"link Email Link succeeded."]; - } - [self hideSpinner:^{ - [self showTypicalUIForUserUpdateResultsWithTitle:@"Link with Email Link" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)showEmailPasswordDialogWithCompletion:(ShowEmailDialogCompletion)completion { - [self showTextInputPromptWithMessage:@"Email Address:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable email) { - if (!userPressedOK || !email.length) { - return; - } - [self showTextInputPromptWithMessage:@"Password:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable password) { - if (!userPressedOK || !password.length) { - return; - } - FIRAuthCredential *credential = [FIREmailAuthProvider credentialWithEmail:email - password:password]; - completion(credential); - }]; - }]; -} - -- (void)showEmailLinkDialogWithCompletion:(ShowEmailDialogCompletion)completion { - [self showTextInputPromptWithMessage:@"Email Address:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable email) { - if (!userPressedOK || !email.length) { - return; - } - [self showTextInputPromptWithMessage:@"Link:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable link) { - if (!userPressedOK || !link.length) { - return; - } - FIRAuthCredential *credential = [FIREmailAuthProvider credentialWithEmail:email - link:link]; - completion(credential); - }]; - }]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Facebook.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Facebook.h deleted file mode 100644 index 18aa7d12b7a..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Facebook.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (Facebook) - -- (StaticContentTableViewSection *)facebookAuthSection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Facebook.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Facebook.m deleted file mode 100644 index 778d010141e..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Facebook.m +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 "MainViewController+Facebook.h" - -#import "AuthProviders.h" -#import "MainViewController+Internal.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation MainViewController (Facebook) - -- (StaticContentTableViewSection *)facebookAuthSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"Facebook Auth" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Sign in with Facebook" - action:^{ [weakSelf signInFacebook]; }], - [StaticContentTableViewCell cellWithTitle:@"Link with Facebook" - action:^{ [weakSelf linkWithFacebook]; }], - [StaticContentTableViewCell cellWithTitle:@"Unlink from Facebook" - action:^{ - [weakSelf unlinkFromProvider:FIRFacebookAuthProvider.id completion:nil]; - }], - [StaticContentTableViewCell cellWithTitle:@"Reauthenticate Facebook" - action:^{ [weakSelf reauthenticateFacebook]; }], - ]]; -} - -- (void)signInFacebook { - [self signinWithProvider:[AuthProviders facebook] retrieveData:YES]; -} - -- (void)linkWithFacebook { - [self linkWithAuthProvider:[AuthProviders facebook] retrieveData:NO]; -} - -- (void)reauthenticateFacebook { - [self reauthenticate:[AuthProviders facebook] retrieveData:NO]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+GameCenter.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+GameCenter.h deleted file mode 100644 index 85b5485aebf..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+GameCenter.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 -#import - -#import "MainViewController.h" - -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (GameCenter) - -- (StaticContentTableViewSection *)gameCenterAuthSection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+GameCenter.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+GameCenter.m deleted file mode 100644 index 3887d413046..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+GameCenter.m +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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 "MainViewController+GameCenter.h" - -#import "AppManager.h" -#import -#import "MainViewController+Internal.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation MainViewController (GameCenter) - -- (StaticContentTableViewSection *)gameCenterAuthSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"Game Center Auth" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Log in System Game Center" - action:^{ [weakSelf logInWithSystemGameCenter]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in Game Center" - action:^{ [weakSelf signInWithGameCenter]; }], - [StaticContentTableViewCell cellWithTitle:@"Link Game Center" - action:^{ [weakSelf linkWithGameCenter]; }], - [StaticContentTableViewCell cellWithTitle:@"Unlink Game Center" - action:^{ [weakSelf unlinkFromProvider:FIRGameCenterAuthProvider.id completion:nil]; }], - [StaticContentTableViewCell cellWithTitle:@"Reauthenticate Game Center" - action:^{ [weakSelf reauthenticateWithGameCenter]; }], - ]]; -} - -- (void)logInWithSystemGameCenter { - GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer]; - localPlayer.authenticateHandler = ^(UIViewController * _Nullable viewController, - NSError * _Nullable error) { - if (error) { - [self showTypicalUIForUserUpdateResultsWithTitle:@"Game Center Error" error:error]; - } else if (viewController != nil) { - [self presentViewController:viewController animated:YES completion:nil]; - } - }; -} - -- (void)signInWithGameCenter { - [FIRGameCenterAuthProvider getCredentialWithCompletion: - ^(FIRAuthCredential * _Nullable credential, NSError * _Nullable error) { - if (error) { - [self showTypicalUIForUserUpdateResultsWithTitle:@"Game Center Error" error:error]; - } else { - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult * _Nullable result, - NSError * _Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Sign in with Game Center failed" error:error]; - } else { - [self logSuccess:@"Sign in with Game Center succeeded."]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign In Error" error:error]; - }]; - }]; - } - }]; -} - -- (void)linkWithGameCenter { - [FIRGameCenterAuthProvider getCredentialWithCompletion: - ^(FIRAuthCredential * _Nullable credential, NSError * _Nullable error) { - if (error) { - [self showTypicalUIForUserUpdateResultsWithTitle:@"Game Center Error" error:error]; - } else { - [[self user] linkWithCredential:credential - completion:^(FIRAuthDataResult * _Nullable result, - NSError * _Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Link with Game Center failed" error:error]; - } else { - [self logSuccess:@"Link with Game Center succeeded."]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Link Error" error:error]; - }]; - }]; - } - }]; -} - -- (void)reauthenticateWithGameCenter { - [FIRGameCenterAuthProvider getCredentialWithCompletion: - ^(FIRAuthCredential * _Nullable credential, NSError * _Nullable error) { - if (error) { - [self showTypicalUIForUserUpdateResultsWithTitle:@"Game Center Error" error:error]; - } else { - [[self user] reauthenticateWithCredential:credential - completion:^(FIRAuthDataResult * _Nullable result, - NSError * _Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Reauthenticate with Game Center failed" error:error]; - } else { - [self logSuccess:@"Reauthenticate with Game Center succeeded."]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Reauthenticate Error" error:error]; - }]; - }]; - } - }]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Google.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Google.h deleted file mode 100644 index ef941148906..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Google.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (Google) - -- (StaticContentTableViewSection *)googleAuthSection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Google.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Google.m deleted file mode 100644 index 3679e2d0c92..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Google.m +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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 "MainViewController+Google.h" - -#import "AppManager.h" -#import "AuthProviders.h" -#import "MainViewController+Internal.h" -@import FirebaseAuth; - -typedef void (^FIRAuthDataResultCallback)(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error); - -NS_ASSUME_NONNULL_BEGIN - -@implementation MainViewController (Google) - -- (StaticContentTableViewSection *)googleAuthSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"Google Auth" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Sign in with Google" - action:^{ [weakSelf signInGoogle]; }], - [StaticContentTableViewCell cellWithTitle:@"Link with Google" - action:^{ [weakSelf linkWithGoogle]; }], - [StaticContentTableViewCell cellWithTitle:@"Unlink from Google" - action:^{ [weakSelf unlinkFromProvider:FIRGoogleAuthProvider.id completion:nil]; }], - [StaticContentTableViewCell cellWithTitle:@"Reauthenticate Google" - action:^{ [weakSelf reauthenticateGoogle]; }], - ]]; -} - -- (void)signInGoogle { - FIRAuth *auth = [AppManager auth]; - if (!auth) { - return; - } - [[AuthProviders google] getAuthCredentialWithPresentingViewController:self - callback:^(FIRAuthCredential *credential, - NSError *error) { - if (credential) { - FIRAuthDataResultCallback completion = ^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - if (error) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - FIRMultiFactorResolver *resolver = error.userInfo[FIRAuthErrors.FIRAuthErrorUserInfoMultiFactorResolverKey]; - NSMutableString *displayNameString = [NSMutableString string]; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - [displayNameString appendString:tmpFactorInfo.displayName]; - [displayNameString appendString:@" "]; - } - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Select factor to sign in\n%@", displayNameString] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable displayName) { - FIRPhoneMultiFactorInfo* selectedHint; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - if ([displayName isEqualToString:tmpFactorInfo.displayName]) { - selectedHint = (FIRPhoneMultiFactorInfo *)tmpFactorInfo; - } - } - [FIRPhoneAuthProvider.provider - verifyPhoneNumberWithMultiFactorInfo:selectedHint - UIDelegate:nil - multiFactorSession:resolver.session - completion:^(NSString * _Nullable verificationID, NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor start sign in failed." error:error]; - } else { - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Verification code for %@", selectedHint.displayName] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable verificationCode) { - FIRPhoneAuthCredential *credential = - [[FIRPhoneAuthProvider provider] credentialWithVerificationID:verificationID - verificationCode:verificationCode]; - FIRMultiFactorAssertion *assertion = [FIRPhoneMultiFactorGenerator assertionWithCredential:credential]; - [resolver resolveSignInWithAssertion:assertion completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor finalize sign in failed." error:error]; - } else { - [self logSuccess:@"Multi factor finalize sign in succeeded."]; - } - }]; - }]; - } - }]; - }]; - } else { - [self logFailure:@"sign-in with provider failed" error:error]; - } - } else { - [self logSuccess:@"sign-in with provider succeeded."]; - } - if (authResult.additionalUserInfo) { - [self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]]; - if (self.isNewUserToggleOn) { - NSString *newUserString = authResult.additionalUserInfo.isNewUser ? - @"New user" : @"Existing user"; - [self showMessagePromptWithTitle:@"New or Existing" - message:newUserString - showCancelButton:NO - completion:nil]; - } - } - }; - [auth signInWithCredential:credential completion:completion]; - } - }]; -} - -- (void)linkWithGoogle { - [self linkWithAuthProvider:[AuthProviders google] retrieveData:NO]; -} - -- (void)reauthenticateGoogle { - [self reauthenticate:[AuthProviders google] retrieveData:NO]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Internal.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Internal.h deleted file mode 100644 index 447020d7e30..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Internal.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -@import FirebaseAuth; -#import "UIViewController+Alerts.h" -#import "AuthProviders.h" - -NS_ASSUME_NONNULL_BEGIN - -static NSString *const kSignedInAlertTitle = @"Signed In"; - -static NSString *const kSignInErrorAlertTitle = @"Sign-In Error"; - -/** @brief The request type for OOB action codes. - */ -typedef enum { - /** No action code settings. */ - ActionCodeRequestTypeEmail, - /** With continue URL but not handled in-app. */ - ActionCodeRequestTypeContinue, - /** Handled in-app. */ - ActionCodeRequestTypeInApp, -} ActionCodeRequestType; - -typedef void (^TextInputCompletionBlock)(NSString *_Nullable userInput); - -typedef void (^TestAutomationCallback)(NSError *_Nullable error); - -@interface MainViewController () - -@property(nonatomic) BOOL isNewUserToggleOn; - -@property(nonatomic) ActionCodeRequestType actionCodeRequestType; - -@property(nonatomic) NSURL *actionCodeContinueURL; - -@property(nonatomic, copy) NSString *appleRawNonce; - -@property(nonatomic) FIROAuthProvider *googleOAuthProvider; -@property(nonatomic) FIROAuthProvider *microsoftOAuthProvider; -@property(nonatomic) FIROAuthProvider *twitterOAuthProvider; -@property(nonatomic) FIROAuthProvider *linkedinOAuthProvider; -@property(nonatomic) FIROAuthProvider *yahooOAuthProvider; -@property(nonatomic) FIROAuthProvider *gitHubOAuthProvider; - -// TODO: Restore FIRAuthStateDidChangeListenerHandle for CocoaPods. -@property(nonatomic) NSMutableArray> *authStateDidChangeListeners; - -@property(nonatomic) NSMutableArray> *IDTokenDidChangeListeners; - -- (void)updateTable; - -- (FIRUser *)user; - -- (void)signinWithProvider:(id)authProvider retrieveData:(BOOL)retrieveData; - -- (void)signInWithProvider:(nonnull id)provider callback:(void(^)(void))callback; - -- (void)linkWithAuthProvider:(id)authProvider retrieveData:(BOOL)retrieveData; - -- (void)unlinkFromProvider:(NSString *)provider - completion:(nullable TestAutomationCallback)completion; - -- (void)reauthenticate:(id)authProvider retrieveData:(BOOL)retrieveData; - -- (void)log:(NSString *)string; - -- (void)logSuccess:(NSString *)string; - -- (void)logFailure:(NSString *)string error:(NSError * _Nullable) error; - -- (void)logFailedTest:(NSString *)reason; - -- (NSString *)stringWithAdditionalUserInfo:(nullable FIRAdditionalUserInfo *)additionalUserInfo; - -- (void)showTypicalUIForUserUpdateResultsWithTitle:(NSString *)resultsTitle - error:(NSError * _Nullable)error; - -- (FIRActionCodeSettings *)actionCodeSettings; - -- (void)authenticateWithSecondFactorError:(NSError * _Nullable)error - workflow:(NSString *)workflow; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+MultiFactor.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+MultiFactor.h deleted file mode 100644 index 97bd9c38dab..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+MultiFactor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (MultiFactor) - -- (StaticContentTableViewSection *)multiFactorSection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+MultiFactor.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+MultiFactor.m deleted file mode 100644 index 19b363b8270..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+MultiFactor.m +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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 "MainViewController+MultiFactor.h" - -@import FirebaseAuth; -#import "MainViewController+Internal.h" -#import - -NS_ASSUME_NONNULL_BEGIN - -@implementation MainViewController (MultiFactor) - -- (StaticContentTableViewSection *)multiFactorSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"Multi Factor" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Phone Enroll" - action:^{ [weakSelf phoneEnroll]; }], - [StaticContentTableViewCell cellWithTitle:@"TOTP Enroll" - action:^{ [weakSelf TOTPEnroll]; }], - [StaticContentTableViewCell cellWithTitle:@"MultiFactor Unenroll" - action:^{ [weakSelf mfaUnenroll]; }], - ]]; -} - -- (void)phoneEnroll { - FIRUser *user = FIRAuth.auth.currentUser; - if (!user) { - [self logFailure:@"Please sign in first." error:nil]; - return; - } - [self showTextInputPromptWithMessage:@"Phone Number" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable phoneNumber) { - [user.multiFactor - getSessionWithCompletion:^(FIRMultiFactorSession *_Nullable session, NSError *_Nullable error) { - // this is the step verfication code has been send to the phone number along with validating the number - [FIRPhoneAuthProvider.provider verifyPhoneNumber:phoneNumber - UIDelegate:nil - multiFactorSession:session - completion:^(NSString * _Nullable verificationID, - NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor start enroll failed." error:error]; - } else { - [self showTextInputPromptWithMessage:@"Verification code" - completionBlock:^(BOOL userPressedOK, - NSString *_Nullable verificationCode) { - FIRPhoneAuthCredential *credential = - [[FIRPhoneAuthProvider provider] credentialWithVerificationID:verificationID - verificationCode:verificationCode]; - FIRMultiFactorAssertion *assertion = - [FIRPhoneMultiFactorGenerator assertionWithCredential:credential]; - [self showTextInputPromptWithMessage:@"Display name" - completionBlock:^(BOOL userPressedOK, - NSString *_Nullable displayName) { - [user.multiFactor enrollWithAssertion:assertion - displayName:displayName - completion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"Multi factor finalize enroll failed." error:error]; - } else { - [self logSuccess:@"Multi factor finalize enroll succeeded."]; - } - }]; - }]; - }]; - } - }]; - }]; - }]; -} - -- (void)TOTPEnroll { - FIRUser *user = FIRAuth.auth.currentUser; - if (!user) { - [self logFailure:@"Please sign in first." error:nil]; - return; - } - [user.multiFactor getSessionWithCompletion:^(FIRMultiFactorSession *_Nullable session, NSError *_Nullable error) { - if (error) { - [self logFailure:@"Error getting multi-factor session." error:error]; - return; - } - [FIRTOTPMultiFactorGenerator generateSecretWithMultiFactorSession:session completion:^(FIRTOTPSecret *_Nullable secret, NSError *_Nullable error) { - if (error) { - [self logFailure:@"Error generating TOTP secret." error:error]; - return; - } - NSString *accountName = user.email; - NSString *issuer = FIRAuth.auth.app.name; - dispatch_async(dispatch_get_main_queue(), ^{ - NSString *url = [secret generateQRCodeURLWithAccountName:accountName issuer:issuer]; - if(!url.length) { - [self logFailure: @"Multi factor finalize enroll failed. Could not generate url." error:nil]; - return; - } - [secret openInOTPAppWithQRCodeURL:url]; - [self showQRCodePromptWithTextInput:@"Scan this QR Code and enter OTP:" - qrCodeString:url - completionBlock:^(BOOL userPressedOK, NSString *_Nullable oneTimePassword) { - FIRTOTPMultiFactorAssertion *assertion = [FIRTOTPMultiFactorGenerator assertionForEnrollmentWithSecret:secret oneTimePassword:oneTimePassword]; - [self showTextInputPromptWithMessage:@"Display name" - completionBlock:^(BOOL userPressedOK, - NSString *_Nullable displayName) { - [user.multiFactor enrollWithAssertion:assertion - displayName:displayName - completion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"Multi factor finalize enroll failed." error:error]; - } else { - [self logSuccess:@"Multi factor finalize enroll succeeded."]; - } - }]; - }]; - }]; - }); - }]; - }]; -} - -- (void)mfaUnenroll { - NSMutableString *displayNameString = [NSMutableString string]; - for (FIRMultiFactorInfo *tmpFactorInfo in FIRAuth.auth.currentUser.multiFactor.enrolledFactors) { - [displayNameString appendString:tmpFactorInfo.displayName]; - [displayNameString appendString:@" "]; - } - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Enter multi factor to unenroll\n%@", displayNameString] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable displayName) { - FIRMultiFactorInfo *factorInfo; - for (FIRMultiFactorInfo *tmpFactorInfo in FIRAuth.auth.currentUser.multiFactor.enrolledFactors) { - if ([displayName isEqualToString:tmpFactorInfo.displayName]) { - factorInfo = tmpFactorInfo; - } - } - [FIRAuth.auth.currentUser.multiFactor unenrollWithInfo:factorInfo - completion:^(NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor unenroll failed." error:error]; - } else { - [self logSuccess:@"Multi factor unenroll succeeded."]; - } - }]; - }]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+OAuth.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+OAuth.h deleted file mode 100644 index f487050c6a0..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+OAuth.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (OAuth) - -- (StaticContentTableViewSection *)oAuthSection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+OAuth.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+OAuth.m deleted file mode 100644 index e5ae479ca9c..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+OAuth.m +++ /dev/null @@ -1,493 +0,0 @@ -/* - * 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 CommonCrypto; - -#import "MainViewController+OAuth.h" - -#import - -#import "AppManager.h" -@import FirebaseAuth; -#import "MainViewController+Internal.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController () - -@end - -@implementation MainViewController (OAuth) - -- (StaticContentTableViewSection *)oAuthSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"OAuth" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Sign in with Google" - action:^{ [weakSelf signInGoogleHeadfulLite]; }], - [StaticContentTableViewCell cellWithTitle:@"Link with Google" - action:^{ [weakSelf linkWithGoogleHeadfulLite]; }], - [StaticContentTableViewCell cellWithTitle:@"Reauthenticate with Google" - action:^{ [weakSelf reauthenticateWithGoogleHeadfulLite]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in with Apple" - action:^{ [weakSelf signInWithApple]; }], - [StaticContentTableViewCell cellWithTitle:@"Link with Apple" - action:^{ [weakSelf linkWithApple]; }], - [StaticContentTableViewCell cellWithTitle:@"Unlink with Apple" - action:^{ [weakSelf unlinkFromProvider:@"apple.com" completion:nil]; }], - [StaticContentTableViewCell cellWithTitle:@"Reauthenticate with Apple" - action:^{ [weakSelf reauthenticateWithApple]; }], - [StaticContentTableViewCell cellWithTitle:@"Revoke Apple Token and Delete User" - action:^{ [weakSelf revokeAppleTokenAndDeleteUser]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in with Twitter" - action:^{ [weakSelf signInTwitterHeadfulLite]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in with GitHub" - action:^{ [weakSelf signInGitHubHeadfulLite]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in with GitHub (Access token)" - action:^{ [weakSelf signInWithGitHub]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in with Microsoft" - action:^{ [weakSelf signInMicrosoftHeadfulLite]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in with Yahoo" - action:^{ [weakSelf signInYahooHeadfulLite]; }], - [StaticContentTableViewCell cellWithTitle:@"Sign in with Linkedin" - action:^{ [weakSelf signInLinkedinHeadfulLite]; }], - ]]; -} - -- (void)signInGoogleHeadfulLite { - FIROAuthProvider *provider = self.googleOAuthProvider; - provider.customParameters = @{ - @"prompt" : @"consent", - }; - provider.scopes = @[ @"profile", @"email", @"https://www.googleapis.com/auth/plus.me" ]; - [self showSpinner:^{ - [[AppManager auth] signInWithProvider:provider - UIDelegate:nil - completion:^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"sign-in with provider (Google) failed" error:error]; - } else if (authResult.additionalUserInfo) { - [self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]]; - if (self.isNewUserToggleOn) { - NSString *newUserString = authResult.additionalUserInfo.newUser ? - @"New user" : @"Existing user"; - [self showMessagePromptWithTitle:@"New or Existing" - message:newUserString - showCancelButton:NO - completion:nil]; - } - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In Error" error:error]; - }]; - }]; - }]; -} - -- (void)linkWithGoogleHeadfulLite { - FIROAuthProvider *provider = self.googleOAuthProvider; - provider.customParameters = @{ - @"prompt" : @"consent", - }; - provider.scopes = @[ @"profile", @"email", @"https://www.googleapis.com/auth/plus.me" ]; - [self showSpinner:^{ - [[AppManager auth].currentUser linkWithProvider:provider - UIDelegate:nil - completion:^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Reauthenticate with provider (Google) failed" error:error]; - } else if (authResult.additionalUserInfo) { - [self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]]; - if (self.isNewUserToggleOn) { - NSString *newUserString = authResult.additionalUserInfo.newUser ? - @"New user" : @"Existing user"; - [self showMessagePromptWithTitle:@"New or Existing" - message:newUserString - showCancelButton:NO - completion:nil]; - } - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Link Error" error:error]; - }]; - }]; - }]; -} - -- (void)reauthenticateWithGoogleHeadfulLite { - FIROAuthProvider *provider = self.googleOAuthProvider; - provider.customParameters = @{ - @"prompt" : @"consent", - }; - provider.scopes = @[ @"profile", @"email", @"https://www.googleapis.com/auth/plus.me" ]; - [self showSpinner:^{ - [[AppManager auth].currentUser reauthenticateWithProvider:provider - UIDelegate:nil - completion:^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Link with provider (Google) failed" error:error]; - } else if (authResult.additionalUserInfo) { - [self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]]; - if (self.isNewUserToggleOn) { - NSString *newUserString = authResult.additionalUserInfo.newUser ? - @"New user" : @"Existing user"; - [self showMessagePromptWithTitle:@"New or Existing" - message:newUserString - showCancelButton:NO - completion:nil]; - } - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Reauthenticate Error" error:error]; - }]; - }]; - }]; -} - -- (void)signInTwitterHeadfulLite { - FIROAuthProvider *provider = self.twitterOAuthProvider; - [self showSpinner:^{ - [provider getCredentialWithUIDelegate:nil completion:^(FIRAuthCredential *_Nullable credential, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with Twitter failed" error:error]; - return; - } - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable - authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"sign-in with Twitter (headful-lite) failed" error:error]; - return; - } else { - [self logSuccess:@"sign-in with Twitter (headful-lite) succeeded."]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In Error" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)signInWithGitHub { - [self showTextInputPromptWithMessage:@"GitHub Access Token:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable accessToken) { - if (!userPressedOK || !accessToken.length) { - return; - } - FIROAuthCredential *credential = - [FIROAuthProvider credentialWithProviderID:FIRGitHubAuthProvider.id accessToken:accessToken]; - if (credential) { - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with provider failed" error:error]; - } else { - [self logSuccess:@"sign-in with provider succeeded."]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In" error:error]; - }]; - } - }]; -} - -- (void)signInGitHubHeadfulLite { - FIROAuthProvider *provider = self.gitHubOAuthProvider; - [self showSpinner:^{ - [provider getCredentialWithUIDelegate:nil completion:^(FIRAuthCredential *_Nullable credential, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with GitHub failed" error:error]; - return; - } - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable - authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"sign-in with GitHub (headful-lite) failed" error:error]; - return; - } else { - [self logSuccess:@"sign-in with GitHub (headful-lite) succeeded."]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In Error" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)signInLinkedinHeadfulLite { - FIROAuthProvider *provider = self.linkedinOAuthProvider; - [self showSpinner:^{ - [provider getCredentialWithUIDelegate:nil completion:^(FIRAuthCredential *_Nullable credential, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with Linkedin failed" error:error]; - return; - } - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable - authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"sign-in with Linkedin (headful-lite) failed" error:error]; - return; - } else { - [self logSuccess:@"sign-in with Linkedin (headful-lite) succeeded."]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In Error" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)signInMicrosoftHeadfulLite { - FIROAuthProvider *provider = self.microsoftOAuthProvider; - provider.customParameters = @{ - @"prompt" : @"consent", - @"login_hint" : @"tu8731@gmail.com", - }; - provider.scopes = @[ @"user.readwrite,calendars.read" ]; - [self showSpinner:^{ - [provider getCredentialWithUIDelegate:nil completion:^(FIRAuthCredential *_Nullable credential, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with Microsoft failed" error:error]; - return; - } - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable - authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"sign-in with Microsoft failed" error:error]; - return; - } else { - [self logSuccess:@"sign-in with Microsoft (headful-lite) succeeded."]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In Error" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)signInYahooHeadfulLite { - FIROAuthProvider *provider = self.yahooOAuthProvider; - [self showSpinner:^{ - [provider getCredentialWithUIDelegate:nil completion:^(FIRAuthCredential *_Nullable credential, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with Yahoo failed" error:error]; - return; - } - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable - authResult, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"sign-in with Yahoo (headful-lite) failed" error:error]; - return; - } else { - [self logSuccess:@"sign-in with Yahoo (headful-lite) succeeded."]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In Error" error:error]; - }]; - }]; - }]; - }]; -} - -- (ASAuthorizationAppleIDRequest *)appleIDRequestWithState:(NSString *)state API_AVAILABLE(ios(13.0)) { - ASAuthorizationAppleIDRequest *request = [[[ASAuthorizationAppleIDProvider alloc] init] createRequest]; - request.requestedScopes = @[ASAuthorizationScopeEmail, ASAuthorizationScopeFullName]; - NSString *rawNonce = [self randomNonce:32]; - self.appleRawNonce = rawNonce; - request.nonce = [self stringBySha256HashingString:rawNonce]; - request.state = state; - return request; -} - -- (NSString *)randomNonce:(NSInteger)length { - NSAssert(length > 0, @"Expected nonce to have positive length"); - NSString *characterSet = @"0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._"; - NSMutableString *result = [NSMutableString string]; - NSInteger remainingLength = length; - - while (remainingLength > 0) { - NSMutableArray *randoms = [NSMutableArray arrayWithCapacity:16]; - for (NSInteger i = 0; i < 16; i++) { - uint8_t random = 0; - int errorCode = SecRandomCopyBytes(kSecRandomDefault, 1, &random); - NSAssert(errorCode == errSecSuccess, @"Unable to generate nonce: OSStatus %i", errorCode); - - [randoms addObject:@(random)]; - } - - for (NSNumber *random in randoms) { - if (remainingLength == 0) { - break; - } - - if (random.unsignedIntValue < characterSet.length) { - unichar character = [characterSet characterAtIndex:random.unsignedIntValue]; - [result appendFormat:@"%C", character]; - remainingLength--; - } - } - } - - return result; -} - -- (NSString *)stringBySha256HashingString:(NSString *)input { - const char *string = [input UTF8String]; - unsigned char result[CC_SHA256_DIGEST_LENGTH]; - CC_SHA256(string, (CC_LONG)strlen(string), result); - - NSMutableString *hashed = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH * 2]; - for (NSInteger i = 0; i < CC_SHA256_DIGEST_LENGTH; i++) { - [hashed appendFormat:@"%02x", result[i]]; - } - return hashed; -} - -- (void)signInWithApple { - if (@available(iOS 13, *)) { - ASAuthorizationAppleIDRequest* request = [self appleIDRequestWithState:@"signIn"]; - - ASAuthorizationController* controller = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]]; - controller.delegate = self; - controller.presentationContextProvider = self; - [controller performRequests]; - } -} - -- (void)linkWithApple { - if (@available(iOS 13, *)) { - ASAuthorizationAppleIDRequest* request = [self appleIDRequestWithState:@"link"]; - - ASAuthorizationController* controller = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]]; - controller.delegate = self; - controller.presentationContextProvider = self; - [controller performRequests]; - } -} - -- (void)reauthenticateWithApple { - if (@available(iOS 13, *)) { - ASAuthorizationAppleIDRequest* request = [self appleIDRequestWithState:@"reauth"]; - - ASAuthorizationController* controller = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]]; - controller.delegate = self; - controller.presentationContextProvider = self; - [controller performRequests]; - } -} - -- (void)revokeAppleTokenAndDeleteUser { - FIRUser *user = [FIRAuth auth].currentUser; - - // Optionally revoke Apple token before account deletion - BOOL isAppleProviderLinked = false; - for (id provider in user.providerData) { - if ([[provider providerID] isEqual: @"apple.com"]) { - isAppleProviderLinked = true; - } - } - if (isAppleProviderLinked) { - if (@available(iOS 13, *)) { - ASAuthorizationAppleIDRequest* request = [self appleIDRequestWithState:@"revokeAppleTokenAndDeleteUser"]; - ASAuthorizationController* controller = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]]; - controller.delegate = self; - controller.presentationContextProvider = self; - [controller performRequests]; - - } else { - // Usual user deletion - } - } -} - -- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0)) { - ASAuthorizationAppleIDCredential* appleIDCredential = authorization.credential; - NSString *IDToken = [NSString stringWithUTF8String:[appleIDCredential.identityToken bytes]]; - FIROAuthCredential *credential = - [FIROAuthProvider appleCredentialWithIDToken:IDToken - rawNonce:self.appleRawNonce - fullName:appleIDCredential.fullName]; - - if ([appleIDCredential.state isEqualToString:@"signIn"]) { - [FIRAuth.auth signInWithCredential:credential completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) { - if (!error) { - NSLog(@"%@", authResult.description); - } else { - NSLog(@"%@", error.description); - } - }]; - } else if ([appleIDCredential.state isEqualToString:@"link"]) { - [FIRAuth.auth.currentUser linkWithCredential:credential completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) { - if (!error) { - NSLog(@"%@", authResult.description); - } else { - NSLog(@"%@", error.description); - } - }]; - } else if ([appleIDCredential.state isEqualToString:@"reauth"]) { - [FIRAuth.auth.currentUser reauthenticateWithCredential:credential completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) { - if (!error) { - NSLog(@"%@", authResult.description); - } else { - NSLog(@"%@", error.description); - } - }]; - } else if ([appleIDCredential.state isEqualToString:@"revokeAppleTokenAndDeleteUser"]) { - NSString *code = [[NSString alloc] initWithData:appleIDCredential.authorizationCode encoding:NSUTF8StringEncoding]; - FIRUser *user = FIRAuth.auth.currentUser; - [FIRAuth.auth revokeTokenWithAuthorizationCode:code completion:^(NSError * _Nullable error) { - if (!error) { - // Token revocation succeeded then delete user again. - [user deleteWithCompletion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"delete account failed" error:error]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Delete User" error:error]; - }]; - } else { - NSLog(@"%@", error.description); - } - }]; - } -} - -- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error API_AVAILABLE(ios(13.0)) { - NSLog(@"%@", error.description); -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+OOB.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+OOB.h deleted file mode 100644 index 2c16d87dc3c..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+OOB.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -static NSString *const kPasswordResetAction = @"resetPassword"; - -static NSString *const kVerifyEmailAction = @"verifyEmail"; - -@interface MainViewController (OOB) - -- (StaticContentTableViewSection *)oobSection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+OOB.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+OOB.m deleted file mode 100644 index bb021c021c0..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+OOB.m +++ /dev/null @@ -1,273 +0,0 @@ -/* - * 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 "MainViewController+OOB.h" - -#import "AppManager.h" -#import "MainViewController+Internal.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation MainViewController (OOB) - -- (StaticContentTableViewSection *)oobSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"OOB" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Action Type" - value:[self actionCodeRequestTypeString] - action:^{ [weakSelf toggleActionCodeRequestType]; }], - [StaticContentTableViewCell cellWithTitle:@"Continue URL" - value:self.actionCodeContinueURL.absoluteString ?: @"(nil)" - action:^{ [weakSelf changeActionCodeContinueURL]; }], - [StaticContentTableViewCell cellWithTitle:@"Request Verify Email" - action:^{ [weakSelf requestVerifyEmail]; }], - [StaticContentTableViewCell cellWithTitle:@"Request Password Reset" - action:^{ [weakSelf requestPasswordReset]; }], - [StaticContentTableViewCell cellWithTitle:@"Reset Password" - action:^{ [weakSelf resetPassword]; }], - [StaticContentTableViewCell cellWithTitle:@"Check Action Code" - action:^{ [weakSelf checkActionCode]; }], - [StaticContentTableViewCell cellWithTitle:@"Apply Action Code" - action:^{ [weakSelf applyActionCode]; }], - [StaticContentTableViewCell cellWithTitle:@"Verify Password Reset Code" - action:^{ [weakSelf verifyPasswordResetCode]; }], - ]]; -} - -- (void)toggleActionCodeRequestType { - switch (self.actionCodeRequestType) { - case ActionCodeRequestTypeInApp: - self.actionCodeRequestType = ActionCodeRequestTypeContinue; - break; - case ActionCodeRequestTypeContinue: - self.actionCodeRequestType = ActionCodeRequestTypeEmail; - break; - case ActionCodeRequestTypeEmail: - self.actionCodeRequestType = ActionCodeRequestTypeInApp; - break; - } - [self updateTable]; -} - -- (NSString *)nameForActionCodeOperation:(FIRActionCodeOperation)operation { - switch (operation) { - case FIRActionCodeOperationVerifyEmail: - return @"Verify Email"; - case FIRActionCodeOperationRecoverEmail: - return @"Recover Email"; - case FIRActionCodeOperationPasswordReset: - return @"Password Reset"; - case FIRActionCodeOperationEmailLink: - return @"Email Sign-In Link"; - case FIRActionCodeOperationVerifyAndChangeEmail: - return @"Verify Before Change Email"; - case FIRActionCodeOperationRevertSecondFactorAddition: - return @"Revert Second Factor Addition"; - case FIRActionCodeOperationUnknown: - return @"Unknown action"; - } -} - -- (NSString *)actionCodeRequestTypeString { - switch (self.actionCodeRequestType) { - case ActionCodeRequestTypeInApp: - return @"In-App + Continue URL"; - case ActionCodeRequestTypeContinue: - return @"Continue URL"; - case ActionCodeRequestTypeEmail: - return @"Email Only"; - } -} - -- (void)changeActionCodeContinueURL { - [self showTextInputPromptWithMessage:@"Continue URL" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (userPressedOK) { - self.actionCodeContinueURL = userInput.length ? [NSURL URLWithString:userInput] : nil; - [self updateTable]; - } - }]; -} - -- (void)requestVerifyEmail { - [self showSpinner:^{ - void (^sendEmailVerification)(void (^)(NSError *)) = ^(void (^completion)(NSError *)) { - if (self.actionCodeRequestType == ActionCodeRequestTypeEmail) { - [[self user] sendEmailVerificationWithCompletion:completion]; - } else { - [[self user] sendEmailVerificationWithActionCodeSettings:[self actionCodeSettings] - completion:completion]; - } - }; - sendEmailVerification(^(NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"request verify email failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"request verify email succeeded."]; - [self showMessagePrompt:@"Sent"]; - }]; - }); - }]; -} - -- (void)requestPasswordReset { - [self showTextInputPromptWithMessage:@"Email:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - [self showSpinner:^{ - void (^requestPasswordReset)(void (^)(NSError *)) = ^(void (^completion)(NSError *)) { - if (self.actionCodeRequestType == ActionCodeRequestTypeEmail) { - [[AppManager auth] sendPasswordResetWithEmail:userInput completion:completion]; - } else { - [[AppManager auth] sendPasswordResetWithEmail:userInput - actionCodeSettings:[self actionCodeSettings] - completion:completion]; - } - }; - requestPasswordReset(^(NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"request password reset failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"request password reset succeeded."]; - [self showMessagePrompt:@"Sent"]; - }]; - }); - }]; - }]; -} - -- (void)resetPassword { - [self showTextInputPromptWithMessage:@"OOB Code:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - NSString *code = userInput; - [self showTextInputPromptWithMessage:@"New Password:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - - [self showSpinner:^{ - [[AppManager auth] confirmPasswordResetWithCode:code - newPassword:userInput - completion:^(NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Password reset failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"Password reset succeeded."]; - [self showMessagePrompt:@"Password reset succeeded."]; - }]; - }]; - }]; - }]; - }]; -} - -- (void)checkActionCode { - [self showTextInputPromptWithMessage:@"OOB Code:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - [self showSpinner:^{ - [[AppManager auth] checkActionCode:userInput completion:^(FIRActionCodeInfo *_Nullable info, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Check action code failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"Check action code succeeded."]; - NSString *email = info.email; - NSString *previousEmail = info.previousEmail; - NSString *message = - previousEmail ? [NSString stringWithFormat:@"%@ -> %@", previousEmail, email] : email; - NSString *operation = [self nameForActionCodeOperation:info.operation]; - [self showMessagePromptWithTitle:operation - message:message - showCancelButton:NO - completion:nil]; - }]; - }]; - }]; - }]; -} - -- (void)applyActionCode { - [self showTextInputPromptWithMessage:@"OOB Code:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - [self showSpinner:^{ - - [[AppManager auth] applyActionCode:userInput completion:^(NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Apply action code failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"Apply action code succeeded."]; - [self showMessagePrompt:@"Action code was properly applied."]; - }]; - }]; - }]; - }]; -} - -- (void)verifyPasswordResetCode { - [self showTextInputPromptWithMessage:@"OOB Code:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - [self showSpinner:^{ - [[AppManager auth] verifyPasswordResetCode:userInput completion:^(NSString *_Nullable email, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Verify password reset code failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"Verify password resest code succeeded."]; - NSString *alertMessage = - [[NSString alloc] initWithFormat:@"Code verified for email: %@", email]; - [self showMessagePrompt:alertMessage]; - }]; - }]; - }]; - }]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Phone.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Phone.h deleted file mode 100644 index 744759b9d55..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Phone.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import "MainViewController+Internal.h" -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (Phone) - -- (StaticContentTableViewSection *)phoneAuthSection; - -- (void)commonPhoneNumberInputWithTitle:(NSString *)title - completion:(TextInputCompletionBlock)completion; - -- (void)signInWithPhoneNumber:(NSString *_Nullable)phoneNumber - completion:(nullable TestAutomationCallback)completion; - -- (void)linkPhoneNumber:(NSString *_Nullable)phoneNumber - completion:(nullable TestAutomationCallback)completion; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Phone.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+Phone.m deleted file mode 100644 index bcc971ffb39..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+Phone.m +++ /dev/null @@ -1,211 +0,0 @@ -/* - * 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 "MainViewController+Phone.h" - -#import "AppManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation MainViewController (Phone) - -- (StaticContentTableViewSection *)phoneAuthSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"Phone Auth" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Sign in With Phone Number" - action:^{ [weakSelf signInWithPhoneNumberWithPrompt]; }], - [StaticContentTableViewCell cellWithTitle:@"Link Phone Number" - action:^{ [weakSelf linkPhoneNumberWithPrompt]; }], - [StaticContentTableViewCell cellWithTitle:@"Unlink Phone Number" - action:^{ [weakSelf unlinkFromProvider:FIRPhoneAuthProvider.id completion:nil]; }], - ]]; -} - -- (void)signInWithPhoneNumber:(NSString *_Nullable)phoneNumber - completion:(nullable TestAutomationCallback)completion { - [self showSpinner:^{ - [[AppManager phoneAuthProvider] verifyPhoneNumber:phoneNumber - UIDelegate:nil - completion:^(NSString *_Nullable verificationID, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"failed to send verification code" error:error]; - [self showMessagePrompt:error.localizedDescription]; - if (completion) { - completion(error); - } - return; - } - [self logSuccess:@"Code sent"]; - [self commonPhoneNumberInputWithTitle:@"Code" - completion:^(NSString *_Nullable verificationCode) { - [self commontPhoneVerificationWithVerificationID:verificationID - verificationCode:verificationCode]; - if (completion) { - completion(nil); - } - }]; - }]; - }]; - }]; -} - -- (void)signInWithPhoneNumberWithPrompt { - [self commonPhoneNumberInputWithTitle:@"Phone #" - completion:^(NSString *_Nullable phone) { - [self signInWithPhoneNumber:phone completion:nil]; - }]; -} - -- (void)commonPhoneNumberInputWithTitle:(NSString *)title - completion:(TextInputCompletionBlock)completion { - [self showTextInputPromptWithMessage:title - keyboardType:UIKeyboardTypePhonePad - completionBlock:^(BOOL userPressedOK, NSString *_Nullable phoneNumber) { - if (!userPressedOK) { - return; - } - completion(phoneNumber); - }]; -} - -- (void)commontPhoneVerificationWithVerificationID:(NSString *)verificationID - verificationCode:(NSString *)verificationCode { - [self showSpinner:^{ - FIRAuthCredential *credential = - [[AppManager phoneAuthProvider] credentialWithVerificationID:verificationID - verificationCode:verificationCode]; - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"failed to verify phone number" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - if (self.isNewUserToggleOn) { - NSString *newUserString = result.additionalUserInfo.isNewUser ? - @"New user" : @"Existing user"; - [self showMessagePromptWithTitle:@"New or Existing" - message:newUserString - showCancelButton:NO - completion:nil]; - } - }]; - }]; - }]; -} - -- (void)linkPhoneNumber:(NSString *_Nullable)phoneNumber - completion:(nullable TestAutomationCallback)completion { - [self showSpinner:^{ - [[AppManager phoneAuthProvider] verifyPhoneNumber:phoneNumber - UIDelegate:nil - completion:^(NSString *_Nullable verificationID, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"failed to send verification code" error:error]; - [self showMessagePrompt:error.localizedDescription]; - if (completion) { - completion(error); - } - return; - } - [self logSuccess:@"Code sent"]; - - [self showTextInputPromptWithMessage:@"Verification code:" - keyboardType:UIKeyboardTypeNumberPad - completionBlock:^(BOOL userPressedOK, - NSString *_Nullable verificationCode) { - if (!userPressedOK || !verificationCode.length) { - return; - } - [self showSpinner:^{ - FIRPhoneAuthCredential *credential = - [[AppManager phoneAuthProvider] credentialWithVerificationID:verificationID - verificationCode:verificationCode]; - [[self user] linkWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - if (error.code == FIRAuthErrorCodeCredentialAlreadyInUse) { - [self showMessagePromptWithTitle:@"Phone number is already linked to " - @"another user" - message:@"Tap Ok to sign in with that user now." - showCancelButton:YES - completion:^(BOOL userPressedOK, - NSString *_Nullable userInput) { - if (userPressedOK) { - // If FIRAuthErrorCodeCredentialAlreadyInUse error, sign in with the - // provided credential. - [self showSpinner:^{ - FIRPhoneAuthCredential *credential = - error.userInfo[FIRAuthErrors.userInfoUpdatedCredentialKey]; - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"failed to verify phone number" error:error]; - [self showMessagePrompt:error.localizedDescription]; - if (completion) { - completion(error); - } - return; - } - }]; - }]; - }]; - } - }]; - } else { - [self logFailure:@"link phone number failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - } - return; - } - [self logSuccess:@"link phone number succeeded."]; - if (completion) { - completion(nil); - } - }]; - }]; - }]; - }]; - }]; - }]; - }]; -} - -- (void)linkPhoneNumberWithPrompt { - [self showTextInputPromptWithMessage:@"Phone #:" - keyboardType:UIKeyboardTypePhonePad - completionBlock:^(BOOL userPressedOK, NSString *_Nullable phoneNumber) { - if (!userPressedOK || !phoneNumber.length) { - return; - } - [self linkPhoneNumber:phoneNumber completion:nil]; - }]; -} - - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+User.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController+User.h deleted file mode 100644 index 5734917b705..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+User.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - -#import "MainViewController.h" - -#import "MainViewController+Internal.h" -#import "StaticContentTableViewManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MainViewController (User) - -- (StaticContentTableViewSection *)userSection; - -- (void)reloadUser; - -- (void)updatePhoneNumber:(NSString *_Nullable)phoneNumber - completion:(nullable TestAutomationCallback)completion; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController+User.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController+User.m deleted file mode 100644 index 7d6362a54fa..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController+User.m +++ /dev/null @@ -1,276 +0,0 @@ -/* - * 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 "MainViewController+User.h" - -#import "AppManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation MainViewController (User) - -- (StaticContentTableViewSection *)userSection { - __weak typeof(self) weakSelf = self; - return [StaticContentTableViewSection sectionWithTitle:@"User" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Set Display Name" - action:^{ [weakSelf setDisplayName]; }], - [StaticContentTableViewCell cellWithTitle:@"Set Photo URL" - action:^{ [weakSelf setPhotoURL]; }], - [StaticContentTableViewCell cellWithTitle:@"Update Email" - action:^{ [weakSelf updateEmail]; }], - [StaticContentTableViewCell cellWithTitle:@"Update Password" - action:^{ [weakSelf updatePassword]; }], - [StaticContentTableViewCell cellWithTitle:@"Update Phone Number" - action:^{ [weakSelf updatePhoneNumber]; }], - [StaticContentTableViewCell cellWithTitle:@"Get Sign-in methods for Email" - action:^{ [weakSelf getAllSignInMethodsForEmail]; }], - [StaticContentTableViewCell cellWithTitle:@"Reload User" - action:^{ [weakSelf reloadUser]; }], - [StaticContentTableViewCell cellWithTitle:@"Delete User" - action:^{ [weakSelf deleteAccount]; }], - [StaticContentTableViewCell cellWithTitle:@"Verify before update email" - action:^{ [weakSelf verifyBeforeUpdateEmail]; }], - ]]; -} - -- (void)setDisplayName { - [self showTextInputPromptWithMessage:@"Display Name:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - [self showSpinner:^{ - FIRUserProfileChangeRequest *changeRequest = [[self user] profileChangeRequest]; - changeRequest.displayName = userInput; - [changeRequest commitChangesWithCompletion:^(NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"set display name failed" error:error]; - } else { - [FIRAuth.auth.currentUser getIDTokenResultWithCompletion:^(FIRAuthTokenResult *_Nullable tokenResult, - NSError *_Nullable error) { - [self logSuccess:@"set display name succeeded."]; - }]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Set Display Name" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)setPhotoURL { - [self showTextInputPromptWithMessage:@"Photo URL:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - [self showSpinner:^{ - FIRUserProfileChangeRequest *changeRequest = [[self user] profileChangeRequest]; - changeRequest.photoURL = [NSURL URLWithString:userInput]; - [changeRequest commitChangesWithCompletion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"set photo URL failed" error:error]; - } else { - [self logSuccess:@"set Photo URL succeeded."]; - } - [self hideSpinner:^{ - [self showTypicalUIForUserUpdateResultsWithTitle:@"Set Photo URL" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)reloadUser { - [self showSpinner:^() { - [[self user] reloadWithCompletion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"reload user failed" error:error]; - } else { - [self logSuccess:@"reload user succeeded."]; - } - [self hideSpinner:^() { - [self showTypicalUIForUserUpdateResultsWithTitle:@"Reload User" error:error]; - }]; - }]; - }]; -} - -- (void)getAllSignInMethodsForEmail { - [self showTextInputPromptWithMessage:@"Email:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - [self showSpinner:^{ - [[AppManager auth] fetchSignInMethodsForEmail:userInput - completion:^(NSArray *_Nullable signInMethods, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"get sign-in methods for email failed" error:error]; - } else { - [self logSuccess:@"get sign-in methods for email succeeded."]; - } - [self hideSpinner:^{ - if (error) { - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self showMessagePrompt:[signInMethods componentsJoinedByString:@", "]]; - }]; - }]; - }]; - }]; -} -- (void)updateEmail { - [self showTextInputPromptWithMessage:@"Email Address:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - [self showSpinner:^{ - [[self user] updateEmail:userInput completion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"update email failed" error:error]; - } else { - [self logSuccess:@"update email succeeded."]; - } - [self hideSpinner:^{ - [self showTypicalUIForUserUpdateResultsWithTitle:@"Update Email" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)verifyBeforeUpdateEmail { - [self showTextInputPromptWithMessage:@"Email Address:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK || !userInput.length) { - return; - } - [self showSpinner:^{ - [[self user] sendEmailVerificationBeforeUpdatingEmail:userInput - actionCodeSettings:[self actionCodeSettings] - completion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"verify before update email failed." error:error]; - } else { - [self logSuccess:@"verify before update email succeeded."]; - } - [self hideSpinner:^{ - [self showTypicalUIForUserUpdateResultsWithTitle:@"Update Email" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)updatePassword { - [self showTextInputPromptWithMessage:@"New Password:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK) { - return; - } - [self showSpinner:^{ - [[self user] updatePassword:userInput completion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"update password failed" error:error]; - } else { - [self logSuccess:@"update password succeeded."]; - } - [self hideSpinner:^{ - [self showTypicalUIForUserUpdateResultsWithTitle:@"Update Password" error:error]; - }]; - }]; - }]; - }]; -} - -- (void)deleteAccount { - FIRUser *user = [self user]; - [user deleteWithCompletion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"delete account failed" error:error]; - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Delete User" error:error]; - }]; -} - -- (void)updatePhoneNumber:(NSString *_Nullable)phoneNumber - completion:(nullable TestAutomationCallback)completion { - [self showSpinner:^{ - [[AppManager phoneAuthProvider] verifyPhoneNumber:phoneNumber - UIDelegate:nil - completion:^(NSString *_Nullable verificationID, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"failed to send verification code" error:error]; - [self showMessagePrompt:error.localizedDescription]; - if (completion) { - completion(error); - } - return; - } - [self logSuccess:@"Code sent"]; - - [self showTextInputPromptWithMessage:@"Verification code:" - keyboardType:UIKeyboardTypeNumberPad - completionBlock:^(BOOL userPressedOK, - NSString *_Nullable verificationCode) { - if (!userPressedOK || !verificationCode.length) { - return; - } - [self showSpinner:^{ - FIRPhoneAuthCredential *credential = - [[AppManager phoneAuthProvider] credentialWithVerificationID:verificationID - verificationCode:verificationCode]; - [[self user] updatePhoneNumberCredential:credential - completion:^(NSError *_Nullable error) { - if (error) { - [self logFailure:@"update phone number failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - if (completion) { - completion(error); - } - } else { - [self logSuccess:@"update phone number succeeded."]; - if (completion) { - completion(nil); - } - } - }]; - }]; - }]; - }]; - }]; -} - -- (void)updatePhoneNumber { - [self showTextInputPromptWithMessage:@"Update Phone #:" - keyboardType:UIKeyboardTypePhonePad - completionBlock:^(BOOL userPressedOK, NSString *_Nullable phoneNumber) { - if (!userPressedOK || !phoneNumber.length) { - return; - } - [self updatePhoneNumber:phoneNumber completion:nil]; - }]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController.h b/FirebaseAuth/Tests/Sample/Sample/MainViewController.h deleted file mode 100644 index 68205415411..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 - -NS_ASSUME_NONNULL_BEGIN - -@class StaticContentTableViewManager; -@class UserTableViewCell; - -/** @class MainViewController - @brief The first view controller presented when the application is started. - */ -@interface MainViewController : UIViewController - -/** @property tableViewManager - @brief A @c StaticContentTableViewManager which is used to manage the contents of the table - view. - */ -@property(nonatomic, strong) IBOutlet StaticContentTableViewManager *tableViewManager; - -/** @property tableView - @brief A UITableView which is used to display user info and a list of actions. - */ -@property(nonatomic, weak) IBOutlet UITableView *tableView; - -/** @property userInfoTableViewCell - @brief A custom UITableViewCell for displaying the user info. - */ -@property(nonatomic, strong) IBOutlet UserTableViewCell *userInfoTableViewCell; - -/** @property userInMemoryInfoTableViewCell - @brief A custom UITableViewCell for displaying the user info. - */ -@property(nonatomic, strong) IBOutlet UserTableViewCell *userInMemoryInfoTableViewCell; - -/** @property userToUseCell - @brief A custom UITableViewCell for choosing which user to use for user operations (either the - currently signed-in user, or the user in "memory". - */ -@property(nonatomic, strong) IBOutlet UITableViewCell *userToUseCell; - -/** @property consoleTextView - @brief A UITextView with a log of the actions performed in the sample app. - */ -@property(nonatomic, weak) IBOutlet UITextView *consoleTextView; - -/** @fn handleIncomingLinkWithURL: - @brief Handles an incoming link to trigger the appropriate OOBCode if possible. - @param URL The webURL of the incoming universal link. - @return Boolean value indicating whether the incoming link could be handled or not. - */ -- (BOOL)handleIncomingLinkWithURL:(NSURL *)URL; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController.m b/FirebaseAuth/Tests/Sample/Sample/MainViewController.m deleted file mode 100644 index 4d9e1329f36..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController.m +++ /dev/null @@ -1,721 +0,0 @@ -/* - * 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 - -#import "AppManager.h" -#import "AuthCredentials.h" -#import "FacebookAuthProvider.h" -#import -#import "GoogleAuthProvider.h" -#import "MainViewController+App.h" -#import "MainViewController+Auth.h" -#import "MainViewController+AutoTests.h" -#import "MainViewController+Custom.h" -#import "MainViewController+Email.h" -#import "MainViewController+Facebook.h" -#import "MainViewController+GameCenter.h" -#import "MainViewController+Google.h" -#import "MainViewController+Internal.h" -#import "MainViewController+MultiFactor.h" -#import "MainViewController+OAuth.h" -#import "MainViewController+OOB.h" -#import "MainViewController+Phone.h" -#import "MainViewController+User.h" -#import "SettingsViewController.h" -#import "StaticContentTableViewManager.h" -#import "UIViewController+Alerts.h" -#import "UserInfoViewController.h" -#import "UserTableViewCell.h" -@import FirebaseAuth;;; - -NS_ASSUME_NONNULL_BEGIN - -static NSString *const kSectionTitleSettings = @"Settings"; - -static NSString *const kSectionTitleUserDetails = @"User Defaults"; - -static NSString *const kSwitchToInMemoryUserTitle = @"Switch to in memory user"; - -static NSString *const kNewOrExistingUserToggleTitle = @"New or Existing User Toggle"; - -typedef void (^FIRTokenCallback)(NSString *_Nullable token, NSError *_Nullable error); - -@implementation MainViewController { - NSMutableString *_consoleString; - - /** @var _userInMemory - @brief Acts like the "memory" function of a calculator. An operation allows sample app users - to assign this value based on @c FIRAuth.currentUser or clear this value. - */ - FIRUser *_userInMemory; - - /** @var _useUserInMemory - @brief Instructs the application to use _userInMemory instead of @c FIRAuth.currentUser for - testing operations. This allows us to test if things still work with a user who is not - the @c FIRAuth.currentUser, and also allows us to test those things while - @c FIRAuth.currentUser remains nil (after a sign-out) and also when @c FIRAuth.currentUser - is non-nil (do to a subsequent sign-in.) - */ - BOOL _useUserInMemory; -} - -// TODO: restore this -const NSNotificationName FIRAuthStateDidChangeNotification = @"FIRAuthStateDidChangeNotification"; - -- (id)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil { - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - _actionCodeRequestType = ActionCodeRequestTypeInApp; - _actionCodeContinueURL = [NSURL URLWithString:KCONTINUE_URL]; - _authStateDidChangeListeners = [NSMutableArray array]; - _IDTokenDidChangeListeners = [NSMutableArray array]; - _googleOAuthProvider = [FIROAuthProvider providerWithProviderID:FIRGoogleAuthProvider.id]; - _microsoftOAuthProvider = [FIROAuthProvider providerWithProviderID:@"microsoft.com"]; - _twitterOAuthProvider = [FIROAuthProvider providerWithProviderID:@"twitter.com"]; - _linkedinOAuthProvider = [FIROAuthProvider providerWithProviderID:@"linkedin.com"]; - _yahooOAuthProvider = [FIROAuthProvider providerWithProviderID:@"yahoo.com"]; - _gitHubOAuthProvider = [FIROAuthProvider providerWithProviderID:@"github.com"]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(authStateChangedForAuth:) - name:FIRAuthStateDidChangeNotification - object:nil]; - self.useStatusBarSpinner = YES; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - // Give us a circle for the image view: - _userInfoTableViewCell.userInfoProfileURLImageView.layer.cornerRadius = - _userInfoTableViewCell.userInfoProfileURLImageView.frame.size.width / 2.0f; - _userInfoTableViewCell.userInfoProfileURLImageView.layer.masksToBounds = YES; - _userInMemoryInfoTableViewCell.userInfoProfileURLImageView.layer.cornerRadius = - _userInMemoryInfoTableViewCell.userInfoProfileURLImageView.frame.size.width / 2.0f; - _userInMemoryInfoTableViewCell.userInfoProfileURLImageView.layer.masksToBounds = YES; -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [self updateTable]; - [self updateUserInfo]; -} - -#pragma mark - Public - -- (BOOL)handleIncomingLinkWithURL:(NSURL *)URL { - // Parse the query portion of the incoming URL. - NSDictionary *queryItems = - parseURL([NSURLComponents componentsWithString:URL.absoluteString].query); - - // Check that all necessary query items are available. - NSString *actionCode = queryItems[@"oobCode"]; - NSString *mode = queryItems[@"mode"]; - if (!actionCode || !mode) { - return NO; - } - // Handle Password Reset action. - if ([mode isEqualToString:kPasswordResetAction]) { - [self showTextInputPromptWithMessage:@"New Password:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable newPassword) { - if (!userPressedOK || !newPassword.length) { - [UIPasteboard generalPasteboard].string = actionCode; - return; - } - [self showSpinner:^() { - [[AppManager auth] confirmPasswordResetWithCode:actionCode - newPassword:newPassword - completion:^(NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Password reset in app failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"Password reset in app succeeded."]; - [self showMessagePrompt:@"Password reset in app succeeded."]; - }]; - }]; - }]; - }]; - return YES; - } - if ([mode isEqualToString:kVerifyEmailAction]) { - [self showMessagePromptWithTitle:@"Tap OK to verify email" - message:actionCode - showCancelButton:YES - completion:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (!userPressedOK) { - return; - } - [self showSpinner:^() { - [[AppManager auth] applyActionCode:actionCode completion:^(NSError *_Nullable error) { - [self hideSpinner:^{ - if (error) { - [self logFailure:@"Verify email in app failed" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"Verify email in app succeeded."]; - [self showMessagePrompt:@"Verify email in app succeeded."]; - }]; - }]; - }]; - }]; - return YES; - } - return NO; -} - -static NSDictionary *parseURL(NSString *urlString) { - NSString *linkURL = [NSURLComponents componentsWithString:urlString].query; - NSArray *URLComponents = [linkURL componentsSeparatedByString:@"&"]; - NSMutableDictionary *queryItems = - [[NSMutableDictionary alloc] initWithCapacity:URLComponents.count]; - for (NSString *component in URLComponents) { - NSRange equalRange = [component rangeOfString:@"="]; - if (equalRange.location != NSNotFound) { - NSString *queryItemKey = - [[component substringToIndex:equalRange.location] stringByRemovingPercentEncoding]; - NSString *queryItemValue = - [[component substringFromIndex:equalRange.location + 1] stringByRemovingPercentEncoding]; - if (queryItemKey && queryItemValue) { - queryItems[queryItemKey] = queryItemValue; - } - } - } - return queryItems; -} - -- (void)updateTable { - __weak typeof(self) weakSelf = self; - _tableViewManager.contents = - [StaticContentTableViewContent contentWithSections:@[ - // User Defaults - [StaticContentTableViewSection sectionWithTitle:kSectionTitleUserDetails cells:@[ - [StaticContentTableViewCell cellWithCustomCell:_userInfoTableViewCell action:^{ - [weakSelf presentUserInfo]; - }], - [StaticContentTableViewCell cellWithCustomCell:_userToUseCell], - [StaticContentTableViewCell cellWithCustomCell:_userInMemoryInfoTableViewCell action:^{ - [weakSelf presentUserInMemoryInfo]; - }], - ]], - // Settings - [StaticContentTableViewSection sectionWithTitle:kSectionTitleSettings cells:@[ - [StaticContentTableViewCell cellWithTitle:kSectionTitleSettings - action:^{ [weakSelf presentSettings]; }], - [StaticContentTableViewCell cellWithTitle:kNewOrExistingUserToggleTitle - value:_isNewUserToggleOn ? @"Enabled" : @"Disabled" - action:^{ - self->_isNewUserToggleOn = !self->_isNewUserToggleOn; - [self updateTable]; }], - [StaticContentTableViewCell cellWithTitle:kSwitchToInMemoryUserTitle - action:^{ [weakSelf updateToSavedUser]; }], - ]], - // Auth - [weakSelf authSection], - // User - [weakSelf userSection], - // Multi Factor - [weakSelf multiFactorSection], - // Email Auth - [weakSelf emailAuthSection], - // Phone Auth - [weakSelf phoneAuthSection], - // Google Auth - [weakSelf googleAuthSection], - // Facebook Auth - [weakSelf facebookAuthSection], - // OAuth - [weakSelf oAuthSection], - // Custom Auth - [weakSelf customAuthSection], - // Game Center Auth - [weakSelf gameCenterAuthSection], - // App - [weakSelf appSection], - // OOB - [weakSelf oobSection], - // Auto Tests - [weakSelf autoTestsSection], - ]]; -} - -#pragma mark - Internal - -- (FIRUser *)user { - return _useUserInMemory ? _userInMemory : [AppManager auth].currentUser; -} - -- (void)signInWithProvider:(nonnull id)provider callback:(void(^)(void))callback { - if (!provider) { - [self logFailedTest:@"A valid auth provider was not provided to the signInWithProvider."]; - return; - } - [provider getAuthCredentialWithPresentingViewController:self - callback:^(FIRAuthCredential *credential, - NSError *error) { - if (!credential) { - [self logFailedTest:@"The test needs a valid credential to continue."]; - return; - } - [[AppManager auth] signInWithCredential:credential - completion:^(FIRAuthDataResult *_Nullable result, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with provider failed" error:error]; - [self logFailedTest:@"Sign-in should succeed"]; - return; - } else { - [self logSuccess:@"sign-in with provider succeeded."]; - callback(); - } - }]; - }]; -} - -- (FIRActionCodeSettings *)actionCodeSettings { - FIRActionCodeSettings *actionCodeSettings = [[FIRActionCodeSettings alloc] init]; - actionCodeSettings.URL = self.actionCodeContinueURL; - actionCodeSettings.handleCodeInApp = self.actionCodeRequestType == ActionCodeRequestTypeInApp; - return actionCodeSettings; -} - -- (void)reauthenticate:(id)authProvider retrieveData:(BOOL)retrieveData { - FIRUser *user = [self user]; - if (!user) { - NSString *provider = @"Firebase"; - if ([authProvider isKindOfClass:[GoogleAuthProvider class]]) { - provider = @"Google"; - } else if ([authProvider isKindOfClass:[FacebookAuthProvider class]]) { - provider = @"Facebook"; - } - NSString *title = @"Missing User"; - NSString *message = - [NSString stringWithFormat:@"There is no signed-in %@ user.", provider]; - [self showMessagePromptWithTitle:title message:message showCancelButton:NO completion:nil]; - return; - } - [authProvider getAuthCredentialWithPresentingViewController:self - callback:^(FIRAuthCredential *credential, - NSError *error) { - if (credential) { - FIRAuthDataResultCallback completion = ^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - if (error) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - FIRMultiFactorResolver *resolver = error.userInfo[FIRAuthErrors.FIRAuthErrorUserInfoMultiFactorResolverKey]; - NSMutableString *displayNameString = [NSMutableString string]; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - [displayNameString appendString:tmpFactorInfo.displayName]; - [displayNameString appendString:@" "]; - } - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Select factor to reauthenticate\n%@", displayNameString] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable displayName) { - FIRPhoneMultiFactorInfo* selectedHint; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - if ([displayName isEqualToString:tmpFactorInfo.displayName]) { - selectedHint = (FIRPhoneMultiFactorInfo *)tmpFactorInfo; - } - } - [FIRPhoneAuthProvider.provider - verifyPhoneNumberWithMultiFactorInfo:selectedHint - UIDelegate:nil - multiFactorSession:resolver.session - completion:^(NSString * _Nullable verificationID, NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor start sign in failed." error:error]; - } else { - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Verification code for %@", selectedHint.displayName] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable verificationCode) { - FIRPhoneAuthCredential *credential = - [[FIRPhoneAuthProvider provider] credentialWithVerificationID:verificationID - verificationCode:verificationCode]; - FIRMultiFactorAssertion *assertion = [FIRPhoneMultiFactorGenerator assertionWithCredential:credential]; - [resolver resolveSignInWithAssertion:assertion completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor finalize sign in failed." error:error]; - } else { - [self logSuccess:@"Multi factor finalize sign in succeeded."]; - } - }]; - }]; - } - }]; - }]; - } else { - [self logFailure:@"reauthenticate operation failed." error:error]; - } - } else { - [self logSuccess:@"reauthenticate operation succeeded."]; - } - if (authResult.additionalUserInfo) { - [self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]]; - } - }; - [user reauthenticateWithCredential:credential completion:completion]; - } - }]; -} - -- (void)signinWithProvider:(id)authProvider retrieveData:(BOOL)retrieveData { - FIRAuth *auth = [AppManager auth]; - if (!auth) { - return; - } - [authProvider getAuthCredentialWithPresentingViewController:self - callback:^(FIRAuthCredential *credential, - NSError *error) { - if (credential) { - FIRAuthDataResultCallback completion = ^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"sign-in with provider failed" error:error]; - } else { - [self logSuccess:@"sign-in with provider succeeded."]; - } - if (authResult.additionalUserInfo) { - [self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]]; - if (self->_isNewUserToggleOn) { - NSString *newUserString = authResult.additionalUserInfo.isNewUser ? - @"New user" : @"Existing user"; - [self showMessagePromptWithTitle:@"New or Existing" - message:newUserString - showCancelButton:NO - completion:nil]; - } - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In" error:error]; - }; - [auth signInWithCredential:credential completion:completion]; - } - }]; -} - -- (void)linkWithAuthProvider:(id)authProvider retrieveData:(BOOL)retrieveData { - FIRUser *user = [self user]; - if (!user) { - return; - } - [authProvider getAuthCredentialWithPresentingViewController:self - callback:^(FIRAuthCredential *credential, - NSError *error) { - if (credential) { - FIRAuthDataResultCallback completion = ^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - if (error) { - if (error.code == FIRAuthErrorCodeSecondFactorRequired) { - FIRMultiFactorResolver *resolver = error.userInfo[FIRAuthErrors.FIRAuthErrorUserInfoMultiFactorResolverKey]; - NSMutableString *displayNameString = [NSMutableString string]; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - [displayNameString appendString:tmpFactorInfo.displayName]; - [displayNameString appendString:@" "]; - } - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Select factor to link\n%@", displayNameString] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable displayName) { - FIRPhoneMultiFactorInfo* selectedHint; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - if ([displayName isEqualToString:tmpFactorInfo.displayName]) { - selectedHint = (FIRPhoneMultiFactorInfo *)tmpFactorInfo; - } - } - [FIRPhoneAuthProvider.provider - verifyPhoneNumberWithMultiFactorInfo:selectedHint - UIDelegate:nil - multiFactorSession:resolver.session - completion:^(NSString * _Nullable verificationID, NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor start sign in failed." error:error]; - } else { - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Verification code for %@", selectedHint.displayName] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable verificationCode) { - FIRPhoneAuthCredential *credential = - [[FIRPhoneAuthProvider provider] credentialWithVerificationID:verificationID - verificationCode:verificationCode]; - FIRMultiFactorAssertion *assertion = [FIRPhoneMultiFactorGenerator assertionWithCredential:credential]; - [resolver resolveSignInWithAssertion:assertion completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) { - if (error) { - [self logFailure:@"Multi factor finalize sign in failed." error:error]; - } else { - [self logSuccess:@"Multi factor finalize sign in succeeded."]; - } - }]; - }]; - } - }]; - }]; - } else { - [self logFailure:@"link auth provider failed" error:error]; - } - } else { - [self logSuccess:@"link auth provider succeeded."]; - } - if (authResult.additionalUserInfo) { - [self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]]; - } - }; - [user linkWithCredential:credential completion:completion]; - } - }]; -} - -- (void)unlinkFromProvider:(NSString *)provider - completion:(nullable TestAutomationCallback)completion { - [[self user] unlinkFromProvider:provider - completion:^(FIRUser *_Nullable user, - NSError *_Nullable error) { - if (error) { - [self logFailure:@"unlink auth provider failed" error:error]; - if (completion) { - completion(error); - } - return; - } - [self logSuccess:@"unlink auth provider succeeded."]; - if (completion) { - completion(nil); - } - [self showTypicalUIForUserUpdateResultsWithTitle:@"Unlink from Provider" error:error]; - }]; -} - -- (void)updateToSavedUser { - if(![AppManager auth].currentUser) { - NSLog(@"You must be signed in to perform this action"); - return; - } - - if (!_userInMemory) { - [self showMessagePrompt:[NSString stringWithFormat:@"You need an in-memory user to perform this" - "action, use the M+ button to save a user to memory.", nil]]; - return; - } - - [[AppManager auth] updateCurrentUser:_userInMemory completion:^(NSError *_Nullable error) { - if (error) { - [self showMessagePrompt: - [NSString stringWithFormat:@"An error Occurred: %@", error.localizedDescription]]; - return; - } - }]; -} - -#pragma mark - Private - -- (void)presentSettings { - SettingsViewController *settingsViewController = [[SettingsViewController alloc] - initWithNibName:NSStringFromClass([SettingsViewController class]) - bundle:nil]; - [self showViewController:settingsViewController sender:self]; -} - -- (void)presentUserInfo { - UserInfoViewController *userInfoViewController = - [[UserInfoViewController alloc] initWithUser:[AppManager auth].currentUser]; - [self showViewController:userInfoViewController sender:self]; -} - -- (void)presentUserInMemoryInfo { - UserInfoViewController *userInfoViewController = - [[UserInfoViewController alloc] initWithUser:_userInMemory]; - [self showViewController:userInfoViewController sender:self]; -} - -- (NSString *)stringWithAdditionalUserInfo:(nullable FIRAdditionalUserInfo *)additionalUserInfo { - if (!additionalUserInfo) { - return @"(no additional user info)"; - } - NSString *newUserString = additionalUserInfo.isNewUser ? @"new user" : @"existing user"; - return [NSString stringWithFormat:@"%@: %@", newUserString, additionalUserInfo.profile]; -} - -- (void)showTypicalUIForUserUpdateResultsWithTitle:(NSString *)resultsTitle - error:(NSError * _Nullable)error { - if (error) { - NSString *message = [NSString stringWithFormat:@"%@ (%ld)\n%@", - error.domain, - (long)error.code, - error.localizedDescription]; - if (error.code == FIRAuthErrorCodeAccountExistsWithDifferentCredential) { - NSString *errorEmail = error.userInfo[FIRAuthErrors.userInfoEmailKey]; - resultsTitle = [NSString stringWithFormat:@"Existing email : %@", errorEmail]; - } - [self showMessagePromptWithTitle:resultsTitle - message:message - showCancelButton:NO - completion:nil]; - return; - } - [self updateUserInfo]; -} - -- (void)showUIForAuthDataResultWithResult:(FIRAuthDataResult *)result - error:(NSError * _Nullable)error { - NSString *errorMessage = [NSString stringWithFormat:@"%@ (%ld)\n%@", - error.domain ?: @"", - (long)error.code, - error.localizedDescription ?: @""]; - [self showMessagePromptWithTitle:@"Error" - message:errorMessage - showCancelButton:NO - completion:^(BOOL userPressedOK, - NSString *_Nullable userInput) { - [self showMessagePromptWithTitle:@"Profile Info" - message:[self stringWithAdditionalUserInfo:result.additionalUserInfo] - showCancelButton:NO - completion:nil]; - [self updateUserInfo]; - }]; -} - -- (void)updateUserInfo { - [_userInfoTableViewCell updateContentsWithUser:[AppManager auth].currentUser]; - [_userInMemoryInfoTableViewCell updateContentsWithUser:_userInMemory]; -} - -- (void)authStateChangedForAuth:(NSNotification *)notification { - [self updateUserInfo]; - if (notification) { - [self log:[NSString stringWithFormat: - @"received FIRAuthStateDidChange notification on user '%@'.", - ((FIRAuth *)notification.object).currentUser.uid]]; - } -} - -- (void)authenticateWithSecondFactorError:(NSError * _Nullable)error - workflow:(NSString *)workflow{ - FIRMultiFactorResolver *resolver = error.userInfo[FIRAuthErrorUserInfoMultiFactorResolverKey]; - NSMutableString *displayNameString = [NSMutableString string]; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - [displayNameString appendString:tmpFactorInfo.displayName]; - [displayNameString appendString:@" "]; - } - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Select factor to %@\n%@", workflow, displayNameString] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable displayName) { - FIRMultiFactorInfo* selectedHint; - for (FIRMultiFactorInfo *tmpFactorInfo in resolver.hints) { - if ([displayName isEqualToString:tmpFactorInfo.displayName]) { - selectedHint = tmpFactorInfo; - } - } - if ([selectedHint.factorID isEqualToString:@"phone"]) { - [FIRPhoneAuthProvider.provider - verifyPhoneNumberWithMultiFactorInfo:(FIRPhoneMultiFactorInfo *)selectedHint - UIDelegate:nil - multiFactorSession:resolver.session - completion:^(NSString * _Nullable verificationID, NSError * _Nullable error) { - if (error) { - [self logFailure:[NSString stringWithFormat:@"Multi factor start %@ failed.", workflow] error:error]; - } else { - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"Verification code for %@", selectedHint.displayName] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable verificationCode) { - FIRPhoneAuthCredential *credential = - [[FIRPhoneAuthProvider provider] credentialWithVerificationID:verificationID - verificationCode:verificationCode]; - FIRMultiFactorAssertion *assertion = [FIRPhoneMultiFactorGenerator assertionWithCredential:credential]; - [resolver resolveSignInWithAssertion:assertion completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) { - if (error) { - [self logFailure:[NSString stringWithFormat:@"Phone Multi factor finalize %@ failed.", workflow] error:error]; - } else { - [self logSuccess:[NSString stringWithFormat:@"Phone Multi factor finalize %@ succeeded.", workflow]]; - } - }]; - }]; - } - }]; - } else if ([selectedHint.factorID isEqualToString:@"totp"]) { - [self showTextInputPromptWithMessage:[NSString stringWithFormat:@"TOTP Verification code for %@", selectedHint.displayName] - completionBlock:^(BOOL userPressedOK, NSString *_Nullable oneTimePassword) { - FIRMultiFactorAssertion *assertion = [FIRTOTPMultiFactorGenerator assertionForSignInWithEnrollmentID:selectedHint.UID oneTimePassword:oneTimePassword]; - [resolver resolveSignInWithAssertion:assertion - completion:^(FIRAuthDataResult *_Nullable authResult, - NSError *_Nullable error) { - if (error) { - [self logFailure:[NSString stringWithFormat:@"TOTP Multi factor finalize %@ failed.", workflow] error:error]; - } else { - [self logSuccess:[NSString stringWithFormat:@"TOTP Multi factor finalize %@ succeeded.", workflow]]; - } - }]; - }]; - } - else { - [self log:[NSString stringWithFormat:@"Multi factor sign in does not support factor ID: %@", selectedHint.factorID]]; - } - }]; -} - -- (void)log:(NSString *)string { - dispatch_async(dispatch_get_main_queue(), ^{ - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss"; - NSString *date = [dateFormatter stringFromDate:[NSDate date]]; - if (!self->_consoleString) { - self->_consoleString = [NSMutableString string]; - } - [self->_consoleString appendString:[NSString stringWithFormat:@"%@ %@\n", date, string]]; - self->_consoleTextView.text = self->_consoleString; - - CGRect targetRect = CGRectMake(0, self->_consoleTextView.contentSize.height - 1, 1, 1); - [self->_consoleTextView scrollRectToVisible:targetRect animated:YES]; - }); -} - -- (void)logSuccess:(NSString *)string { - [self log:[NSString stringWithFormat:@"SUCCESS: %@", string]]; -} - -- (void)logFailure:(NSString *)string error:(NSError * _Nullable) error { - NSString *message = - [NSString stringWithFormat:@"FAILURE: %@ Error Description: %@.", string, error.description]; - [self log:message]; -} - -- (void)logFailedTest:( NSString *_Nonnull )reason { - [self log:[NSString stringWithFormat:@"FAILIURE: TEST FAILED - %@", reason]]; -} - -#pragma mark - IBAction - -- (IBAction)userToUseDidChange:(UISegmentedControl *)sender { - _useUserInMemory = (sender.selectedSegmentIndex == 1); -} - -- (IBAction)memoryPlus { - _userInMemory = [AppManager auth].currentUser; - [self updateUserInfo]; -} - -- (IBAction)memoryClear { - _userInMemory = nil; - [self updateUserInfo]; -} - -- (IBAction)clearConsole:(id)sender { - [_consoleString appendString:@"\n\n"]; - _consoleTextView.text = @""; -} - -- (IBAction)copyConsole:(id)sender { - UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; - pasteboard.string = _consoleString ?: @""; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/MainViewController.xib b/FirebaseAuth/Tests/Sample/Sample/MainViewController.xib deleted file mode 100644 index ac5a82f9eec..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/MainViewController.xib +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FirebaseAuth/Tests/Sample/Sample/SampleTemplate.entitlements b/FirebaseAuth/Tests/Sample/Sample/SampleTemplate.entitlements deleted file mode 100644 index 87371f3fdc0..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/SampleTemplate.entitlements +++ /dev/null @@ -1,14 +0,0 @@ - - - - - application-identifier - $(AppIdentifierPrefix)$(CFBundleIdentifier) - aps-environment - development - com.apple.developer.associated-domains - - applinks:$KAPP_LINKS_DOMAIN - - - diff --git a/FirebaseAuth/Tests/Sample/Sample/SettingsViewController.h b/FirebaseAuth/Tests/Sample/Sample/SettingsViewController.h deleted file mode 100644 index 3c8467e48c0..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/SettingsViewController.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - -@class StaticContentTableViewManager; - -/** @class SettingsViewController - @brief A view controller for sample app info and settings. - */ -@interface SettingsViewController : UIViewController - -/** @property tableViewManager - @brief A @c StaticContentTableViewManager which is used to manage the contents of the table - view. - */ -@property(nonatomic, strong) IBOutlet StaticContentTableViewManager *tableViewManager; - -/** @fn done - @brief Called when user taps the "Done" button. - */ -- (IBAction)done:(id)sender; - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/SettingsViewController.m b/FirebaseAuth/Tests/Sample/Sample/SettingsViewController.m deleted file mode 100644 index 08b24166a87..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/SettingsViewController.m +++ /dev/null @@ -1,426 +0,0 @@ -/* - * 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 "SettingsViewController.h" - -#import - -#import "AppManager.h" -@import FirebaseAuth; -#import -#import -#import -#import -#import "StaticContentTableViewManager.h" -#import "UIViewController+Alerts.h" - -/** @var kIdentityToolkitRequestClassName - @brief The class name of Identity Toolkit requests. - */ -static NSString *const kIdentityToolkitRequestClassName = @"IdentityToolkitRequest"; - -/** @var kSecureTokenRequestClassName - @brief The class name of Secure Token Service requests. - */ -static NSString *const kSecureTokenRequestClassName = @"SecureTokenRequest"; - -/** @var kIdentityToolkitSandboxHost - @brief The host of Identity Toolkit sandbox server. - */ -static NSString *const kIdentityToolkitSandboxHost = @"staging-www.sandbox.googleapis.com"; - -/** @var kSecureTokenSandboxHost - @brief The host of Secure Token Service sandbox server. - */ -static NSString *const kSecureTokenSandboxHost = @"staging-securetoken.sandbox.googleapis.com"; - -/** @var kGoogleServiceInfoPlists - @brief a C-array of plist file base names of Google service info to initialize FIRApp. - */ -static NSString *const kGoogleServiceInfoPlists[] = { - @"GoogleService-Info", - @"GoogleService-Info_multi" -}; - -/** @var kSharedKeychainAccessGroup - @brief The shared keychain access group for testing. - */ -static NSString *const kSharedKeychainAccessGroup = @"com.google.firebase.auth.keychainGroup1"; - -/** @var gAPIEndpoints - @brief List of API Hosts by request class name. - */ -static NSDictionary *> *gAPIHosts; - -/** @var gFirebaseAppOptions - @brief List of FIROptions. - */ -static NSArray *gFirebaseAppOptions; - -/** @protocol RequestClass - @brief A de-facto protocol followed by request class objects to access its API host. - */ -@protocol RequestClass -- (NSString *)host; -- (void)setHost:(NSString *)host; -@end - -/** @fn requestHost - @brief Retrieves the API host for the request class. - @param requestClassName The name of the request class. - */ -static NSString *APIHost(NSString *requestClassName) { - return [(id)NSClassFromString(requestClassName) host]; -} - -/** @fn truncatedString - @brief Truncates a string under a maximum length. - @param string The original string to be truncated. - @param length The maximum length of the truncated string. - @return The truncated string, which is not longer than @c length. - */ -static NSString *truncatedString(NSString *string, NSUInteger length) { - if (string.length <= length) { - return string; - } - NSUInteger half = (length - 3) / 2; - return [NSString stringWithFormat:@"%@...%@", - [string substringToIndex:half], - [string substringFromIndex:string.length - half]]; -} - -@implementation SettingsViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - [self setUpAPIHosts]; - [self setUpFirebaseAppOptions]; - [self loadTableView]; -} - -- (IBAction)done:(id)sender { - [self dismissViewControllerAnimated:YES completion:nil]; -} - -// TODO: This reliance on `NSClassFromString` crashes with the Swift implementation. - -- (void)setUpAPIHosts { - if (gAPIHosts) { - return; - } - gAPIHosts = @{ - kIdentityToolkitRequestClassName : @[ - APIHost(kIdentityToolkitRequestClassName), - kIdentityToolkitSandboxHost, - ], - kSecureTokenRequestClassName : @[ - APIHost(kSecureTokenRequestClassName), - kSecureTokenSandboxHost, - ], - }; -} - -- (void)setUpFirebaseAppOptions { - if (gFirebaseAppOptions) { - return; - } - int numberOfOptions = sizeof(kGoogleServiceInfoPlists) / sizeof(*kGoogleServiceInfoPlists); - NSMutableArray *appOptions = [[NSMutableArray alloc] initWithCapacity:numberOfOptions]; - for (int i = 0; i < numberOfOptions; i++) { - NSString *plistFileName = kGoogleServiceInfoPlists[i]; - NSString *plistFilePath = [[NSBundle mainBundle] pathForResource:plistFileName - ofType:@"plist"]; - FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:plistFilePath]; - [appOptions addObject:options]; - } - gFirebaseAppOptions = [appOptions copy]; -} - -- (void)loadTableView { - NSString *appIdentifierPrefix = NSBundle.mainBundle.infoDictionary[@"AppIdentifierPrefix"]; - NSString *fullKeychainAccessGroup = [appIdentifierPrefix stringByAppendingString:kSharedKeychainAccessGroup]; - - __weak typeof(self) weakSelf = self; - _tableViewManager.contents = [StaticContentTableViewContent contentWithSections:@[ - [StaticContentTableViewSection sectionWithTitle:@"Versions" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"FirebaseAuth" - value:FIRFirebaseVersion()], - ]], - [StaticContentTableViewSection sectionWithTitle:@"API Hosts" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Identity Toolkit" - value:APIHost(kIdentityToolkitRequestClassName) - action:^{ - [weakSelf toggleAPIHostWithRequestClassName:kIdentityToolkitRequestClassName]; - }], - [StaticContentTableViewCell cellWithTitle:@"Secure Token" - value:APIHost(kSecureTokenRequestClassName) - action:^{ - [weakSelf toggleAPIHostWithRequestClassName:kSecureTokenRequestClassName]; - }], - ]], - [StaticContentTableViewSection sectionWithTitle:@"Firebase Apps" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Active App" - value:[self activeAppDescription] - action:^{ - [weakSelf toggleActiveApp]; - }], - [StaticContentTableViewCell cellWithTitle:@"Default App" - value:[self projectIDForAppAtIndex:0] - action:^{ - [weakSelf toggleProjectForAppAtIndex:0]; - }], - [StaticContentTableViewCell cellWithTitle:@"Other App" - value:[self projectIDForAppAtIndex:1] - action:^{ - [weakSelf toggleProjectForAppAtIndex:1]; - }], - ]], - [StaticContentTableViewSection sectionWithTitle:@"Keychain Access Groups" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Current Access Group" - value:[AppManager auth].userAccessGroup ? [AppManager auth].userAccessGroup : @"[none]" - ], - [StaticContentTableViewCell cellWithTitle:@"Default Group" - value:@"[none]" - action:^{ - [[AppManager auth] useUserAccessGroup:nil error:nil]; - [self loadTableView]; - }], - [StaticContentTableViewCell cellWithTitle:@"Shared Group" - value:fullKeychainAccessGroup - action:^{ - [[AppManager auth] useUserAccessGroup:fullKeychainAccessGroup error:nil]; - [self loadTableView]; - }], - ]], - [StaticContentTableViewSection sectionWithTitle:@"Phone Auth" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"APNs Token" - value:[self APNSTokenString] - action:^{ - [weakSelf clearAPNSToken]; - }], - [StaticContentTableViewCell cellWithTitle:@"App Credential" - value:[self appCredentialString] - action:^{ - [weakSelf clearAppCredential]; - }], - ]], - [StaticContentTableViewSection sectionWithTitle:@"Language" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Auth Language" - value:[AppManager auth].languageCode ?: @"[none]" - action:^{ - [weakSelf showLanguageInput]; - }], - [StaticContentTableViewCell cellWithTitle:@"Use App language" action:^{ - [[AppManager auth] useAppLanguage]; - [weakSelf loadTableView]; - }], - ]], - [StaticContentTableViewSection sectionWithTitle:@"Auth Settings" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"Disable App Verification (Phone)" - value:[AppManager auth].settings. - appVerificationDisabledForTesting ? @"Yes" : @"No" - action:^{ - [weakSelf toggleDisableAppVerification]; - [weakSelf loadTableView]; - }], - ]], - ]]; -} - -/** @fn toggleDisableAppVerification - @brief Toggles the appVerificationDisabledForTesting flag on the current Auth instance. - */ -- (void)toggleDisableAppVerification { - [AppManager auth].settings.appVerificationDisabledForTesting = - ![AppManager auth].settings.appVerificationDisabledForTesting; -} - -/** @fn toggleAPIHostWithRequestClassName: - @brief Toggles the host name of the server that handles RPCs. - @param requestClassName The name of the RPC request class. - */ -- (void)toggleAPIHostWithRequestClassName:(NSString *)requestClassName { - NSString *currentHost = APIHost(requestClassName); - NSArray *allHosts = gAPIHosts[requestClassName]; - NSString *newHost = allHosts[([allHosts indexOfObject:currentHost] + 1) % allHosts.count]; - [(id)NSClassFromString(requestClassName) setHost:newHost]; - [self loadTableView]; -} - -/** @fn activeAppDescription - @brief Returns the description for the currently active Firebase app. - */ -- (NSString *)activeAppDescription { - return [AppManager sharedInstance].active == 0 ? @"[Default]" : @"[Other]"; -} - -/** @fn toggleActiveApp - @brief Toggles the active Firebase app for the rest of the application. - */ -- (void)toggleActiveApp { - AppManager *apps = [AppManager sharedInstance]; - // This changes the FIRAuth instance returned from `[AppManager auth]` to be one that is - // associated with a different `FIRApp` instance. The sample app uses `[AppManager auth]` - // instead of `[FIRAuth auth]` almost everywhere. Thus, this statement switches between default - // and non-default `FIRApp` instances for the sample app to test against. - apps.active = (apps.active + 1) % apps.count; - [self loadTableView]; -} - -/** @fn projectIDForAppAtIndex: - @brief Returns the Firebase project ID for the Firebase app at the given index. - @param index The index for the app in the app manager. - @return The ID of the project. - */ -- (NSString *)projectIDForAppAtIndex:(int)index { - NSString *APIKey = [[AppManager sharedInstance] appAtIndex:index].options.APIKey; - for (FIROptions *options in gFirebaseAppOptions) { - if ([options.APIKey isEqualToString:APIKey]) { - return options.projectID; - } - } - return @"[none]"; -} - -/** @fn projectIDForAppAtIndex: - @brief Returns the Firebase project ID for the Firebase app at the given index. - @param index The index for the app in the app manager. - @return The ID of the project. - */ -- (NSString *)keychainAccessGroupAtIndex:(int)index { - NSArray *array = @[@"123", @"456"]; - return array[index]; -} - -/** @fn toggleProjectForAppAtIndex: - @brief Toggles the Firebase project for the Firebase app at the given index by recreating the - FIRApp instance with different options. - @param index The index for the app to be recreated in the app manager. - */ -- (void)toggleProjectForAppAtIndex:(int)index { - NSString *APIKey = [[AppManager sharedInstance] appAtIndex:index].options.APIKey; - int optionIndex; - for (optionIndex = 0; optionIndex < gFirebaseAppOptions.count; optionIndex++) { - FIROptions *options = gFirebaseAppOptions[optionIndex]; - if ([options.APIKey isEqualToString:APIKey]) { - break; - } - } - - FIROptions *options; - if (index == 0) { - // For default apps, the next options cannot be `nil`. - optionIndex = (optionIndex + 1) % gFirebaseAppOptions.count; - options = gFirebaseAppOptions[optionIndex]; - } else { - // For non-default apps, `nil` is considered the next options after the last options in the array. - optionIndex = (optionIndex + 1) % (gFirebaseAppOptions.count + 1); - if (optionIndex != gFirebaseAppOptions.count) { - options = gFirebaseAppOptions[optionIndex]; - } - } - __weak typeof(self) weakSelf = self; - [[AppManager sharedInstance] recreateAppAtIndex:index withOptions:options completion:^() { - dispatch_async(dispatch_get_main_queue(), ^() { - [weakSelf loadTableView]; - }); - }]; -} - -/** @fn APNSTokenString - @brief Returns a string representing APNS token. - */ -- (NSString *)APNSTokenString { - FIRAuthAPNSToken *token = [AppManager auth].tokenManager.token; - if (!token) { - return @""; - } - return [NSString stringWithFormat:@"%@(%@)", - truncatedString(token.string, 19), - token.type == FIRAuthAPNSTokenTypeProd ? @"P" : @"S"]; -} - -/** @fn clearAPNSToken - @brief Clears the saved app credential. - */ -- (void)clearAPNSToken { - FIRAuthAPNSToken *token = [AppManager auth].tokenManager.token; - if (!token) { - return; - } - NSString *tokenType = token.type == FIRAuthAPNSTokenTypeProd ? @"Production" : @"Sandbox"; - NSString *message = [NSString stringWithFormat:@"token: %@\ntype: %@", - token.string, tokenType]; - [self showMessagePromptWithTitle:@"Clear APNs Token?" - message:message - showCancelButton:YES - completion:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (userPressedOK) { - [AppManager auth].tokenManager.token = nil; - [self loadTableView]; - } - }]; -} - -/** @fn appCredentialString - @brief Returns a string representing app credential. - */ -- (NSString *)appCredentialString { - FIRAuthAppCredential *credential = [AppManager auth].appCredentialManager.credential; - if (!credential) { - return @""; - } - return [NSString stringWithFormat:@"%@/%@", - truncatedString(credential.receipt, 13), - truncatedString(credential.secret, 13)]; -} - -/** @fn clearAppCredential - @brief Clears the saved app credential. - */ -- (void)clearAppCredential { - FIRAuthAppCredential *credential = [AppManager auth].appCredentialManager.credential; - if (!credential) { - return; - } - NSString *message = [NSString stringWithFormat:@"receipt: %@\nsecret: %@", - credential.receipt, credential.secret]; - [self showMessagePromptWithTitle:@"Clear App Credential?" - message:message - showCancelButton:YES - completion:^(BOOL userPressedOK, NSString *_Nullable userInput) { - if (userPressedOK) { - [[AppManager auth].appCredentialManager clearCredential]; - [self loadTableView]; - } - }]; -} - -/** @fn showLanguageInput - @brief Show language code input field. - */ -- (void)showLanguageInput { - [self showTextInputPromptWithMessage:@"Enter Language Code For Auth:" - completionBlock:^(BOOL userPressedOK, NSString *_Nullable languageCode) { - if (!userPressedOK) { - return; - } - [AppManager auth].languageCode = languageCode.length ? languageCode : nil; - [self loadTableView]; - }]; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/SettingsViewController.xib b/FirebaseAuth/Tests/Sample/Sample/SettingsViewController.xib deleted file mode 100644 index 327453c5bd3..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/SettingsViewController.xib +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FirebaseAuth/Tests/Sample/Sample/StaticContentTableViewManager.h b/FirebaseAuth/Tests/Sample/Sample/StaticContentTableViewManager.h deleted file mode 100644 index b6afa96ff35..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/StaticContentTableViewManager.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * 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 - -#pragma mark - Forward Declarations - -@class StaticContentTableViewCell; -@class StaticContentTableViewContent; -@class StaticContentTableViewSection; - -#pragma mark - Block Type Definitions - -/** @typedef StaticContentTableViewCellAction - @brief The type of block invoked when a cell is tapped. - */ -typedef void(^StaticContentTableViewCellAction)(void); - -#pragma mark - - -/** @class StaticContentTableViewManager - @brief Generic class useful for populating a @c UITableView with static content. - @remarks Because I keep writing the same UITableView code for every internal testing app, and - it's getting too tedious and ugly to keep writing the same thing over and over. It makes - our sample apps harder to maintain with all this code sprinkled around everywhere, and - we end up cutting corners and making junky testing apps, and spending more time in the - process. - */ -@interface StaticContentTableViewManager : NSObject - -/** @property contents - @brief The static contents of the @c UITableView. - @remarks Setting this property will reload the @c UITableView. - */ -@property(nonatomic, strong, nullable) StaticContentTableViewContent *contents; - -/** @property tableView - @brief A reference to the managed @c UITableView. - @remarks This is needed to automatically reload the table view when the @c contents are changed. - */ -@property(nonatomic, weak, nullable) IBOutlet UITableView *tableView; - -@end - -#pragma mark - - -/** @class StaticContentTableViewContent - @brief Represents the contents of a @c UITableView. - */ -@interface StaticContentTableViewContent : NSObject - -/** @property sections - @brief The sections for the @c UITableView. - */ -@property(nonatomic, copy, readonly, nullable) NSArray *sections; - -/** @fn contentWithSections: - @brief Convenience factory method for creating a new instance of - @c StaticContentTableViewContent. - @param sections The sections for the @c UITableView. - */ -+ (nullable instancetype)contentWithSections: - (nullable NSArray *)sections; - -/** @fn init - @brief Please use initWithSections: - */ -- (nullable instancetype)init NS_UNAVAILABLE; - -/** @fn initWithSections: - @brief Designated initializer. - @param sections The sections in the @c UITableView. - */ -- (nullable instancetype)initWithSections: - (nullable NSArray *)sections; - -@end - -#pragma mark - - -/** @class StaticContentTableViewSection - @brief Represents a section in a @c UITableView. - @remarks Each section has a title (used for the section title in the @c UITableView) and an - array of cells. - */ -@interface StaticContentTableViewSection : NSObject - -/** @property title - @brief The title of the section in the @c UITableView. - */ -@property(nonatomic, copy, readonly, nullable) NSString *title; - -/** @property cells - @brief The cells in this section of the @c UITableView. - */ -@property(nonatomic, copy, readonly, nullable) NSArray *cells; - -/** @fn sectionWithTitle:cells: - @brief Convenience factory method for creating a new instance of - @c StaticContentTableViewSection. - @param title The title of the section in the @c UITableView. - @param cells The cells in this section of the @c UITableView. - */ -+ (nullable instancetype)sectionWithTitle:(nullable NSString *)title - cells:(nullable NSArray *)cells; - -/** @fn init - @brief Please use initWithTitle:cells: - */ -- (nullable instancetype)init NS_UNAVAILABLE; - -/** @fn initWithTitle:cells: - @brief Designated initializer. - @param title The title of the section in the @c UITableView. - @param cells The cells in this section of the @c UITableView. - */ -- (nullable instancetype)initWithTitle:(nullable NSString *)title - cells:(nullable NSArray *)cells; - -@end - -#pragma mark - - -/** @class StaticContentTableViewCell - @brief Represents a cell in a @c UITableView. - @remarks Cells may be custom cells (in which you specify a @c UITableViewCell to use), or - simple single-label cells which you supply the title text for. It does not make sense to - specify both @c customCell and also @c title, but if a @c customCell is specified, it will - be used instead of the @c title. - */ -@interface StaticContentTableViewCell : NSObject - -/** @property customCell - @brief The custom @c UITableViewCell to use for this cell. - */ -@property(nonatomic, strong, readonly, nullable) UITableViewCell *customCell; - -/** @property title - @brief If no custom cell is being used, this is the text of the @c titleLabel of the - @c UITableViewCell. - */ -@property(nonatomic, copy, readonly, nullable) NSString *title; - -/** @property value - @brief If no custom cell is being used, this is the text of the @c detailTextLabel of the - @c UITableViewCell. - */ -@property(nonatomic, copy, readonly, nullable) NSString *value; - -/** @property accessibilityIdentifier - @brief The accessibility ID for the corresponding @c UITableViewCell. - */ -@property(nonatomic, copy, readonly, nullable) NSString *accessibilityIdentifier; - -/** @property action - @brief A block which is executed when the cell is selected. - @remarks Avoid retain cycles. Since these blocked are retained here, and your - @c UIViewController's object graph likely retains this object, you don't want these blocks - to retain your @c UIViewController. The easiest thing is just to create a weak reference to - your @c UIViewController and pass it a message as the only thing the block does. - */ -@property(nonatomic, copy, readonly, nullable) StaticContentTableViewCellAction action; - -/** @fn cellWithTitle: - @brief Convenience factory method for a new instance of @c StaticContentTableViewCell. - @param title The text of the @c titleLabel of the @c UITableViewCell. - */ -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title; - -/** @fn cellWithTitle:value: - @brief Convenience factory method for a new instance of @c StaticContentTableViewCell. - @param title The text of the @c titleLabel of the @c UITableViewCell. - @param value The text of the @c detailTextLabel of the @c UITableViewCell. - */ -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title - value:(nullable NSString *)value; - -/** @fn cellWithTitle:action: - @brief Convenience factory method for a new instance of @c StaticContentTableViewCell. - @param title The text of the @c titleLabel of the @c UITableViewCell. - @param action A block which is executed when the cell is selected. - */ -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title - action:(nullable StaticContentTableViewCellAction)action; - -/** @fn cellWithTitle:value:action: - @brief Convenience factory method for a new instance of @c StaticContentTableViewCell. - @param title The text of the @c titleLabel of the @c UITableViewCell. - @param value The text of the @c detailTextLabel of the @c UITableViewCell. - @param action A block which is executed when the cell is selected. - */ -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title - value:(nullable NSString *)value - action:(nullable StaticContentTableViewCellAction)action; - -/** @fn cellWithTitle:value:action:accessibilityLabel: - @brief Convenience factory method for a new instance of @c StaticContentTableViewCell. - @param title The text of the @c titleLabel of the @c UITableViewCell. - @param value The text of the @c detailTextLabel of the @c UITableViewCell. - @param action A block which is executed when the cell is selected. - @param accessibilityID The accessibility ID to add to the cell. - */ -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title - value:(nullable NSString *)value - action:(nullable StaticContentTableViewCellAction)action - accessibilityID:(nullable NSString *)accessibilityID; - -/** @fn cellWithCustomCell: - @brief Convenience factory method for a new instance of @c StaticContentTableViewCell. - @param customCell The custom @c UITableViewCell to use for this cell. - */ -+ (nullable instancetype)cellWithCustomCell:(nullable UITableViewCell *)customCell; - -/** @fn cellWithCustomCell:action: - @brief Convenience factory method for a new instance of @c StaticContentTableViewCell. - @param customCell The custom @c UITableViewCell to use for this cell. - @param action A block which is executed when the cell is selected. - */ -+ (nullable instancetype)cellWithCustomCell:(nullable UITableViewCell *)customCell - action:(nullable StaticContentTableViewCellAction)action; - -/** @fn init - @brief Please use initWithCustomCell:title:action: - */ -- (nullable instancetype)init NS_UNAVAILABLE; - -/** @fn initWithCustomCell:title:action: - @brief Designated initializer. - @param customCell The custom @c UITableViewCell to use for this cell. - @param title If no custom cell is being used, this is the text of the @c titleLabel of the - @c UITableViewCell. - @param action A block which is executed when the cell is selected. - @param accessibilityID The accessibility ID to add to the cell. - */ -- (nullable instancetype)initWithCustomCell:(nullable UITableViewCell *)customCell - title:(nullable NSString *)title - value:(nullable NSString *)value - action:(nullable StaticContentTableViewCellAction)action - accessibilityID:(nullable NSString *)accessibilityID - NS_DESIGNATED_INITIALIZER; - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/StaticContentTableViewManager.m b/FirebaseAuth/Tests/Sample/Sample/StaticContentTableViewManager.m deleted file mode 100644 index 2b94778ca8f..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/StaticContentTableViewManager.m +++ /dev/null @@ -1,243 +0,0 @@ -/* - * 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 "StaticContentTableViewManager.h" - -/** @var kCellReuseIdentitfier - @brief The reuse identifier for default style table view cell. - */ -static NSString *const kCellReuseIdentitfier = @"reuseIdentifier"; - -/** @var kCellReuseIdentitfier - @brief The reuse identifier for value style table view cell. - */ -static NSString *const kValueCellReuseIdentitfier = @"reuseValueIdentifier"; - -#pragma mark - - -@implementation StaticContentTableViewManager - -- (void)setContents:(StaticContentTableViewContent *)contents { - _contents = contents; - [self.tableView reloadData]; -} - -- (void)setTableView:(UITableView *)tableView { - _tableView = tableView; - [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellReuseIdentitfier]; -} - -#pragma mark - UITableViewDataSource - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return _contents.sections.count; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return _contents.sections[section].cells.count; -} - -- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { - return _contents.sections[section].title; -} - -- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { - return index; -} - -- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { - NSMutableArray *sectionTitles = [NSMutableArray array]; - for (StaticContentTableViewSection *section in _contents.sections) { - [sectionTitles addObject:[section.title substringToIndex:3]]; - } - return sectionTitles; -} - -#pragma mark - UITableViewDelegate - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - StaticContentTableViewCell *cellData = _contents.sections[indexPath.section].cells[indexPath.row]; - if (cellData.customCell) { - return cellData.customCell.frame.size.height; - } - return 44; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView - cellForRowAtIndexPath:(NSIndexPath *)indexPath { - StaticContentTableViewCell *cellData = _contents.sections[indexPath.section].cells[indexPath.row]; - UITableViewCell *cell = cellData.customCell; - if (cell) { - return cell; - } - if (cellData.value.length) { - cell = [tableView dequeueReusableCellWithIdentifier:kValueCellReuseIdentitfier]; - if (!cell) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 - reuseIdentifier:kValueCellReuseIdentitfier]; - cell.detailTextLabel.adjustsFontSizeToFitWidth = YES; - cell.detailTextLabel.minimumScaleFactor = 0.5; - } - cell.detailTextLabel.text = cellData.value; - } else { - // kCellReuseIdentitfier has already been registered. - cell = [tableView dequeueReusableCellWithIdentifier:kCellReuseIdentitfier - forIndexPath:indexPath]; - } - cell.textLabel.text = cellData.title; - cell.accessibilityIdentifier = cellData.accessibilityIdentifier; - return cell; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - StaticContentTableViewCell *cellData = _contents.sections[indexPath.section].cells[indexPath.row]; - BOOL hasAssociatedAction = cellData.action != nil; - if (hasAssociatedAction) { - cellData.action(); - } - [tableView deselectRowAtIndexPath:indexPath animated:hasAssociatedAction]; -} - -@end - -#pragma mark - - -@implementation StaticContentTableViewContent - -+ (nullable instancetype)contentWithSections: - (nullable NSArray *)sections { - return [[self alloc] initWithSections:sections]; -} - -- (nullable instancetype)initWithSections: - (nullable NSArray *)sections { - self = [super init]; - if (self) { - _sections = [sections copy]; - } - return self; -} - -@end - -#pragma mark - - -@implementation StaticContentTableViewSection - -+ (nullable instancetype)sectionWithTitle:(nullable NSString *)title - cells:(nullable NSArray *)cells { - return [[self alloc] initWithTitle:title cells:cells]; -} - -- (nullable instancetype)initWithTitle:(nullable NSString *)title - cells:(nullable NSArray *)cells { - self = [super init]; - if (self) { - _title = [title copy]; - _cells = [cells copy]; - } - return self; -} - -@end - -#pragma mark - - -@implementation StaticContentTableViewCell - -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title { - return [[self alloc] initWithCustomCell:nil - title:title - value:nil - action:nil - accessibilityID:nil]; -} - -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title - value:(nullable NSString *)value { - return [[self alloc] initWithCustomCell:nil - title:title - value:value - action:nil - accessibilityID:nil]; -} - -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title - action:(nullable StaticContentTableViewCellAction)action { - return [[self alloc] initWithCustomCell:nil - title:title - value:nil - action:action - accessibilityID:nil]; -} - -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title - value:(nullable NSString *)value - action:(nullable StaticContentTableViewCellAction)action { - return [[self alloc] initWithCustomCell:nil - title:title - value:value - action:action - accessibilityID:nil]; -} - -+ (nullable instancetype)cellWithTitle:(nullable NSString *)title - value:(nullable NSString *)value - action:(nullable StaticContentTableViewCellAction)action - accessibilityID:(nullable NSString *)accessibilityID { - return [[self alloc] initWithCustomCell:nil - title:title - value:value - action:action - accessibilityID:accessibilityID]; -} - -+ (nullable instancetype)cellWithCustomCell:(nullable UITableViewCell *)customCell { - return [[self alloc] initWithCustomCell:customCell - title:nil - value:nil - action:nil - accessibilityID:nil]; -} - -+ (nullable instancetype)cellWithCustomCell:(nullable UITableViewCell *)customCell - action:(nullable StaticContentTableViewCellAction)action { - return [[self alloc] initWithCustomCell:customCell - title:nil - value:nil action:action - accessibilityID:nil]; -} - -- (nullable instancetype)initWithCustomCell:(nullable UITableViewCell *)customCell - title:(nullable NSString *)title - value:(nullable NSString *)value - action:(nullable StaticContentTableViewCellAction)action - accessibilityID:(nullable NSString *)accessibilityID { - self = [super init]; - if (self) { - _customCell = customCell; - _title = [title copy]; - _value = [value copy]; - _action = action; - if (accessibilityID) { - _accessibilityIdentifier = [accessibilityID copy]; - self.isAccessibilityElement = YES; - } - } - return self; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/UIViewController+Alerts.h b/FirebaseAuth/Tests/Sample/Sample/UIViewController+Alerts.h deleted file mode 100644 index 8d7f6fa472d..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/UIViewController+Alerts.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 - -NS_ASSUME_NONNULL_BEGIN - -/*! @typedef AlertPromptCompletionBlock - @brief The type of callback used to report text input prompt results. - */ -typedef void (^AlertPromptCompletionBlock)(BOOL userPressedOK, NSString *_Nullable userInput); - -/*! @category UIViewController(Alerts) - @brief Wrapper for @c UIAlertController and @c UIAlertView for backwards compatibility with - iOS 6+. - */ -@interface UIViewController (Alerts) - -/*! @property useStatusBarSpinner - @brief Uses the status bar to indicate work is occuring instead of a modal "please wait" dialog. - This is generally useful for allowing user interaction while things are happening. - */ -@property(nonatomic, assign) BOOL useStatusBarSpinner; - -/*! @fn showMessagePrompt: - @brief Displays an alert with an 'OK' button and a message. - @param message The message to display. - @remarks The message is also copied to the pasteboard. - */ -- (void)showMessagePrompt:(NSString *)message; - -/*! @fn showMessagePromptWithTitle:message: - @brief Displays a titled alert with an 'OK' button and a message. - @param title The title of the alert if it exists. - @param message The message to display. - @param showCancelButton A flag indicating whether or not a cancel option is available. - @param completion The completion block to be executed after the alert is dismissed, if it - exists. - @remarks The message is also copied to the pasteboard. - */ -- (void)showMessagePromptWithTitle:(nullable NSString *)title - message:(NSString *)message - showCancelButton:(BOOL)showCancelButton - completion:(nullable AlertPromptCompletionBlock)completion; - -/*! @fn showTextInputPromptWithMessage:keyboardType:completionBlock: - @brief Shows a prompt with a text field and 'OK'/'Cancel' buttons. - @param message The message to display. - @param keyboardType The type of keyboard to display for the UITextView in the prompt. - @param completion A block to call when the user taps 'OK' or 'Cancel'. - */ -- (void)showTextInputPromptWithMessage:(NSString *)message - keyboardType:(UIKeyboardType)keyboardType - completionBlock:(AlertPromptCompletionBlock)completion; - -/*! @fn showTextInputPromptWithMessage:completionBlock: - @brief Shows a prompt with a text field and 'OK'/'Cancel' buttons. - @param message The message to display. - @param completion A block to call when the user taps 'OK' or 'Cancel'. - */ -- (void)showTextInputPromptWithMessage:(NSString *)message - completionBlock:(AlertPromptCompletionBlock)completion; - -/*! @fn showQRCodePromptWithTextInput:message:qrCodeString:completionBlock: - @brief Shows a prompt with a QR code image, text message, text field for input, and 'OK'/'Cancel' buttons. - @param message The message to display. - @param qrCodeString The string to encode as a QR code and display as an image. - @param completion A block to call when the user taps 'OK' or 'Cancel'. - */ -- (void)showQRCodePromptWithTextInput:(NSString *)message - qrCodeString:(NSString *)qrCodeString - completionBlock:(AlertPromptCompletionBlock)completion; - -/*! @fn showSpinner - @brief Shows the please wait spinner. - @param completion Called after the spinner has been hidden. - */ -- (void)showSpinner:(nullable void(^)(void))completion; - -/*! @fn hideSpinner - @brief Hides the please wait spinner. - @param completion Called after the spinner has been hidden. - */ -- (void)hideSpinner:(nullable void(^)(void))completion; - -@end - -NS_ASSUME_NONNULL_END diff --git a/FirebaseAuth/Tests/Sample/Sample/UIViewController+Alerts.m b/FirebaseAuth/Tests/Sample/Sample/UIViewController+Alerts.m deleted file mode 100644 index 49474e258d0..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/UIViewController+Alerts.m +++ /dev/null @@ -1,410 +0,0 @@ -/* - * 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 "UIViewController+Alerts.h" - -#import - -/*! @var kPleaseWaitAssociatedObjectKey - @brief Key used to identify the "please wait" spinner associated object. - */ -static NSString *const kPleaseWaitAssociatedObjectKey = - @"_UIViewControllerAlertCategory_PleaseWaitScreenAssociatedObject"; - -/*! @var kUseStatusBarSpinnerAssociatedObjectKey - @brief The address of this constant is the key used to identify the "use status bar spinner" - associated object. - */ -static const void *const kUseStatusBarSpinnerAssociatedObjectKey; - -/*! @var kOK - @brief Text for an 'OK' button. - */ -static NSString *const kOK = @"OK"; - -/*! @var kCancel - @brief Text for an 'Cancel' button. - */ -static NSString *const kCancel = @"Cancel"; - -/*! @class SimpleTextPromptDelegate - @brief A @c UIAlertViewDelegate which allows @c UIAlertView to be used with blocks more easily. - */ -@interface SimpleTextPromptDelegate : NSObject - -/*! @fn init - @brief Please use initWithCompletionHandler. - */ -- (nullable instancetype)init NS_UNAVAILABLE; - -/*! @fn initWithCompletionHandler: - @brief Designated initializer. - @param completionHandler The block to call when the alert view is dismissed. - */ -- (nullable instancetype)initWithCompletionHandler:(AlertPromptCompletionBlock)completionHandler - NS_DESIGNATED_INITIALIZER; - -@end - -@implementation UIViewController (Alerts) - -- (void)setUseStatusBarSpinner:(BOOL)useStatusBarSpinner { - objc_setAssociatedObject(self, - &kUseStatusBarSpinnerAssociatedObjectKey, - useStatusBarSpinner ? @(YES) : nil, - OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (BOOL)useStatusBarSpinner { - return objc_getAssociatedObject(self, &kUseStatusBarSpinnerAssociatedObjectKey) ? YES : NO; -} - -/*! @fn supportsAlertController - @brief Determines if the current platform supports @c UIAlertController. - @return YES if the current platform supports @c UIAlertController. - */ -- (BOOL)supportsAlertController { - return NSClassFromString(@"UIAlertController") != nil; -} - -- (void)showMessagePrompt:(NSString *)message { - [self showMessagePromptWithTitle:nil message:message showCancelButton:NO completion:nil]; -} - -- (void)showMessagePromptWithTitle:(nullable NSString *)title - message:(NSString *)message - showCancelButton:(BOOL)showCancelButton - completion:(nullable AlertPromptCompletionBlock)completion { - if (message) { - [UIPasteboard generalPasteboard].string = message; - } - if ([self supportsAlertController]) { - UIAlertController *alert = - [UIAlertController alertControllerWithTitle:title - message:message - preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *okAction = - [UIAlertAction actionWithTitle:kOK - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * _Nonnull action) { - if (completion) { - completion(YES, nil); - } - }]; - [alert addAction:okAction]; - - if (showCancelButton) { - UIAlertAction *cancelAction = - [UIAlertAction actionWithTitle:kCancel - style:UIAlertActionStyleCancel - handler:^(UIAlertAction * _Nonnull action) { - completion(NO, nil); - }]; - [alert addAction:cancelAction]; - } - [self presentViewController:alert animated:YES completion:nil]; - } else { - UIAlertController* alert = [UIAlertController alertControllerWithTitle:title - message:message - preferredStyle:UIAlertControllerStyleAlert]; - [self presentViewController:alert animated:YES completion:nil]; - } -} - -- (void)showTextInputPromptWithMessage:(NSString *)message - completionBlock:(AlertPromptCompletionBlock)completion { - [self showTextInputPromptWithMessage:message - keyboardType:UIKeyboardTypeDefault - completionBlock:completion]; -} - -- (void)showTextInputPromptWithMessage:(NSString *)message - keyboardType:(UIKeyboardType)keyboardType - completionBlock:(nonnull AlertPromptCompletionBlock)completion { - if ([self supportsAlertController]) { - UIAlertController *prompt = - [UIAlertController alertControllerWithTitle:nil - message:message - preferredStyle:UIAlertControllerStyleAlert]; - __weak UIAlertController *weakPrompt = prompt; - UIAlertAction *cancelAction = - [UIAlertAction actionWithTitle:kCancel - style:UIAlertActionStyleCancel - handler:^(UIAlertAction * _Nonnull action) { - completion(NO, nil); - }]; - UIAlertAction *okAction = [UIAlertAction actionWithTitle:kOK - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * _Nonnull action) { - UIAlertController *strongPrompt = weakPrompt; - completion(YES, strongPrompt.textFields[0].text); - }]; - [prompt addTextFieldWithConfigurationHandler:^(UITextField *_Nonnull textField) { - textField.keyboardType = keyboardType; - }]; - [prompt addAction:cancelAction]; - [prompt addAction:okAction]; - [self presentViewController:prompt animated:YES completion:nil]; - } else { - SimpleTextPromptDelegate *prompt = - [[SimpleTextPromptDelegate alloc] initWithCompletionHandler:completion]; - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:message - delegate:prompt - cancelButtonTitle:@"Cancel" - otherButtonTitles:@"Ok", nil]; - alertView.alertViewStyle = UIAlertViewStylePlainTextInput; - [alertView show]; - } -} - -- (void)showQRCodePromptWithTextInput:(NSString *)message - qrCodeString:(NSString *)qrCodeString - completionBlock:(AlertPromptCompletionBlock)completion { - - // Create the QR code image from the provided string - NSData *qrCodeData = [qrCodeString dataUsingEncoding:NSUTF8StringEncoding]; - CIFilter *qrCodeFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"]; - [qrCodeFilter setValue:qrCodeData forKey:@"inputMessage"]; - CIImage *qrCodeImage = qrCodeFilter.outputImage; - - // Scale the QR code image to an appropriate size - CGRect extent = qrCodeImage.extent; - CGFloat scale = MIN(240.0 / CGRectGetWidth(extent), 240.0 / CGRectGetHeight(extent)); - CIImage *scaledImage = [qrCodeImage imageByApplyingTransform:CGAffineTransformMakeScale(scale, scale)]; - UIImage *qrCodeUIImage = [UIImage imageWithCIImage:scaledImage]; - - // Create the alert controller to display the QR code and text input - UIAlertController *prompt = [UIAlertController alertControllerWithTitle:nil - message:@"\n\n\n\n\n\n\n\n\n\n" - preferredStyle:UIAlertControllerStyleAlert]; - __weak UIAlertController *weakPrompt = prompt; - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" - style:UIAlertActionStyleCancel - handler:^(UIAlertAction * _Nonnull action) { - completion(NO, nil); - }]; - UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * _Nonnull action) { - UIAlertController *strongPrompt = weakPrompt; - completion(YES, strongPrompt.textFields[0].text); - }]; - [prompt addTextFieldWithConfigurationHandler:^(UITextField *_Nonnull textField) { - textField.placeholder = @"Enter OTP"; - }]; - [prompt addAction:cancelAction]; - [prompt addAction:okAction]; - - // Add the QR code image view to the alert controller - UIImageView *qrCodeImageView = [[UIImageView alloc] initWithImage:qrCodeUIImage]; - qrCodeImageView.contentMode = UIViewContentModeScaleAspectFit; - qrCodeImageView.translatesAutoresizingMaskIntoConstraints = NO; - [prompt.view addSubview:qrCodeImageView]; - [qrCodeImageView.centerXAnchor constraintEqualToAnchor:prompt.view.centerXAnchor].active = YES; - [qrCodeImageView.topAnchor constraintEqualToAnchor:prompt.view.topAnchor - constant:10.0].active = YES; - [qrCodeImageView.widthAnchor constraintEqualToConstant:240.0].active = YES; - [qrCodeImageView.heightAnchor constraintEqualToConstant:240.0].active = YES; - - // Add the message label to the alert controller - UILabel *messageLabel = [[UILabel alloc] init]; - messageLabel.text = message; - messageLabel.textAlignment = NSTextAlignmentCenter; - messageLabel.numberOfLines = 0; - messageLabel.translatesAutoresizingMaskIntoConstraints = NO; - [prompt.view addSubview:messageLabel]; - [messageLabel.topAnchor constraintEqualToAnchor:qrCodeImageView.bottomAnchor - constant:10.0].active = YES; - [messageLabel.leadingAnchor constraintEqualToAnchor:prompt.view.leadingAnchor - constant:10.0].active = YES; - [messageLabel.trailingAnchor constraintEqualToAnchor:prompt.view.trailingAnchor - constant:-10.0].active = YES; - - // Present the alert controller - [self presentViewController:prompt animated:YES completion:nil]; -} - -- (void)showSpinner:(nullable void(^)(void))completion { - if (self.useStatusBarSpinner) { - [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; - completion(); - return; - } - if ([self supportsAlertController]) { - [self showModernSpinner:completion]; - } else { - [self showIOS7Spinner:completion]; - } -} - -- (void)showModernSpinner:(nullable void (^)(void))completion { - UIAlertController *pleaseWaitAlert = - objc_getAssociatedObject(self, - (__bridge const void *)kPleaseWaitAssociatedObjectKey); - if (pleaseWaitAlert) { - if (completion) { - completion(); - } - return; - } - pleaseWaitAlert = [UIAlertController alertControllerWithTitle:nil - message:@"Please Wait...\n\n\n\n" - preferredStyle:UIAlertControllerStyleAlert]; - - UIActivityIndicatorView *spinner = - [[UIActivityIndicatorView alloc] - initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; - spinner.color = [UIColor blackColor]; - spinner.center = CGPointMake(pleaseWaitAlert.view.bounds.size.width / 2, - pleaseWaitAlert.view.bounds.size.height / 2); - spinner.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | - UIViewAutoresizingFlexibleTopMargin | - UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin; - [spinner startAnimating]; - [pleaseWaitAlert.view addSubview:spinner]; - - objc_setAssociatedObject(self, - (__bridge const void *)(kPleaseWaitAssociatedObjectKey), - pleaseWaitAlert, - OBJC_ASSOCIATION_RETAIN_NONATOMIC); - [self presentViewController:pleaseWaitAlert animated:YES completion:completion]; -} - -- (void)showIOS7Spinner:(nullable void (^)(void))completion { - UIWindow *pleaseWaitWindow = - objc_getAssociatedObject(self, - (__bridge const void *)kPleaseWaitAssociatedObjectKey); - - if (pleaseWaitWindow) { - if (completion) { - completion(); - } - return; - } - - pleaseWaitWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - pleaseWaitWindow.backgroundColor = [UIColor clearColor]; - pleaseWaitWindow.windowLevel = UIWindowLevelStatusBar - 1; - - UIView *pleaseWaitView = [[UIView alloc] initWithFrame:pleaseWaitWindow.bounds]; - pleaseWaitView.autoresizingMask = UIViewAutoresizingFlexibleWidth | - UIViewAutoresizingFlexibleHeight; - pleaseWaitView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; - UIActivityIndicatorView *spinner = - [[UIActivityIndicatorView alloc] - initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; - spinner.center = pleaseWaitView.center; - [pleaseWaitView addSubview:spinner]; - [spinner startAnimating]; - - pleaseWaitView.layer.opacity = 0.0; - [self.view addSubview:pleaseWaitView]; - - [pleaseWaitWindow addSubview:pleaseWaitView]; - - [pleaseWaitWindow makeKeyAndVisible]; - - objc_setAssociatedObject(self, - (__bridge const void *)(kPleaseWaitAssociatedObjectKey), - pleaseWaitWindow, - OBJC_ASSOCIATION_RETAIN_NONATOMIC); - - [UIView animateWithDuration:0.5f animations:^{ - pleaseWaitView.layer.opacity = 1.0f; - } completion:^(BOOL finished) { - if (completion) { - completion(); - } - }]; -} - -- (void)hideSpinner:(nullable void(^)(void))completion { - if (self.useStatusBarSpinner) { - [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; - completion(); - return; - } - if ([self supportsAlertController]) { - [self hideModernSpinner:completion]; - } else { - [self hideIOS7Spinner:completion]; - } -} - -- (void)hideModernSpinner:(nullable void(^)(void))completion { - UIAlertController *pleaseWaitAlert = - objc_getAssociatedObject(self, - (__bridge const void *)kPleaseWaitAssociatedObjectKey); - - [pleaseWaitAlert dismissViewControllerAnimated:YES completion:completion]; - - objc_setAssociatedObject(self, - (__bridge const void *)(kPleaseWaitAssociatedObjectKey), - nil, - OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (void)hideIOS7Spinner:(nullable void(^)(void))completion { - UIWindow *pleaseWaitWindow = - objc_getAssociatedObject(self, - (__bridge const void *)kPleaseWaitAssociatedObjectKey); - - UIView *pleaseWaitView; - pleaseWaitView = pleaseWaitWindow.subviews.firstObject; - - [UIView animateWithDuration:0.5f animations:^{ - pleaseWaitView.layer.opacity = 0.0f; - } completion:^(BOOL finished) { - [pleaseWaitWindow resignKeyWindow]; - objc_setAssociatedObject(self, - (__bridge const void *)(kPleaseWaitAssociatedObjectKey), - nil, - OBJC_ASSOCIATION_RETAIN_NONATOMIC); - if (completion) { - completion(); - } - }]; -} - -@end - -@implementation SimpleTextPromptDelegate { - AlertPromptCompletionBlock _completionHandler; - SimpleTextPromptDelegate *_retainedSelf; -} - -- (instancetype)initWithCompletionHandler:(AlertPromptCompletionBlock)completionHandler { - self = [super init]; - if (self) { - _completionHandler = completionHandler; - _retainedSelf = self; - } - return self; -} - -- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { - if (buttonIndex == alertView.firstOtherButtonIndex) { - _completionHandler(YES, [alertView textFieldAtIndex:0].text); - } else { - _completionHandler(NO, nil); - } - _completionHandler = nil; - _retainedSelf = nil; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/UserInfoViewController.h b/FirebaseAuth/Tests/Sample/Sample/UserInfoViewController.h deleted file mode 100644 index 6eee27fc379..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/UserInfoViewController.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 - -@class FIRUser; -@class StaticContentTableViewManager; - -/** @class UserInfoViewController - @brief A view controller for displaying @c FIRUser data. - */ -@interface UserInfoViewController : UIViewController - -/** @property tableViewManager - @brief A @c StaticContentTableViewManager which is used to manage the contents of the table - view. - */ -@property(nonatomic, strong) IBOutlet StaticContentTableViewManager *tableViewManager; - -/** @fn initWithUser: - @biref Initializes with a @c FIRUser instance. - @param user The user to be displayed in the view. - */ -- (instancetype)initWithUser:(FIRUser *)user NS_DESIGNATED_INITIALIZER; - -/** @fn initWithNibName:bundle: - @brief Not available. Call initWithUser: instead. - */ -- (instancetype)initWithNibName:(NSString *)nibNameOrNil - bundle:(NSBundle *)nibBundleOrNil NS_UNAVAILABLE; - -/** @fn initWithCoder: - @brief Not available. Call initWithUser: instead. - */ -- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE; - -/** @fn done - @brief Called when user taps the "Done" button. - */ -- (IBAction)done:(id)sender; - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/UserInfoViewController.m b/FirebaseAuth/Tests/Sample/Sample/UserInfoViewController.m deleted file mode 100644 index 453c0aeb6be..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/UserInfoViewController.m +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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 "UserInfoViewController.h" - -@import FirebaseAuth; -#import "StaticContentTableViewManager.h" - -/** @fn stringWithBool - @brief Converts a boolean value to a string for display. - @param boolValue the boolean value. - @return The string form of the boolean value. - */ -static NSString *stringWithBool(BOOL boolValue) { - return boolValue ? @"YES" : @"NO"; -} - -/** @fn stringFromDate - @brief Converts a NSDate va to a string for display. - @param date The NSDate instance. - @return The string form of the NSDate instance. - */ -static NSString *stringFromDate(NSDate *date) { - if (!date) { - return @"nil"; - } - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - dateFormatter.dateStyle = NSDateFormatterShortStyle; - dateFormatter.timeStyle = NSDateFormatterShortStyle; - return [dateFormatter stringFromDate:date]; -} - -@implementation UserInfoViewController { - FIRUser *_user; -} - -- (instancetype)initWithUser:(FIRUser *)user { - self = [super initWithNibName:NSStringFromClass([self class]) bundle:nil]; - if (self) { - _user = user; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - [self loadTableView]; -} - -- (void)loadTableView { - NSMutableArray *sections = [@[ - [StaticContentTableViewSection sectionWithTitle:@"User" cells:@[ - [StaticContentTableViewCell cellWithTitle:@"anonymous" value:stringWithBool(_user.anonymous)], - [StaticContentTableViewCell cellWithTitle:@"creation date" - value:stringFromDate(_user.metadata.creationDate)], - [StaticContentTableViewCell cellWithTitle:@"last sign in date" - value:stringFromDate(_user.metadata.lastSignInDate)], - [StaticContentTableViewCell cellWithTitle:@"email verified" - value:stringWithBool(_user.emailVerified)], - [StaticContentTableViewCell cellWithTitle:@"refresh token" value:_user.refreshToken], - [StaticContentTableViewCell cellWithTitle:@"multi factor" value:[self multiFactorString]], - ]] - ] mutableCopy]; - [sections addObject:[self sectionWithUserInfo:_user]]; - for (id userInfo in _user.providerData) { - [sections addObject:[self sectionWithUserInfo:userInfo]]; - } - _tableViewManager.contents = [StaticContentTableViewContent contentWithSections:sections]; -} - -- (StaticContentTableViewSection *)sectionWithUserInfo:(id)userInfo { - return [StaticContentTableViewSection sectionWithTitle:userInfo.providerID cells:@[ - [StaticContentTableViewCell cellWithTitle:@"uid" value:userInfo.uid], - [StaticContentTableViewCell cellWithTitle:@"displayName" value:userInfo.displayName], - [StaticContentTableViewCell cellWithTitle:@"photoURL" value:[userInfo.photoURL absoluteString]], - [StaticContentTableViewCell cellWithTitle:@"email" value:userInfo.email], - [StaticContentTableViewCell cellWithTitle:@"phoneNumber" value:userInfo.phoneNumber] - ]]; -} - -- (IBAction)done:(id)sender { - [self dismissViewControllerAnimated:YES completion:nil]; -} - -- (NSString *)multiFactorString { - NSMutableString *string = [NSMutableString string]; - - for (FIRMultiFactorInfo *info in _user.multiFactor.enrolledFactors) { - [string appendString:info.displayName]; - [string appendString:@" "]; - } - - return string; -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/UserInfoViewController.xib b/FirebaseAuth/Tests/Sample/Sample/UserInfoViewController.xib deleted file mode 100644 index 9098e442743..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/UserInfoViewController.xib +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/FirebaseAuth/Tests/Sample/Sample/UserTableViewCell.h b/FirebaseAuth/Tests/Sample/Sample/UserTableViewCell.h deleted file mode 100644 index bc629071634..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/UserTableViewCell.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 - -@class FIRUser; - -/** @class UserTableViewCell - @brief Represents a user in a table view. - */ -@interface UserTableViewCell : UITableViewCell - -/** @property userInfoProfileURLImageView - @brief A UIImageView whose image is set to the user's profile URL. - */ -@property(nonatomic, weak) IBOutlet UIImageView *userInfoProfileURLImageView; - -/** @property userInfoDisplayNameLabel - @brief A UILabel whose text is set to the user's display name. - */ -@property(nonatomic, weak) IBOutlet UILabel *userInfoDisplayNameLabel; - -/** @property userInfoEmailLabel - @brief A UILabel whose text is set to the user's email. - */ -@property(nonatomic, weak) IBOutlet UILabel *userInfoEmailLabel; - -/** @property userInfoUserIDLabel - @brief A UILabel whose text is set to the user's User ID. - */ -@property(nonatomic, weak) IBOutlet UILabel *userInfoUserIDLabel; - -/** @property userInfoProviderListLabel - @brief A UILabel whose text is set to the user's comma-delimited list of federated sign in - provider IDs. - */ -@property(nonatomic, weak) IBOutlet UILabel *userInfoProviderListLabel; - -/** @fn updateContentsWithUser: - @brief Updates the values of the controls on this table view cell to represent the user. - @param user The user whose values should be used to populate this cell. - */ -- (void)updateContentsWithUser:(FIRUser *)user; - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/UserTableViewCell.m b/FirebaseAuth/Tests/Sample/Sample/UserTableViewCell.m deleted file mode 100644 index 71ad96c045f..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/UserTableViewCell.m +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 "UserTableViewCell.h" - -@import FirebaseAuth; - -@implementation UserTableViewCell { - /** @var _lastPhotoURL - @brief Used to make sure only the last requested image is used to update the UIImageView. - */ - NSURL *_lastPhotoURL; -} - -- (void)updateContentsWithUser:(FIRUser *)user { - _userInfoDisplayNameLabel.text = user.displayName; - _userInfoEmailLabel.text = user.email; - _userInfoUserIDLabel.text = user.uid; - - NSMutableArray *providerIDs = [NSMutableArray array]; - for (id userInfo in user.providerData) { - [providerIDs addObject:userInfo.providerID]; - } - _userInfoProviderListLabel.text = [providerIDs componentsJoinedByString:@", "]; - - NSURL *photoURL = user.photoURL; - _lastPhotoURL = photoURL; // to prevent eariler image overwrites later one. - if (photoURL) { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^() { - UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:photoURL]]; - dispatch_async(dispatch_get_main_queue(), ^() { - if (photoURL == self->_lastPhotoURL) { - self->_userInfoProfileURLImageView.image = image; - } - }); - }); - } else { - _userInfoProfileURLImageView.image = nil; - } -} - -@end diff --git a/FirebaseAuth/Tests/Sample/Sample/main.m b/FirebaseAuth/Tests/Sample/Sample/main.m deleted file mode 100644 index f970dbf4250..00000000000 --- a/FirebaseAuth/Tests/Sample/Sample/main.m +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 "ApplicationDelegate.h" - -int main(int argc, char *argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([ApplicationDelegate class])); - } -}