MainViewController+Internal.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright 2019 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import "MainViewController.h"
  18. #import "FirebaseAuth/FirebaseAuth.h"
  19. #import "UIViewController+Alerts.h"
  20. #import "AuthProviders.h"
  21. NS_ASSUME_NONNULL_BEGIN
  22. static NSString *const kSignedInAlertTitle = @"Signed In";
  23. static NSString *const kSignInErrorAlertTitle = @"Sign-In Error";
  24. /** @brief The request type for OOB action codes.
  25. */
  26. typedef enum {
  27. /** No action code settings. */
  28. ActionCodeRequestTypeEmail,
  29. /** With continue URL but not handled in-app. */
  30. ActionCodeRequestTypeContinue,
  31. /** Handled in-app. */
  32. ActionCodeRequestTypeInApp,
  33. } ActionCodeRequestType;
  34. typedef void (^TextInputCompletionBlock)(NSString *_Nullable userInput);
  35. typedef void (^TestAutomationCallback)(NSError *_Nullable error);
  36. @interface MainViewController ()
  37. @property(nonatomic) BOOL isNewUserToggleOn;
  38. @property(nonatomic) ActionCodeRequestType actionCodeRequestType;
  39. @property(nonatomic) NSURL *actionCodeContinueURL;
  40. @property(nonatomic, copy) NSString *appleRawNonce;
  41. @property(nonatomic) FIROAuthProvider *googleOAuthProvider;
  42. @property(nonatomic) FIROAuthProvider *microsoftOAuthProvider;
  43. @property(nonatomic) FIROAuthProvider *twitterOAuthProvider;
  44. @property(nonatomic) FIROAuthProvider *linkedinOAuthProvider;
  45. @property(nonatomic) FIROAuthProvider *yahooOAuthProvider;
  46. @property(nonatomic) FIROAuthProvider *gitHubOAuthProvider;
  47. @property(nonatomic) NSMutableArray<FIRAuthStateDidChangeListenerHandle> *authStateDidChangeListeners;
  48. @property(nonatomic) NSMutableArray<FIRAuthStateDidChangeListenerHandle> *IDTokenDidChangeListeners;
  49. - (void)updateTable;
  50. - (FIRUser *)user;
  51. - (void)signinWithProvider:(id<AuthProvider>)authProvider retrieveData:(BOOL)retrieveData;
  52. - (void)signInWithProvider:(nonnull id<AuthProvider>)provider callback:(void(^)(void))callback;
  53. - (void)linkWithAuthProvider:(id<AuthProvider>)authProvider retrieveData:(BOOL)retrieveData;
  54. - (void)unlinkFromProvider:(NSString *)provider
  55. completion:(nullable TestAutomationCallback)completion;
  56. - (void)reauthenticate:(id<AuthProvider>)authProvider retrieveData:(BOOL)retrieveData;
  57. - (void)log:(NSString *)string;
  58. - (void)logSuccess:(NSString *)string;
  59. - (void)logFailure:(NSString *)string error:(NSError * _Nullable) error;
  60. - (void)logFailedTest:(NSString *)reason;
  61. - (NSString *)stringWithAdditionalUserInfo:(nullable FIRAdditionalUserInfo *)additionalUserInfo;
  62. - (void)showTypicalUIForUserUpdateResultsWithTitle:(NSString *)resultsTitle
  63. error:(NSError * _Nullable)error;
  64. - (FIRActionCodeSettings *)actionCodeSettings;
  65. @end
  66. NS_ASSUME_NONNULL_END