@umituz/react-native-settings 5.3.59 → 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",
|
|
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,
|
|
@@ -117,6 +117,10 @@
|
|
|
117
117
|
"type": "git",
|
|
118
118
|
"url": "https://github.com/umituz/react-native-settings"
|
|
119
119
|
},
|
|
120
|
+
"optionalDependencies": {
|
|
121
|
+
"expo-store-review": "~6.0.0",
|
|
122
|
+
"expo-device": "~8.0.0"
|
|
123
|
+
},
|
|
120
124
|
"peerDependencies": {
|
|
121
125
|
"@expo/vector-icons": ">=14.0.0",
|
|
122
126
|
"@react-navigation/native": ">=6.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
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* useAppRating Hook
|
|
3
3
|
* React hook for app rating system
|
|
4
|
+
* Lazy loads expo-store-review to reduce bundle size
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import React, { useState, useCallback, useMemo } from "react";
|
|
7
|
-
import * as StoreReview from "expo-store-review";
|
|
8
8
|
import type {
|
|
9
9
|
RatingConfig,
|
|
10
10
|
UseAppRatingResult,
|
|
@@ -67,6 +67,8 @@ export function useAppRating(config: RatingConfig): UseAppRatingResult {
|
|
|
67
67
|
await RatingService.markRated();
|
|
68
68
|
|
|
69
69
|
try {
|
|
70
|
+
// Lazy load expo-store-review
|
|
71
|
+
const StoreReview = await import('expo-store-review');
|
|
70
72
|
const isAvailable = await StoreReview.isAvailableAsync();
|
|
71
73
|
|
|
72
74
|
if (isAvailable) {
|