Skip to content

Commit

Permalink
improve performance of NoteOptionsButton #1458
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanmontz committed Oct 7, 2024
1 parent 909d57b commit 99e389b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update Xcode to version 15.4, adding compatibility for Xcode 16.
- Reduced spammy "Failed to parse Follow" log messages.
- Upgraded fastlane to version 2.223.1.
- Improved performance of NoteOptionsButton. [#1458](https://github.com/planetary-social/nos/issues/1458)

## [0.2.1] - 2024-10-01Z

Expand Down
22 changes: 11 additions & 11 deletions Nos/Views/Components/Button/NoteOptionsButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,51 +28,51 @@ struct NoteOptionsButton: View {
// This hack fixes a weird issue where the confirmationDialog wouldn't be shown sometimes. ¯\_(ツ)_/¯
.background(showingOptions == true ? .clear : .clear)
}
.confirmationDialog(String(localized: .localizable.share), isPresented: $showingOptions) {
Button(String(localized: .localizable.copyNoteIdentifier)) {
.confirmationDialog("share", isPresented: $showingOptions) {
Button("copyNoteIdentifier") {
analytics.copiedNoteIdentifier()
copyMessageIdentifier()
}
Button(String(localized: .localizable.shareNote)) {
Button("shareNote") {
showingShare = true
analytics.sharedNoteLink()
}
if !note.isStub {
Button(String(localized: .localizable.copyNoteText)) {
Button("copyNoteText") {
analytics.copiedNoteText()
copyMessage()
}
Button(String(localized: .localizable.viewSource)) {
Button("viewSource") {
analytics.viewedNoteSource()
showingSource = true
}
if note.author != currentUser.author {
Button(String(localized: .localizable.reportNote)) {
Button("reportNote") {
showingReportMenu = true
}
}
}
if note.author == currentUser.author {
Button(String(localized: .localizable.deleteNote), role: .destructive) {
Button("deleteNote", role: .destructive) {
confirmDelete = true
}
}
}
.reportMenu($showingReportMenu, reportedObject: .note(note))
.alert(
String(localized: .localizable.confirmDelete),
"confirmDelete",
isPresented: $confirmDelete,
actions: {
Button(String(localized: .localizable.confirm), role: .destructive) {
Button("confirm", role: .destructive) {
analytics.deletedNote()
Task { await deletePost() }
}
Button(String(localized: .localizable.cancel), role: .cancel) {
Button("cancel", role: .cancel) {
confirmDelete = false
}
},
message: {
Text(.localizable.deleteNoteConfirmation)
Text("deleteNoteConfirmation")
}
)
.sheet(isPresented: $showingSource) {
Expand Down

0 comments on commit 99e389b

Please sign in to comment.