FIRAppDistributionUIService.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. NS_EXTENSION_UNAVAILABLE_IOS("Firebase App Distribution is not supported for iOS extensions.")
  29. @interface FIRAppDistributionUIService : NSObject <UIApplicationDelegate,
  30. ASWebAuthenticationPresentationContextProviding,
  31. SFSafariViewControllerDelegate>
  32. /// Returns the FIRAppDistributionAppDelegatorInterceptor singleton.
  33. /// Always register just this singleton as the app delegate interceptor. This instance is
  34. /// retained. The App Delegate Swizzler only retains weak references and so this is needed.
  35. + (instancetype)sharedInstance;
  36. typedef void (^AppDistributionRegistrationFlowCompletion)(NSError *_Nullable error);
  37. @property(nullable, nonatomic) UIViewController *safariHostingViewController;
  38. @property(nullable, nonatomic) UIWindow *window;
  39. @property(nullable, nonatomic) AppDistributionRegistrationFlowCompletion registrationFlowCompletion;
  40. - (void)appDistributionRegistrationFlow:(NSURL *)URL
  41. withCompletion:(AppDistributionRegistrationFlowCompletion)completion;
  42. - (void)showUIAlert:(UIAlertController *)alertController;
  43. - (void)showUIAlertWithCompletion:(FIRFADUIActionCompletion)completion;
  44. - (void)initializeUIState;
  45. - (void)resetUIState;
  46. @end
  47. NS_ASSUME_NONNULL_END