Skip to content

Added a Username Copy Button #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 12, 2023
Merged

Conversation

ReactaDev
Copy link
Contributor

@ReactaDev ReactaDev commented May 12, 2023

Summery

A Button to directly copy user and discrim from the mini profile page.

How it works

Uses pasteboard to copy to clipboard, grabs the "user.username" and "user.discriminator" and interpolates it with a "#" to form a string "Username#1234" that gets copied to the clipboard.

Code that was added

let pasteboard = NSPasteboard.general

Button(action: { pasteboard.declareTypes([.string], owner: nil) pasteboard.setString("\(user.username)#\(user.discriminator)", forType: .string) }, label: { Image(systemName: "square.on.square") }) .buttonStyle(.plain) .padding() .frame(width: 20, height: 20)

All in all, a very simple ease of life change.

Examples

image

A Button to directly copy user and discrim from the mini profile page.
@cryptoAlgorithm
Copy link
Member

Great first contribution! It would be great if you could include screenshots of how this button would look (editing your OP would suffice) to make evaluating this PR quicker. Thanks!

@ReactaDev
Copy link
Contributor Author

Great first contribution! It would be great if you could include screenshots of how this button would look (editing your OP would suffice) to make evaluating this PR quicker. Thanks!

Upated! Sorry about that!

@cryptoAlgorithm
Copy link
Member

Ok, looks good! Looks like the only thing that's left is to resolve these lint warnings before this PR can be merged!

@cryptoAlgorithm
Copy link
Member

A little tip: I suggest enabling the Automatically trim trailing whitespace and Including whitespace-only lines options in Xcode's settings to automatically remove any trailing whitespace.

Screenshot 2023-05-12 at 11 05 38 PM

@ReactaDev
Copy link
Contributor Author

Ahh I will fix that. Its a bad habit I have with code formating

@ReactaDev
Copy link
Contributor Author

A little tip: I suggest enabling the Automatically trim trailing whitespace and Including whitespace-only lines options in Xcode's settings to automatically remove any trailing whitespace.

Screenshot 2023-05-12 at 11 05 38 PM

Ohh I will enable that right now! Thank you! I have spent way to long debugging those.

@cryptoAlgorithm cryptoAlgorithm added this pull request to the merge queue May 12, 2023
Merged via the queue into SwiftcordApp:main with commit 7f53558 May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants