mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
feat(utils): work openFile in simulator (#8495)
* feat: open file in iOS simulator * feat: added isRealDevice util * feat: have in mind isRealDevice in utils.openFile refactor to avoid some circular dependencies Co-authored-by: Vasil Trifonov <v.trifonov@gmail.com>
This commit is contained in:
@ -9,7 +9,7 @@ export * from "./utils-common";
|
||||
export function openFile(filePath: string): boolean {
|
||||
try {
|
||||
const appPath = ios.getCurrentAppPath();
|
||||
const path = filePath.replace("~", appPath);
|
||||
let path = ios.isRealDevice() ? filePath.replace("~", appPath) : filePath;
|
||||
|
||||
const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path));
|
||||
controller.delegate = <UIDocumentInteractionControllerDelegate>new ios.UIDocumentInteractionControllerDelegateImpl();
|
||||
@ -45,3 +45,7 @@ export function openUrl(location: string): boolean {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isRealDevice(): boolean {
|
||||
return ios.isRealDevice();
|
||||
}
|
||||
|
Reference in New Issue
Block a user