@umituz/react-native-settings 1.1.0 → 1.2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Settings management for React Native apps - user preferences, theme, language, notifications",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"@umituz/react-native-design-system": "latest",
|
|
34
34
|
"@umituz/react-native-design-system-theme": "latest",
|
|
35
35
|
"@umituz/react-native-localization": "latest",
|
|
36
|
-
"@umituz/react-native-notifications": "latest",
|
|
37
36
|
"react-native-paper": "^5.12.3",
|
|
38
37
|
"expo-linear-gradient": "~14.0.0"
|
|
39
38
|
},
|
|
@@ -18,9 +18,17 @@ import { useTheme } from '@umituz/react-native-design-system-theme';
|
|
|
18
18
|
import { ScreenLayout } from '@umituz/react-native-design-system';
|
|
19
19
|
import { SettingItem } from '../components/SettingItem';
|
|
20
20
|
import { getLanguageByCode, useLocalization } from '@umituz/react-native-localization';
|
|
21
|
-
import { notificationService } from '@umituz/react-native-notifications';
|
|
22
21
|
import { useTranslation } from 'react-i18next';
|
|
23
22
|
|
|
23
|
+
// Optional notification service - only import if package is available
|
|
24
|
+
let notificationService: any = null;
|
|
25
|
+
try {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
27
|
+
notificationService = require('@umituz/react-native-notifications').notificationService;
|
|
28
|
+
} catch {
|
|
29
|
+
// Package not available, notificationService will be null
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
export const SettingsScreen: React.FC = () => {
|
|
25
33
|
const navigation = useNavigation();
|
|
26
34
|
const { theme, themeMode } = useTheme();
|
|
@@ -44,9 +52,11 @@ export const SettingsScreen: React.FC = () => {
|
|
|
44
52
|
};
|
|
45
53
|
|
|
46
54
|
const handleNotificationsPress = async () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
if (notificationService) {
|
|
56
|
+
const hasPermissions = await notificationService.hasPermissions();
|
|
57
|
+
if (!hasPermissions) {
|
|
58
|
+
await notificationService.requestPermissions();
|
|
59
|
+
}
|
|
50
60
|
}
|
|
51
61
|
navigation.navigate('Notifications' as never);
|
|
52
62
|
};
|