@umituz/react-native-notifications 1.3.2 → 1.3.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-notifications",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Offline-first local notifications system for React Native apps using expo-notifications",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -56,6 +56,8 @@ export class NotificationManager {
56
56
  shouldShowAlert: true,
57
57
  shouldPlaySound: true,
58
58
  shouldSetBadge: true,
59
+ shouldShowBanner: true,
60
+ shouldShowList: true,
59
61
  }),
60
62
  });
61
63
 
@@ -25,6 +25,7 @@ interface RemindersState {
25
25
  }
26
26
 
27
27
  interface RemindersActions {
28
+ initialize: () => Promise<void>;
28
29
  loadReminders: () => Promise<void>;
29
30
  addReminder: (reminder: Reminder) => Promise<void>;
30
31
  updateReminder: (id: string, updates: Partial<Reminder>) => Promise<void>;
@@ -44,8 +45,8 @@ type RemindersStore = RemindersState & RemindersActions;
44
45
 
45
46
  const DEFAULT_PREFERENCES: NotificationPreferences = {
46
47
  enabled: false,
47
- sound: false,
48
- vibration: false,
48
+ sound: true,
49
+ vibration: true,
49
50
  quietHours: {
50
51
  enabled: false,
51
52
  startHour: 22,
@@ -65,13 +66,34 @@ export const useRemindersStore = create<RemindersStore>((set, get) => ({
65
66
  isLoading: true,
66
67
  isInitialized: false,
67
68
 
69
+ initialize: async () => {
70
+ try {
71
+ const [remindersData, preferencesData] = await Promise.all([
72
+ AsyncStorage.getItem(STORAGE_KEYS.REMINDERS),
73
+ AsyncStorage.getItem(STORAGE_KEYS.PREFERENCES)
74
+ ]);
75
+
76
+ const reminders = remindersData ? JSON.parse(remindersData) : [];
77
+ let preferences = DEFAULT_PREFERENCES;
78
+
79
+ if (preferencesData) {
80
+ const parsed = JSON.parse(preferencesData);
81
+ preferences = { ...DEFAULT_PREFERENCES, ...parsed };
82
+ }
83
+
84
+ set({ reminders, preferences, isLoading: false, isInitialized: true });
85
+ } catch {
86
+ set({ reminders: [], preferences: DEFAULT_PREFERENCES, isLoading: false, isInitialized: true });
87
+ }
88
+ },
89
+
68
90
  loadReminders: async () => {
69
91
  try {
70
92
  const data = await AsyncStorage.getItem(STORAGE_KEYS.REMINDERS);
71
93
  const reminders = data ? JSON.parse(data) : [];
72
- set({ reminders, isLoading: false, isInitialized: true });
94
+ set({ reminders });
73
95
  } catch {
74
- set({ reminders: [], isLoading: false, isInitialized: true });
96
+ set({ reminders: [] });
75
97
  }
76
98
  },
77
99
 
@@ -40,7 +40,7 @@ export const FrequencySelector: React.FC<FrequencySelectorProps> = ({
40
40
  <AtomicIcon
41
41
  name={option.iconName}
42
42
  size="sm"
43
- color={isSelected ? 'surface' : 'textSecondary'}
43
+ color={isSelected ? 'onSurface' : 'secondary'}
44
44
  />
45
45
  <AtomicText type="bodySmall" style={isSelected ? styles.selectedText : styles.text}>
46
46
  {getLabel(option.labelKey)}
@@ -89,7 +89,7 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
89
89
  thumbColor={tokens.colors.surface}
90
90
  />
91
91
  ) : (
92
- <AtomicIcon name="chevron-forward" size="md" color="textSecondary" />
92
+ <AtomicIcon name="chevron-forward" size="md" color="secondary" />
93
93
  )}
94
94
  </TouchableOpacity>
95
95
  </View>
@@ -5,7 +5,8 @@
5
5
 
6
6
  import React, { useMemo } from 'react';
7
7
  import { View, TouchableOpacity, StyleSheet } from 'react-native';
8
- import { AtomicText, AtomicIcon, AtomicSwitch, AtomicCard } from '@umituz/react-native-design-system';
8
+ import { AtomicText, AtomicIcon, AtomicCard } from '@umituz/react-native-design-system';
9
+ import { Switch } from 'react-native';
9
10
  import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
10
11
  import type { QuietHoursConfig, QuietHoursTranslations } from '../../infrastructure/services/types';
11
12
 
@@ -41,7 +42,12 @@ export const QuietHoursCard: React.FC<QuietHoursCardProps> = ({
41
42
  <AtomicText type="bodyLarge">{translations.title}</AtomicText>
42
43
  <AtomicText type="bodySmall" style={styles.description}>{translations.description}</AtomicText>
43
44
  </View>
44
- <AtomicSwitch value={config.enabled} onValueChange={onToggle} />
45
+ <Switch
46
+ value={config.enabled}
47
+ onValueChange={onToggle}
48
+ trackColor={{ false: tokens.colors.surfaceSecondary, true: tokens.colors.primary }}
49
+ thumbColor={tokens.colors.surface}
50
+ />
45
51
  </View>
46
52
 
47
53
  {config.enabled && (
@@ -54,7 +60,7 @@ export const QuietHoursCard: React.FC<QuietHoursCardProps> = ({
54
60
  </TouchableOpacity>
55
61
 
56
62
  <View style={styles.timeSeparator}>
57
- <AtomicIcon name="arrow-forward" size="sm" color="textSecondary" />
63
+ <AtomicIcon name="arrow-forward" size="sm" color="secondary" />
58
64
  </View>
59
65
 
60
66
  <TouchableOpacity style={styles.timeButton} onPress={onEndTimePress} activeOpacity={0.7}>
@@ -5,7 +5,8 @@
5
5
 
6
6
  import React, { useMemo } from 'react';
7
7
  import { View, TouchableOpacity, StyleSheet } from 'react-native';
8
- import { AtomicText, AtomicIcon, AtomicSwitch } from '@umituz/react-native-design-system';
8
+ import { AtomicText, AtomicIcon } from '@umituz/react-native-design-system';
9
+ import { Switch } from 'react-native';
9
10
  import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
10
11
  import type { Reminder, ReminderFrequency } from '../../infrastructure/services/types';
11
12
 
@@ -65,7 +66,7 @@ export const ReminderItem: React.FC<ReminderItemProps> = ({
65
66
  <AtomicIcon
66
67
  name={getFrequencyIcon(reminder.frequency)}
67
68
  size="md"
68
- color={reminder.enabled ? 'primary' : 'textSecondary'}
69
+ color={reminder.enabled ? 'primary' : 'secondary'}
69
70
  />
70
71
  </View>
71
72
  <View style={styles.textContainer}>
@@ -87,7 +88,12 @@ export const ReminderItem: React.FC<ReminderItemProps> = ({
87
88
  <TouchableOpacity style={styles.deleteButton} onPress={() => onDelete(reminder.id)}>
88
89
  <AtomicIcon name="trash" size="sm" color="error" />
89
90
  </TouchableOpacity>
90
- <AtomicSwitch value={reminder.enabled} onValueChange={() => onToggle(reminder.id)} />
91
+ <Switch
92
+ value={reminder.enabled}
93
+ onValueChange={() => onToggle(reminder.id)}
94
+ trackColor={{ false: tokens.colors.surfaceSecondary, true: tokens.colors.primary }}
95
+ thumbColor={tokens.colors.surface}
96
+ />
91
97
  </View>
92
98
  </View>
93
99
  );
@@ -51,7 +51,7 @@ export const TimePresetSelector: React.FC<TimePresetSelectorProps> = ({
51
51
  <AtomicIcon
52
52
  name={preset.iconName}
53
53
  size="md"
54
- color={isSelected ? 'surface' : 'textSecondary'}
54
+ color={isSelected ? 'onSurface' : 'secondary'}
55
55
  />
56
56
  <AtomicText type="bodySmall" style={isSelected ? styles.selectedText : styles.text}>
57
57
  {getPresetLabel(preset.labelKey)}
@@ -68,7 +68,7 @@ export const TimePresetSelector: React.FC<TimePresetSelectorProps> = ({
68
68
  onPress={onSelectCustom}
69
69
  activeOpacity={0.7}
70
70
  >
71
- <AtomicIcon name="time" size="md" color={isCustomSelected ? 'surface' : 'textSecondary'} />
71
+ <AtomicIcon name="time" size="md" color={isCustomSelected ? 'onSurface' : 'secondary'} />
72
72
  <AtomicText type="bodySmall" style={isCustomSelected ? styles.selectedText : styles.text}>
73
73
  {customLabel}
74
74
  </AtomicText>
@@ -5,7 +5,8 @@
5
5
 
6
6
  import React, { useEffect, useMemo, useCallback } from 'react';
7
7
  import { View, StyleSheet, ActivityIndicator, ScrollView, TouchableOpacity } from 'react-native';
8
- import { AtomicText, AtomicIcon, AtomicSwitch, AtomicCard, ScreenLayout } from '@umituz/react-native-design-system';
8
+ import { AtomicText, AtomicIcon, AtomicCard, ScreenLayout } from '@umituz/react-native-design-system';
9
+ import { Switch } from 'react-native';
9
10
  import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
10
11
  import { QuietHoursCard } from '../components/QuietHoursCard';
11
12
  import { useRemindersStore, useNotificationPreferences, useQuietHours, useReminders } from '../../infrastructure/storage/RemindersStore';
@@ -33,11 +34,11 @@ export const NotificationSettingsScreen: React.FC<NotificationSettingsScreenProp
33
34
  const preferences = useNotificationPreferences();
34
35
  const quietHours = useQuietHours();
35
36
  const reminders = useReminders();
36
- const { loadPreferences, updatePreferences, updateQuietHours, isLoading } = useRemindersStore();
37
+ const { initialize, updatePreferences, updateQuietHours, isLoading } = useRemindersStore();
37
38
 
38
39
  useEffect(() => {
39
- loadPreferences();
40
- }, [loadPreferences]);
40
+ initialize();
41
+ }, [initialize]);
41
42
 
42
43
  const handleMasterToggle = useCallback(async (value: boolean) => {
43
44
  if (value) {
@@ -122,7 +123,7 @@ export const NotificationSettingsScreen: React.FC<NotificationSettingsScreenProp
122
123
  <AtomicText type="bodySmall" style={styles.badgeText}>{reminders.length}</AtomicText>
123
124
  </View>
124
125
  )}
125
- <AtomicIcon name="chevron-forward" size="md" color="textSecondary" />
126
+ <AtomicIcon name="chevron-forward" size="md" color="secondary" />
126
127
  </TouchableOpacity>
127
128
  </AtomicCard>
128
129
 
@@ -160,7 +161,12 @@ const SettingRow: React.FC<SettingRowProps> = ({ iconName, title, description, v
160
161
  <AtomicText type="bodyLarge">{title}</AtomicText>
161
162
  <AtomicText type="bodySmall" style={styles.description}>{description}</AtomicText>
162
163
  </View>
163
- <AtomicSwitch value={value} onValueChange={onToggle} />
164
+ <Switch
165
+ value={value}
166
+ onValueChange={onToggle}
167
+ trackColor={{ false: tokens.colors.surfaceSecondary, true: tokens.colors.primary }}
168
+ thumbColor={tokens.colors.surface}
169
+ />
164
170
  </View>
165
171
  );
166
172
  };
@@ -7,7 +7,8 @@
7
7
 
8
8
  import React, { useMemo } from 'react';
9
9
  import { View, StyleSheet, ActivityIndicator } from 'react-native';
10
- import { AtomicIcon, AtomicSwitch, AtomicCard, AtomicText, ScreenLayout, STATIC_TOKENS } from '@umituz/react-native-design-system';
10
+ import { AtomicIcon, AtomicCard, AtomicText, ScreenLayout, STATIC_TOKENS } from '@umituz/react-native-design-system';
11
+ import { Switch } from 'react-native';
11
12
  import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
12
13
  import { useNotificationSettings } from '../../infrastructure/hooks/useNotificationSettings';
13
14
  import type { DesignTokens } from '@umituz/react-native-design-system';
@@ -38,8 +39,8 @@ export const NotificationsScreen: React.FC<NotificationsScreenProps> = ({
38
39
  <ScreenLayout testID={testID}>
39
40
  <View style={styles.loadingContainer}>
40
41
  <ActivityIndicator size="large" color={tokens.colors.primary} />
41
- <AtomicText
42
- type="bodyMedium"
42
+ <AtomicText
43
+ type="bodyMedium"
43
44
  style={{ color: tokens.colors.textSecondary, marginTop: STATIC_TOKENS.spacing.md }}
44
45
  >
45
46
  {translations.loadingText || 'Loading...'}
@@ -64,9 +65,11 @@ export const NotificationsScreen: React.FC<NotificationsScreenProps> = ({
64
65
  {translations.description}
65
66
  </AtomicText>
66
67
  </View>
67
- <AtomicSwitch
68
+ <Switch
68
69
  value={notificationsEnabled}
69
70
  onValueChange={setNotificationsEnabled}
71
+ trackColor={{ false: tokens.colors.surfaceSecondary, true: tokens.colors.primary }}
72
+ thumbColor={tokens.colors.surface}
70
73
  testID="notifications-toggle"
71
74
  />
72
75
  </View>
@@ -65,7 +65,7 @@ export const ReminderListScreen: React.FC<ReminderListScreenProps> = ({
65
65
  const renderEmpty = useCallback(() => (
66
66
  <View style={styles.emptyContainer}>
67
67
  <View style={styles.emptyIconContainer}>
68
- <AtomicIcon name="notifications-off" size="xl" color="textSecondary" />
68
+ <AtomicIcon name="notifications-off" size="xl" color="secondary" />
69
69
  </View>
70
70
  <AtomicText type="bodyLarge" style={styles.emptyTitle}>{translations.emptyTitle}</AtomicText>
71
71
  <AtomicText type="bodySmall" style={styles.emptyDescription}>{translations.emptyDescription}</AtomicText>
@@ -97,7 +97,7 @@ export const ReminderListScreen: React.FC<ReminderListScreenProps> = ({
97
97
 
98
98
  {canAddMore && (
99
99
  <TouchableOpacity style={styles.fab} onPress={onAddPress} activeOpacity={0.8}>
100
- <AtomicIcon name="add" size="md" color="surface" />
100
+ <AtomicIcon name="add" size="md" color="onSurface" />
101
101
  <AtomicText type="bodyMedium" style={styles.fabText}>{translations.addButtonLabel}</AtomicText>
102
102
  </TouchableOpacity>
103
103
  )}