FIROptions.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 <Foundation/Foundation.h>
  17. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * This class provides constant fields of Google APIs.
  20. */
  21. NS_SWIFT_NAME(FirebaseOptions)
  22. @interface FIROptions : NSObject <NSCopying>
  23. /**
  24. * Returns the default options.
  25. */
  26. + (nullable FIROptions *)defaultOptions NS_SWIFT_NAME(defaultOptions());
  27. /**
  28. * An iOS API key used for authenticating requests from your app, e.g.
  29. * @"AIzaSyDdVgKwhZl0sTTTLZ7iTmt1r3N2cJLnaDk", used to identify your app to Google servers.
  30. */
  31. @property(nonatomic, copy, nullable) NSString *APIKey NS_SWIFT_NAME(apiKey);
  32. /**
  33. * The bundle ID for the application. Defaults to `[[NSBundle mainBundle] bundleID]` when not set
  34. * manually or in a plist.
  35. */
  36. @property(nonatomic, copy) NSString *bundleID;
  37. /**
  38. * The OAuth2 client ID for iOS application used to authenticate Google users, for example
  39. * @"12345.apps.googleusercontent.com", used for signing in with Google.
  40. */
  41. @property(nonatomic, copy, nullable) NSString *clientID;
  42. /**
  43. * The tracking ID for Google Analytics, e.g. @"UA-12345678-1", used to configure Google Analytics.
  44. */
  45. @property(nonatomic, copy, nullable) NSString *trackingID;
  46. /**
  47. * The Project Number from the Google Developer's console, for example @"012345678901", used to
  48. * configure Google Cloud Messaging.
  49. */
  50. @property(nonatomic, copy) NSString *GCMSenderID NS_SWIFT_NAME(gcmSenderID);
  51. /**
  52. * The Project ID from the Firebase console, for example @"abc-xyz-123".
  53. */
  54. @property(nonatomic, copy, nullable) NSString *projectID;
  55. /**
  56. * The Android client ID used in Google AppInvite when an iOS app has its Android version, for
  57. * example @"12345.apps.googleusercontent.com".
  58. */
  59. @property(nonatomic, copy, nullable) NSString *androidClientID;
  60. /**
  61. * The Google App ID that is used to uniquely identify an instance of an app.
  62. */
  63. @property(nonatomic, copy) NSString *googleAppID;
  64. /**
  65. * The database root URL, e.g. @"http://abc-xyz-123.firebaseio.com".
  66. */
  67. @property(nonatomic, copy, nullable) NSString *databaseURL;
  68. /**
  69. * The URL scheme used to set up Durable Deep Link service.
  70. */
  71. @property(nonatomic, copy, nullable) NSString *deepLinkURLScheme;
  72. /**
  73. * The Google Cloud Storage bucket name, e.g. @"abc-xyz-123.storage.firebase.com".
  74. */
  75. @property(nonatomic, copy, nullable) NSString *storageBucket;
  76. /**
  77. * Initializes a customized instance of FIROptions with keys. googleAppID, bundleID and GCMSenderID
  78. * are required. Other keys may required for configuring specific services.
  79. */
  80. - (instancetype)initWithGoogleAppID:(NSString *)googleAppID
  81. bundleID:(NSString *)bundleID
  82. GCMSenderID:(NSString *)GCMSenderID
  83. APIKey:(NSString *)APIKey
  84. clientID:(NSString *)clientID
  85. trackingID:(NSString *)trackingID
  86. androidClientID:(NSString *)androidClientID
  87. databaseURL:(NSString *)databaseURL
  88. storageBucket:(NSString *)storageBucket
  89. deepLinkURLScheme:(NSString *)deepLinkURLScheme
  90. DEPRECATED_MSG_ATTRIBUTE(
  91. "Use `-[[FIROptions alloc] initWithGoogleAppID:GCMSenderID:]` "
  92. "(`FirebaseOptions(googleAppID:gcmSenderID:)` in Swift)` and property "
  93. "setters instead.");
  94. /**
  95. * Initializes a customized instance of FIROptions from the file at the given plist file path.
  96. * For example,
  97. * NSString *filePath =
  98. * [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];
  99. * FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];
  100. * Returns nil if the plist file does not exist or is invalid.
  101. */
  102. - (nullable instancetype)initWithContentsOfFile:(NSString *)plistPath;
  103. /**
  104. * Initializes a customized instance of FIROptions with required fields. Use the mutable properties
  105. * to modify fields for configuring specific services.
  106. */
  107. // clang-format off
  108. - (instancetype)initWithGoogleAppID:(NSString *)googleAppID
  109. GCMSenderID:(NSString *)GCMSenderID
  110. NS_SWIFT_NAME(init(googleAppID:gcmSenderID:));
  111. // clang-format on
  112. @end
  113. NS_ASSUME_NONNULL_END