From 3e045cf8a8f1c6ebcac52ca87636fc71a60d6de5 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sat, 5 Mar 2022 12:07:57 +0000 Subject: [PATCH] fix(ios): try to accept all content types for #477 --- src/context/revoltjs/FileUploads.tsx | 62 +++++++++++++++++----------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/src/context/revoltjs/FileUploads.tsx b/src/context/revoltjs/FileUploads.tsx index ca17b3f3..6c7e57d3 100644 --- a/src/context/revoltjs/FileUploads.tsx +++ b/src/context/revoltjs/FileUploads.tsx @@ -20,33 +20,39 @@ type BehaviourType = | { behaviour: "ask"; onChange: (file: File) => void } | { behaviour: "upload"; onUpload: (id: string) => Promise } | { - behaviour: "multi"; - onChange: (files: File[]) => void; - append?: (files: File[]) => void; - } + behaviour: "multi"; + onChange: (files: File[]) => void; + append?: (files: File[]) => void; + }; type StyleType = | { - style: "icon" | "banner"; - width?: number; - height?: number; - previewURL?: string; - defaultPreview?: string; - desaturateDefault?: boolean - } + style: "icon" | "banner"; + width?: number; + height?: number; + previewURL?: string; + defaultPreview?: string; + desaturateDefault?: boolean; + } | { - style: "attachment"; - attached: boolean; - uploading: boolean; - cancel: () => void; - size?: number; - } + style: "attachment"; + attached: boolean; + uploading: boolean; + cancel: () => void; + size?: number; + }; -type Props = BehaviourType & StyleType & { - fileType: "backgrounds" | "icons" | "avatars" | "attachments" | "banners"; - maxFileSize: number; - remove: () => Promise; -} +type Props = BehaviourType & + StyleType & { + fileType: + | "backgrounds" + | "icons" + | "avatars" + | "attachments" + | "banners"; + maxFileSize: number; + remove: () => Promise; + }; export async function uploadFile( autumnURL: string, @@ -75,6 +81,7 @@ export function grabFiles( ) { const input = document.createElement("input"); input.type = "file"; + input.accept = "*"; input.multiple = multiple ?? false; input.onchange = async (e) => { @@ -226,14 +233,19 @@ export function FileUploader(props: Props) { })} data-uploading={uploading}>