Repository navigation
feat: hand a reconnecting phone the clipboard it missed - #338
Closed
fernando2393 wants to merge 1 commit into
Closed
fernando2393 wants to merge 1 commit into
fernando2393 wants to merge 1 commit into
Conversation
iOS closes the connection when the app leaves the foreground, so text copied on the computer while the phone is away was never delivered. Remember what each paired phone last received or sent, by certificate fingerprint, and after the phone's hello send it the current clipboard text if it has not seen it. A phone that just sent the text, and one that already has it, are not sent it again. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Owner
|
I appreciate the effort, but I don't think this is what users want or expect. Since the daemon can't see what's going on on the iPhone this can overwrite new iphone clipboard entries with ancient stuff from the daemon. I think if people do want this it should be a setting on the phone app, not memory in the daemon. The app can already request the clipboard so we could give the user a setting to re-fetch ( |
Contributor
Author
|
That's fair. The daemon can't see what was copied on the phone while the app was away, so it could replace something newer with something old, and a phone-side setting to re-fetch on startup is the right place for it. Closing this one. Thanks for taking the time to explain. |
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.
Problem
iOS closes the TCP session as soon as the app leaves the foreground, so text copied on the computer while the phone is away was never delivered. Opening the app reconnected, but nobody told it what it had missed.
Change
The daemon remembers, per paired peer (certificate fingerprint), the last clipboard text it sent to or received from that peer. After a paired client's
hello, it sends oneclipboard_updatedwith the current Host clipboard if that peer has not got it. Not sent whenclipboard_auto_shareis off or the clipboard is an image. A phone that just sent the text is not sent it back.broadcast_clipboard_text()replaces three copies of the same JSON-building code and records delivery.Testing
Existing suite passes on this branch alone (638 tests). By hand with a real iPhone: copy on the computer with the app closed, open the app, the text arrives and pastes.
Not unit-tested: the hello handler lives inside the TLS session loop; happy to extract it if you want a test.
🤖 Generated with Claude Code
Note: this touches
net.cppanddaemon/main.cpplike #324, but a different feature (clipboard text, not MAP messages); happy to rebase whichever lands second.