FIRAppDistribution.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. @class FIRAppDistributionRelease;
  15. #import <AppAuth/AppAuth.h>
  16. #import <Foundation/Foundation.h>
  17. #import <UIKit/UIKit.h>
  18. NS_ASSUME_NONNULL_BEGIN
  19. /**
  20. * @related AppDistributionError
  21. *
  22. * The completion handler invoked when the new build request returns.
  23. * If the call fails we return the appropriate `error code`, described by
  24. * `AppDistributionError`.
  25. *
  26. * @param release The new release that is available to be installed.
  27. * @param error The error describing why the new build request failed.
  28. */
  29. typedef void (^FIRAppDistributionUpdateCheckCompletion)(
  30. FIRAppDistributionRelease *_Nullable release, NSError *_Nullable error)
  31. NS_SWIFT_NAME(AppDistributionUpdateCheckCompletion);
  32. /**
  33. * The Firebase App Distribution API provides methods to check for update to
  34. * the app and returns information that enables updating the app.
  35. *
  36. * By default, Firebase App Distribution is initialized with `FirebaseApp.configure()`.
  37. *
  38. * Note: The App Distribution class cannot be subclassed. If this makes testing difficult,
  39. * we suggest using a wrapper class or a protocol extension.
  40. */
  41. NS_SWIFT_NAME(AppDistribution)
  42. @interface FIRAppDistribution : NSObject
  43. // Is true if the App Distribution tester is signed in
  44. @property(nonatomic, readonly) BOOL isTesterSignedIn;
  45. /** :nodoc: */
  46. - (instancetype)init NS_UNAVAILABLE;
  47. /**
  48. * Sign-in the App Distribution tester
  49. */
  50. - (void)signInTesterWithCompletion:(void (^)(NSError *_Nullable error))completion
  51. NS_SWIFT_NAME(signInTester(completion:));
  52. /**
  53. * Check to see whether a new distribution is available
  54. */
  55. - (void)checkForUpdateWithCompletion:(FIRAppDistributionUpdateCheckCompletion)completion
  56. NS_SWIFT_NAME(checkForUpdate(completion:));
  57. /**
  58. * Sign out App Distribution tester
  59. */
  60. - (void)signOutTester;
  61. /**
  62. * Accesses the singleton App Distribution instance.
  63. *
  64. * @return The singleton App Distribution instance.
  65. */
  66. + (instancetype)appDistribution NS_SWIFT_NAME(appDistribution());
  67. @end
  68. /**
  69. * @enum AppDistributionError
  70. */
  71. typedef NS_ENUM(NSUInteger, FIRAppDistributionError) {
  72. /// Unknown error.
  73. FIRAppDistributionErrorUnknown = 0,
  74. // Authentication failed
  75. FIRAppDistributionErrorAuthenticationFailure = 1,
  76. // Authentication canceled
  77. FIRAppDistributionErrorAuthenticationCancelled = 2,
  78. // Network unavailable to make requests or the request timed out
  79. FIRAppDistributionErrorNetworkFailure = 3,
  80. } NS_SWIFT_NAME(AppDistributionError);
  81. NS_ASSUME_NONNULL_END