mayo-firebase-config 1.2.11 → 1.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,7 @@
1
1
  package com.mayofirebaseconfig;
2
2
 
3
+ import android.util.Log;
4
+
3
5
  import com.facebook.react.bridge.ReactApplicationContext;
4
6
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
5
7
  import com.facebook.react.bridge.ReactMethod;
@@ -36,10 +38,16 @@ public class FirebaseConfigExtractorModule extends ReactContextBaseJavaModule {
36
38
  // Use AssetManager to read the google-services.json file from the assets folder
37
39
  AssetManager assetManager = getReactApplicationContext().getAssets();
38
40
  InputStream input = assetManager.open("google-services.json");
39
-
41
+
42
+ // Log file opened successfully
43
+ Log.d(NAME, "google-services.json file opened successfully.");
44
+
40
45
  // Convert InputStream to String
41
46
  String json = convertStreamToString(input);
42
47
 
48
+ // Log raw JSON string
49
+ Log.d(NAME, "JSON string: " + json);
50
+
43
51
  // Use JSONObject to parse the JSON string
44
52
  JSONObject jsonObject = new JSONObject(json);
45
53
  JSONArray clientArray = jsonObject.getJSONArray("client");
@@ -48,6 +56,10 @@ public class FirebaseConfigExtractorModule extends ReactContextBaseJavaModule {
48
56
  JSONArray apiKeyArray = clientObject.getJSONArray("api_key");
49
57
  JSONObject apiKeyObject = apiKeyArray.getJSONObject(0);
50
58
 
59
+ // Log parsed objects
60
+ Log.d(NAME, "Parsed projectInfo: " + projectInfo.toString());
61
+ Log.d(NAME, "Parsed apiKeyObject: " + apiKeyObject.toString());
62
+
51
63
  // Extract webClientId
52
64
  JSONArray oauthClientArray = clientObject.getJSONArray("oauth_client");
53
65
  String webClientId = "";
@@ -72,7 +84,11 @@ public class FirebaseConfigExtractorModule extends ReactContextBaseJavaModule {
72
84
  config.put("databaseURL", "https://" + projectInfo.getString("project_id") + ".firebaseio.com");
73
85
 
74
86
  promise.resolve(config);
87
+ } catch (IOException e) {
88
+ Log.e(NAME, "Error reading Firebase config file", e);
89
+ promise.reject("ERR_IO_EXCEPTION", "Error reading Firebase config file", e);
75
90
  } catch (Exception e) {
91
+ Log.e(NAME, "Error extracting Firebase config on Android", e);
76
92
  promise.reject("ERR_UNEXPECTED_EXCEPTION", "Error extracting Firebase config on Android", e);
77
93
  }
78
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mayo-firebase-config",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "license": "MIT",
5
5
  "author": "Mohamed Bennekrouf",
6
6
  "main": "dist/index.js",