@dubsdotapp/expo 0.2.62 → 0.2.63

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.
Files changed (2) hide show
  1. package/app.plugin.js +72 -0
  2. package/package.json +3 -2
package/app.plugin.js ADDED
@@ -0,0 +1,72 @@
1
+ const { withDangerousMod } = require('@expo/config-plugins');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ /**
6
+ * @dubsdotapp/expo Expo config plugin.
7
+ *
8
+ * Generates a google-services.json for the Dubs Firebase project using the
9
+ * app's own Android package name. This allows Firebase (and therefore FCM)
10
+ * to initialise automatically at runtime — no manual Firebase setup required.
11
+ *
12
+ * Usage in app.json:
13
+ * ["@dubsdotapp/expo"]
14
+ */
15
+ function withDubsNotifications(config) {
16
+ return withDangerousMod(config, [
17
+ 'android',
18
+ async (cfg) => {
19
+ const packageName = cfg.android?.package;
20
+ if (!packageName) {
21
+ throw new Error(
22
+ '@dubsdotapp/expo plugin: "android.package" must be set in app.json',
23
+ );
24
+ }
25
+
26
+ const googleServices = {
27
+ project_info: {
28
+ project_number: '161838368570',
29
+ project_id: 'dubs-a835d',
30
+ storage_bucket: 'dubs-a835d.firebasestorage.app',
31
+ },
32
+ client: [
33
+ {
34
+ client_info: {
35
+ mobilesdk_app_id: '1:161838368570:android:5d77e05a49f7efc64b7203',
36
+ android_client_info: {
37
+ package_name: packageName,
38
+ },
39
+ },
40
+ oauth_client: [],
41
+ api_key: [
42
+ {
43
+ current_key: 'AIzaSyCtJKF-o1cZ3Y89oM5FlXIGsjFchETzzkM',
44
+ },
45
+ ],
46
+ services: {
47
+ appinvite_service: {
48
+ other_platform_oauth_client: [],
49
+ },
50
+ },
51
+ },
52
+ ],
53
+ configuration_version: '1',
54
+ };
55
+
56
+ const projectRoot = cfg.modRequest.projectRoot;
57
+ const filePath = path.join(
58
+ projectRoot,
59
+ 'android',
60
+ 'app',
61
+ 'google-services.json',
62
+ );
63
+
64
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
65
+ fs.writeFileSync(filePath, JSON.stringify(googleServices, null, 2));
66
+
67
+ return cfg;
68
+ },
69
+ ]);
70
+ }
71
+
72
+ module.exports = withDubsNotifications;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dubsdotapp/expo",
3
- "version": "0.2.62",
3
+ "version": "0.2.63",
4
4
  "description": "React Native SDK for the Dubs betting platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -15,7 +15,8 @@
15
15
  },
16
16
  "files": [
17
17
  "dist",
18
- "src"
18
+ "src",
19
+ "app.plugin.js"
19
20
  ],
20
21
  "scripts": {
21
22
  "build": "tsup",