Make the 'try again' button a link

This commit is contained in:
Danila Fedorin 2021-08-27 10:02:23 -07:00
parent ff2d315502
commit 64129caaff
2 changed files with 13 additions and 5 deletions

View file

@ -44,6 +44,12 @@ export class AutoOpenViewModel extends ViewModel {
return this.openingDefault; return this.openingDefault;
} }
get deepLink() {
return this._client ?
this._client.getDeepLink(this._proposedPlatform, this._link) :
this._link.toMatrixUrl()
}
get webDeepLink() { get webDeepLink() {
return this._client && this._webPlatform && this._client.getDeepLink(this._webPlatform, this._link); return this._client && this._webPlatform && this._client.getDeepLink(this._webPlatform, this._link);
} }
@ -52,10 +58,7 @@ export class AutoOpenViewModel extends ViewModel {
this._openLinkVM.closeAutoOpen(); this._openLinkVM.closeAutoOpen();
} }
tryOpenLink() { startSpinner() {
this.openLink(this._client ?
this._client.getDeepLink(this._proposedPlatform, this._link) :
this._link.toMatrixUrl());
this.trying = true; this.trying = true;
this.setTimeout(() => { this.setTimeout(() => {
if (this.autoRedirect) { if (this.autoRedirect) {
@ -69,4 +72,9 @@ export class AutoOpenViewModel extends ViewModel {
}, 1000); }, 1000);
this.emitChange(); this.emitChange();
} }
tryOpenLink() {
this.openLink(this.deepLink);
this.startSpinner();
}
} }

View file

@ -50,7 +50,7 @@ class TryingLinkView extends TemplateView {
[]; [];
const timeoutOptions = t.span({ className: "timeoutOptions" }, [ const timeoutOptions = t.span({ className: "timeoutOptions" }, [
t.strong("Not working? "), t.strong("Not working? "),
t.button({ className: "text", onClick: () => vm.tryOpenLink() }, "Try again"), t.a({ href: vm.deepLink, onClick: () => vm.startSpinner() }, "Try again"),
" or ", " or ",
t.button({ className: "text", onClick: () => vm.close() }, "select another app") t.button({ className: "text", onClick: () => vm.close() }, "select another app")
]); ]);