fix: Fixed issue where some editors would not open on Android

This commit is contained in:
Aman Harwara
2023-07-16 23:44:53 +05:30
parent e1f1be96cb
commit 5932eb814c
2 changed files with 18 additions and 5 deletions

View File

@@ -20,7 +20,10 @@ export class GetFeatureUrl {
} }
if (uiFeature.isFeatureDescription) { if (uiFeature.isFeatureDescription) {
return this.urlForNativeComponent(uiFeature.asFeatureDescription) return this.urlForNativeComponent(
uiFeature.asFeatureDescription.identifier,
uiFeature.asFeatureDescription.index_path,
)
} }
if (uiFeature.asComponent.offlineOnly) { if (uiFeature.asComponent.offlineOnly) {
@@ -29,6 +32,13 @@ export class GetFeatureUrl {
const url = uiFeature.asComponent.hosted_url || uiFeature.asComponent.legacy_url const url = uiFeature.asComponent.hosted_url || uiFeature.asComponent.legacy_url
if (!url) { if (!url) {
if (uiFeature.asComponent.package_info.identifier && uiFeature.asComponent.package_info.index_path) {
return this.urlForNativeComponent(
uiFeature.asComponent.package_info.identifier,
uiFeature.asComponent.package_info.index_path,
)
}
return undefined return undefined
} }
@@ -58,13 +68,16 @@ export class GetFeatureUrl {
} }
} }
private urlForNativeComponent(feature: ComponentFeatureDescription): string { private urlForNativeComponent(
identifier: ComponentFeatureDescription['identifier'],
index_path: ComponentFeatureDescription['index_path'],
): string {
if (this.isMobile) { if (this.isMobile) {
const baseUrlRequiredForThemesInsideEditors = window.location.href.split('/index.html')[0] const baseUrlRequiredForThemesInsideEditors = window.location.href.split('/index.html')[0]
return `${baseUrlRequiredForThemesInsideEditors}/web-src/components/assets/${feature.identifier}/${feature.index_path}` return `${baseUrlRequiredForThemesInsideEditors}/web-src/components/assets/${identifier}/${index_path}`
} else { } else {
const baseUrlRequiredForThemesInsideEditors = window.location.origin const baseUrlRequiredForThemesInsideEditors = window.location.origin
return `${baseUrlRequiredForThemesInsideEditors}/components/assets/${feature.identifier}/${feature.index_path}` return `${baseUrlRequiredForThemesInsideEditors}/components/assets/${identifier}/${index_path}`
} }
} }

View File

@@ -3,7 +3,7 @@
"version": "3.166.14", "version": "3.166.14",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"main": "dist/app.js", "main": "dist/app.js",
"author": "Standard Notes.", "author": "Standard Notes",
"private": true, "private": true,
"files": [ "files": [
"dist" "dist"