You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
5.2 KiB

  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <FirebaseCore/FIRApp.h>
  17. @class FIRComponentContainer;
  18. @protocol FIRLibrary;
  19. /**
  20. * The internal interface to FIRApp. This is meant for first-party integrators, who need to receive
  21. * FIRApp notifications, log info about the success or failure of their configuration, and access
  22. * other internal functionality of FIRApp.
  23. *
  24. * TODO(b/28296561): Restructure this header.
  25. */
  26. NS_ASSUME_NONNULL_BEGIN
  27. typedef NS_ENUM(NSInteger, FIRConfigType) {
  28. FIRConfigTypeCore = 1,
  29. FIRConfigTypeSDK = 2,
  30. };
  31. extern NSString *const kFIRDefaultAppName;
  32. extern NSString *const kFIRAppReadyToConfigureSDKNotification;
  33. extern NSString *const kFIRAppDeleteNotification;
  34. extern NSString *const kFIRAppIsDefaultAppKey;
  35. extern NSString *const kFIRAppNameKey;
  36. extern NSString *const kFIRGoogleAppIDKey;
  37. extern NSString *const kFirebaseCoreErrorDomain;
  38. /**
  39. * The format string for the User Defaults key used for storing the data collection enabled flag.
  40. * This includes formatting to append the Firebase App's name.
  41. */
  42. extern NSString *const kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat;
  43. /**
  44. * The plist key used for storing the data collection enabled flag.
  45. */
  46. extern NSString *const kFIRGlobalAppDataCollectionEnabledPlistKey;
  47. /** @var FIRAuthStateDidChangeInternalNotification
  48. @brief The name of the @c NSNotificationCenter notification which is posted when the auth state
  49. changes (e.g. a new token has been produced, a user logs in or out). The object parameter of
  50. the notification is a dictionary possibly containing the key:
  51. @c FIRAuthStateDidChangeInternalNotificationTokenKey (the new access token.) If it does not
  52. contain this key it indicates a sign-out event took place.
  53. */
  54. extern NSString *const FIRAuthStateDidChangeInternalNotification;
  55. /** @var FIRAuthStateDidChangeInternalNotificationTokenKey
  56. @brief A key present in the dictionary object parameter of the
  57. @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this
  58. key will contain the new access token.
  59. */
  60. extern NSString *const FIRAuthStateDidChangeInternalNotificationTokenKey;
  61. /** @var FIRAuthStateDidChangeInternalNotificationAppKey
  62. @brief A key present in the dictionary object parameter of the
  63. @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this
  64. key will contain the FIRApp associated with the auth instance.
  65. */
  66. extern NSString *const FIRAuthStateDidChangeInternalNotificationAppKey;
  67. /** @var FIRAuthStateDidChangeInternalNotificationUIDKey
  68. @brief A key present in the dictionary object parameter of the
  69. @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this
  70. key will contain the new user's UID (or nil if there is no longer a user signed in).
  71. */
  72. extern NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey;
  73. @interface FIRApp ()
  74. /**
  75. * A flag indicating if this is the default app (has the default app name).
  76. */
  77. @property(nonatomic, readonly) BOOL isDefaultApp;
  78. /*
  79. * The container of interop SDKs for this app.
  80. */
  81. @property(nonatomic) FIRComponentContainer *container;
  82. /**
  83. * Checks if the default app is configured without trying to configure it.
  84. */
  85. + (BOOL)isDefaultAppConfigured;
  86. /**
  87. * Registers a given third-party library with the given version number to be reported for
  88. * analytics.
  89. *
  90. * @param name Name of the library.
  91. * @param version Version of the library.
  92. */
  93. + (void)registerLibrary:(nonnull NSString *)name withVersion:(nonnull NSString *)version;
  94. /**
  95. * Registers a given internal library to be reported for analytics.
  96. *
  97. * @param library Optional parameter for component registration.
  98. * @param name Name of the library.
  99. */
  100. + (void)registerInternalLibrary:(nonnull Class<FIRLibrary>)library
  101. withName:(nonnull NSString *)name;
  102. /**
  103. * Registers a given internal library with the given version number to be reported for
  104. * analytics. This should only be used for non-Firebase libraries that have their own versioning
  105. * scheme.
  106. *
  107. * @param library Optional parameter for component registration.
  108. * @param name Name of the library.
  109. * @param version Version of the library.
  110. */
  111. + (void)registerInternalLibrary:(nonnull Class<FIRLibrary>)library
  112. withName:(nonnull NSString *)name
  113. withVersion:(nonnull NSString *)version;
  114. /**
  115. * A concatenated string representing all the third-party libraries and version numbers.
  116. */
  117. + (NSString *)firebaseUserAgent;
  118. /**
  119. * Can be used by the unit tests in eack SDK to reset FIRApp. This method is thread unsafe.
  120. */
  121. + (void)resetApps;
  122. /**
  123. * Can be used by the unit tests in each SDK to set customized options.
  124. */
  125. - (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)options;
  126. @end
  127. NS_ASSUME_NONNULL_END