Replace file approval waits with temporary receive codes and prepare v0.4.0 - #19
Merged
Conversation
File sharing previously used the same general approval idea that text sharing once used. The sender posted an offer, the HTTP request remained open, and the receiver had to accept or decline it before the transfer could continue. After separating text into its own direct-delivery flow, the file path was the only place that still needed this waiting system. Instead of trying to make the waiting machinery smaller, this change asks whether that machinery is still necessary. Replace the receiver-side Accept/Decline step with a temporary four-digit receive code. Generate one code for each fresh application session and keep it only in memory. Show the same code on both the Send and Receive screens so it is available from the default screen. Do not advertise it through discovery, persist it, or remember entered codes on sending devices. When sending files, ask for the target device's code before creating the transfer. Validate the input as exactly four ASCII digits in the UI, ViewModel, and outgoing controller. Include the entered code with the file metadata offer. Make the receiver answer the file offer immediately with an accepted, invalid-code, receiver-busy, or preparation-failed result. Under the existing operation mutex, atomically check that the receiver is idle, compare the code, prepare the platform TCP receiver, and publish the ReceivingFiles state before returning acceptance. Remove the file decision machinery that is no longer needed: - remove UserDecision and CompletableDeferred - remove IncomingFileOffer and WaitingForFiles states - remove the receiver Accept/Decline screen - remove the suspended decision request and its 50-second timeout - remove the old Accept/Cancel response race Keep the parts that still protect file-transfer correctness: - operation IDs and sender IDs - best-effort remote cancellation - platform-owned first-connection timeout - transfer progress and completed-file counts - raw TCP framing and streamed file bytes - file index and promised-size validation - incomplete-file cleanup - final batch result handling Update navigation so compact devices open Receive when file reception begins, and replace the old waiting-for-approval sender state with a clear Preparing Files state. Prepare preview version 0.4.0 across Android, Desktop, and iOS. Increment Android and iOS build numbers to 4 while preserving the permanent Windows MSI upgrade identity. Refresh the README, changelog, architecture, development, roadmap, privacy, security, store, screenshot, and project-context documentation. Explain that the receive code is a convenience against accidental or casual sends, not authentication, because it has a small keyspace, travels over cleartext HTTP, and currently has no attempt throttling. BREAKING CHANGE: the file-offer request and response format is incompatible with Sync360 0.3.0 and older. Both devices must use matching 0.4.0 builds. The advertised preview protocol version intentionally remains 1 for now, so discovery may still show an older incompatible device. No Gradle build, automated test, or runtime transfer test was performed.
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.
Why this change exists
This update began with a simple question:
Do file transfers still need an HTTP request waiting for someone to press
Accept or Decline?
The old flow worked, but it required several connected pieces:
Those pieces were understandable when text and files shared the same idea.
Text has since become a small, independent direct-delivery flow. That left
files as the only feature carrying the complete waiting system.
Instead of repeatedly simplifying that system, this change removes the need
for it.
The new idea
Every fresh Sync360 application session receives a temporary four-digit
file receive code.
The same code is visible on both the Send and Receive screens. When someone
wants to send files to that device, they select their files and target
device, then enter the code shown on the target.
The receiving device already knows its own code, so it can answer
immediately:
There is no receiver-side Accept or Decline screen and no HTTP request
waiting for a person to make a decision.
What the flow feels like now
The code is requested for every file send. Sending devices do not remember
it.
A fresh application session generates another code. Navigating between
screens or recomposing the UI does not change it.
Why this is simpler
The receiver no longer needs to publish an offer state and wait for the UI.
There is no deferred user decision, decision timeout, waiting-for-files
state, or Accept/Cancel timing gap.
The receiver performs one short atomic operation:
Two simultaneous offers cannot both claim the receiver, and direct text
cannot claim it during the same operation.
What has not changed
The actual file-transfer foundation remains intact.
Files still use:
This change simplifies admission to a file transfer. It does not replace
the proven streaming and cleanup path underneath it.
Receive-code lifetime
The code is generated once by the application-scoped incoming controller.
Both the Send and Receive screens read that exact value. They do not
generate independent codes.
The code is:
Failure behavior
Failure is explicit and bounded:
Cancellation is still best effort. If cancellation and the offer cross on
the network in the opposite order, the receiver may remain reserved until
its 30-second timeout, but it recovers automatically and does not receive
file bytes from the cancelled sender.
Compatibility warning
This is a breaking file-protocol change.
The file-offer request now contains a receive code, and the response now
contains an explicit status. Sync360 0.4.0 therefore cannot transfer files
with 0.3.0 or older builds.
Both devices must be updated to 0.4.0.
The advertised preview protocol version intentionally remains
1for now.Because of that preview-stage decision, old and new devices may still
discover each other even though their file request formats are
incompatible. Seeing a device in the nearby list does not guarantee
cross-version compatibility.
Security position
The four-digit code is a convenience check, not authentication.
It reduces accidental or casual unwanted file sends, but:
Current builds should still be used only on private networks controlled by
the user.
Release preparation
This PR prepares Sync360
0.4.0:0.4.040.4.00.4.041