MainViewController+Internal.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 "MainViewController.h"
  17. #import "FirebaseAuth.h"
  18. #import "UIViewController+Alerts.h"
  19. #import "AuthProviders.h"
  20. NS_ASSUME_NONNULL_BEGIN
  21. static NSString *const kSignedInAlertTitle = @"Signed In";
  22. static NSString *const kSignInErrorAlertTitle = @"Sign-In Error";
  23. /** @brief The request type for OOB action codes.
  24. */
  25. typedef enum {
  26. /** No action code settings. */
  27. ActionCodeRequestTypeEmail,
  28. /** With continue URL but not handled in-app. */
  29. ActionCodeRequestTypeContinue,
  30. /** Handled in-app. */
  31. ActionCodeRequestTypeInApp,
  32. } ActionCodeRequestType;
  33. typedef void (^TextInputCompletionBlock)(NSString *_Nullable userInput);
  34. typedef void (^TestAutomationCallback)(NSError *_Nullable error);
  35. @interface MainViewController ()
  36. @property(nonatomic) BOOL isNewUserToggleOn;
  37. @property(nonatomic) ActionCodeRequestType actionCodeRequestType;
  38. @property(nonatomic) NSURL *actionCodeContinueURL;
  39. @property(nonatomic) FIROAuthProvider *googleOAuthProvider;
  40. @property(nonatomic) FIROAuthProvider *microsoftOAuthProvider;
  41. @property(nonatomic) NSMutableArray<FIRAuthStateDidChangeListenerHandle> *authStateDidChangeListeners;
  42. @property(nonatomic) NSMutableArray<FIRAuthStateDidChangeListenerHandle> *IDTokenDidChangeListeners;
  43. - (void)updateTable;
  44. - (FIRUser *)user;
  45. - (void)signinWithProvider:(id<AuthProvider>)authProvider retrieveData:(BOOL)retrieveData;
  46. - (void)signInWithProvider:(nonnull id<AuthProvider>)provider callback:(void(^)(void))callback;
  47. - (void)linkWithAuthProvider:(id<AuthProvider>)authProvider retrieveData:(BOOL)retrieveData;
  48. - (void)unlinkFromProvider:(NSString *)provider
  49. completion:(nullable TestAutomationCallback)completion;
  50. - (void)reauthenticate:(id<AuthProvider>)authProvider retrieveData:(BOOL)retrieveData;
  51. - (void)log:(NSString *)string;
  52. - (void)logSuccess:(NSString *)string;
  53. - (void)logFailure:(NSString *)string error:(NSError * _Nullable) error;
  54. - (void)logFailedTest:(NSString *)reason;
  55. - (NSString *)stringWithAdditionalUserInfo:(nullable FIRAdditionalUserInfo *)additionalUserInfo;
  56. - (void)showTypicalUIForUserUpdateResultsWithTitle:(NSString *)resultsTitle
  57. error:(NSError * _Nullable)error;
  58. - (FIRActionCodeSettings *)actionCodeSettings;
  59. @end
  60. NS_ASSUME_NONNULL_END