Skip to content

Commit e42bef1

Browse files
author
neurodynamic
committed
adds app mode detection to prevent development start state from accidentally propagating to production start state
1 parent 5ebb34e commit e42bef1

File tree

9 files changed

+11551
-11424
lines changed

9 files changed

+11551
-11424
lines changed

elm/Main.elm

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ import Main.Update
1010
import Main.View
1111
import Stages.Debugging.Model exposing (HelpTab(..), Page(..))
1212
import Utils.Constants as Constants
13-
import Utils.DummyData as DummyData
13+
import Utils.Types.AppMode exposing (AppMode(..))
1414
import Utils.Types.BreakType exposing (BreakType(..))
1515
import Utils.Types.Error as Error
16-
16+
import Utils.DevModeStartState as DevModeStartState
1717

1818
init : Value -> ( Model, Cmd Msg )
1919
init flags =
2020
let
21-
{ numbers, startingError, logoPath } =
21+
{ numbers, startingError, logoPath, appMode } =
2222
case Main.Interop.decodeFlags flags of
23-
Ok { randomNumbers, logo } ->
23+
Ok { randomNumbers, logo, mode } ->
2424
{ numbers = randomNumbers
2525
, logoPath = logo
2626
, startingError = Nothing
27+
, appMode = mode
2728
}
2829

2930
Err error ->
@@ -38,29 +39,26 @@ init flags =
3839
, inModule = "Main"
3940
}
4041
)
42+
, appMode = Production
4143
}
4244
in
4345
( { requestedBugCount = 1
4446
, logo = logoPath
4547
, randomNumbers = numbers
46-
-- , stage = Intro
48+
, stage =
49+
case appMode of
50+
Production ->
51+
Intro
4752

48-
-- , stage = DummyData.chooseFileStage
49-
, stage = DummyData.gotFileStage
50-
-- , stage = DummyData.debuggingStageStepsPage numbers
51-
-- , stage = DummyData.debuggingStageIDontSeeAnyErrorsPage numbers
52-
-- , stage = DummyData.debuggingStageBugHintsTab numbers
53-
-- , stage = DummyData.debuggingStageTipsTab numbers
54-
-- , stage = DummyData.debuggingStageEncouragementTab numbers
55-
-- , stage = DummyData.debuggingStageShowAnswerTab numbers
56-
-- , stage = DummyData.successfulFinishStage numbers
57-
-- , stage = DummyData.shownAnswerFinishedStage numbers
53+
Development ->
54+
DevModeStartState.get numbers
5855
, maybeError = startingError
5956
}
6057
, Cmd.none
6158
)
6259

6360

61+
6462
main : Program Value Model Msg
6563
main =
6664
Browser.document

0 commit comments

Comments
 (0)