MainViewController+Internal.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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) FIROAuthProvider *twitterOAuthProvider;
  42. @property(nonatomic) FIROAuthProvider *linkedinOAuthProvider;
  43. @property(nonatomic) FIROAuthProvider *yahooOAuthProvider;
  44. @property(nonatomic) NSMutableArray<FIRAuthStateDidChangeListenerHandle> *authStateDidChangeListeners;
  45. @property(nonatomic) NSMutableArray<FIRAuthStateDidChangeListenerHandle> *IDTokenDidChangeListeners;
  46. - (void)updateTable;
  47. - (FIRUser *)user;
  48. - (void)signinWithProvider:(id<AuthProvider>)authProvider retrieveData:(BOOL)retrieveData;
  49. - (void)signInWithProvider:(nonnull id<AuthProvider>)provider callback:(void(^)(void))callback;
  50. - (void)linkWithAuthProvider:(id<AuthProvider>)authProvider retrieveData:(BOOL)retrieveData;
  51. - (void)unlinkFromProvider:(NSString *)provider
  52. completion:(nullable TestAutomationCallback)completion;
  53. - (void)reauthenticate:(id<AuthProvider>)authProvider retrieveData:(BOOL)retrieveData;
  54. - (void)log:(NSString *)string;
  55. - (void)logSuccess:(NSString *)string;
  56. - (void)logFailure:(NSString *)string error:(NSError * _Nullable) error;
  57. - (void)logFailedTest:(NSString *)reason;
  58. - (NSString *)stringWithAdditionalUserInfo:(nullable FIRAdditionalUserInfo *)additionalUserInfo;
  59. - (void)showTypicalUIForUserUpdateResultsWithTitle:(NSString *)resultsTitle
  60. error:(NSError * _Nullable)error;
  61. - (FIRActionCodeSettings *)actionCodeSettings;
  62. @end
  63. NS_ASSUME_NONNULL_END