Skip to content

Commit

Permalink
Merge pull request #1591 from planetary-social/bdm/perf-NoteOptionsBu…
Browse files Browse the repository at this point in the history
…tton

performance improvements for NoteOptionsButton #1458
  • Loading branch information
joshuatbrown authored Oct 9, 2024
2 parents b5ebd9a + 99e389b commit f2cc48d
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 @@ -22,6 +22,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 f2cc48d

Please sign in to comment.