feat(mobile): add setting to always open web view on launch (#1500)
This commit is contained in:
@@ -33,6 +33,7 @@ export function environmentFromString(string: string) {
|
||||
web: Environment.Web,
|
||||
desktop: Environment.Desktop,
|
||||
mobile: Environment.Mobile,
|
||||
nativeMobileWeb: Environment.NativeMobileWeb,
|
||||
}
|
||||
return map[string]
|
||||
}
|
||||
@@ -42,6 +43,7 @@ export function environmentToString(environment: Environment) {
|
||||
[Environment.Web]: 'web',
|
||||
[Environment.Desktop]: 'desktop',
|
||||
[Environment.Mobile]: 'mobile',
|
||||
[Environment.NativeMobileWeb]: 'native-mobile-web',
|
||||
}
|
||||
return map[environment]
|
||||
}
|
||||
|
||||
@@ -291,11 +291,15 @@ export class SNComponentManager
|
||||
}
|
||||
|
||||
const isWeb = this.environment === Environment.Web
|
||||
const isMobileWebView = this.environment === Environment.NativeMobileWeb
|
||||
if (nativeFeature) {
|
||||
if (!isWeb) {
|
||||
if (!isWeb && !isMobileWebView) {
|
||||
throw Error('Mobile must override urlForComponent to handle native paths')
|
||||
}
|
||||
const baseUrlRequiredForThemesInsideEditors = window.location.origin
|
||||
let baseUrlRequiredForThemesInsideEditors = window.location.origin
|
||||
if (isMobileWebView) {
|
||||
baseUrlRequiredForThemesInsideEditors = window.location.href.split('/index.html')[0]
|
||||
}
|
||||
return `${baseUrlRequiredForThemesInsideEditors}/components/assets/${component.identifier}/${nativeFeature.index_path}`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user