Repository navigation
K2GO-427 feat(contentexchange): import content from a connected drive - #684
Merged
Merged
Conversation
Add the import action, the receiver half of the disk round-trip, mirroring the merged export slice. The user picks a drive via SAF, the app reads the bundle (manifest.json, tolerating a missing one by scanning for .zim), the core validates per item (importable / already-have / newer / older / no-app), the user selects with a phone-disk preflight, and a foreground service stages each archive where the box (proot) can read it and calls the core to ingest it. - domain: ImportEntry/Manifest/Verdict/Scan/Preflight + ImportCarrier/ImportSource ports; reuse the generic ExportJob for the transfer state. - data: SafImportCarrier (DocumentsContract reader, no new permission/dependency), ImportManifestReader (parse + no-manifest scan), CxCoreImportSource (validate / import-item / delete), BoxImportStaging (box /library/.cx-staging <-> host path), CxCoreDataSource import/delete calls. - presentation: ImportReviewFragment + ViewModel/Adapter (grouped states, preflight), ContentImportService (specialUse foreground, per-item retry, grant release), ImportProgressFragment; "Import from drive" entry on the manager. - JVM tests for the scan, parse, verdict and preflight rules. Replace-older imports the newer version; auto-deleting the old copy is deferred (validate does not return the box's existing ref to delete, and it is per-app). Strings parked in strings_untranslated.xml; l10n at the feature closing PR.
…race Import picker takes READ only (it never writes the drive) and prunes stale persisted grants, keeping each active run's tree so the two pickers do not revoke each other. Cancel no longer clears the session while the worker drains: the worker owns teardown, so the main thread only flags cancel and releases the grant, clearing and stopping itself only when no run is active.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Import action of the content manager (slice 3): read a bundle from a user-picked
connected drive, validate it against this box, and import the selected items. The receiver
half of the disk round-trip (the K2GO-427 user deliverable).
no new dependency, mirrors SafExportCarrier). The persisted tree grant is released at the
run's terminal points.
manifest is tolerated: the drive is scanned instead) -> POST /v1/import/validate -> a review
list marking each item importable / already-have (same) / newer / older / no-app (the core's
dedup; a Calibre soft verdict is advisory).
"selected / free on device" and blocks a pick that will not fit: a small phone takes a
subset of a big drive.
/library/.cx-staging, the filename sanitized) -> POST /v1/import/item -> the core ingests
(delegating to the app's own import) -> the staging copy is removed. The item is the unit of
resume: retry a failed item; skip SAME_VERSION. A NEWER item over an OLDER one offers
replace (optionally deleting the old).
(chunked), so a multi-GB item never buffers.
ImportScan, ImportPreflight) with JVM tests; data (SafImportCarrier, BoxImportStaging,
CxCoreImportSource, ImportManifestReader); presentation (review + progress + service).
Verification: assembleStandardDebug builds; JVM unit tests. On-device import against a real
drive is a follow-up (needs a drive + a box running cx-core).
UI changes
New user-facing strings (parked in strings_untranslated.xml, l10n at the feature's closing
PR): the "import from drive" entry, the review screen (per-item status labels), the selection
Material 3 tokens; on-device render check pending.