@umituz/react-native-notifications 1.0.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/LICENSE +22 -0
- package/README.md +93 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +15 -0
- package/lib/index.js.map +1 -0
- package/lib/infrastructure/config/notificationsConfig.d.ts +20 -0
- package/lib/infrastructure/config/notificationsConfig.d.ts.map +1 -0
- package/lib/infrastructure/config/notificationsConfig.js +81 -0
- package/lib/infrastructure/config/notificationsConfig.js.map +1 -0
- package/lib/infrastructure/hooks/actions/useNotificationActions.d.ts +17 -0
- package/lib/infrastructure/hooks/actions/useNotificationActions.d.ts.map +1 -0
- package/lib/infrastructure/hooks/actions/useNotificationActions.js +141 -0
- package/lib/infrastructure/hooks/actions/useNotificationActions.js.map +1 -0
- package/lib/infrastructure/hooks/state/useNotificationsState.d.ts +12 -0
- package/lib/infrastructure/hooks/state/useNotificationsState.d.ts.map +1 -0
- package/lib/infrastructure/hooks/state/useNotificationsState.js +30 -0
- package/lib/infrastructure/hooks/state/useNotificationsState.js.map +1 -0
- package/lib/infrastructure/hooks/types.d.ts +87 -0
- package/lib/infrastructure/hooks/types.d.ts.map +1 -0
- package/lib/infrastructure/hooks/types.js +8 -0
- package/lib/infrastructure/hooks/types.js.map +1 -0
- package/lib/infrastructure/hooks/useNotificationSettings.d.ts +10 -0
- package/lib/infrastructure/hooks/useNotificationSettings.d.ts.map +1 -0
- package/lib/infrastructure/hooks/useNotificationSettings.js +43 -0
- package/lib/infrastructure/hooks/useNotificationSettings.js.map +1 -0
- package/lib/infrastructure/hooks/useNotifications.d.ts +23 -0
- package/lib/infrastructure/hooks/useNotifications.d.ts.map +1 -0
- package/lib/infrastructure/hooks/useNotifications.js +51 -0
- package/lib/infrastructure/hooks/useNotifications.js.map +1 -0
- package/lib/infrastructure/hooks/utils/useNotificationRefresh.d.ts +13 -0
- package/lib/infrastructure/hooks/utils/useNotificationRefresh.d.ts.map +1 -0
- package/lib/infrastructure/hooks/utils/useNotificationRefresh.js +82 -0
- package/lib/infrastructure/hooks/utils/useNotificationRefresh.js.map +1 -0
- package/lib/infrastructure/services/NotificationManager.d.ts +138 -0
- package/lib/infrastructure/services/NotificationManager.d.ts.map +1 -0
- package/lib/infrastructure/services/NotificationManager.js +284 -0
- package/lib/infrastructure/services/NotificationManager.js.map +1 -0
- package/lib/infrastructure/services/NotificationService.d.ts +30 -0
- package/lib/infrastructure/services/NotificationService.d.ts.map +1 -0
- package/lib/infrastructure/services/NotificationService.js +41 -0
- package/lib/infrastructure/services/NotificationService.js.map +1 -0
- package/lib/infrastructure/services/channels/ChannelManager.d.ts +18 -0
- package/lib/infrastructure/services/channels/ChannelManager.d.ts.map +1 -0
- package/lib/infrastructure/services/channels/ChannelManager.js +87 -0
- package/lib/infrastructure/services/channels/ChannelManager.js.map +1 -0
- package/lib/infrastructure/services/delivery/NotificationDelivery.d.ts +16 -0
- package/lib/infrastructure/services/delivery/NotificationDelivery.d.ts.map +1 -0
- package/lib/infrastructure/services/delivery/NotificationDelivery.js +57 -0
- package/lib/infrastructure/services/delivery/NotificationDelivery.js.map +1 -0
- package/lib/infrastructure/services/preferences/PreferencesManager.d.ts +18 -0
- package/lib/infrastructure/services/preferences/PreferencesManager.d.ts.map +1 -0
- package/lib/infrastructure/services/preferences/PreferencesManager.js +65 -0
- package/lib/infrastructure/services/preferences/PreferencesManager.js.map +1 -0
- package/lib/infrastructure/services/types.d.ts +89 -0
- package/lib/infrastructure/services/types.d.ts.map +1 -0
- package/lib/infrastructure/services/types.js +7 -0
- package/lib/infrastructure/services/types.js.map +1 -0
- package/lib/infrastructure/storage/NotificationsStore.d.ts +23 -0
- package/lib/infrastructure/storage/NotificationsStore.d.ts.map +1 -0
- package/lib/infrastructure/storage/NotificationsStore.js +25 -0
- package/lib/infrastructure/storage/NotificationsStore.js.map +1 -0
- package/package.json +62 -0
- package/src/index.ts +34 -0
- package/src/infrastructure/config/notificationsConfig.ts +98 -0
- package/src/infrastructure/hooks/actions/useNotificationActions.ts +233 -0
- package/src/infrastructure/hooks/state/useNotificationsState.ts +46 -0
- package/src/infrastructure/hooks/types.ts +83 -0
- package/src/infrastructure/hooks/useNotificationSettings.ts +45 -0
- package/src/infrastructure/hooks/useNotifications.ts +70 -0
- package/src/infrastructure/hooks/utils/useNotificationRefresh.ts +107 -0
- package/src/infrastructure/services/NotificationManager.ts +326 -0
- package/src/infrastructure/services/NotificationService.ts +50 -0
- package/src/infrastructure/services/channels/ChannelManager.ts +111 -0
- package/src/infrastructure/services/delivery/NotificationDelivery.ts +65 -0
- package/src/infrastructure/services/preferences/PreferencesManager.ts +77 -0
- package/src/infrastructure/services/types.ts +81 -0
- package/src/infrastructure/storage/NotificationsStore.ts +39 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifications Store - Zustand State Management
|
|
3
|
+
* Simple offline-first notification state
|
|
4
|
+
* NO backend, NO user IDs, NO notification history
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { create } from 'zustand';
|
|
8
|
+
|
|
9
|
+
interface NotificationsStore {
|
|
10
|
+
// State
|
|
11
|
+
hasPermissions: boolean;
|
|
12
|
+
isInitialized: boolean;
|
|
13
|
+
|
|
14
|
+
// Actions
|
|
15
|
+
setPermissions: (granted: boolean) => void;
|
|
16
|
+
setInitialized: (initialized: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const useNotificationsStore = create<NotificationsStore>((set) => ({
|
|
20
|
+
hasPermissions: false,
|
|
21
|
+
isInitialized: false,
|
|
22
|
+
|
|
23
|
+
setPermissions: (granted) => set({ hasPermissions: granted }),
|
|
24
|
+
setInitialized: (initialized) => set({ isInitialized: initialized }),
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Hook for accessing notifications state
|
|
29
|
+
*/
|
|
30
|
+
export const useNotifications = () => {
|
|
31
|
+
const { hasPermissions, isInitialized, setPermissions, setInitialized } = useNotificationsStore();
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
hasPermissions,
|
|
35
|
+
isInitialized,
|
|
36
|
+
setPermissions,
|
|
37
|
+
setInitialized,
|
|
38
|
+
};
|
|
39
|
+
};
|