@umituz/react-native-settings 5.3.60 → 5.3.61
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "5.3.
|
|
4
|
-
"description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification - expo-store-review now lazy loaded",
|
|
3
|
+
"version": "5.3.61",
|
|
4
|
+
"description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification - expo-store-review and expo-device now lazy loaded",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -118,7 +118,8 @@
|
|
|
118
118
|
"url": "https://github.com/umituz/react-native-settings"
|
|
119
119
|
},
|
|
120
120
|
"optionalDependencies": {
|
|
121
|
-
"expo-store-review": "~6.0.0"
|
|
121
|
+
"expo-store-review": "~6.0.0",
|
|
122
|
+
"expo-device": "~8.0.0"
|
|
122
123
|
},
|
|
123
124
|
"peerDependencies": {
|
|
124
125
|
"@expo/vector-icons": ">=14.0.0",
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as Notifications from 'expo-notifications';
|
|
2
|
-
import * as Device from 'expo-device';
|
|
3
2
|
import { Platform } from 'react-native';
|
|
4
3
|
import { devWarn, devError, devLog } from '../../../../utils/devUtils';
|
|
5
4
|
|
|
6
5
|
export class NotificationPermissions {
|
|
7
6
|
async requestPermissions(): Promise<boolean> {
|
|
8
7
|
try {
|
|
9
|
-
|
|
8
|
+
// Lazy load expo-device
|
|
9
|
+
const Device = await import('expo-device');
|
|
10
|
+
|
|
11
|
+
if (!Device.default.isDevice) {
|
|
10
12
|
devWarn('[NotificationPermissions] Notifications only work on physical devices');
|
|
11
13
|
return false;
|
|
12
14
|
}
|
|
@@ -33,7 +35,10 @@ export class NotificationPermissions {
|
|
|
33
35
|
|
|
34
36
|
async hasPermissions(): Promise<boolean> {
|
|
35
37
|
try {
|
|
36
|
-
|
|
38
|
+
// Lazy load expo-device
|
|
39
|
+
const Device = await import('expo-device');
|
|
40
|
+
|
|
41
|
+
if (!Device.default.isDevice) return false;
|
|
37
42
|
const permissionsResponse = await Notifications.getPermissionsAsync();
|
|
38
43
|
return permissionsResponse.status === 'granted' || permissionsResponse.granted === true;
|
|
39
44
|
} catch (error) {
|
|
@@ -48,33 +53,12 @@ export class NotificationPermissions {
|
|
|
48
53
|
try {
|
|
49
54
|
await Notifications.setNotificationChannelAsync('default', {
|
|
50
55
|
name: 'Default',
|
|
51
|
-
importance: Notifications.AndroidImportance.DEFAULT,
|
|
52
|
-
vibrationPattern: [0, 250, 250, 250],
|
|
53
|
-
sound: 'default',
|
|
54
|
-
lightColor: '#3B82F6',
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
await Notifications.setNotificationChannelAsync('reminders', {
|
|
58
|
-
name: 'Reminders',
|
|
59
|
-
importance: Notifications.AndroidImportance.HIGH,
|
|
60
|
-
vibrationPattern: [0, 250, 250, 250],
|
|
61
|
-
sound: 'default',
|
|
62
|
-
lightColor: '#3B82F6',
|
|
63
|
-
enableVibrate: true,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
await Notifications.setNotificationChannelAsync('urgent', {
|
|
67
|
-
name: 'Urgent',
|
|
68
56
|
importance: Notifications.AndroidImportance.MAX,
|
|
69
|
-
vibrationPattern: [0,
|
|
70
|
-
|
|
71
|
-
lightColor: '#EF4444',
|
|
72
|
-
enableVibrate: true,
|
|
57
|
+
vibrationPattern: [0, 250, 250, 250],
|
|
58
|
+
lightColor: '#FF231F7C',
|
|
73
59
|
});
|
|
74
|
-
|
|
75
|
-
devLog('[NotificationPermissions] Android channels created');
|
|
76
60
|
} catch (error) {
|
|
77
61
|
devError('[NotificationPermissions] Android channel creation failed:', error);
|
|
78
62
|
}
|
|
79
63
|
}
|
|
80
|
-
}
|
|
64
|
+
}
|