@@ -59,11 +59,11 @@ export class ClientViewModel extends ViewModel {
5959 if ( this . _proposedPlatform === this . _nativePlatform ) {
6060 deepLinkLabel = "Open in app" ;
6161 } else {
62- deepLinkLabel = `Open on ${ this . _client . getPreferredWebInstance ( this . _link ) } ` ;
62+ deepLinkLabel = `Open on ${ this . preferredWebInstance } ` ;
6363 }
6464 }
6565 const actions = [ ] ;
66- const proposedDeepLink = this . _client . getDeepLink ( this . _proposedPlatform , this . _link ) ;
66+ const proposedDeepLink = this . _client . getDeepLink ( this . _proposedPlatform , this . _link , this . preferredWebInstance ) ;
6767 if ( proposedDeepLink ) {
6868 actions . push ( {
6969 label : deepLinkLabel ,
@@ -83,8 +83,8 @@ export class ClientViewModel extends ViewModel {
8383 // show only if there is a preferred instance, and if we don't already link to it in the first button
8484 if ( hasPreferredWebInstance && this . _webPlatform && this . _proposedPlatform !== this . _webPlatform ) {
8585 actions . push ( {
86- label : `Open on ${ this . _client . getPreferredWebInstance ( this . _link ) } ` ,
87- url : this . _client . getDeepLink ( this . _webPlatform , this . _link ) ,
86+ label : `Open on ${ this . preferredWebInstance } ` ,
87+ url : this . _client . getDeepLink ( this . _webPlatform , this . _link , this . preferredWebInstance ) ,
8888 kind : "open-in-web" ,
8989 activated : ( ) => { } // don't persist this choice as we don't persist the preferred web instance, it's in the url
9090 } ) ;
@@ -108,10 +108,10 @@ export class ClientViewModel extends ViewModel {
108108 actions . push ( ...nativeActions ) ;
109109 }
110110 if ( this . _webPlatform ) {
111- const webDeepLink = this . _client . getDeepLink ( this . _webPlatform , this . _link ) ;
111+ const webDeepLink = this . _client . getDeepLink ( this . _webPlatform , this . _link , this . preferredWebInstance ) ;
112112 if ( webDeepLink ) {
113113 const webLabel = this . hasPreferredWebInstance ?
114- `Open on ${ this . _client . getPreferredWebInstance ( this . _link ) } ` :
114+ `Open on ${ this . preferredWebInstance } ` :
115115 `Continue in your browser` ;
116116 actions . push ( {
117117 label : webLabel ,
@@ -128,14 +128,22 @@ export class ClientViewModel extends ViewModel {
128128 return actions ;
129129 }
130130
131- get hasPreferredWebInstance ( ) {
131+ get preferredWebInstance ( ) {
132132 // also check there is a web platform that matches the platforms the user is on (mobile or desktop web)
133- return this . _webPlatform && typeof this . _client . getPreferredWebInstance ( this . _link ) === "string" ;
133+ if ( ! this . _webPlatform ) return undefined ;
134+ return (
135+ this . preferences . getPreferredWebInstance ( this . _client . id )
136+ || this . _client . getPreferredWebInstance ( this . _link )
137+ ) ;
138+ }
139+
140+ get hasPreferredWebInstance ( ) {
141+ return typeof this . preferredWebInstance === "string" ;
134142 }
135143
136144 get hostedByBannerLabel ( ) {
137- const preferredWebInstance = this . _client . getPreferredWebInstance ( this . _link ) ;
138- if ( this . _webPlatform && preferredWebInstance ) {
145+ if ( this . hasPreferredWebInstance ) {
146+ const preferredWebInstance = this . preferredWebInstance ;
139147 let label = preferredWebInstance ;
140148 const subDomainIdx = preferredWebInstance . lastIndexOf ( "." , preferredWebInstance . lastIndexOf ( "." ) - 1 ) ;
141149 if ( subDomainIdx !== - 1 ) {
@@ -188,7 +196,7 @@ export class ClientViewModel extends ViewModel {
188196
189197 get showDeepLinkInInstall ( ) {
190198 // we can assume this._nativePlatform as this._clientCanIntercept already checks it
191- return this . _clientCanIntercept && ! ! this . _client . getDeepLink ( this . _nativePlatform , this . _link ) ;
199+ return this . _clientCanIntercept && ! ! this . _client . getDeepLink ( this . _nativePlatform , this . _link , this . preferredWebInstance ) ;
192200 }
193201
194202 get availableOnPlatformNames ( ) {
0 commit comments