Skip to content

Commit

Permalink
Merge pull request #259 from Crossbell-Box/develop
Browse files Browse the repository at this point in the history
Fix location permission message in app.config.ts and comment out unus…
  • Loading branch information
dohooo authored Nov 22, 2023
2 parents d0b03d3 + 57841bc commit 68a156e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-trainers-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"xlog": minor
---

Fix location permission message in app.config.ts and comment out unused code in preload-provider.tsx.
2 changes: 1 addition & 1 deletion app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
33 changes: 17 additions & 16 deletions src/providers/preload-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,30 @@ const defaultCountryInfo = i18n.language.startsWith("zh")
: countries.us;

export const PreloadProvider: FC<PropsWithChildren<{}>> = ({ 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"),
InterBold: require("@tamagui/font-inter/otf/Inter-Bold.otf"),
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;
Expand Down

0 comments on commit 68a156e

Please sign in to comment.