fix(ios-reported-bug): app only displayed the splash screen after enabling access to location
This commit is contained in:
parent
2ba8a37ed0
commit
2e35c41e0f
3 changed files with 19 additions and 3 deletions
|
@ -2,7 +2,11 @@ import { useEffect, useRef, useState } from "react";
|
||||||
import { createLogger } from "~/lib/logger";
|
import { createLogger } from "~/lib/logger";
|
||||||
import { BACKGROUND_SCOPES } from "~/lib/logger/scopes";
|
import { BACKGROUND_SCOPES } from "~/lib/logger/scopes";
|
||||||
|
|
||||||
import { usePermissionWizardState, usePermissionsState } from "~/stores";
|
import {
|
||||||
|
usePermissionWizardState,
|
||||||
|
usePermissionsState,
|
||||||
|
useTreeState,
|
||||||
|
} from "~/stores";
|
||||||
|
|
||||||
import trackLocation from "~/location/trackLocation";
|
import trackLocation from "~/location/trackLocation";
|
||||||
|
|
||||||
|
@ -12,6 +16,8 @@ const locationLogger = createLogger({
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function useTrackLocation() {
|
export default function useTrackLocation() {
|
||||||
|
const { splashScreenHidden } = useTreeState(["splashScreenHidden"]);
|
||||||
|
|
||||||
const { currentStep, completed } = usePermissionWizardState([
|
const { currentStep, completed } = usePermissionWizardState([
|
||||||
"completed",
|
"completed",
|
||||||
"currentStep",
|
"currentStep",
|
||||||
|
@ -34,7 +40,8 @@ export default function useTrackLocation() {
|
||||||
if (
|
if (
|
||||||
locationBackground &&
|
locationBackground &&
|
||||||
motion &&
|
motion &&
|
||||||
(currentStep === "tracking" || currentStep === "success" || completed)
|
(currentStep === "tracking" || currentStep === "success" || completed) &&
|
||||||
|
splashScreenHidden
|
||||||
) {
|
) {
|
||||||
locationLogger.info("Enabling location tracking", {
|
locationLogger.info("Enabling location tracking", {
|
||||||
step: currentStep,
|
step: currentStep,
|
||||||
|
@ -48,7 +55,7 @@ export default function useTrackLocation() {
|
||||||
step: currentStep,
|
step: currentStep,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [locationBackground, motion, currentStep, completed]);
|
}, [locationBackground, motion, currentStep, completed, splashScreenHidden]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (trackLocationEnabled) {
|
if (trackLocationEnabled) {
|
||||||
|
|
|
@ -9,6 +9,8 @@ import LayoutProviders from "~/layout/LayoutProviders";
|
||||||
import loadRessources from "~/layout/loadRessources";
|
import loadRessources from "~/layout/loadRessources";
|
||||||
import useMount from "~/hooks/useMount";
|
import useMount from "~/hooks/useMount";
|
||||||
|
|
||||||
|
import { treeActions } from "~/stores";
|
||||||
|
|
||||||
SplashScreen.preventAutoHideAsync();
|
SplashScreen.preventAutoHideAsync();
|
||||||
|
|
||||||
export default function AppView() {
|
export default function AppView() {
|
||||||
|
@ -30,6 +32,7 @@ export default function AppView() {
|
||||||
const onLayoutRootView = useCallback(async () => {
|
const onLayoutRootView = useCallback(async () => {
|
||||||
if (appIsReady) {
|
if (appIsReady) {
|
||||||
await SplashScreen.hideAsync();
|
await SplashScreen.hideAsync();
|
||||||
|
treeActions.splashScreenHidden();
|
||||||
}
|
}
|
||||||
}, [appIsReady]);
|
}, [appIsReady]);
|
||||||
|
|
||||||
|
|
|
@ -49,15 +49,21 @@ export default createAtom(({ merge, getActions }) => {
|
||||||
merge({ suspend: true });
|
merge({ suspend: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const splashScreenHidden = () => {
|
||||||
|
merge({ splashScreenHidden: true });
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
default: {
|
default: {
|
||||||
triggerReload: false,
|
triggerReload: false,
|
||||||
suspend: false,
|
suspend: false,
|
||||||
|
splashScreenHidden: false,
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
triggerReload,
|
triggerReload,
|
||||||
suspendTree,
|
suspendTree,
|
||||||
onReload,
|
onReload,
|
||||||
|
splashScreenHidden,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue