diff --git a/ui/src/app/models/app-types.ts b/ui/src/app/models/app-types.ts index c0162347d..d7479d08b 100644 --- a/ui/src/app/models/app-types.ts +++ b/ui/src/app/models/app-types.ts @@ -46,6 +46,7 @@ export interface AppInstalledFull extends AppInstalledPreview { lastBackup: string | null configuredRequirements: AppDependency[] | null // null if not yet configured hasFetchedFull: boolean + startAlert?: string uninstallAlert?: string restoreAlert?: string actions: Actions diff --git a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.html b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.html index 8a5220bb9..40d1b903a 100644 --- a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.html +++ b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.html @@ -74,7 +74,7 @@ Fix - + Start diff --git a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.ts b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.ts index 00743087c..bbf155dbe 100644 --- a/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.ts +++ b/ui/src/app/pages/apps-routes/app-installed-show/app-installed-show.page.ts @@ -286,15 +286,13 @@ export class AppInstalledShowPage extends Cleanup { }).catch(e => this.setError(e)) } - async start (): Promise { + async tryStart (): Promise { const app = peekProperties(this.app) - this.loader.of({ - message: `Starting ${app.title}...`, - spinner: 'lines', - cssClass: 'loader', - }).displayDuringP( - this.apiService.startApp(this.appId), - ).catch(e => this.setError(e)) + if (app.startAlert) { + this.presentAlertStart(app) + } else { + this.start(app) + } } async presentModalBackup (type: 'create' | 'restore') { @@ -387,6 +385,36 @@ export class AppInstalledShowPage extends Cleanup { return await popover.present() } + private async presentAlertStart (app: AppInstalledFull): Promise { + const alert = await this.alertCtrl.create({ + header: 'Warning', + message: app.startAlert, + buttons: [ + { + text: 'Cancel', + role: 'cancel', + }, + { + text: 'Start', + handler: () => { + this.start(app) + }, + }, + ], + }) + await alert.present() + } + + private async start (app: AppInstalledFull): Promise { + this.loader.of({ + message: `Starting ${app.title}...`, + spinner: 'lines', + cssClass: 'loader', + }).displayDuringP( + this.apiService.startApp(this.appId), + ).catch(e => this.setError(e)) + } + private setError (e: Error): Observable { this.$error$.next(e.message) return of() diff --git a/ui/src/app/services/api/mock-app-fixures.ts b/ui/src/app/services/api/mock-app-fixures.ts index 43c197112..0548044f9 100644 --- a/ui/src/app/services/api/mock-app-fixures.ts +++ b/ui/src/app/services/api/mock-app-fixures.ts @@ -53,6 +53,7 @@ export const bitcoinI: AppInstalledFull = { lanEnabled: true, title: 'Bitcoin Core', torAddress: '4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion', + startAlert: 'Bitcoind could take a loooooong time to start. Please be patient.', status: AppStatus.STOPPED, iconURL: 'assets/img/service-icons/bitcoind.png', instructions: 'some instructions',