@umituz/react-native-notifications 1.0.5 → 1.1.0
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/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib/infrastructure/hooks/actions/useNotificationActions.d.ts +4 -13
- package/lib/infrastructure/hooks/actions/useNotificationActions.d.ts.map +1 -1
- package/lib/infrastructure/hooks/actions/useNotificationActions.js +4 -70
- package/lib/infrastructure/hooks/actions/useNotificationActions.js.map +1 -1
- package/lib/infrastructure/hooks/actions/useNotificationManagementActions.d.ts +8 -0
- package/lib/infrastructure/hooks/actions/useNotificationManagementActions.d.ts.map +1 -0
- package/lib/infrastructure/hooks/actions/useNotificationManagementActions.js +78 -0
- package/lib/infrastructure/hooks/actions/useNotificationManagementActions.js.map +1 -0
- package/lib/infrastructure/hooks/state/useNotificationsState.d.ts +8 -8
- package/lib/infrastructure/hooks/useNotificationSettings.d.ts +2 -2
- package/lib/infrastructure/hooks/useNotifications.d.ts +21 -1
- package/lib/infrastructure/hooks/useNotifications.d.ts.map +1 -1
- package/lib/infrastructure/hooks/useNotifications.js +30 -9
- package/lib/infrastructure/hooks/useNotifications.js.map +1 -1
- package/lib/infrastructure/hooks/utils/useNotificationRefresh.d.ts +5 -10
- package/lib/infrastructure/hooks/utils/useNotificationRefresh.d.ts.map +1 -1
- package/lib/infrastructure/hooks/utils/useNotificationRefresh.js +32 -15
- package/lib/infrastructure/hooks/utils/useNotificationRefresh.js.map +1 -1
- package/lib/infrastructure/services/NotificationBadgeManager.d.ts +5 -0
- package/lib/infrastructure/services/NotificationBadgeManager.d.ts.map +1 -0
- package/lib/infrastructure/services/NotificationBadgeManager.js +29 -0
- package/lib/infrastructure/services/NotificationBadgeManager.js.map +1 -0
- package/lib/infrastructure/services/NotificationManager.d.ts +5 -84
- package/lib/infrastructure/services/NotificationManager.d.ts.map +1 -1
- package/lib/infrastructure/services/NotificationManager.js +36 -203
- package/lib/infrastructure/services/NotificationManager.js.map +1 -1
- package/lib/infrastructure/services/NotificationPermissions.d.ts +6 -0
- package/lib/infrastructure/services/NotificationPermissions.d.ts.map +1 -0
- package/lib/infrastructure/services/NotificationPermissions.js +75 -0
- package/lib/infrastructure/services/NotificationPermissions.js.map +1 -0
- package/lib/infrastructure/services/NotificationScheduler.d.ts +8 -0
- package/lib/infrastructure/services/NotificationScheduler.d.ts.map +1 -0
- package/lib/infrastructure/services/NotificationScheduler.js +72 -0
- package/lib/infrastructure/services/NotificationScheduler.js.map +1 -0
- package/lib/infrastructure/services/delivery/NotificationDelivery.d.ts +2 -8
- package/lib/infrastructure/services/delivery/NotificationDelivery.d.ts.map +1 -1
- package/lib/infrastructure/services/delivery/NotificationDelivery.js +27 -13
- package/lib/infrastructure/services/delivery/NotificationDelivery.js.map +1 -1
- package/lib/infrastructure/storage/NotificationsStore.d.ts +8 -1
- package/lib/infrastructure/storage/NotificationsStore.d.ts.map +1 -1
- package/lib/infrastructure/storage/NotificationsStore.js +2 -1
- package/lib/infrastructure/storage/NotificationsStore.js.map +1 -1
- package/lib/infrastructure/utils/dev.d.ts +5 -0
- package/lib/infrastructure/utils/dev.d.ts.map +1 -0
- package/lib/infrastructure/utils/dev.js +24 -0
- package/lib/infrastructure/utils/dev.js.map +1 -0
- package/lib/presentation/screens/NotificationsScreen.d.ts +14 -4
- package/lib/presentation/screens/NotificationsScreen.d.ts.map +1 -1
- package/lib/presentation/screens/NotificationsScreen.js +12 -15
- package/lib/presentation/screens/NotificationsScreen.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/NotificationManager.test.ts +215 -0
- package/src/__tests__/useNotificationActions.test.ts +189 -0
- package/src/__tests__/useNotificationRefresh.test.ts +213 -0
- package/src/index.ts +7 -0
- package/src/infrastructure/hooks/actions/useNotificationActions.ts +8 -110
- package/src/infrastructure/hooks/actions/useNotificationManagementActions.ts +131 -0
- package/src/infrastructure/hooks/useNotifications.ts +37 -11
- package/src/infrastructure/hooks/utils/useNotificationRefresh.ts +40 -16
- package/src/infrastructure/services/NotificationBadgeManager.ts +28 -0
- package/src/infrastructure/services/NotificationManager.ts +51 -217
- package/src/infrastructure/services/NotificationPermissions.ts +80 -0
- package/src/infrastructure/services/NotificationScheduler.ts +77 -0
- package/src/infrastructure/services/delivery/NotificationDelivery.ts +32 -14
- package/src/infrastructure/storage/NotificationsStore.ts +3 -2
- package/src/infrastructure/utils/dev.ts +25 -0
- package/src/presentation/screens/NotificationsScreen.tsx +31 -18
- package/src/types/global.d.ts +255 -0
package/lib/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export { useNotificationsStore, useNotifications } from './infrastructure/storag
|
|
|
10
10
|
export { NotificationService, notificationService } from './infrastructure/services/NotificationService';
|
|
11
11
|
export { NotificationManager } from './infrastructure/services/NotificationManager';
|
|
12
12
|
export { useNotificationSettings } from './infrastructure/hooks/useNotificationSettings';
|
|
13
|
+
export { NotificationsScreen } from './presentation/screens/NotificationsScreen';
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,YAAY,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAGtG,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAGpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,YAAY,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAGtG,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAGpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAOzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -12,4 +12,9 @@ export { NotificationService, notificationService } from './infrastructure/servi
|
|
|
12
12
|
export { NotificationManager } from './infrastructure/services/NotificationManager';
|
|
13
13
|
// Hooks
|
|
14
14
|
export { useNotificationSettings } from './infrastructure/hooks/useNotificationSettings';
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// PRESENTATION LAYER EXPORTS
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Screens
|
|
19
|
+
export { NotificationsScreen } from './presentation/screens/NotificationsScreen';
|
|
15
20
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,gBAAgB;AAChB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAOlF,wBAAwB;AACxB,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAEtG,WAAW;AACX,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAEpF,QAAQ;AACR,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,gBAAgB;AAChB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAOlF,wBAAwB;AACxB,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAEtG,WAAW;AACX,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACzG,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAEpF,QAAQ;AACR,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAE/E,UAAU;AACV,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* useNotificationActions - Offline Notification Actions
|
|
3
|
-
*
|
|
4
|
-
* All actions use AsyncStorage and expo-notifications.
|
|
5
|
-
* NO backend - pure offline.
|
|
6
|
-
*/
|
|
1
|
+
import type { SendNotificationOptions, Notification } from '../types';
|
|
7
2
|
export declare const useNotificationActions: (state: any, setters: any) => {
|
|
8
|
-
sendNotification:
|
|
9
|
-
markAsRead:
|
|
10
|
-
markAllAsRead:
|
|
11
|
-
deleteNotification: any;
|
|
12
|
-
registerChannel: any;
|
|
13
|
-
verifyChannel: any;
|
|
14
|
-
updatePreferences: any;
|
|
3
|
+
sendNotification: (options: SendNotificationOptions) => Promise<Notification[]>;
|
|
4
|
+
markAsRead: (notificationId: string) => Promise<boolean>;
|
|
5
|
+
markAllAsRead: () => Promise<boolean>;
|
|
15
6
|
};
|
|
16
7
|
//# sourceMappingURL=useNotificationActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationActions.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/actions/useNotificationActions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNotificationActions.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/actions/useNotificationActions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,YAAY,EAGb,MAAM,UAAU,CAAC;AAMlB,eAAO,MAAM,sBAAsB,GAAI,OAAO,GAAG,EAAE,SAAS,GAAG;gCAc3C,uBAAuB,KAAG,OAAO,CAAC,YAAY,EAAE,CAAC;iCAsC1C,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;yBAkCN,OAAO,CAAC,OAAO,CAAC;CA8B7D,CAAC"}
|
|
@@ -3,12 +3,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
|
3
3
|
import { NotificationDelivery } from '../../services/delivery/NotificationDelivery';
|
|
4
4
|
import { ChannelManager } from '../../services/channels/ChannelManager';
|
|
5
5
|
import { PreferencesManager } from '../../services/preferences/PreferencesManager';
|
|
6
|
-
|
|
7
|
-
* useNotificationActions - Offline Notification Actions
|
|
8
|
-
*
|
|
9
|
-
* All actions use AsyncStorage and expo-notifications.
|
|
10
|
-
* NO backend - pure offline.
|
|
11
|
-
*/
|
|
6
|
+
import { devLog } from '../../utils/dev';
|
|
12
7
|
export const useNotificationActions = (state, setters) => {
|
|
13
8
|
const { setNotifications, setUnreadCount, setChannels, setPreferences, setError, } = setters;
|
|
14
9
|
const notificationDelivery = new NotificationDelivery();
|
|
@@ -17,7 +12,6 @@ export const useNotificationActions = (state, setters) => {
|
|
|
17
12
|
const sendNotification = useCallback(async (options) => {
|
|
18
13
|
try {
|
|
19
14
|
setError(null);
|
|
20
|
-
// Create notification
|
|
21
15
|
const notification = {
|
|
22
16
|
id: `notif_${Date.now()}`,
|
|
23
17
|
title: options.title,
|
|
@@ -27,13 +21,12 @@ export const useNotificationActions = (state, setters) => {
|
|
|
27
21
|
created_at: new Date().toISOString(),
|
|
28
22
|
read: false,
|
|
29
23
|
};
|
|
30
|
-
// Save to AsyncStorage
|
|
31
24
|
const data = await AsyncStorage.getItem('@notifications:list');
|
|
32
25
|
const notifications = data ? JSON.parse(data) : [];
|
|
33
26
|
notifications.unshift(notification);
|
|
34
27
|
await AsyncStorage.setItem('@notifications:list', JSON.stringify(notifications));
|
|
35
|
-
// Deliver using expo-notifications
|
|
36
28
|
await notificationDelivery.deliver(notification);
|
|
29
|
+
devLog('[useNotificationActions] Notification sent:', notification.id);
|
|
37
30
|
return [notification];
|
|
38
31
|
}
|
|
39
32
|
catch (err) {
|
|
@@ -49,6 +42,7 @@ export const useNotificationActions = (state, setters) => {
|
|
|
49
42
|
await AsyncStorage.setItem('@notifications:list', JSON.stringify(updated));
|
|
50
43
|
setNotifications((prev) => prev.map((n) => n.id === notificationId ? { ...n, read: true } : n));
|
|
51
44
|
setUnreadCount((prev) => Math.max(0, prev - 1));
|
|
45
|
+
devLog('[useNotificationActions] Marked as read:', notificationId);
|
|
52
46
|
return true;
|
|
53
47
|
}
|
|
54
48
|
catch (err) {
|
|
@@ -64,6 +58,7 @@ export const useNotificationActions = (state, setters) => {
|
|
|
64
58
|
await AsyncStorage.setItem('@notifications:list', JSON.stringify(updated));
|
|
65
59
|
setNotifications((prev) => prev.map((n) => ({ ...n, read: true })));
|
|
66
60
|
setUnreadCount(0);
|
|
61
|
+
devLog('[useNotificationActions] All notifications marked as read');
|
|
67
62
|
return true;
|
|
68
63
|
}
|
|
69
64
|
catch (err) {
|
|
@@ -71,71 +66,10 @@ export const useNotificationActions = (state, setters) => {
|
|
|
71
66
|
return false;
|
|
72
67
|
}
|
|
73
68
|
}, [setNotifications, setUnreadCount, setError]);
|
|
74
|
-
const deleteNotification = useCallback(async (notificationId) => {
|
|
75
|
-
try {
|
|
76
|
-
const data = await AsyncStorage.getItem('@notifications:list');
|
|
77
|
-
const notifications = data ? JSON.parse(data) : [];
|
|
78
|
-
const deleted = notifications.find((n) => n.id === notificationId);
|
|
79
|
-
const filtered = notifications.filter((n) => n.id !== notificationId);
|
|
80
|
-
await AsyncStorage.setItem('@notifications:list', JSON.stringify(filtered));
|
|
81
|
-
setNotifications((prev) => prev.filter((n) => n.id !== notificationId));
|
|
82
|
-
if (deleted && !deleted.read) {
|
|
83
|
-
setUnreadCount((prev) => Math.max(0, prev - 1));
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
catch (err) {
|
|
88
|
-
setError(err instanceof Error ? err.message : 'Failed to delete notification');
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}, [setNotifications, setUnreadCount, setError]);
|
|
92
|
-
const registerChannel = useCallback(async (channelType, preferences = {}) => {
|
|
93
|
-
try {
|
|
94
|
-
const channel = await channelManager.register(channelType, preferences);
|
|
95
|
-
if (channel) {
|
|
96
|
-
setChannels((prev) => [...prev, channel]);
|
|
97
|
-
}
|
|
98
|
-
return channel;
|
|
99
|
-
}
|
|
100
|
-
catch (err) {
|
|
101
|
-
setError(err instanceof Error ? err.message : 'Failed to register channel');
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
}, [setChannels, setError]);
|
|
105
|
-
const verifyChannel = useCallback(async (channelId) => {
|
|
106
|
-
try {
|
|
107
|
-
const success = await channelManager.verify(channelId);
|
|
108
|
-
if (success) {
|
|
109
|
-
setChannels((prev) => prev.map((c) => c.id === channelId ? { ...c, is_verified: true } : c));
|
|
110
|
-
}
|
|
111
|
-
return success;
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
setError(err instanceof Error ? err.message : 'Failed to verify channel');
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
}, [setChannels, setError]);
|
|
118
|
-
const updatePreferences = useCallback(async (newPreferences) => {
|
|
119
|
-
try {
|
|
120
|
-
const success = await preferencesManager.update(newPreferences);
|
|
121
|
-
if (success) {
|
|
122
|
-
setPreferences((prev) => prev ? { ...prev, ...newPreferences } : null);
|
|
123
|
-
}
|
|
124
|
-
return success;
|
|
125
|
-
}
|
|
126
|
-
catch (err) {
|
|
127
|
-
setError(err instanceof Error ? err.message : 'Failed to update preferences');
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
}, [setPreferences, setError]);
|
|
131
69
|
return {
|
|
132
70
|
sendNotification,
|
|
133
71
|
markAsRead,
|
|
134
72
|
markAllAsRead,
|
|
135
|
-
deleteNotification,
|
|
136
|
-
registerChannel,
|
|
137
|
-
verifyChannel,
|
|
138
|
-
updatePreferences,
|
|
139
73
|
};
|
|
140
74
|
};
|
|
141
75
|
//# sourceMappingURL=useNotificationActions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationActions.js","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/actions/useNotificationActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,YAAY,MAAM,2CAA2C,CAAC;AAQrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"useNotificationActions.js","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/actions/useNotificationActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,YAAY,MAAM,2CAA2C,CAAC;AAQrE,OAAO,EAAE,oBAAoB,EAAE,M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AC,CAAC,CAAC,CAAC;YAElB,MAAM,CAAC,2DAA2D,CAAC,CAAC;YAEpE,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CACN,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAClE,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,EAAE,CAAC,gBAAgB,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjD,OAAO;QACL,gBAAgB;QAChB,UAAU;QACV,aAAa;KACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NotificationChannel, NotificationPreferences } from '../types';
|
|
2
|
+
export declare const useNotificationManagementActions: (state: any, setters: any) => {
|
|
3
|
+
deleteNotification: (notificationId: string) => Promise<boolean>;
|
|
4
|
+
registerChannel: (channelType: "push" | "in_app", preferences?: Record<string, any>) => Promise<NotificationChannel | null>;
|
|
5
|
+
verifyChannel: (channelId: string) => Promise<boolean>;
|
|
6
|
+
updatePreferences: (newPreferences: Partial<NotificationPreferences>) => Promise<boolean>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=useNotificationManagementActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotificationManagementActions.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/actions/useNotificationManagementActions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAKlB,eAAO,MAAM,gCAAgC,GAAI,OAAO,GAAG,EAAE,SAAS,GAAG;yCAO9C,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;mCAoCjC,MAAM,GAAG,QAAQ,gBACjB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC/B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;+BAqBpB,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;wCAyBpB,OAAO,CAAC,uBAAuB,CAAC,KAAG,OAAO,CAAC,OAAO,CAAC;CA4B7E,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
3
|
+
import { ChannelManager } from '../../services/channels/ChannelManager';
|
|
4
|
+
import { PreferencesManager } from '../../services/preferences/PreferencesManager';
|
|
5
|
+
import { devLog } from '../../utils/dev';
|
|
6
|
+
export const useNotificationManagementActions = (state, setters) => {
|
|
7
|
+
const { setNotifications, setUnreadCount, setChannels, setPreferences, setError } = setters;
|
|
8
|
+
const channelManager = new ChannelManager();
|
|
9
|
+
const preferencesManager = new PreferencesManager();
|
|
10
|
+
const deleteNotification = useCallback(async (notificationId) => {
|
|
11
|
+
try {
|
|
12
|
+
const data = await AsyncStorage.getItem('@notifications:list');
|
|
13
|
+
const notifications = data ? JSON.parse(data) : [];
|
|
14
|
+
const deleted = notifications.find((n) => n.id === notificationId);
|
|
15
|
+
const filtered = notifications.filter((n) => n.id !== notificationId);
|
|
16
|
+
await AsyncStorage.setItem('@notifications:list', JSON.stringify(filtered));
|
|
17
|
+
setNotifications((prev) => prev.filter((n) => n.id !== notificationId));
|
|
18
|
+
if (deleted && !deleted.read) {
|
|
19
|
+
setUnreadCount((prev) => Math.max(0, prev - 1));
|
|
20
|
+
}
|
|
21
|
+
devLog('[useNotificationManagementActions] Deleted notification:', notificationId);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
setError(err instanceof Error ? err.message : 'Failed to delete notification');
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}, [setNotifications, setUnreadCount, setError]);
|
|
29
|
+
const registerChannel = useCallback(async (channelType, preferences = {}) => {
|
|
30
|
+
try {
|
|
31
|
+
const channel = await channelManager.register(channelType, preferences);
|
|
32
|
+
if (channel) {
|
|
33
|
+
setChannels((prev) => [...prev, channel]);
|
|
34
|
+
}
|
|
35
|
+
devLog('[useNotificationManagementActions] Channel registered:', channel?.id);
|
|
36
|
+
return channel;
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
setError(err instanceof Error ? err.message : 'Failed to register channel');
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}, [setChannels, setError]);
|
|
43
|
+
const verifyChannel = useCallback(async (channelId) => {
|
|
44
|
+
try {
|
|
45
|
+
const success = await channelManager.verify(channelId);
|
|
46
|
+
if (success) {
|
|
47
|
+
setChannels((prev) => prev.map((c) => c.id === channelId ? { ...c, is_verified: true } : c));
|
|
48
|
+
}
|
|
49
|
+
devLog('[useNotificationManagementActions] Channel verified:', channelId, success);
|
|
50
|
+
return success;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
setError(err instanceof Error ? err.message : 'Failed to verify channel');
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}, [setChannels, setError]);
|
|
57
|
+
const updatePreferences = useCallback(async (newPreferences) => {
|
|
58
|
+
try {
|
|
59
|
+
const success = await preferencesManager.update(newPreferences);
|
|
60
|
+
if (success) {
|
|
61
|
+
setPreferences((prev) => prev ? { ...prev, ...newPreferences } : null);
|
|
62
|
+
}
|
|
63
|
+
devLog('[useNotificationManagementActions] Preferences updated:', newPreferences);
|
|
64
|
+
return success;
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
setError(err instanceof Error ? err.message : 'Failed to update preferences');
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}, [setPreferences, setError]);
|
|
71
|
+
return {
|
|
72
|
+
deleteNotification,
|
|
73
|
+
registerChannel,
|
|
74
|
+
verifyChannel,
|
|
75
|
+
updatePreferences,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=useNotificationManagementActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotificationManagementActions.js","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/actions/useNotificationManagementActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,YAAY,MAAM,2CAA2C,CAAC;AAMrE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,KAAU,EAAE,OAAY,EAAE,EAAE;IAC3E,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE5F,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;IAC5C,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAEpD,MAAM,kBAAkB,GAAG,WAAW,CACpC,KAAK,EAAE,cAAsB,EAAoB,EAAE;QACjD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;YAC/D,MAAM,aAAa,GAAmB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAEnE,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC;YACnE,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC;YAEtE,MAAM,YAAY,CAAC,OAAO,CACxB,qBAAqB,EACrB,I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,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,CAC7C,CAAC;YACJ,CAAC;YAED,MAAM,CAAC,yDAAyD,EAAE,cAAc,CAAC,CAAC;YAElF,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CACN,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,8BAA8B,CACpE,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,EACD,CAAC,cAAc,EAAE,QAAQ,CAAC,CAC3B,CAAC;IAEF,OAAO;QACL,kBAAkB;QAClB,eAAe;QACf,aAAa;QACb,iBAAiB;KAClB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { NotificationsState } from '../types';
|
|
2
2
|
export declare const useNotificationsState: () => {
|
|
3
|
-
state:
|
|
4
|
-
setNotifications: (notifications: NotificationsState["notifications"]) =>
|
|
5
|
-
setChannels: (channels: NotificationsState["channels"]) =>
|
|
6
|
-
setUnreadCount: (unreadCount: number) =>
|
|
7
|
-
setPreferences: (preferences: NotificationsState["preferences"]) =>
|
|
8
|
-
setLoading: (loading: boolean) =>
|
|
9
|
-
setError: (error: string | null) =>
|
|
10
|
-
setHasMore: (hasMore: boolean) =>
|
|
3
|
+
state: NotificationsState;
|
|
4
|
+
setNotifications: (notifications: NotificationsState["notifications"]) => void;
|
|
5
|
+
setChannels: (channels: NotificationsState["channels"]) => void;
|
|
6
|
+
setUnreadCount: (unreadCount: number) => void;
|
|
7
|
+
setPreferences: (preferences: NotificationsState["preferences"]) => void;
|
|
8
|
+
setLoading: (loading: boolean) => void;
|
|
9
|
+
setError: (error: string | null) => void;
|
|
10
|
+
setHasMore: (hasMore: boolean) => void;
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=useNotificationsState.d.ts.map
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Manages a single toggle for enabling/disabling notifications
|
|
4
4
|
*/
|
|
5
5
|
export declare const useNotificationSettings: () => {
|
|
6
|
-
notificationsEnabled:
|
|
6
|
+
notificationsEnabled: boolean;
|
|
7
7
|
setNotificationsEnabled: (value: boolean) => Promise<void>;
|
|
8
|
-
isLoading:
|
|
8
|
+
isLoading: boolean;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=useNotificationSettings.d.ts.map
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import type { UseNotificationsOptions } from './types';
|
|
2
2
|
export * from './types';
|
|
3
|
-
export declare function useNotifications(userId: string, options?: UseNotificationsOptions):
|
|
3
|
+
export declare function useNotifications(userId: string, options?: UseNotificationsOptions): {
|
|
4
|
+
loadMoreNotifications: () => Promise<void>;
|
|
5
|
+
cleanup: () => void;
|
|
6
|
+
refreshNotifications: () => Promise<void>;
|
|
7
|
+
refreshChannels: () => Promise<void>;
|
|
8
|
+
refreshPreferences: () => Promise<void>;
|
|
9
|
+
deleteNotification: (notificationId: string) => Promise<boolean>;
|
|
10
|
+
registerChannel: (channelType: "push" | "in_app", preferences?: Record<string, any>) => Promise<import("./types").NotificationChannel | null>;
|
|
11
|
+
verifyChannel: (channelId: string) => Promise<boolean>;
|
|
12
|
+
updatePreferences: (newPreferences: Partial<import("./types").NotificationPreferences>) => Promise<boolean>;
|
|
13
|
+
sendNotification: (options: import("./types").SendNotificationOptions) => Promise<import("./types").Notification[]>;
|
|
14
|
+
markAsRead: (notificationId: string) => Promise<boolean>;
|
|
15
|
+
markAllAsRead: () => Promise<boolean>;
|
|
16
|
+
notifications: import("./types").Notification[];
|
|
17
|
+
channels: import("./types").NotificationChannel[];
|
|
18
|
+
unreadCount: number;
|
|
19
|
+
preferences: import("./types").NotificationPreferences | null;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
error: string | null;
|
|
22
|
+
hasMore: boolean;
|
|
23
|
+
};
|
|
4
24
|
//# sourceMappingURL=useNotifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/hooks/useNotifications.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/hooks/useNotifications.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGvD,cAAc,SAAS,CAAC;AAExB,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B;;;;;;;;;;;;;;;;;;;;EAqFrF"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
1
|
+
import { useEffect, useCallback } from 'react';
|
|
2
2
|
import { useNotificationsState } from './state/useNotificationsState';
|
|
3
3
|
import { useNotificationActions } from './actions/useNotificationActions';
|
|
4
|
+
import { useNotificationManagementActions } from './actions/useNotificationManagementActions';
|
|
4
5
|
import { useNotificationRefresh } from './utils/useNotificationRefresh';
|
|
6
|
+
import { devLog } from '../utils/dev';
|
|
5
7
|
export * from './types';
|
|
6
8
|
export function useNotifications(userId, options = {}) {
|
|
7
9
|
const { autoRefresh = false, refreshInterval = 30000, pageSize = 20 } = options;
|
|
@@ -16,8 +18,19 @@ export function useNotifications(userId, options = {}) {
|
|
|
16
18
|
setHasMore,
|
|
17
19
|
};
|
|
18
20
|
const actions = useNotificationActions(state, setters);
|
|
21
|
+
const managementActions = useNotificationManagementActions(state, setters);
|
|
19
22
|
const refresh = useNotificationRefresh(pageSize, setters);
|
|
20
|
-
const loadMoreNotifications = () => refresh.loadMoreNotifications(state.notifications.length, state.hasMore, state.loading);
|
|
23
|
+
const loadMoreNotifications = useCallback(() => refresh.loadMoreNotifications(state.notifications.length, state.hasMore, state.loading), [refresh, state.notifications.length, state.hasMore, state.loading]);
|
|
24
|
+
const cleanup = useCallback(() => {
|
|
25
|
+
setNotifications([]);
|
|
26
|
+
setChannels([]);
|
|
27
|
+
setUnreadCount(0);
|
|
28
|
+
setPreferences(null);
|
|
29
|
+
setError(null);
|
|
30
|
+
setLoading(false);
|
|
31
|
+
setHasMore(true);
|
|
32
|
+
devLog('[useNotifications] Cleaned up notification state');
|
|
33
|
+
}, [setNotifications, setChannels, setUnreadCount, setPreferences, setError, setLoading, setHasMore]);
|
|
21
34
|
// Load initial data
|
|
22
35
|
useEffect(() => {
|
|
23
36
|
if (userId) {
|
|
@@ -26,26 +39,34 @@ export function useNotifications(userId, options = {}) {
|
|
|
26
39
|
refresh.refreshPreferences();
|
|
27
40
|
}
|
|
28
41
|
else {
|
|
29
|
-
|
|
30
|
-
setChannels([]);
|
|
31
|
-
setUnreadCount(0);
|
|
32
|
-
setPreferences(null);
|
|
42
|
+
cleanup();
|
|
33
43
|
}
|
|
34
|
-
}, [userId]);
|
|
35
|
-
// Auto-refresh setup
|
|
44
|
+
}, [userId, cleanup]);
|
|
45
|
+
// Auto-refresh setup with proper cleanup
|
|
36
46
|
useEffect(() => {
|
|
37
47
|
if (!autoRefresh || !userId)
|
|
38
48
|
return;
|
|
39
49
|
const interval = setInterval(() => {
|
|
40
50
|
refresh.refreshNotifications();
|
|
41
51
|
}, refreshInterval);
|
|
42
|
-
return () =>
|
|
52
|
+
return () => {
|
|
53
|
+
clearInterval(interval);
|
|
54
|
+
devLog('[useNotifications] Auto-refresh interval cleared');
|
|
55
|
+
};
|
|
43
56
|
}, [autoRefresh, userId, refreshInterval]);
|
|
57
|
+
// Cleanup on unmount
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
return () => {
|
|
60
|
+
devLog('[useNotifications] Component unmounted, cleaning up');
|
|
61
|
+
};
|
|
62
|
+
}, []);
|
|
44
63
|
return {
|
|
45
64
|
...state,
|
|
46
65
|
...actions,
|
|
66
|
+
...managementActions,
|
|
47
67
|
...refresh,
|
|
48
68
|
loadMoreNotifications,
|
|
69
|
+
cleanup,
|
|
49
70
|
};
|
|
50
71
|
}
|
|
51
72
|
//# sourceMappingURL=useNotifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotifications.js","sourceRoot":"","sources":["../../../src/infrastructure/hooks/useNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useNotifications.js","sourceRoot":"","sources":["../../../src/infrastructure/hooks/useNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,cAAc,SAAS,CAAC;AAExB,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,UAAmC,EAAE;IACpF,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,eAAe,GAAG,KAAK,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAEhF,MAAM,EACJ,KAAK,EACL,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,UAAU,EACV,QAAQ,EACR,UAAU,GACX,GAAG,qBAAqB,EAAE,CAAC;IAE5B,MAAM,OAAO,GAAG;QACd,gBAAgB;QAChB,WAAW;QACX,cAAc;QACd,cAAc;QACd,UAAU;QACV,QAAQ;QACR,UAAU;KACX,CAAC;IAEF,MAAM,OAAO,GAAG,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,iBAAiB,GAAG,gCAAgC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3E,MAAM,OAAO,GAAG,sBAA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,WAAW,CAAC,GAAG,EAAE;YAChC,OAAO,CAAC,oBAAoB,EAAE,CAAC;QACjC,CAAC,EAAE,eAAe,CAAC,CAAC;QAEpB,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,QAAQ,CAAC,CAAC;YACxB,MAAM,CAAC,kDAAkD,CAAC,CAAC;QAC7D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IAE3C,qBAAqB;IACrB,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,qDAAqD,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,GAAG,KAAK;QACR,GAAG,OAAO;QACV,GAAG,iBAAiB;QACpB,GAAG,OAAO;QACV,qBAAqB;QACrB,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useNotificationRefresh - Offline Notification Refresh
|
|
3
|
-
*
|
|
4
|
-
* Uses AsyncStorage for local data.
|
|
5
|
-
* NO backend - pure offline.
|
|
6
|
-
*/
|
|
7
1
|
export declare const useNotificationRefresh: (pageSize: number, setters: any) => {
|
|
8
|
-
refreshNotifications:
|
|
9
|
-
loadMoreNotifications:
|
|
10
|
-
refreshChannels:
|
|
11
|
-
refreshPreferences:
|
|
2
|
+
refreshNotifications: () => Promise<void>;
|
|
3
|
+
loadMoreNotifications: (currentLength: number, hasMore: boolean, loading: boolean) => Promise<void>;
|
|
4
|
+
refreshChannels: () => Promise<void>;
|
|
5
|
+
refreshPreferences: () => Promise<void>;
|
|
6
|
+
cleanup: () => void;
|
|
12
7
|
};
|
|
13
8
|
//# sourceMappingURL=useNotificationRefresh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationRefresh.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/utils/useNotificationRefresh.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNotificationRefresh.d.ts","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/utils/useNotificationRefresh.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,EAAE,SAAS,GAAG;;2CAuD3C,MAAM,WAAW,OAAO,WAAW,OAAO;;;;CAoEnE,CAAC"}
|
|
@@ -1,42 +1,51 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
2
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
3
3
|
import { ChannelManager } from '../../services/channels/ChannelManager';
|
|
4
4
|
import { PreferencesManager } from '../../services/preferences/PreferencesManager';
|
|
5
|
-
|
|
6
|
-
* useNotificationRefresh - Offline Notification Refresh
|
|
7
|
-
*
|
|
8
|
-
* Uses AsyncStorage for local data.
|
|
9
|
-
* NO backend - pure offline.
|
|
10
|
-
*/
|
|
5
|
+
import { devLog, devError } from '../../utils/dev';
|
|
11
6
|
export const useNotificationRefresh = (pageSize, setters) => {
|
|
12
7
|
const { setNotifications, setUnreadCount, setChannels, setPreferences, setLoading, setError, setHasMore, } = setters;
|
|
13
|
-
const channelManager = new ChannelManager();
|
|
14
|
-
const preferencesManager = new PreferencesManager();
|
|
8
|
+
const channelManager = useRef(new ChannelManager()).current;
|
|
9
|
+
const preferencesManager = useRef(new PreferencesManager()).current;
|
|
10
|
+
const abortController = useRef(null);
|
|
11
|
+
const cleanup = useCallback(() => {
|
|
12
|
+
if (abortController.current) {
|
|
13
|
+
abortController.current.abort();
|
|
14
|
+
abortController.current = null;
|
|
15
|
+
}
|
|
16
|
+
}, []);
|
|
15
17
|
const refreshNotifications = useCallback(async () => {
|
|
16
18
|
try {
|
|
19
|
+
cleanup();
|
|
20
|
+
abortController.current = new AbortController();
|
|
17
21
|
setLoading(true);
|
|
18
22
|
setError(null);
|
|
19
|
-
// Load from AsyncStorage
|
|
20
23
|
const data = await AsyncStorage.getItem('@notifications:list');
|
|
21
24
|
const allNotifications = data ? JSON.parse(data) : [];
|
|
22
|
-
// Paginate
|
|
23
25
|
const paginated = allNotifications.slice(0, pageSize);
|
|
24
26
|
const unread = allNotifications.filter((n) => !n.read).length;
|
|
25
27
|
setNotifications(paginated);
|
|
26
28
|
setUnreadCount(unread);
|
|
27
29
|
setHasMore(allNotifications.length > pageSize);
|
|
30
|
+
devLog('[useNotificationRefresh] Refreshed notifications:', paginated.length);
|
|
28
31
|
}
|
|
29
32
|
catch (err) {
|
|
33
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
30
36
|
setError(err instanceof Error ? err.message : 'Failed to load notifications');
|
|
31
37
|
}
|
|
32
38
|
finally {
|
|
33
39
|
setLoading(false);
|
|
40
|
+
cleanup();
|
|
34
41
|
}
|
|
35
|
-
}, [pageSize, setNotifications, setUnreadCount, setHasMore, setLoading, setError]);
|
|
42
|
+
}, [pageSize, setNotifications, setUnreadCount, setHasMore, setLoading, setError, cleanup]);
|
|
36
43
|
const loadMoreNotifications = useCallback(async (currentLength, hasMore, loading) => {
|
|
37
44
|
if (!hasMore || loading)
|
|
38
45
|
return;
|
|
39
46
|
try {
|
|
47
|
+
cleanup();
|
|
48
|
+
abortController.current = new AbortController();
|
|
40
49
|
setLoading(true);
|
|
41
50
|
setError(null);
|
|
42
51
|
const data = await AsyncStorage.getItem('@notifications:list');
|
|
@@ -44,32 +53,39 @@ export const useNotificationRefresh = (pageSize, setters) => {
|
|
|
44
53
|
const moreNotifications = allNotifications.slice(currentLength, currentLength + pageSize);
|
|
45
54
|
setNotifications((prev) => [...prev, ...moreNotifications]);
|
|
46
55
|
setHasMore(allNotifications.length > currentLength + pageSize);
|
|
56
|
+
devLog('[useNotificationRefresh] Loaded more notifications:', moreNotifications.length);
|
|
47
57
|
}
|
|
48
58
|
catch (err) {
|
|
59
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
49
62
|
setError(err instanceof Error
|
|
50
63
|
? err.message
|
|
51
64
|
: 'Failed to load more notifications');
|
|
52
65
|
}
|
|
53
66
|
finally {
|
|
54
67
|
setLoading(false);
|
|
68
|
+
cleanup();
|
|
55
69
|
}
|
|
56
|
-
}, [pageSize, setNotifications, setHasMore, setLoading, setError]);
|
|
70
|
+
}, [pageSize, setNotifications, setHasMore, setLoading, setError, cleanup]);
|
|
57
71
|
const refreshChannels = useCallback(async () => {
|
|
58
72
|
try {
|
|
59
73
|
const channelsData = await channelManager.getActiveChannels();
|
|
60
74
|
setChannels(channelsData);
|
|
75
|
+
devLog('[useNotificationRefresh] Refreshed channels:', channelsData.length);
|
|
61
76
|
}
|
|
62
77
|
catch (err) {
|
|
63
|
-
|
|
78
|
+
devError('[useNotificationRefresh] Failed to refresh channels:', err);
|
|
64
79
|
}
|
|
65
80
|
}, [setChannels]);
|
|
66
81
|
const refreshPreferences = useCallback(async () => {
|
|
67
82
|
try {
|
|
68
83
|
const prefsData = await preferencesManager.get();
|
|
69
84
|
setPreferences(prefsData);
|
|
85
|
+
devLog('[useNotificationRefresh] Refreshed preferences');
|
|
70
86
|
}
|
|
71
87
|
catch (err) {
|
|
72
|
-
|
|
88
|
+
devError('[useNotificationRefresh] Failed to refresh preferences:', err);
|
|
73
89
|
}
|
|
74
90
|
}, [setPreferences]);
|
|
75
91
|
return {
|
|
@@ -77,6 +93,7 @@ export const useNotificationRefresh = (pageSize, setters) => {
|
|
|
77
93
|
loadMoreNotifications,
|
|
78
94
|
refreshChannels,
|
|
79
95
|
refreshPreferences,
|
|
96
|
+
cleanup,
|
|
80
97
|
};
|
|
81
98
|
};
|
|
82
99
|
//# sourceMappingURL=useNotificationRefresh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationRefresh.js","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/utils/useNotificationRefresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useNotificationRefresh.js","sourceRoot":"","sources":["../../../../src/infrastructure/hooks/utils/useNotificationRefresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,YAAY,MAAM,2CAA2C,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAE,OAAY,EAAE,EAAE;IACvE,MAAM,EACJ,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,cAAc,EACd,UAAU,EACV,QAAQ,EACR,UAAU,GACX,GAAG,OAAO,CAAC;IAEZ,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC;IAC5D,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC;IACpE,MAAM,eAAe,GAAG,MAAM,CAAyB,IAAI,CAAC,CAAC;IAE7D,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/B,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;YAC5B,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAChC,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC;QACjC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,oBAAoB,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAClD,IAAI,CAAC;YACH,OAAO,EAAE,CAAC;YACV,eAAe,CAAC,OAAO,GAAG,IAAI,eAAe,EAAE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