FIRAppDistribution.h 3.4 KB

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