From 57841bcb0188f079fd04acd5a649923249625543 Mon Sep 17 00:00:00 2001 From: Caspian Date: Wed, 22 Nov 2023 20:02:05 +0000 Subject: [PATCH] Fix location permission message in app.config.ts and comment out unused code in preload-provider.tsx. --- .changeset/light-trainers-matter.md | 5 +++++ app.config.ts | 2 +- src/providers/preload-provider.tsx | 33 +++++++++++++++-------------- 3 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 .changeset/light-trainers-matter.md diff --git a/.changeset/light-trainers-matter.md b/.changeset/light-trainers-matter.md new file mode 100644 index 0000000..ddc69bb --- /dev/null +++ b/.changeset/light-trainers-matter.md @@ -0,0 +1,5 @@ +--- +"xlog": minor +--- + +Fix location permission message in app.config.ts and comment out unused code in preload-provider.tsx. diff --git a/app.config.ts b/app.config.ts index 2f85dfe..8461738 100644 --- a/app.config.ts +++ b/app.config.ts @@ -75,7 +75,7 @@ export default (_: ConfigContext): ExpoConfig => { [ "expo-location", { - locationAlwaysAndWhenInUsePermission: "Allow $(PRODUCT_NAME) to use your location so you can see articles around you.", + locationWhenInUsePermission: "Allow $(PRODUCT_NAME) to use your location so you can see articles around you.", }, ], "sentry-expo", diff --git a/src/providers/preload-provider.tsx b/src/providers/preload-provider.tsx index 584c81b..333fd15 100644 --- a/src/providers/preload-provider.tsx +++ b/src/providers/preload-provider.tsx @@ -28,7 +28,7 @@ const defaultCountryInfo = i18n.language.startsWith("zh") : countries.us; export const PreloadProvider: FC> = ({ children }) => { - const [locationPermissionRequested, setLocationPermissionRequested] = useState(false); + // const [locationPermissionRequested, setLocationPermissionRequested] = useState(false); const [fontsLoadingReady] = useFonts({ Inter: require("@tamagui/font-inter/otf/Inter-Regular.otf"), InterLight: require("@tamagui/font-inter/otf/Inter-Light.otf"), @@ -36,21 +36,22 @@ export const PreloadProvider: FC> = ({ children }) => { InterSemiBold: require("@tamagui/font-inter/otf/Inter-SemiBold.otf"), }); - const allReady = fontsLoadingReady || locationPermissionRequested; - - useEffect(() => { - getUserCountryCode() - .then((countryCode) => { - const countryInfo = countries[countryCode] || defaultCountryInfo; - cacheStorage.set(COUNTRY_INFO_KEY, JSON.stringify(countryInfo)); - }) - .catch(() => { - cacheStorage.set(COUNTRY_INFO_KEY, JSON.stringify(defaultCountryInfo)); - }) - .finally(() => { - setLocationPermissionRequested(true); - }); - }, []); + const allReady = fontsLoadingReady; + // const allReady = fontsLoadingReady || locationPermissionRequested; + + // useEffect(() => { + // getUserCountryCode() + // .then((countryCode) => { + // const countryInfo = countries[countryCode] || defaultCountryInfo; + // cacheStorage.set(COUNTRY_INFO_KEY, JSON.stringify(countryInfo)); + // }) + // .catch(() => { + // cacheStorage.set(COUNTRY_INFO_KEY, JSON.stringify(defaultCountryInfo)); + // }) + // .finally(() => { + // setLocationPermissionRequested(true); + // }); + // }, []); if (!allReady) return null;