Skip to content

Commit

Permalink
Enhance onboarding flow and fix iOS back button issue
Browse files Browse the repository at this point in the history
  • Loading branch information
codergautam committed Dec 29, 2024
1 parent 2d80e51 commit 2d4db55
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 5 additions & 3 deletions components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,11 @@ setShowCountryButtons(false)
window.crazyMidgame = crazyMidgame;

}, []);


function backBtnPressed(queueNextGame = false, nextGameType) {
setStreetViewShown(false)
setOnboardingCompleted(true)

if (loading) setLoading(false);
if(multiplayerError) setMultiplayerError(false)
Expand All @@ -1618,13 +1622,11 @@ setShowCountryButtons(false)
if(screen === "onboarding") {
setScreen("home")
setOnboarding(null)
setOnboardingCompleted(true)
gameStorage.setItem("onboarding", 'done')

return;
}

setStreetViewShown(false)

if (multiplayerState?.inGame) {
if(!multiplayerState?.gameData?.host || multiplayerState?.gameData?.state === "waiting") {
Expand Down Expand Up @@ -2050,8 +2052,8 @@ setShowCountryButtons(false)
</button>
)}

<div className={`home__content ${screen !== "home" ? "hidden" : "cshown"} `}>

<div className={`home__content ${screen !== "home" ? "hidden" : ""} `}>


{ onboardingCompleted===null ? (
Expand Down
10 changes: 10 additions & 0 deletions styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ html {
animation: hide 0.5s ease-in-out forwards;
pointer-events: none;
}
// we have to do this for ios otherwise back btn makes a blank home page, not sure why
// not even all ios devices some randomly
.cshown {
left: 50%;
opacity: 1;
animation: fadeIn 0.5s ease-in-out forwards;
pointer-events: all;
display: flex !important;

}

.home__btns {
display: flex;
Expand Down

0 comments on commit 2d4db55

Please sign in to comment.