FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore: deprecate utils.ios.openFile · NativeScript/NativeScript@00a5ee1 · GitHub

Commit 00a5ee1

Browse files
vakrilov
committed
chore: deprecate utils.ios.openFile
1 parent c3c3356 commit 00a5ee1

1 file changed

Lines changed: 21 additions & 14 deletions

File tree

‎tns-core-modules/utils/utils.ios.ts‎

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,9 @@ export module ios {
8989
export const MajorVersion = NSString.stringWithString(UIDevice.currentDevice.systemVersion).intValue;
9090

9191
export function openFile(filePath: string): boolean {
92-
try {
93-
const appPath = getCurrentAppPath();
94-
const path = filePath.replace("~", appPath);
92+
console.log("utils.ios.openFile() is deprecated; use utils.openFile() instead");
9593

96-
const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path));
97-
controller.delegate = new UIDocumentInteractionControllerDelegateImpl();
98-
99-
return controller.presentPreviewAnimated(true);
100-
}
101-
catch (e) {
102-
traceWrite("Error in openFile", traceCategories.Error, traceMessageType.error);
103-
}
104-
105-
return false;
94+
return openFileAtRootModule(filePath);
10695
}
10796

10897
export function getCurrentAppPath(): string {
@@ -146,7 +135,25 @@ export module ios {
146135

147136
}
148137

149-
export const openFile = ios.openFile;
138+
export function openFile(filePath: string): boolean {
139+
try {
140+
const appPath = ios.getCurrentAppPath();
141+
const path = filePath.replace("~", appPath);
142+
143+
const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path));
144+
controller.delegate = new UIDocumentInteractionControllerDelegateImpl();
145+
146+
return controller.presentPreviewAnimated(true);
147+
}
148+
catch (e) {
149+
traceWrite("Error in openFile", traceCategories.Error, traceMessageType.error);
150+
}
151+
152+
return false;
153+
}
154+
155+
// Need this so that we can use this function inside the ios module (avoid name clashing).
156+
const openFileAtRootModule = openFile;
150157

151158
export function GC() {
152159
__collect();

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL