← All repositories

reportage

A life-logging app for iPhone

git clone https://code.inqk.net/reportage.git


commit 3f18b3b3895c646be97d64cdedfd158a1ba611ad
parent 189f5d9c7c9fb18983187a369f3ac4f5aa2abd4e
Author: Michael Camilleri <[email protected]>
Date:   Wed, 21 Oct 2026 12:24:01 +0900

Add delete button to Archived Question screen

Diffstat

MReportage/Views/Settings/QuestionsView.swift | 30++++++++++++++++--------------

1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/Reportage/Views/Settings/QuestionsView.swift b/Reportage/Views/Settings/QuestionsView.swift

@@ -312,7 +312,13 @@ private struct QuestionDetailView: View {
     }
 
     @ViewBuilder private var removal: some View {
-        if editor.archivedAt != nil {
+        // An unanswered question can be deleted even when archived, as the
+        // default questions are when a Reporter import replaces them.
+        if answerCount == 0 {
+            Section {
+                removeButton("Delete Question", role: .destructive) { isConfirmingDelete = true }
+            }
+        } else if editor.archivedAt != nil {
             Section {
                 SettingsNote {
                     Text(
@@ -322,19 +328,15 @@ private struct QuestionDetailView: View {
             }
         } else if let answerCount {
             Section {
-                if answerCount == 0 {
-                    removeButton("Delete Question", role: .destructive) { isConfirmingDelete = true }
-                } else {
-                    removeButton("Archive Question", role: nil) {
-                        editor.archive()
-                        commit()
-                        dismiss()
-                    }
-                    SettingsNote {
-                        Text(
-                            "This question can't be deleted because it's been answered in ^[\(answerCount) report](inflect: true). Archiving it stops it being asked and keeps those answers."
-                        )
-                    }
+                removeButton("Archive Question", role: nil) {
+                    editor.archive()
+                    commit()
+                    dismiss()
+                }
+                SettingsNote {
+                    Text(
+                        "This question can't be deleted because it's been answered in ^[\(answerCount) report](inflect: true). Archiving it stops it being asked and keeps those answers."
+                    )
                 }
             }
         }