Rename OpenDefault to AutoOpen

This commit is contained in:
Danila Fedorin 2021-08-26 15:33:53 -07:00
parent 1179db5ad9
commit ff2d315502
2 changed files with 7 additions and 8 deletions

View file

@ -15,9 +15,8 @@ limitations under the License.
*/ */
import {ViewModel} from "../utils/ViewModel.js"; import {ViewModel} from "../utils/ViewModel.js";
import {getMatchingPlatforms, selectPlatforms} from "./clients/index.js";
export class OpenDefaultViewModel extends ViewModel { export class AutoOpenViewModel extends ViewModel {
constructor(options) { constructor(options) {
super(options); super(options);
const {client, link, openLinkVM, proposedPlatform, webPlatform} = options; const {client, link, openLinkVM, proposedPlatform, webPlatform} = options;
@ -50,7 +49,7 @@ export class OpenDefaultViewModel extends ViewModel {
} }
close() { close() {
this._openLinkVM.closeDefault(); this._openLinkVM.closeAutoOpen();
} }
tryOpenLink() { tryOpenLink() {

View file

@ -18,7 +18,7 @@ import {ViewModel} from "../utils/ViewModel.js";
import {ClientListViewModel} from "./ClientListViewModel.js"; import {ClientListViewModel} from "./ClientListViewModel.js";
import {ClientViewModel} from "./ClientViewModel.js"; import {ClientViewModel} from "./ClientViewModel.js";
import {PreviewViewModel} from "../preview/PreviewViewModel.js"; import {PreviewViewModel} from "../preview/PreviewViewModel.js";
import {OpenDefaultViewModel} from "./OpenDefaultViewModel.js"; import {AutoOpenViewModel} from "./AutoOpenViewModel.js";
import {ServerConsentViewModel} from "./ServerConsentViewModel.js"; import {ServerConsentViewModel} from "./ServerConsentViewModel.js";
import {getLabelForLinkKind} from "../Link.js"; import {getLabelForLinkKind} from "../Link.js";
import {orderedUnique} from "../utils/unique.js"; import {orderedUnique} from "../utils/unique.js";
@ -36,12 +36,12 @@ export class OpenLinkViewModel extends ViewModel {
this.clientsViewModel = null; this.clientsViewModel = null;
this.previewLoading = false; this.previewLoading = false;
this.tryingLink = false; this.tryingLink = false;
if (!this._tryOpenDefault()) { if (!this._tryAutoOpen()) {
this._activeOpen(); this._activeOpen();
} }
} }
_tryOpenDefault() { _tryAutoOpen() {
const client = this._getPreferredClient(); const client = this._getPreferredClient();
let proposedPlatform = null; let proposedPlatform = null;
let webPlatform = null; let webPlatform = null;
@ -60,7 +60,7 @@ export class OpenLinkViewModel extends ViewModel {
return false; return false;
} }
} }
this.openDefaultViewModel = new OpenDefaultViewModel(this.childOptions({ this.openDefaultViewModel = new AutoOpenViewModel(this.childOptions({
client, client,
link: this._link, link: this._link,
openLinkVM: this, openLinkVM: this,
@ -71,7 +71,7 @@ export class OpenLinkViewModel extends ViewModel {
return true; return true;
} }
closeDefault() { closeAutoOpen() {
this.openDefaultViewModel = null; this.openDefaultViewModel = null;
// If no client was selected, this is a no-op. // If no client was selected, this is a no-op.
// Otherwise, see ClientViewModel.back for some reasons // Otherwise, see ClientViewModel.back for some reasons