@umituz/react-native-notifications 1.3.0 → 1.3.2
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 +1 -1
- package/src/infrastructure/config/reminderPresets.ts +6 -6
- package/src/presentation/components/NotificationsSection.tsx +8 -12
- package/src/presentation/components/QuietHoursCard.tsx +1 -1
- package/src/presentation/components/ReminderItem.tsx +4 -4
- package/src/presentation/components/TimePresetSelector.tsx +1 -1
- package/src/presentation/screens/NotificationSettingsScreen.tsx +5 -5
- package/src/presentation/screens/NotificationsScreen.tsx +1 -1
- package/src/presentation/screens/ReminderListScreen.tsx +2 -2
package/package.json
CHANGED
|
@@ -15,28 +15,28 @@ export const DEFAULT_TIME_PRESETS: TimePreset[] = [
|
|
|
15
15
|
hour: 8,
|
|
16
16
|
minute: 0,
|
|
17
17
|
labelKey: 'notifications.presets.morning',
|
|
18
|
-
iconName: '
|
|
18
|
+
iconName: 'sunny',
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
id: 'noon',
|
|
22
22
|
hour: 12,
|
|
23
23
|
minute: 0,
|
|
24
24
|
labelKey: 'notifications.presets.noon',
|
|
25
|
-
iconName: '
|
|
25
|
+
iconName: 'sunny',
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
id: 'afternoon',
|
|
29
29
|
hour: 15,
|
|
30
30
|
minute: 0,
|
|
31
31
|
labelKey: 'notifications.presets.afternoon',
|
|
32
|
-
iconName: '
|
|
32
|
+
iconName: 'partly-sunny',
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
id: 'evening',
|
|
36
36
|
hour: 18,
|
|
37
37
|
minute: 0,
|
|
38
38
|
labelKey: 'notifications.presets.evening',
|
|
39
|
-
iconName: '
|
|
39
|
+
iconName: 'partly-sunny',
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
id: 'night',
|
|
@@ -71,12 +71,12 @@ export const FREQUENCY_OPTIONS: FrequencyOption[] = [
|
|
|
71
71
|
{
|
|
72
72
|
id: 'weekly',
|
|
73
73
|
labelKey: 'notifications.frequency.weekly',
|
|
74
|
-
iconName: 'calendar
|
|
74
|
+
iconName: 'calendar',
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
id: 'monthly',
|
|
78
78
|
labelKey: 'notifications.frequency.monthly',
|
|
79
|
-
iconName: 'calendar
|
|
79
|
+
iconName: 'calendar',
|
|
80
80
|
},
|
|
81
81
|
];
|
|
82
82
|
|
|
@@ -8,6 +8,8 @@ import type { StyleProp, ViewStyle } from 'react-native';
|
|
|
8
8
|
import { View, TouchableOpacity, StyleSheet, Switch } from 'react-native';
|
|
9
9
|
import { AtomicText, AtomicIcon } from '@umituz/react-native-design-system';
|
|
10
10
|
import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
|
|
11
|
+
// @ts-ignore - Optional peer dependency
|
|
12
|
+
import { useNavigation } from '@react-navigation/native';
|
|
11
13
|
import { notificationService } from '../../infrastructure/services/NotificationService';
|
|
12
14
|
|
|
13
15
|
export interface NotificationsSectionConfig {
|
|
@@ -22,14 +24,13 @@ export interface NotificationsSectionConfig {
|
|
|
22
24
|
export interface NotificationsSectionProps {
|
|
23
25
|
config?: NotificationsSectionConfig;
|
|
24
26
|
containerStyle?: StyleProp<ViewStyle>;
|
|
25
|
-
onNavigate?: (route: string) => void;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
29
30
|
config,
|
|
30
31
|
containerStyle,
|
|
31
|
-
onNavigate,
|
|
32
32
|
}) => {
|
|
33
|
+
const navigation = useNavigation();
|
|
33
34
|
const tokens = useAppDesignTokens();
|
|
34
35
|
const styles = useMemo(() => createStyles(tokens), [tokens]);
|
|
35
36
|
|
|
@@ -54,14 +55,9 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
54
55
|
}, [config]);
|
|
55
56
|
|
|
56
57
|
const handlePress = useCallback(async () => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
if (config?.route && onNavigate) {
|
|
62
|
-
onNavigate(config.route);
|
|
63
|
-
}
|
|
64
|
-
}, [config?.route, onNavigate]);
|
|
58
|
+
const route = config?.route || 'Notifications';
|
|
59
|
+
navigation.navigate(route as never);
|
|
60
|
+
}, [config?.route, navigation]);
|
|
65
61
|
|
|
66
62
|
const title = config?.title || 'Notifications';
|
|
67
63
|
const description = config?.description || 'Manage notification preferences';
|
|
@@ -78,7 +74,7 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
78
74
|
activeOpacity={0.7}
|
|
79
75
|
>
|
|
80
76
|
<View style={styles.iconContainer}>
|
|
81
|
-
<AtomicIcon name="
|
|
77
|
+
<AtomicIcon name="notifications" size="md" color="primary" />
|
|
82
78
|
</View>
|
|
83
79
|
<View style={styles.textContainer}>
|
|
84
80
|
<AtomicText type="bodyLarge">{title}</AtomicText>
|
|
@@ -93,7 +89,7 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
93
89
|
thumbColor={tokens.colors.surface}
|
|
94
90
|
/>
|
|
95
91
|
) : (
|
|
96
|
-
<AtomicIcon name="chevron-
|
|
92
|
+
<AtomicIcon name="chevron-forward" size="md" color="textSecondary" />
|
|
97
93
|
)}
|
|
98
94
|
</TouchableOpacity>
|
|
99
95
|
</View>
|
|
@@ -54,7 +54,7 @@ export const QuietHoursCard: React.FC<QuietHoursCardProps> = ({
|
|
|
54
54
|
</TouchableOpacity>
|
|
55
55
|
|
|
56
56
|
<View style={styles.timeSeparator}>
|
|
57
|
-
<AtomicIcon name="arrow-
|
|
57
|
+
<AtomicIcon name="arrow-forward" size="sm" color="textSecondary" />
|
|
58
58
|
</View>
|
|
59
59
|
|
|
60
60
|
<TouchableOpacity style={styles.timeButton} onPress={onEndTimePress} activeOpacity={0.7}>
|
|
@@ -32,10 +32,10 @@ const getFrequencyIcon = (frequency: ReminderFrequency): string => {
|
|
|
32
32
|
const icons: Record<ReminderFrequency, string> = {
|
|
33
33
|
once: 'calendar',
|
|
34
34
|
daily: 'repeat',
|
|
35
|
-
weekly: 'calendar
|
|
36
|
-
monthly: 'calendar
|
|
35
|
+
weekly: 'calendar',
|
|
36
|
+
monthly: 'calendar',
|
|
37
37
|
};
|
|
38
|
-
return icons[frequency] || '
|
|
38
|
+
return icons[frequency] || 'notifications';
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export const ReminderItem: React.FC<ReminderItemProps> = ({
|
|
@@ -85,7 +85,7 @@ export const ReminderItem: React.FC<ReminderItemProps> = ({
|
|
|
85
85
|
|
|
86
86
|
<View style={styles.actions}>
|
|
87
87
|
<TouchableOpacity style={styles.deleteButton} onPress={() => onDelete(reminder.id)}>
|
|
88
|
-
<AtomicIcon name="trash
|
|
88
|
+
<AtomicIcon name="trash" size="sm" color="error" />
|
|
89
89
|
</TouchableOpacity>
|
|
90
90
|
<AtomicSwitch value={reminder.enabled} onValueChange={() => onToggle(reminder.id)} />
|
|
91
91
|
</View>
|
|
@@ -68,7 +68,7 @@ export const TimePresetSelector: React.FC<TimePresetSelectorProps> = ({
|
|
|
68
68
|
onPress={onSelectCustom}
|
|
69
69
|
activeOpacity={0.7}
|
|
70
70
|
>
|
|
71
|
-
<AtomicIcon name="
|
|
71
|
+
<AtomicIcon name="time" size="md" color={isCustomSelected ? 'surface' : 'textSecondary'} />
|
|
72
72
|
<AtomicText type="bodySmall" style={isCustomSelected ? styles.selectedText : styles.text}>
|
|
73
73
|
{customLabel}
|
|
74
74
|
</AtomicText>
|
|
@@ -77,7 +77,7 @@ export const NotificationSettingsScreen: React.FC<NotificationSettingsScreenProp
|
|
|
77
77
|
<ScrollView style={styles.scrollView} showsVerticalScrollIndicator={false}>
|
|
78
78
|
<AtomicCard style={styles.card}>
|
|
79
79
|
<SettingRow
|
|
80
|
-
iconName="
|
|
80
|
+
iconName="notifications"
|
|
81
81
|
title={translations.masterToggleTitle}
|
|
82
82
|
description={translations.masterToggleDescription}
|
|
83
83
|
value={preferences.enabled}
|
|
@@ -90,7 +90,7 @@ export const NotificationSettingsScreen: React.FC<NotificationSettingsScreenProp
|
|
|
90
90
|
<>
|
|
91
91
|
<AtomicCard style={styles.card}>
|
|
92
92
|
<SettingRow
|
|
93
|
-
iconName="volume-
|
|
93
|
+
iconName="volume-high"
|
|
94
94
|
title={translations.soundTitle}
|
|
95
95
|
description={translations.soundDescription}
|
|
96
96
|
value={preferences.sound}
|
|
@@ -99,7 +99,7 @@ export const NotificationSettingsScreen: React.FC<NotificationSettingsScreenProp
|
|
|
99
99
|
/>
|
|
100
100
|
<View style={styles.divider} />
|
|
101
101
|
<SettingRow
|
|
102
|
-
iconName="
|
|
102
|
+
iconName="phone-portrait"
|
|
103
103
|
title={translations.vibrationTitle}
|
|
104
104
|
description={translations.vibrationDescription}
|
|
105
105
|
value={preferences.vibration}
|
|
@@ -111,7 +111,7 @@ export const NotificationSettingsScreen: React.FC<NotificationSettingsScreenProp
|
|
|
111
111
|
<AtomicCard style={styles.card}>
|
|
112
112
|
<TouchableOpacity style={styles.navRow} onPress={onRemindersPress} activeOpacity={0.7}>
|
|
113
113
|
<View style={styles.iconContainer}>
|
|
114
|
-
<AtomicIcon name="
|
|
114
|
+
<AtomicIcon name="time" size="md" color="primary" />
|
|
115
115
|
</View>
|
|
116
116
|
<View style={styles.textContainer}>
|
|
117
117
|
<AtomicText type="bodyLarge">{translations.remindersTitle}</AtomicText>
|
|
@@ -122,7 +122,7 @@ export const NotificationSettingsScreen: React.FC<NotificationSettingsScreenProp
|
|
|
122
122
|
<AtomicText type="bodySmall" style={styles.badgeText}>{reminders.length}</AtomicText>
|
|
123
123
|
</View>
|
|
124
124
|
)}
|
|
125
|
-
<AtomicIcon name="chevron-
|
|
125
|
+
<AtomicIcon name="chevron-forward" size="md" color="textSecondary" />
|
|
126
126
|
</TouchableOpacity>
|
|
127
127
|
</AtomicCard>
|
|
128
128
|
|
|
@@ -25,7 +25,7 @@ export interface NotificationsScreenProps {
|
|
|
25
25
|
|
|
26
26
|
export const NotificationsScreen: React.FC<NotificationsScreenProps> = ({
|
|
27
27
|
translations,
|
|
28
|
-
iconName = '
|
|
28
|
+
iconName = 'notifications',
|
|
29
29
|
iconColor = 'primary',
|
|
30
30
|
testID = 'notifications-screen',
|
|
31
31
|
}) => {
|
|
@@ -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="
|
|
68
|
+
<AtomicIcon name="notifications-off" size="xl" color="textSecondary" />
|
|
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="
|
|
100
|
+
<AtomicIcon name="add" size="md" color="surface" />
|
|
101
101
|
<AtomicText type="bodyMedium" style={styles.fabText}>{translations.addButtonLabel}</AtomicText>
|
|
102
102
|
</TouchableOpacity>
|
|
103
103
|
)}
|