From 8cf3a6b0f0c0ac5d8ce33d32e0b66a28f90a787b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 19 Apr 2018 14:40:42 -0400 Subject: [PATCH] hostname or uri --- src/models/view/loginUriView.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/models/view/loginUriView.ts b/src/models/view/loginUriView.ts index 6222fef96e3..6e221e02d3b 100644 --- a/src/models/view/loginUriView.ts +++ b/src/models/view/loginUriView.ts @@ -6,12 +6,15 @@ import { LoginUri } from '../domain/loginUri'; import { PlatformUtilsService } from '../../abstractions/platformUtils.service'; +import { UtilsService } from '../../services/utils.service'; + export class LoginUriView implements View { match: UriMatchType = null; // tslint:disable private _uri: string; private _domain: string; + private _hostname: string; // tslint:enable constructor(u?: LoginUri) { @@ -47,8 +50,19 @@ export class LoginUriView implements View { return this._domain; } - get domainOrUri(): string { - return this.domain != null ? this.domain : this.uri; + get hostname(): string { + if (this._hostname == null && this.uri != null) { + this._hostname = UtilsService.getHostname(this.uri); + if (this._hostname === '') { + this._hostname = null; + } + } + + return this._hostname; + } + + get hostnameOrUri(): string { + return this.hostname != null ? this.hostname : this.uri; } get isWebsite(): boolean {