@dubsdotapp/expo 0.2.67 → 0.2.69
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 +18 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/usePushNotifications.ts +14 -1
package/app.plugin.js
CHANGED
|
@@ -2,6 +2,8 @@ const {
|
|
|
2
2
|
withDangerousMod,
|
|
3
3
|
withProjectBuildGradle,
|
|
4
4
|
withAppBuildGradle,
|
|
5
|
+
withEntitlementsPlist,
|
|
6
|
+
withInfoPlist,
|
|
5
7
|
} = require('@expo/config-plugins');
|
|
6
8
|
const fs = require('fs');
|
|
7
9
|
const path = require('path');
|
|
@@ -93,6 +95,22 @@ function withDubsNotifications(config) {
|
|
|
93
95
|
return cfg;
|
|
94
96
|
});
|
|
95
97
|
|
|
98
|
+
// Step 4 — iOS push entitlement (aps-environment)
|
|
99
|
+
config = withEntitlementsPlist(config, (cfg) => {
|
|
100
|
+
cfg.modResults['aps-environment'] =
|
|
101
|
+
cfg.modResults['aps-environment'] || 'production';
|
|
102
|
+
return cfg;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Step 5 — iOS UIBackgroundModes for remote notifications
|
|
106
|
+
config = withInfoPlist(config, (cfg) => {
|
|
107
|
+
const modes = cfg.modResults.UIBackgroundModes || [];
|
|
108
|
+
if (!modes.includes('remote-notification')) {
|
|
109
|
+
cfg.modResults.UIBackgroundModes = [...modes, 'remote-notification'];
|
|
110
|
+
}
|
|
111
|
+
return cfg;
|
|
112
|
+
});
|
|
113
|
+
|
|
96
114
|
return config;
|
|
97
115
|
}
|
|
98
116
|
|
package/dist/index.js
CHANGED
|
@@ -2479,6 +2479,16 @@ function usePushNotifications() {
|
|
|
2479
2479
|
(0, import_react16.useEffect)(() => {
|
|
2480
2480
|
if (didMount.current) return;
|
|
2481
2481
|
didMount.current = true;
|
|
2482
|
+
const Notifications = getNotificationsModule();
|
|
2483
|
+
if (Notifications) {
|
|
2484
|
+
Notifications.setNotificationHandler({
|
|
2485
|
+
handleNotification: async () => ({
|
|
2486
|
+
shouldShowAlert: true,
|
|
2487
|
+
shouldPlaySound: true,
|
|
2488
|
+
shouldSetBadge: false
|
|
2489
|
+
})
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2482
2492
|
restoreIfGranted();
|
|
2483
2493
|
}, []);
|
|
2484
2494
|
return {
|