fix: added missing openFile method in ios utils (#7431)

* fix: added missing openFile method in ios utils

* chore: deprecate utils.ios.openFile
This commit is contained in:
Alexander Vakrilov
2019-08-01 16:05:32 +03:00
committed by GitHub
parent 09d370919f
commit cb58cab213

View File

@ -89,20 +89,9 @@ export module ios {
export const MajorVersion = NSString.stringWithString(UIDevice.currentDevice.systemVersion).intValue;
export function openFile(filePath: string): boolean {
try {
const appPath = getCurrentAppPath();
const path = filePath.replace("~", appPath);
console.log("utils.ios.openFile() is deprecated; use utils.openFile() instead");
const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path));
controller.delegate = new UIDocumentInteractionControllerDelegateImpl();
return controller.presentPreviewAnimated(true);
}
catch (e) {
traceWrite("Error in openFile", traceCategories.Error, traceMessageType.error);
}
return false;
return openFileAtRootModule(filePath);
}
export function getCurrentAppPath(): string {
@ -146,6 +135,26 @@ export module ios {
}
export function openFile(filePath: string): boolean {
try {
const appPath = ios.getCurrentAppPath();
const path = filePath.replace("~", appPath);
const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path));
controller.delegate = new UIDocumentInteractionControllerDelegateImpl();
return controller.presentPreviewAnimated(true);
}
catch (e) {
traceWrite("Error in openFile", traceCategories.Error, traceMessageType.error);
}
return false;
}
// Need this so that we can use this function inside the ios module (avoid name clashing).
const openFileAtRootModule = openFile;
export function GC() {
__collect();
}