From 64129caaff6c3ea99369711559fbeb9bf6794bec Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 27 Aug 2021 10:02:23 -0700 Subject: [PATCH] Make the 'try again' button a link --- src/open/AutoOpenViewModel.js | 16 ++++++++++++---- src/open/OpenLinkView.js | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/open/AutoOpenViewModel.js b/src/open/AutoOpenViewModel.js index 8598ef5..b96a1c2 100644 --- a/src/open/AutoOpenViewModel.js +++ b/src/open/AutoOpenViewModel.js @@ -44,6 +44,12 @@ export class AutoOpenViewModel extends ViewModel { return this.openingDefault; } + get deepLink() { + return this._client ? + this._client.getDeepLink(this._proposedPlatform, this._link) : + this._link.toMatrixUrl() + } + get webDeepLink() { return this._client && this._webPlatform && this._client.getDeepLink(this._webPlatform, this._link); } @@ -52,10 +58,7 @@ export class AutoOpenViewModel extends ViewModel { this._openLinkVM.closeAutoOpen(); } - tryOpenLink() { - this.openLink(this._client ? - this._client.getDeepLink(this._proposedPlatform, this._link) : - this._link.toMatrixUrl()); + startSpinner() { this.trying = true; this.setTimeout(() => { if (this.autoRedirect) { @@ -69,4 +72,9 @@ export class AutoOpenViewModel extends ViewModel { }, 1000); this.emitChange(); } + + tryOpenLink() { + this.openLink(this.deepLink); + this.startSpinner(); + } } diff --git a/src/open/OpenLinkView.js b/src/open/OpenLinkView.js index 40259fe..8937645 100644 --- a/src/open/OpenLinkView.js +++ b/src/open/OpenLinkView.js @@ -50,7 +50,7 @@ class TryingLinkView extends TemplateView { []; const timeoutOptions = t.span({ className: "timeoutOptions" }, [ t.strong("Not working? "), - t.button({ className: "text", onClick: () => vm.tryOpenLink() }, "Try again"), + t.a({ href: vm.deepLink, onClick: () => vm.startSpinner() }, "Try again"), " or ", t.button({ className: "text", onClick: () => vm.close() }, "select another app") ]);