FIRAppDistribution.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. * The Firebase App Distribution API provides methods to check for update to
  19. * the app and returns information that enables updating the app.
  20. *
  21. * By default, Firebase App Distribution is initialized with `FirebaseApp.configure()`.
  22. *
  23. * Note: The App Distribution class cannot be subclassed. If this makes testing difficult,
  24. * we suggest using a wrapper class or a protocol extension.
  25. */
  26. NS_SWIFT_NAME(AppDistribution)
  27. @interface FIRAppDistribution : NSObject
  28. /// Returns true if the App Distribution tester is signed in.
  29. @property(nonatomic, readonly) BOOL isTesterSignedIn;
  30. /** :nodoc: */
  31. - (instancetype)init NS_UNAVAILABLE;
  32. /**
  33. * Sign-in the App Distribution tester
  34. */
  35. - (void)signInTesterWithCompletion:(void (^)(NSError *_Nullable error))completion
  36. NS_SWIFT_NAME(signInTester(completion:));
  37. /**
  38. * Check to see whether a new distribution is available
  39. */
  40. - (void)checkForUpdateWithCompletion:
  41. (void (^)(FIRAppDistributionRelease *_Nullable release, NSError *_Nullable error))completion
  42. NS_SWIFT_NAME(checkForUpdate(completion:));
  43. /**
  44. * Sign out App Distribution tester
  45. */
  46. - (void)signOutTester;
  47. /**
  48. * Accesses the singleton App Distribution instance.
  49. *
  50. * @return The singleton App Distribution instance.
  51. */
  52. + (instancetype)appDistribution NS_SWIFT_NAME(appDistribution());
  53. @end
  54. /// The error domain for codes in the `FIRAppDistributionError` enum.
  55. FOUNDATION_EXPORT NSString *const FIRAppDistributionErrorDomain
  56. NS_SWIFT_NAME(AppDistributionErrorDomain);
  57. /// The key for finding error details in the `NSError`'s `userInfo`.
  58. FOUNDATION_EXPORT NSString *const FIRAppDistributionErrorDetailsKey
  59. NS_SWIFT_NAME(FunctionsErrorDetailsKey);
  60. /**
  61. * Error codes representing sign in or version check failure reasons.
  62. */
  63. typedef NS_ENUM(NSUInteger, FIRAppDistributionError) {
  64. /// Returned when an unknown error occurred.
  65. FIRAppDistributionErrorUnknown = 0,
  66. /// Returned when App Distribution failed to authenticate the user.
  67. FIRAppDistributionErrorAuthenticationFailure = 1,
  68. /// Returned when sign-in was cancelled.
  69. FIRAppDistributionErrorAuthenticationCancelled = 2,
  70. /// Returned when the network was unavailable to make requests or
  71. /// the request timed out.
  72. FIRAppDistributionErrorNetworkFailure = 3,
  73. } NS_SWIFT_NAME(AppDistributionError);
  74. NS_ASSUME_NONNULL_END