@dubsdotapp/expo 0.2.62 → 0.2.64
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.
- package/app.plugin.js +84 -0
- package/package.json +6 -3
package/app.plugin.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
// If the developer already has their own google-services.json, leave it alone.
|
|
65
|
+
// Their existing Firebase project will handle FCM just fine.
|
|
66
|
+
if (fs.existsSync(filePath)) {
|
|
67
|
+
return cfg;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Also check the project root (some devs place it there for app.json googleServicesFile)
|
|
71
|
+
const rootGoogleServices = path.join(projectRoot, 'google-services.json');
|
|
72
|
+
if (fs.existsSync(rootGoogleServices)) {
|
|
73
|
+
return cfg;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
77
|
+
fs.writeFileSync(filePath, JSON.stringify(googleServices, null, 2));
|
|
78
|
+
|
|
79
|
+
return cfg;
|
|
80
|
+
},
|
|
81
|
+
]);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = withDubsNotifications;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dubsdotapp/expo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.64",
|
|
4
4
|
"description": "React Native SDK for the Dubs betting platform",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -11,11 +11,14 @@
|
|
|
11
11
|
"react-native": "./dist/index.js",
|
|
12
12
|
"import": "./dist/index.mjs",
|
|
13
13
|
"require": "./dist/index.js"
|
|
14
|
-
}
|
|
14
|
+
},
|
|
15
|
+
"./app.plugin": "./app.plugin.js",
|
|
16
|
+
"./app.plugin.js": "./app.plugin.js"
|
|
15
17
|
},
|
|
16
18
|
"files": [
|
|
17
19
|
"dist",
|
|
18
|
-
"src"
|
|
20
|
+
"src",
|
|
21
|
+
"app.plugin.js"
|
|
19
22
|
],
|
|
20
23
|
"scripts": {
|
|
21
24
|
"build": "tsup",
|