FIRAppDistribution.h 3.5 KB

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