FIRAppDistributionUIService.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <AuthenticationServices/AuthenticationServices.h>
  15. #import <Foundation/Foundation.h>
  16. #import <SafariServices/SafariServices.h>
  17. #import <UIKit/UIKit.h>
  18. #import "FirebaseAppDistribution/Sources/Private/FIRAppDistribution.h"
  19. NS_ASSUME_NONNULL_BEGIN
  20. /**
  21. * The completion handler invoked when a button is clicked from the UI prompt indicating if a user
  22. * clicked continue YES or cancelled NO
  23. */
  24. typedef void (^FIRFADUIActionCompletion)(BOOL continued)
  25. NS_SWIFT_NAME(AppDistributionActionCompletion);
  26. /// An instance of this class provides UI elements required for the App Distribution tester
  27. /// authentication flow as an AppDelegate interceptor.
  28. @interface FIRAppDistributionUIService : NSObject <UIApplicationDelegate,
  29. ASWebAuthenticationPresentationContextProviding,
  30. SFSafariViewControllerDelegate>
  31. /// Returns the FIRAppDistributionAppDelegatorInterceptor singleton.
  32. /// Always register just this singleton as the app delegate interceptor. This instance is
  33. /// retained. The App Delegate Swizzler only retains weak references and so this is needed.
  34. + (instancetype)sharedInstance;
  35. typedef void (^AppDistributionRegistrationFlowCompletion)(NSError *_Nullable error);
  36. @property(nullable, nonatomic) UIViewController *safariHostingViewController;
  37. @property(nullable, nonatomic) UIWindow *window;
  38. @property(nullable, nonatomic) AppDistributionRegistrationFlowCompletion registrationFlowCompletion;
  39. - (void)appDistributionRegistrationFlow:(NSURL *)URL
  40. withCompletion:(AppDistributionRegistrationFlowCompletion)completion;
  41. - (void)showUIAlert:(UIAlertController *)alertController;
  42. - (void)showUIAlertWithCompletion:(FIRFADUIActionCompletion)completion;
  43. - (void)initializeUIState;
  44. - (void)resetUIState;
  45. @end
  46. NS_ASSUME_NONNULL_END