@@ -94,6 +94,21 @@ public Thread newThread(Runnable r) {
94
94
}
95
95
};
96
96
97
+ private static final String API_KEY_VALIDATION_MSG =
98
+ "Please set a valid API key. A Firebase API key is required to communicate with "
99
+ + "Firebase server APIs: It authenticates your project with Google."
100
+ + "Please refer to https://firebase.google.com/support/privacy/init-options." ;
101
+
102
+ private static final String APP_ID_VALIDATION_MSG =
103
+ "Please set your Application ID. A valid Firebase App ID is required to communicate "
104
+ + "with Firebase server APIs: It identifies your application with Firebase."
105
+ + "Please refer to https://firebase.google.com/support/privacy/init-options." ;
106
+
107
+ private static final String PROJECT_ID_VALIDATION_MSG =
108
+ "Please set your Project ID. A valid Firebase Project ID is required to communicate "
109
+ + "with Firebase server APIs: It identifies your application with Firebase."
110
+ + "Please refer to https://firebase.google.com/support/privacy/init-options." ;
111
+
97
112
/** package private constructor. */
98
113
FirebaseInstallations (
99
114
FirebaseApp firebaseApp ,
@@ -147,19 +162,12 @@ public Thread newThread(Runnable r) {
147
162
* or empty.
148
163
*/
149
164
private void preConditionChecks () {
150
- Preconditions .checkNotEmpty (getApplicationId ());
151
- Preconditions .checkNotEmpty (getProjectIdentifier ());
152
- Preconditions .checkNotEmpty (getApiKey ());
153
- Preconditions .checkArgument (
154
- Utils .isValidAppIdFormat (getApplicationId ()),
155
- "Please set your Application ID. A valid Firebase App ID is required to communicate "
156
- + "with Firebase server APIs: It identifies your application with Firebase."
157
- + "Please refer to https://firebase.google.com/support/privacy/init-options." );
165
+ Preconditions .checkNotEmpty (getApplicationId (), APP_ID_VALIDATION_MSG );
166
+ Preconditions .checkNotEmpty (getProjectIdentifier (), PROJECT_ID_VALIDATION_MSG );
167
+ Preconditions .checkNotEmpty (getApiKey (), API_KEY_VALIDATION_MSG );
158
168
Preconditions .checkArgument (
159
- Utils .isValidApiKeyFormat (getApiKey ()),
160
- "Please set a valid API key. A Firebase API key is required to communicate with "
161
- + "Firebase server APIs: It authenticates your project with Google."
162
- + "Please refer to https://firebase.google.com/support/privacy/init-options." );
169
+ Utils .isValidAppIdFormat (getApplicationId ()), APP_ID_VALIDATION_MSG );
170
+ Preconditions .checkArgument (Utils .isValidApiKeyFormat (getApiKey ()), API_KEY_VALIDATION_MSG );
163
171
}
164
172
165
173
/** Returns the Project Id or Project Number for the Firebase Project. */
0 commit comments