enhance: extract reusable CopyButton control with copy feedback - #2668
Merged
love-linger merged 3 commits intoSep 1, 2026
Merged
Conversation
love-linger
reviewed
Sep 1, 2026
| { | ||
| protected override Type StyleKeyOverride => typeof(Button); | ||
|
|
||
| public static readonly StyledProperty<string> CopyTextProperty = |
Collaborator
There was a problem hiding this comment.
CopyText is a per-instance-data. I suggest to use DirectProperty instead of StyledProperty for it.
Contributor
Author
There was a problem hiding this comment.
Pushed two commits addressing this:
fix: ...—OnClickwas settingIsCopied = trueeven whenCopyTextwas empty, so it now returns early in that case. Also removed the now-redundantif (_resetTimer != null)check inOnUnloaded, since_resetTimeris always initialized inOnLoadedby the timeOnUnloadedruns (same pattern asCommitBaseInfo's_iconResetTimer, which never null-checks it either).code_style: ...— switchedCopyTexttoDirectPropertyas suggested, since it's purely per-instance data with no styling/animation use case, matching the existingIsCopiedproperty.
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.
What
Extracts the "copy + show checkmark for 1s" logic into a reusable
CopyButtoncontrol (src/Views/CopyButton.cs), and uses it in:CommitBaseInfo(copy commit SHA)LauncherPage(copy notification message)Why
Both places previously implemented very similar copy-feedback logic
(a
DispatcherTimer+ two icons toggled by anIsCopiedflag)separately.
CopyButtonconsolidates this into one control driven bya
CopyTextproperty, so no changes to data models are needed.Note
This overlaps with #2666, which adds the same copy-feedback UX to
LauncherPageviaNotification.IsCopied. Left a comment there todiscuss which approach to land on.