FIRAppDistribution.h 3.5 KB

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