FIRAppDistribution.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. // The error domain for codes in the FIRAppDistributionError enum.
  69. FOUNDATION_EXPORT NSString *const FIRAppDistributionErrorDomain
  70. NS_SWIFT_NAME(AppDistributionErrorDomain);
  71. // The key for finding error details in the NSError userInfo.
  72. FOUNDATION_EXPORT NSString *const FIRAppDistributionErrorDetailsKey
  73. NS_SWIFT_NAME(FunctionsErrorDetailsKey);
  74. /**
  75. * @enum AppDistributionError
  76. */
  77. typedef NS_ENUM(NSUInteger, FIRAppDistributionError) {
  78. /// Unknown error.
  79. FIRAppDistributionErrorUnknown = 0,
  80. // Authentication failed
  81. FIRAppDistributionErrorAuthenticationFailure = 1,
  82. // Authentication canceled
  83. FIRAppDistributionErrorAuthenticationCancelled = 2,
  84. // Network unavailable to make requests or the request timed out
  85. FIRAppDistributionErrorNetworkFailure = 3,
  86. } NS_SWIFT_NAME(AppDistributionError);
  87. NS_ASSUME_NONNULL_END