Add missing comments to localized strings, reorder buttons, mark destructive buttons

This commit is contained in:
2023-01-26 22:50:45 -05:00
parent 203203a706
commit 51f94cf135
10 changed files with 207 additions and 56 deletions

View File

@@ -434,21 +434,26 @@ struct ContentView: View {
.onReceive(handle_notify(.new_mutes)) { notif in
home.filter_muted()
}
.alert("User blocked", isPresented: $user_blocked_confirm, actions: {
Button("Thanks!") {
.alert(NSLocalizedString("User blocked", comment: "Alert message to indicate "), isPresented: $user_blocked_confirm, actions: {
Button(NSLocalizedString("Thanks!", comment: "Button to close out of alert that informs that the action to block a user was successful.")) {
user_blocked_confirm = false
}
}, message: {
if let pubkey = self.blocking {
let profile = damus_state!.profiles.lookup(id: pubkey)
let name = Profile.displayName(profile: profile, pubkey: pubkey)
Text("\(name) has been blocked")
Text("\(name) has been blocked", comment: "Alert message that informs a user was blocked.")
} else {
Text("User has been blocked")
Text("User has been blocked", comment: "Alert message that informs a user was blocked.")
}
})
.alert("Create new mutelist", isPresented: $confirm_overwrite_mutelist, actions: {
Button("Yes, Overwrite") {
.alert(NSLocalizedString("Create new mutelist", comment: "Title of alert prompting the user to create a new mutelist."), isPresented: $confirm_overwrite_mutelist, actions: {
Button(NSLocalizedString("Cancel", comment: "Button to cancel out of alert that creates a new mutelist.")) {
confirm_overwrite_mutelist = false
confirm_block = false
}
Button(NSLocalizedString("Yes, Overwrite", comment: "Text of button that confirms to overwrite the existing mutelist.")) {
guard let ds = damus_state else {
return
}
@@ -472,20 +477,18 @@ struct ContentView: View {
confirm_block = false
user_blocked_confirm = true
}
Button("Cancel") {
confirm_overwrite_mutelist = false
}, message: {
Text("No block list found, create a new one? This will overwrite any previous block lists.", comment: "Alert message prompt that asks if the user wants to create a new block list, overwriting previous block lists.")
})
.alert(NSLocalizedString("Block User", comment: "Title of alert for blocking a user."), isPresented: $confirm_block, actions: {
Button(NSLocalizedString("Cancel", comment: "Alert button to cancel out of alert for blocking a user."), role: .cancel) {
confirm_block = false
}
}, message: {
Text("No block list found, create a new one? This will overwrite any previous block lists.")
})
.alert("Block User", isPresented: $confirm_block, actions: {
Button("Block") {
Button(NSLocalizedString("Block", comment: "Alert button to block a user."), role: .destructive) {
guard let ds = damus_state else {
return
}
if ds.contacts.mutelist == nil {
confirm_overwrite_mutelist = true
} else {
@@ -495,7 +498,7 @@ struct ContentView: View {
guard let pubkey = blocking else {
return
}
guard let ev = create_or_update_mutelist(keypair: keypair, mprev: ds.contacts.mutelist, to_add: pubkey) else {
return
}
@@ -503,17 +506,13 @@ struct ContentView: View {
ds.pool.send(.event(ev))
}
}
Button("Cancel") {
confirm_block = false
}
}, message: {
if let pubkey = blocking {
let profile = damus_state?.profiles.lookup(id: pubkey)
let name = Profile.displayName(profile: profile, pubkey: pubkey)
Text("Block \(name)?")
Text("Block \(name)?", comment: "Alert message prompt to ask if a user should be blocked.")
} else {
Text("Could not find user to block...")
Text("Could not find user to block...", comment: "Alert message to indicate that the blocked user could not be found.")
}
})
}

View File

@@ -139,10 +139,10 @@ struct ConfigView: View {
.navigationTitle(NSLocalizedString("Settings", comment: "Navigation title for Settings view."))
.navigationBarTitleDisplayMode(.large)
.alert(NSLocalizedString("Logout", comment: "Alert for logging out the user."), isPresented: $confirm_logout) {
Button(NSLocalizedString("Cancel", comment: "Cancel out of logging out the user.")) {
Button(NSLocalizedString("Cancel", comment: "Cancel out of logging out the user."), role: .cancel) {
confirm_logout = false
}
Button(NSLocalizedString("Logout", comment: "Button for logging out the user.")) {
Button(NSLocalizedString("Logout", comment: "Button for logging out the user."), role: .destructive) {
notify(.logout, ())
}
} message: {

View File

@@ -16,7 +16,7 @@ struct EULAView: View {
DamusGradient()
ScrollView {
Text("EULA")
Text("EULA", comment: "Label indicating that the below text is the EULA, an acronym for End User License Agreement.")
.font(.title.bold())
.foregroundColor(.white)
@@ -72,11 +72,11 @@ By using our Application, you signify your acceptance of this EULA. If you do no
NavigationLink(destination: CreateAccountView(), isActive: $creating_account) {
EmptyView()
}
DamusWhiteButton("Accept") {
DamusWhiteButton(NSLocalizedString("Accept", comment: "Button to accept the end user license agreement before being allowed into the app.")) {
creating_account = true
}
DamusWhiteButton("Reject") {
DamusWhiteButton(NSLocalizedString("Reject", comment: "Button to reject the end user license agreement, which disallows the user from being let into the app.")) {
dismiss()
}
}

View File

@@ -38,14 +38,14 @@ struct EventMenuContext: View {
Label(NSLocalizedString("Copy Note JSON", comment: "Context menu option for copying the JSON text from the note."), systemImage: "square.on.square")
}
Button {
Button(role: .destructive) {
let target: ReportTarget = .note(ReportNoteTarget(pubkey: event.pubkey, note_id: event.id))
notify(.report, target)
} label: {
Label(NSLocalizedString("Report", comment: "Context menu option for reporting content."), systemImage: "exclamationmark.bubble")
}
Button {
Button(role: .destructive) {
notify(.block, event.pubkey)
} label: {
Label(NSLocalizedString("Block", comment: "Context menu option for blocking users."), systemImage: "exclamationmark.octagon")

View File

@@ -43,7 +43,7 @@ struct MutelistView: View {
RemoveAction(pubkey: pubkey)
}
}
.navigationTitle("Blocked Users")
.navigationTitle(NSLocalizedString("Blocked Users", comment: "Navigation title of view to see list of blocked users."))
}
}

View File

@@ -374,17 +374,17 @@ struct ProfileView: View {
}
}
}
.confirmationDialog("Actions", isPresented: $action_sheet_presented) {
Button("Share") {
.confirmationDialog(NSLocalizedString("Actions", comment: "Title for confirmation dialog to either share, report, or block a profile."), isPresented: $action_sheet_presented) {
Button(NSLocalizedString("Share", comment: "Button to share the link to a profile.")) {
show_share_sheet = true
}
Button("Report") {
Button(NSLocalizedString("Report", comment: "Button to report a profile."), role: .destructive) {
let target: ReportTarget = .user(profile.pubkey)
notify(.report, target)
}
Button("Block") {
Button(NSLocalizedString("Block", comment: "Button to block a profile."), role: .destructive) {
notify(.block, profile.pubkey)
}
}

View File

@@ -25,16 +25,16 @@ struct ReportView: View {
var Success: some View {
VStack(alignment: .center, spacing: 20) {
Text("Report sent!")
Text("Report sent!", comment: "Message indicating that a report was successfully sent to relay servers.")
.font(.headline)
Text("Relays have been notified and clients will be able to use this information to filter content. Thank you!")
Text("Relays have been notified and clients will be able to use this information to filter content. Thank you!", comment: "Description of what was done as a result of sending a report to relay servers.")
Text("Report ID:")
Text("Report ID:", comment: "Label indicating that the text underneath is the identifier of the report that was sent to relay servers.")
Text(report_id)
Button("Copy Report ID") {
Button(NSLocalizedString("Copy Report ID", comment: "Button to copy report ID.")) {
UIPasteboard.general.string = report_id
let g = UIImpactFeedbackGenerator(style: .medium)
g.impactOccurred()
@@ -59,33 +59,33 @@ struct ReportView: View {
var MainForm: some View {
VStack {
Text("Report")
Text("Report", comment: "Label indicating that the current view is for the user to report content.")
.font(.headline)
.padding()
Form {
Section(content: {
Button("It's spam") {
Button(NSLocalizedString("It's spam", comment: "Button for user to report that the account or content has spam.")) {
do_send_report(type: .spam)
}
Button("Nudity or explicit content") {
Button(NSLocalizedString("Nudity or explicit content", comment: "Button for user to report that the account or content has nudity or explicit content.")) {
do_send_report(type: .explicit)
}
Button("Illegal content") {
Button(NSLocalizedString("Illegal content", comment: "Button for user to report that the account or content has illegal content.")) {
do_send_report(type: .illegal)
}
if case .user = target {
Button("They are impersonating someone") {
Button(NSLocalizedString("They are impersonating someone", comment: "Button for user to report that the account is impersonating someone.")) {
do_send_report(type: .impersonation)
}
}
}, header: {
Text("What do you want to report?")
Text("What do you want to report?", comment: "Header text to prompt user what issue they want to report.")
}, footer: {
Text("Your report will be sent to the relays you are connected to")
Text("Your report will be sent to the relays you are connected to", comment: "Footer text to inform user what will happen when the report is submitted.")
})
}
}

View File

@@ -148,10 +148,10 @@ struct SideMenuView: View {
isSidebarVisible.toggle()
}
.alert("Logout", isPresented: $confirm_logout) {
Button(NSLocalizedString("Cancel", comment: "Cancel out of logging out the user.")) {
Button(NSLocalizedString("Cancel", comment: "Cancel out of logging out the user."), role: .cancel) {
confirm_logout = false
}
Button(NSLocalizedString("Logout", comment: "Button for logging out the user.")) {
Button(NSLocalizedString("Logout", comment: "Button for logging out the user."), role: .destructive) {
notify(.logout, ())
}
} message: {