diff --git a/src/viewmodels/AccountSetupViewModel.ts b/src/viewmodels/AccountSetupViewModel.ts index 91c0c7b46c78d31e03a928f6965e6ea7a56cd389..5791a7ddac89d3da12d463043a0d2f8cd1ff695f 100644 --- a/src/viewmodels/AccountSetupViewModel.ts +++ b/src/viewmodels/AccountSetupViewModel.ts @@ -57,6 +57,10 @@ export class AccountSetupViewModel extends ViewModel { this._state.set("timeline"); } + dismiss() { + this._state.set("start"); + } + private get _homeserver(): string { return this._config.homeserver; } diff --git a/src/viewmodels/RootViewModel.ts b/src/viewmodels/RootViewModel.ts index ef4e18424cc3fced885b0ed250f222e02390e867..3a54abc1fb48d7f0745f96b142006581db0b9e51 100644 --- a/src/viewmodels/RootViewModel.ts +++ b/src/viewmodels/RootViewModel.ts @@ -18,16 +18,16 @@ export class RootViewModel extends ViewModel { super(options); this._config = config; this._client = new Client(this.platform); + this._state.subscribe(stage => this._applyNavigation(stage)); } async start() { - this._state.subscribe(stage => this._applyNavigation(stage)); const sessionAlreadyExists = await this.attemptStartWithExistingSession(); if (sessionAlreadyExists) { - this._showTimeline(); + this._state.set("timeline"); return; } - this._showAccountSetup(); + this._state.set("account-setup"); } private _applyNavigation(stage: string) { @@ -35,6 +35,12 @@ export class RootViewModel extends ViewModel { case "timeline": this._showTimeline(); break; + case "start": + this._showStartButton(); + break; + case "account-setup": + this._showAccountSetup(); + break; } } @@ -57,6 +63,11 @@ export class RootViewModel extends ViewModel { this.emitChange("activeSection"); } + private _showStartButton() { + this._activeSection = "start"; + this.emitChange("activeSection"); + } + /** * Try to start Hydrogen based on an existing hydrogen session. * If multiple sessions exist, this method chooses the most recent one.