fix: Fixed issue on Android where deprecated editors wouldn't load

This commit is contained in:
Aman Harwara
2023-11-30 14:31:26 +05:30
parent 5f6b574846
commit b89d9af7db
2 changed files with 24 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ import {
GetIframeEditors,
GetNativeThemes,
NativeFeatureIdentifier,
GetDeprecatedEditors,
} from '@standardnotes/features'
import { Copy, removeFromArray, sleep, isNotUndefined, LoggerInterface } from '@standardnotes/utils'
import { ComponentViewer } from '@Lib/Services/ComponentManager/ComponentViewer'
@@ -106,6 +107,7 @@ export class ComponentManager
this.addSyncedComponentItemObserver()
this.registerMobileNativeComponentUrls()
this.registerDeprecatedEditorUrlsForAndroid()
this.eventDisposers.push(
preferences.addEventObserver((event) => {
@@ -292,6 +294,23 @@ export class ComponentManager
}
}
private registerDeprecatedEditorUrlsForAndroid(): void {
if (!isMobileDevice(this.device)) {
return
}
const deprecatedEditors = [...GetDeprecatedEditors()]
for (const component of deprecatedEditors) {
const feature = new UIFeature<ComponentFeatureDescription>(component)
const url = this.urlForFeature(feature)
if (url) {
this.device.registerComponentUrl(feature.uniqueIdentifier.value, url)
}
}
}
detectFocusChange = (): void => {
const activeIframes = Array.from(document.getElementsByTagName('iframe'))