Skip to content

Commit

Permalink
Also a fix of #52
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Oct 31, 2023
1 parent e634bdc commit cdffc76
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
3 changes: 1 addition & 2 deletions Website/src/activitys/MainApplication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,10 @@ const MainApplication = () => {
// @ts-ignore
<Fab
onClick={() => {
// @ts-ignore
Chooser.getFile(
"application/zip",
(file) => {
if (file) {
if (file !== "RESULT_CANCELED") {
context.pushPage({
component: TerminalActivity,
key: "TerminalActivity",
Expand Down
31 changes: 21 additions & 10 deletions Website/src/typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,29 @@ declare global {
readonly __nativeStorage__: Pick<Storage, "getItem" | "setItem" | "removeItem" | "clear"> & { defineName: (name: string) => void };
}

type TerminalExec = {
command: string;
env: Record<string, string>;
onLine: (line: string) => void;
onExit: (code: number) => void;
};

interface Terminal {
exec(opt: TerminalExec): void;
namespace Terminal {
export type Exec = {
command: string;
env: Record<string, string>;
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<any> {}

Expand Down

0 comments on commit cdffc76

Please sign in to comment.