@dubsdotapp/expo 0.5.20 → 0.5.22
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 +26 -29
- package/dist/index.d.mts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/usePushNotifications.ts +22 -3
package/app.plugin.js
CHANGED
|
@@ -15,14 +15,21 @@ const GMS_PLUGIN = 'apply plugin: "com.google.gms.google-services"';
|
|
|
15
15
|
/**
|
|
16
16
|
* @dubsdotapp/expo Expo config plugin.
|
|
17
17
|
*
|
|
18
|
-
* 1.
|
|
18
|
+
* 1. Stages the developer's google-services.json into android/app/ at prebuild time
|
|
19
|
+
* (each consumer must bring their own Firebase project — no shared fallback)
|
|
19
20
|
* 2. Adds the Google Services Gradle classpath + plugin so Firebase initialises
|
|
20
21
|
*
|
|
22
|
+
* The plugin looks for google-services.json in two locations (in priority order):
|
|
23
|
+
* 1. <projectRoot>/google-services.json ← recommended (committed by the dev)
|
|
24
|
+
* 2. <projectRoot>/android/app/google-services.json (already in place — leave alone)
|
|
25
|
+
*
|
|
26
|
+
* If neither exists, prebuild fails with a clear error. Push will not work without it.
|
|
27
|
+
*
|
|
21
28
|
* Usage in app.json:
|
|
22
29
|
* ["@dubsdotapp/expo"]
|
|
23
30
|
*/
|
|
24
31
|
function withDubsNotifications(config) {
|
|
25
|
-
// Step 1 —
|
|
32
|
+
// Step 1 — stage google-services.json into android/app/
|
|
26
33
|
config = withDangerousMod(config, [
|
|
27
34
|
'android',
|
|
28
35
|
async (cfg) => {
|
|
@@ -34,38 +41,28 @@ function withDubsNotifications(config) {
|
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
const projectRoot = cfg.modRequest.projectRoot;
|
|
37
|
-
const
|
|
44
|
+
const targetPath = path.join(projectRoot, 'android', 'app', 'google-services.json');
|
|
45
|
+
const rootPath = path.join(projectRoot, 'google-services.json');
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (fs.existsSync(filePath) || fs.existsSync(rootGoogleServices)) {
|
|
47
|
+
if (fs.existsSync(targetPath)) {
|
|
48
|
+
// Already in place (e.g. committed under android/app/) — leave it alone
|
|
42
49
|
return cfg;
|
|
43
50
|
}
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
client: [
|
|
52
|
-
{
|
|
53
|
-
client_info: {
|
|
54
|
-
mobilesdk_app_id: '1:161838368570:android:5d77e05a49f7efc64b7203',
|
|
55
|
-
android_client_info: { package_name: packageName },
|
|
56
|
-
},
|
|
57
|
-
oauth_client: [],
|
|
58
|
-
api_key: [{ current_key: 'AIzaSyCtJKF-o1cZ3Y89oM5FlXIGsjFchETzzkM' }],
|
|
59
|
-
services: { appinvite_service: { other_platform_oauth_client: [] } },
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
configuration_version: '1',
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
66
|
-
fs.writeFileSync(filePath, JSON.stringify(googleServices, null, 2));
|
|
52
|
+
if (fs.existsSync(rootPath)) {
|
|
53
|
+
// Developer dropped it at project root — copy into android/app/ where Gradle expects
|
|
54
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
55
|
+
fs.copyFileSync(rootPath, targetPath);
|
|
56
|
+
return cfg;
|
|
57
|
+
}
|
|
67
58
|
|
|
68
|
-
|
|
59
|
+
throw new Error(
|
|
60
|
+
'@dubsdotapp/expo plugin: google-services.json not found.\n' +
|
|
61
|
+
' Download it from your Firebase project (Project settings → General → Your apps) and place it at:\n' +
|
|
62
|
+
` ${path.join(projectRoot, 'google-services.json')}\n` +
|
|
63
|
+
' The package name in Firebase must match android.package in app.json: ' +
|
|
64
|
+
`${packageName}`,
|
|
65
|
+
);
|
|
69
66
|
},
|
|
70
67
|
]);
|
|
71
68
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1212,11 +1212,29 @@ interface ShortVideo {
|
|
|
1212
1212
|
declare function useShorts(league?: string, limit?: number): QueryResult<ShortVideo[]>;
|
|
1213
1213
|
|
|
1214
1214
|
interface PushNotificationStatus {
|
|
1215
|
-
/**
|
|
1215
|
+
/**
|
|
1216
|
+
* Whether push is currently delivering to this user — the right signal for
|
|
1217
|
+
* UI bindings like a "Notifications: Enabled/Disabled" toggle.
|
|
1218
|
+
*
|
|
1219
|
+
* Equivalent to `enabled && !!pushToken`. Goes false after `unregister()`
|
|
1220
|
+
* even though OS permission is still granted. Goes true after `register()`
|
|
1221
|
+
* succeeds.
|
|
1222
|
+
*
|
|
1223
|
+
* Use this — NOT `hasPermission` — when binding switches/toggles.
|
|
1224
|
+
*/
|
|
1225
|
+
isActive: boolean;
|
|
1226
|
+
/** Whether push notifications are enabled in the SDK configuration (the `pushEnabled` prop on DubsProvider). */
|
|
1216
1227
|
enabled: boolean;
|
|
1217
|
-
/**
|
|
1228
|
+
/**
|
|
1229
|
+
* Whether OS-level notification permission has been granted on this device.
|
|
1230
|
+
*
|
|
1231
|
+
* Note: this stays true after `unregister()` because the OS doesn't revoke
|
|
1232
|
+
* permission when a server token is dropped. Useful for permission-flow
|
|
1233
|
+
* prompts (e.g. "Re-enable in Settings" hint), but NOT for "is push on" UI —
|
|
1234
|
+
* use `isActive` for that.
|
|
1235
|
+
*/
|
|
1218
1236
|
hasPermission: boolean;
|
|
1219
|
-
/** The push token (
|
|
1237
|
+
/** The native device push token (FCM/APNs), if currently registered with the server. */
|
|
1220
1238
|
pushToken: string | null;
|
|
1221
1239
|
/**
|
|
1222
1240
|
* @deprecated Use pushToken instead. Kept for backwards compatibility.
|
package/dist/index.d.ts
CHANGED
|
@@ -1212,11 +1212,29 @@ interface ShortVideo {
|
|
|
1212
1212
|
declare function useShorts(league?: string, limit?: number): QueryResult<ShortVideo[]>;
|
|
1213
1213
|
|
|
1214
1214
|
interface PushNotificationStatus {
|
|
1215
|
-
/**
|
|
1215
|
+
/**
|
|
1216
|
+
* Whether push is currently delivering to this user — the right signal for
|
|
1217
|
+
* UI bindings like a "Notifications: Enabled/Disabled" toggle.
|
|
1218
|
+
*
|
|
1219
|
+
* Equivalent to `enabled && !!pushToken`. Goes false after `unregister()`
|
|
1220
|
+
* even though OS permission is still granted. Goes true after `register()`
|
|
1221
|
+
* succeeds.
|
|
1222
|
+
*
|
|
1223
|
+
* Use this — NOT `hasPermission` — when binding switches/toggles.
|
|
1224
|
+
*/
|
|
1225
|
+
isActive: boolean;
|
|
1226
|
+
/** Whether push notifications are enabled in the SDK configuration (the `pushEnabled` prop on DubsProvider). */
|
|
1216
1227
|
enabled: boolean;
|
|
1217
|
-
/**
|
|
1228
|
+
/**
|
|
1229
|
+
* Whether OS-level notification permission has been granted on this device.
|
|
1230
|
+
*
|
|
1231
|
+
* Note: this stays true after `unregister()` because the OS doesn't revoke
|
|
1232
|
+
* permission when a server token is dropped. Useful for permission-flow
|
|
1233
|
+
* prompts (e.g. "Re-enable in Settings" hint), but NOT for "is push on" UI —
|
|
1234
|
+
* use `isActive` for that.
|
|
1235
|
+
*/
|
|
1218
1236
|
hasPermission: boolean;
|
|
1219
|
-
/** The push token (
|
|
1237
|
+
/** The native device push token (FCM/APNs), if currently registered with the server. */
|
|
1220
1238
|
pushToken: string | null;
|
|
1221
1239
|
/**
|
|
1222
1240
|
* @deprecated Use pushToken instead. Kept for backwards compatibility.
|