From ce7f00afb3d48a4ef28398e02132b5431f1c8001 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow <156889717+saileshwar-skyflow@users.noreply.github.com> Date: Mon, 30 Nov 2026 21:31:33 +0530 Subject: [PATCH 01/12] SK-3326: Add file element support to skyvault (#202) --- .github/workflows/internal_release.yml | 67 ++- .../kotlin/Skyflow/container/Container.kt | 4 + .../src/main/kotlin/Skyflow/core/Messages.kt | 12 +- .../core/file/FileUploadRequestBody.kt | 42 ++ .../Skyflow/core/file/FileUploadValidator.kt | 160 ++++++ .../kotlin/Skyflow/core/file/SelectedFile.kt | 34 ++ .../kotlin/Skyflow/error/SkyflowErrorCode.kt | 12 +- samples/skyvault/build.gradle | 2 +- samples/skyvault/src/main/AndroidManifest.xml | 1 + .../java/com/Skyflow/FileUploadActivity.kt | 240 +++++++++ .../src/main/java/com/Skyflow/MainActivity.kt | 5 + .../main/res/layout/activity_file_upload.xml | 64 +++ .../src/main/res/layout/activity_main.xml | 10 + .../skyvault/src/main/res/values/strings.xml | 5 + skyvault/README.md | 267 ++++++++++ skyvault/build.gradle | 2 + skyvault/src/main/AndroidManifest.xml | 14 + .../kotlin/Skyflow/SkyflowFileProvider.kt | 16 + .../collect/client/CountingRequestBody.kt | 34 ++ .../collect/client/FileUploadAPICallback.kt | 456 ++++++++++++++++ .../collect/client/ImageMetadataStripper.kt | 86 +++ .../Skyflow/container/FileUploadContainer.kt | 148 ++++++ .../src/main/kotlin/Skyflow/core/APIClient.kt | 38 ++ .../Skyflow/element/CollectElementInput.kt | 44 ++ .../Skyflow/element/CollectElementOptions.kt | 33 +- .../kotlin/Skyflow/element/FileElementType.kt | 17 + .../Skyflow/element/FileInputElement.kt | 500 ++++++++++++++++++ .../main/kotlin/Skyflow/element/FilePicker.kt | 232 ++++++++ .../main/kotlin/Skyflow/element/FileSource.kt | 18 + .../Skyflow/element/FileUploadOptions.kt | 17 + .../element/FileUploadProgressListener.kt | 17 + .../src/main/res/xml/skyflow_file_paths.xml | 5 + .../java/com/Skyflow/FileInputElementTest.kt | 248 +++++++++ .../com/Skyflow/FileUploadValidatorTest.kt | 310 +++++++++++ .../com/Skyflow/ImageMetadataStripperTest.kt | 43 ++ 35 files changed, 3174 insertions(+), 29 deletions(-) create mode 100644 common/src/main/kotlin/Skyflow/core/file/FileUploadRequestBody.kt create mode 100644 common/src/main/kotlin/Skyflow/core/file/FileUploadValidator.kt create mode 100644 common/src/main/kotlin/Skyflow/core/file/SelectedFile.kt create mode 100644 samples/skyvault/src/main/java/com/Skyflow/FileUploadActivity.kt create mode 100644 samples/skyvault/src/main/res/layout/activity_file_upload.xml create mode 100644 skyvault/src/main/kotlin/Skyflow/SkyflowFileProvider.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/collect/client/CountingRequestBody.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/collect/client/FileUploadAPICallback.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/collect/client/ImageMetadataStripper.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/container/FileUploadContainer.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/element/FileElementType.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/element/FileInputElement.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/element/FilePicker.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/element/FileSource.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/element/FileUploadOptions.kt create mode 100644 skyvault/src/main/kotlin/Skyflow/element/FileUploadProgressListener.kt create mode 100644 skyvault/src/main/res/xml/skyflow_file_paths.xml create mode 100644 skyvault/src/test/java/com/Skyflow/FileInputElementTest.kt create mode 100644 skyvault/src/test/java/com/Skyflow/FileUploadValidatorTest.kt create mode 100644 skyvault/src/test/java/com/Skyflow/ImageMetadataStripperTest.kt diff --git a/.github/workflows/internal_release.yml b/.github/workflows/internal_release.yml index dafcbbcf..9f272518 100644 --- a/.github/workflows/internal_release.yml +++ b/.github/workflows/internal_release.yml @@ -1,12 +1,12 @@ name: Internal Release -# ONE internal (dev) release for both SDKs from a single `release/*` branch — no separate -# flowvault-release branch, no two PRs. What gets published is decided by the SCOPE of changes -# (relative to main), mirroring the skyflow-js internal workflow: -# common/ or a shared root changed -> publish BOTH skyvault + flowvault -# only skyvault/ changed -> publish skyvault -# only flowvault/ changed -> publish flowvault -# (Public/beta releases stay per-product via their tag namespaces — this scope logic is internal-only.) +# Internal (dev) releases. The publish target is chosen by the RELEASE BRANCH NAME, with a +# scope-based fallback on the shared `release/*` branch: +# skyvault-release/* -> publish skyvault only +# flowvault-release/* -> publish flowvault only +# release/* -> decide by the SCOPE of changes vs main (common/ or a shared root -> +# BOTH skyvault + flowvault; only skyvault/ -> skyvault; only flowvault/ -> flowvault) +# (Public/beta releases stay per-product via their tag namespaces — this logic is internal-only.) on: push: tags-ignore: @@ -15,12 +15,14 @@ on: - "skyvault/build.gradle" - "flowvault/build.gradle" - "*.md" - # Sample apps are not shipped artifacts — a samples-only change must not trigger an internal - # (dev) release. (The scope step also treats samples/ as out-of-scope, so nothing would publish - # even if triggered; this stops the workflow from running at all for samples-only pushes.) + # Sample apps are not shipped artifacts — a samples-only (or docs-only) push must not trigger + # an internal (dev) release on any release branch; this stops the workflow from running at all + # for such pushes. (On release/*, the scope step also treats samples/ as out-of-scope.) - "samples/**" branches: - release/* + - skyvault-release/* + - flowvault-release/* jobs: internal-release: @@ -40,27 +42,42 @@ jobs: distribution: 'temurin' java-version: '17' - - name: Detect changed scope + base versions + - name: Detect scope (by branch) + base versions id: scope run: | - # Update origin/main's tracking ref explicitly, then base the merge-base on it. - # Do NOT use FETCH_HEAD here: the `git fetch --tags` below re-points FETCH_HEAD at - # the release branch, so `merge-base FETCH_HEAD HEAD` collapsed to HEAD -> empty diff - # -> both SDKs read as out-of-scope -> publish skipped. + # origin/main is needed for the base-version tags below, and for the release/* scope + # fallback. Do NOT use FETCH_HEAD: the `git fetch --tags` below re-points FETCH_HEAD at + # the release branch, which would collapse `merge-base FETCH_HEAD HEAD` to HEAD. git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main git fetch --tags --quiet - # Diff vs where this release branch diverged from main (idempotent across re-pushes). - BASE=$(git merge-base origin/main HEAD) - CHANGED=$(git diff --name-only "$BASE" HEAD) - echo "Merge-base with main: $BASE" - echo "Changed files:"; echo "$CHANGED" - # Shared roots feed BOTH SDK builds -> treat like common. - SHARED='^(common/|scripts/|build\.gradle|settings\.gradle|gradle/|gradle\.properties|gradlew|\.github/workflows/)' + # Publish target is chosen by the release branch name; release/* falls back to change scope. + # skyvault-release/* -> skyvault only + # flowvault-release/* -> flowvault only + # release/* -> scope of changes vs main (common/ or shared root -> both) sky=false; fv=false - if echo "$CHANGED" | grep -qE "$SHARED"; then sky=true; fv=true; fi - if echo "$CHANGED" | grep -qE '^skyvault/'; then sky=true; fi - if echo "$CHANGED" | grep -qE '^flowvault/'; then fv=true; fi + case "$GITHUB_REF_NAME" in + skyvault-release/*) + sky=true + echo "Branch '$GITHUB_REF_NAME' -> skyvault only" + ;; + flowvault-release/*) + fv=true + echo "Branch '$GITHUB_REF_NAME' -> flowvault only" + ;; + *) + # Diff vs where this release branch diverged from main (idempotent across re-pushes). + BASE=$(git merge-base origin/main HEAD) + CHANGED=$(git diff --name-only "$BASE" HEAD) + echo "Merge-base with main: $BASE" + echo "Changed files:"; echo "$CHANGED" + # Shared roots feed BOTH SDK builds -> treat like common. + SHARED='^(common/|scripts/|build\.gradle|settings\.gradle|gradle/|gradle\.properties|gradlew|\.github/workflows/)' + if echo "$CHANGED" | grep -qE "$SHARED"; then sky=true; fv=true; fi + if echo "$CHANGED" | grep -qE '^skyvault/'; then sky=true; fi + if echo "$CHANGED" | grep -qE '^flowvault/'; then fv=true; fi + ;; + esac # Base versions for the -dev suffix (skyvault: latest plain-semver tag on main; flowvault: latest flowvault/x.y.z). skytag=$(git describe --tags --abbrev=0 --match '[0-9]*.[0-9]*.[0-9]*' origin/main 2>/dev/null || echo "1.27.0") diff --git a/common/src/main/kotlin/Skyflow/container/Container.kt b/common/src/main/kotlin/Skyflow/container/Container.kt index 5dac141c..d2146f68 100644 --- a/common/src/main/kotlin/Skyflow/container/Container.kt +++ b/common/src/main/kotlin/Skyflow/container/Container.kt @@ -33,6 +33,10 @@ class Container internal constructor( internal val collectElements: MutableList = mutableListOf(); internal val revealElements: MutableList