Skip to content

SK-3326: Add file element support to skyvault - #202

Open
saileshwar-skyflow wants to merge 2 commits into
mainfrom
saileshwar/SK-3326-add-file-element-support-skyvault
Open

saileshwar-skyflow wants to merge 2 commits into
mainfrom
saileshwar/SK-3326-add-file-element-support-skyvault

Conversation

@saileshwar-skyflow

Copy link
Copy Markdown
Collaborator

What

Adds a skyvault-only file-upload element (single and multiple), aligned with the skyflow-js / iOS file-upload contract. File types stay out of flowvault's public surface.

Changes

SDK

  • FileElementInput / FileElementOptions / FileElementType (FILE_INPUT, MULTI_FILE_INPUT) / FileSource (FILES, PHOTOS, CAMERA)
  • FileInputElement — per-file remove (✕), and five selectable trigger looks via FileElementAppearance: FIELD, BUTTON, ICON, CARD, CUSTOM (app's own trigger → openPicker()), plus buttonStyles
  • FilePicker — SAF documents, Photo Picker, and camera (SDK's own FileProvider; no runtime permission)
  • container.uploadFiles(callback) and uploadFiles(metaData, callback) — direct upload and multi insert-then-upload; response aggregated as { fileUploadResponse, errorResponse } (partial success supported)
  • common/core/file: SelectedFile, FileUploadValidator (type / size / empty / name / count), streamed FileUploadRequestBody (no disk copy); shared error codes + messages

Sample — samples/skyvault → FileUploadActivity demonstrating every FileElementType, FileElementAppearance and FileSource, with styled and default looks.

Docs — new "Securely collecting files client-side" section in the skyvault README.

Tests — FileUploadValidatorTest and FileInputElementTest (selection, limits, state, validation, per-appearance rendering).

Verification

  • :skyvault:compileDebugKotlin + :flowvault:compileDebugKotlin — green
  • :samples:skyvault:assembleDebug — green (FileProvider manifest merges)
  • :skyvault:testDebugUnitTest (new tests) — green

Security note

The boundary is the API, not an isolated process: the element exposes no getter for the bytes, Uri or file name (same model as a text field), but native Android can't hide a picked file from host app code that deliberately reads it — documented in the README.

🤖 Generated with Claude Code

Adds a skyvault-only file-upload element (single and multiple) with
native pickers, five selectable trigger layouts, upload to the vault,
a sample, docs and unit tests. File types stay out of flowvault.

SDK:
- FileElementInput / FileElementOptions / FileElementType / FileSource
- FileInputElement: per-file remove, five FileElementAppearance looks
  (FIELD, BUTTON, ICON, CARD, CUSTOM + openPicker()), buttonStyles
- FilePicker: SAF documents, Photo Picker, camera (SDK FileProvider)
- container.uploadFiles() and uploadFiles(metaData): direct upload and
  multi insert-then-upload, response aggregated as in skyflow-js
- common/core/file: SelectedFile, FileUploadValidator, streamed
  FileUploadRequestBody (no disk copy); shared error codes/messages

Sample: FileUploadActivity demoing every type, appearance and source.
Docs: "Securely collecting files" section in skyvault README.
Tests: FileUploadValidatorTest, FileInputElementTest (all green).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Gitleaks Findings: No secrets detected. Safe to proceed!

@github-actions

Copy link
Copy Markdown

Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging.

The sample apps read local.properties (absent on CI) and have no root
compileSdk, so including :samples:skyvault / :samples:flowvault made CI
configure them and fail. Match main: build only :skyvault and :flowvault;
the file-upload sample stays as reference source like the other samples.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Gitleaks Findings: No secrets detected. Safe to proceed!

@github-actions

Copy link
Copy Markdown

Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant