fix: on mobile open links from editor in external browser (#1860)

This commit is contained in:
Aman Harwara
2022-10-25 21:38:29 +05:30
committed by GitHub
parent ca7455a854
commit d9db73ea05
14 changed files with 99 additions and 62 deletions

View File

@@ -11,6 +11,7 @@ import {
RawKeychainValue,
removeFromArray,
TransferPayload,
UuidString,
} from '@standardnotes/snjs'
import { Alert, Linking, PermissionsAndroid, Platform, StatusBar } from 'react-native'
import FileViewer from 'react-native-file-viewer'
@@ -79,6 +80,7 @@ export class MobileDevice implements MobileDeviceInterface {
private eventObservers: MobileDeviceEventHandler[] = []
public isDarkMode = false
public statusBarBgColor: string | undefined
private componentUrls: Map<UuidString, string> = new Map()
constructor(
private stateObserverService?: AppStateObserverService,
@@ -596,4 +598,16 @@ export class MobileDevice implements MobileDeviceInterface {
},
)
}
addComponentUrl(componentUuid: UuidString, componentUrl: string) {
this.componentUrls.set(componentUuid, componentUrl)
}
removeComponentUrl(componentUuid: UuidString) {
this.componentUrls.delete(componentUuid)
}
isUrlComponentUrl(url: string): boolean {
return Array.from(this.componentUrls.values()).includes(url)
}
}