@dubsdotapp/expo 0.2.54 → 0.2.55
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/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/usePushNotifications.ts +6 -10
package/dist/index.js
CHANGED
|
@@ -2349,7 +2349,8 @@ function useUFCFighterDetail(athleteId) {
|
|
|
2349
2349
|
var import_react16 = require("react");
|
|
2350
2350
|
var import_react_native6 = require("react-native");
|
|
2351
2351
|
function usePushNotifications() {
|
|
2352
|
-
const { client } = useDubs();
|
|
2352
|
+
const { client, appName } = useDubs();
|
|
2353
|
+
const channelId = (0, import_react16.useMemo)(() => appName.toLowerCase().replace(/[^a-z0-9-]/g, ""), [appName]);
|
|
2353
2354
|
const [hasPermission, setHasPermission] = (0, import_react16.useState)(false);
|
|
2354
2355
|
const [expoPushToken, setExpoPushToken] = (0, import_react16.useState)(null);
|
|
2355
2356
|
const [loading, setLoading] = (0, import_react16.useState)(false);
|
|
@@ -2372,20 +2373,14 @@ function usePushNotifications() {
|
|
|
2372
2373
|
}, []);
|
|
2373
2374
|
const setupAndroidChannels = (0, import_react16.useCallback)((Notifications) => {
|
|
2374
2375
|
if (import_react_native6.Platform.OS === "android") {
|
|
2375
|
-
Notifications.setNotificationChannelAsync("default", {
|
|
2376
|
-
name: "Default",
|
|
2376
|
+
Notifications.setNotificationChannelAsync(channelId || "default", {
|
|
2377
|
+
name: appName || "Default",
|
|
2377
2378
|
importance: Notifications.AndroidImportance?.MAX ?? 4,
|
|
2378
2379
|
vibrationPattern: [0, 250, 250, 250]
|
|
2379
2380
|
}).catch(() => {
|
|
2380
2381
|
});
|
|
2381
|
-
Notifications.setNotificationChannelAsync("pickem", {
|
|
2382
|
-
name: "Pick'em Updates",
|
|
2383
|
-
importance: Notifications.AndroidImportance?.HIGH ?? 3,
|
|
2384
|
-
vibrationPattern: [0, 250, 250, 250]
|
|
2385
|
-
}).catch(() => {
|
|
2386
|
-
});
|
|
2387
2382
|
}
|
|
2388
|
-
}, []);
|
|
2383
|
+
}, [channelId, appName]);
|
|
2389
2384
|
const registerTokenWithServer = (0, import_react16.useCallback)(async (token) => {
|
|
2390
2385
|
const deviceName = getDeviceName();
|
|
2391
2386
|
await client.registerPushToken({
|