Track hidden status in OpenLinkViewModel

This commit is contained in:
Danila Fedorin 2021-08-24 12:24:45 -07:00
parent b17ce2ee13
commit b239f49580

View file

@ -32,6 +32,8 @@ export class OpenLinkViewModel extends ViewModel {
this.previewViewModel = null; this.previewViewModel = null;
this.clientsViewModel = null; this.clientsViewModel = null;
this.previewLoading = false; this.previewLoading = false;
this.tryingLink = false;
this._tryLink();
if (this.preferences.homeservers === null) { if (this.preferences.homeservers === null) {
this._showServerConsent(); this._showServerConsent();
} else { } else {
@ -39,6 +41,18 @@ export class OpenLinkViewModel extends ViewModel {
} }
} }
_tryLink() {
const matrixUrl = this._link.toMatrixUrl()
if (matrixUrl) {
this.tryingLink = true;
setTimeout(() => {
this.tryingLink = false;
this.emitChange();
}, 5000);
this.openLink(matrixUrl);
}
}
_showServerConsent() { _showServerConsent() {
let servers = []; let servers = [];
if (this.preferences.homeservers) { if (this.preferences.homeservers) {