@towsila/expo-ui-library 1.3.0 → 1.4.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": "@towsila/expo-ui-library",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"expo-location": "*",
|
|
19
19
|
"expo-secure-store": "*",
|
|
20
20
|
"expo-splash-screen": "*",
|
|
21
|
+
"expo-notifications": "*",
|
|
22
|
+
"expo-device": "*",
|
|
21
23
|
"react": "*",
|
|
22
24
|
"react-native": "*",
|
|
23
25
|
"react-native-keyboard-aware-scroll-view": "*",
|
|
@@ -49,7 +51,9 @@
|
|
|
49
51
|
"dependencies": {
|
|
50
52
|
"@expo/vector-icons": "^15.1.1",
|
|
51
53
|
"@towsila/icons": "^1.0.3",
|
|
54
|
+
"expo-device": "^57.0.1",
|
|
52
55
|
"expo-linear-gradient": "*",
|
|
56
|
+
"expo-notifications": "^57.0.7",
|
|
53
57
|
"expo-secure-store": "*",
|
|
54
58
|
"react-native-svg": "*"
|
|
55
59
|
}
|
|
@@ -38,9 +38,9 @@ export const LocationPermissionProvider = ({
|
|
|
38
38
|
|
|
39
39
|
subscriptionRef.current = await Location.watchPositionAsync(
|
|
40
40
|
{
|
|
41
|
-
accuracy: Location.Accuracy.
|
|
42
|
-
timeInterval:
|
|
43
|
-
distanceInterval:
|
|
41
|
+
accuracy: Location.Accuracy.BestForNavigation,
|
|
42
|
+
timeInterval: 2000,
|
|
43
|
+
distanceInterval: 2,
|
|
44
44
|
},
|
|
45
45
|
(location) => {
|
|
46
46
|
setCoords({
|
|
@@ -67,7 +67,7 @@ export const LocationPermissionProvider = ({
|
|
|
67
67
|
if (isGranted) {
|
|
68
68
|
try {
|
|
69
69
|
const initial = await Location.getCurrentPositionAsync({
|
|
70
|
-
accuracy: Location.Accuracy.
|
|
70
|
+
accuracy: Location.Accuracy.BestForNavigation,
|
|
71
71
|
});
|
|
72
72
|
setCoords({
|
|
73
73
|
latitude: initial.coords.latitude,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/hooks/useFcmToken.ts (or hooks/getFcmToken.ts — match your library's existing folder convention)
|
|
2
|
+
import * as Notifications from "expo-notifications";
|
|
3
|
+
import * as Device from "expo-device";
|
|
4
|
+
|
|
5
|
+
export async function getFcmToken(): Promise<string | null> {
|
|
6
|
+
if (!Device.isDevice) {
|
|
7
|
+
console.log("Push notifications require a physical device");
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { status: existingStatus } = await Notifications.getPermissionsAsync();
|
|
12
|
+
let finalStatus = existingStatus;
|
|
13
|
+
|
|
14
|
+
if (existingStatus !== "granted") {
|
|
15
|
+
const { status } = await Notifications.requestPermissionsAsync();
|
|
16
|
+
finalStatus = status;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (finalStatus !== "granted") {
|
|
20
|
+
console.log("Push notification permission denied");
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const tokenResponse = await Notifications.getDevicePushTokenAsync();
|
|
25
|
+
return tokenResponse.data;
|
|
26
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -61,4 +61,5 @@ export {default as Toast} from "./components/ui/toast";
|
|
|
61
61
|
export {default as AccountStatusScreen} from "./components/screens/AccountStatusScreen";
|
|
62
62
|
export {sendEmail} from "./service/sendEmail";
|
|
63
63
|
export {useToast} from "./hooks/useToast";
|
|
64
|
-
export {default as RatingStars} from "./components/ui/rating";
|
|
64
|
+
export {default as RatingStars} from "./components/ui/rating";
|
|
65
|
+
export { getFcmToken } from "./hooks/useFcmToken";
|