mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -1,61 +1,5 @@
|
||||
import { ios } from "./native-helper";
|
||||
import { Trace } from "../trace";
|
||||
|
||||
export { ios };
|
||||
export * from "./utils-common";
|
||||
|
||||
export function openFile(filePath: string): boolean {
|
||||
try {
|
||||
const appPath = ios.getCurrentAppPath();
|
||||
let path = ios.isRealDevice()
|
||||
? filePath.replace("~", appPath)
|
||||
: filePath;
|
||||
|
||||
const controller = UIDocumentInteractionController.interactionControllerWithURL(
|
||||
NSURL.fileURLWithPath(path)
|
||||
);
|
||||
controller.delegate = <UIDocumentInteractionControllerDelegate>(
|
||||
new ios.UIDocumentInteractionControllerDelegateImpl()
|
||||
);
|
||||
|
||||
return controller.presentPreviewAnimated(true);
|
||||
} catch (e) {
|
||||
Trace.write(
|
||||
"Error in openFile",
|
||||
Trace.categories.Error,
|
||||
Trace.messageType.error
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function GC() {
|
||||
__collect();
|
||||
}
|
||||
|
||||
export function releaseNativeObject(object: NSObject) {
|
||||
__releaseNativeCounterpart(object);
|
||||
}
|
||||
|
||||
export function openUrl(location: string): boolean {
|
||||
try {
|
||||
const url = NSURL.URLWithString(location.trim());
|
||||
if (UIApplication.sharedApplication.canOpenURL(url)) {
|
||||
return UIApplication.sharedApplication.openURL(url);
|
||||
}
|
||||
} catch (e) {
|
||||
// We Don't do anything with an error. We just output it
|
||||
Trace.write(
|
||||
"Error in OpenURL",
|
||||
Trace.categories.Error,
|
||||
Trace.messageType.error
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isRealDevice(): boolean {
|
||||
return ios.isRealDevice();
|
||||
}
|
||||
/**
|
||||
* A lot of plugins still used utils/utils
|
||||
* Left here for convenience (over time can eventually remove these)
|
||||
*/
|
||||
export * from './index';
|
||||
|
||||
Reference in New Issue
Block a user