fix(mobile): iOS share sheet, empty files tab, and stuck upload status
- app.json: add CFBundleDocumentTypes to iOS infoPlist so the app appears in the iOS Share Sheet; add ACTION_SEND/SEND_MULTIPLE intentFilters for Android share intent support - src/context/ShareContext.tsx (new): React context that queues files received from the share sheet and delivers them to UploadScreen - app/_layout.tsx: wrap in ShareProvider; add Linking handler (makeUrlHandler factory + getInitialURL cold-start + addEventListener warm-start) to capture file:// and content:// URLs - src/services/api.ts: fix FileRecord interface (original_filename, nested ProcessingStatus, mime_type); fix UploadResponse interface; fix listFiles() (per_page param, unwrap data.files); add getFileStatus(fileId) for single-file status polling - src/screens/FilesScreen.tsx: use file.original_filename and file.processing_status.status; fix statusEmoji to use actual backend status values (completed/pending/duplicate) - src/screens/UploadScreen.tsx: consume ShareContext for auto-upload of shared files; add 5-second polling loop (search by filename → file_id → getFileStatus) to show real-time server processing status; uploadFile wrapped in useCallback; proper effect dependency arrays Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
+26
-11
@@ -41,21 +41,27 @@ export interface DeviceRegistration {
|
||||
platform: "ios" | "android" | "web";
|
||||
}
|
||||
|
||||
export interface ProcessingStatus {
|
||||
status: string;
|
||||
last_step: string | null;
|
||||
has_errors: boolean;
|
||||
total_steps: number;
|
||||
}
|
||||
|
||||
export interface FileRecord {
|
||||
id: number;
|
||||
filename: string;
|
||||
status: string;
|
||||
created_at: string;
|
||||
original_filename: string;
|
||||
file_size: number | null;
|
||||
content_type: string | null;
|
||||
owner_id: string | null;
|
||||
mime_type: string | null;
|
||||
created_at: string;
|
||||
processing_status: ProcessingStatus;
|
||||
}
|
||||
|
||||
export interface UploadResponse {
|
||||
task_id: string;
|
||||
status: string;
|
||||
message: string;
|
||||
filename: string;
|
||||
original_filename: string;
|
||||
stored_filename: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -186,12 +192,21 @@ class DocuElevateAPI {
|
||||
return this.request<UploadResponse>("POST", "/api/ui-upload", { formData });
|
||||
}
|
||||
|
||||
/** List recently processed files. */
|
||||
async listFiles(page = 1, pageSize = 20): Promise<FileRecord[]> {
|
||||
return this.request<FileRecord[]>(
|
||||
/** List recently processed files, optionally filtered by filename search. */
|
||||
async listFiles(page = 1, pageSize = 20, search?: string): Promise<FileRecord[]> {
|
||||
let url = `/api/files?page=${page}&per_page=${pageSize}`;
|
||||
if (search) url += `&search=${encodeURIComponent(search)}`;
|
||||
const data = await this.request<{ files: FileRecord[]; pagination: unknown }>("GET", url);
|
||||
return data.files;
|
||||
}
|
||||
|
||||
/** Get the processing status for a single file by its ID. */
|
||||
async getFileStatus(fileId: number): Promise<ProcessingStatus> {
|
||||
const data = await this.request<{ processing_status: ProcessingStatus }>(
|
||||
"GET",
|
||||
`/api/files?page=${page}&page_size=${pageSize}`
|
||||
`/api/files/${fileId}`
|
||||
);
|
||||
return data.processing_status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user