diff --git a/Website/src/activitys/MainApplication.tsx b/Website/src/activitys/MainApplication.tsx index 837ecca1..53eea589 100644 --- a/Website/src/activitys/MainApplication.tsx +++ b/Website/src/activitys/MainApplication.tsx @@ -162,11 +162,10 @@ const MainApplication = () => { // @ts-ignore { - // @ts-ignore Chooser.getFile( "application/zip", (file) => { - if (file) { + if (file !== "RESULT_CANCELED") { context.pushPage({ component: TerminalActivity, key: "TerminalActivity", diff --git a/Website/src/typings/global.d.ts b/Website/src/typings/global.d.ts index 20534e83..df3bf65f 100644 --- a/Website/src/typings/global.d.ts +++ b/Website/src/typings/global.d.ts @@ -76,18 +76,29 @@ declare global { readonly __nativeStorage__: Pick & { defineName: (name: string) => void }; } - type TerminalExec = { - command: string; - env: Record; - onLine: (line: string) => void; - onExit: (code: number) => void; - }; - - interface Terminal { - exec(opt: TerminalExec): void; + namespace Terminal { + export type Exec = { + command: string; + env: Record; + onLine: (line: string) => void; + onExit: (code: number) => void; + }; + + export function exec(opt: Exec): void; } - const Terminal: Terminal; + namespace Chooser { + export type File = { + name: string; + uri: string; + path: string; + }; + + export type SuccessCallback = (file: File | "RESULT_CANCELED") => void; + export type ErrorCallback = ((code: number) => void) | null; + + export function getFile(type: string, successCallback: SuccessCallback, ErrorCallback: ErrorCallback): any; + } interface Window extends AndroidWindow {}