Skip to content

Commit ef7e47d

Browse files
joeblauclaude
andauthored
feat: confirm before stopping a live broadcast (#27)
The toolbar stop button tore the broadcast down on the first tap, so a stray touch could drop the stream mid-session. When live, tapping stop now asks for confirmation with a destructive "Stop Broadcast" action and a "Keep Streaming" cancel; starting a broadcast is unchanged. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 48627d0 commit ef7e47d

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

Stream/ContentView.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ struct ContentView: View {
2020

2121
@State private var showingSettings = false
2222

23+
/// Gates the "Stop Broadcast" confirmation. A live stream is easy to kill by a
24+
/// stray tap on the toolbar's stop button, so tapping it while live asks first
25+
/// instead of tearing the broadcast down immediately.
26+
@State private var showingStopConfirmation = false
27+
2328
/// The mic gain to restore when the user un-mutes from the FAB. Captured the
2429
/// moment they mute so toggling back returns to their chosen level, not unity.
2530
@State private var preMuteVolume: Double = 1.0
@@ -76,6 +81,19 @@ struct ContentView: View {
7681
.sheet(isPresented: $showingSettings) { settingsSheet }
7782
}
7883
.task { chat.autoConnect() }
84+
.confirmationDialog(
85+
"Stop the broadcast?",
86+
isPresented: $showingStopConfirmation,
87+
titleVisibility: .visible
88+
) {
89+
Button("Stop Broadcast", role: .destructive) {
90+
Haptics.tap()
91+
capture.stop()
92+
}
93+
Button("Keep Streaming", role: .cancel) { }
94+
} message: {
95+
Text("You're live. Stopping ends the stream for everyone watching.")
96+
}
7997
.alert("Screen Capture", isPresented: Binding(
8098
get: { capture.errorMessage != nil },
8199
set: { if !$0 { capture.clearError() } }
@@ -93,7 +111,7 @@ struct ContentView: View {
93111
Button {
94112
Haptics.tap()
95113
if capture.isLive {
96-
capture.stop()
114+
showingStopConfirmation = true
97115
} else {
98116
persist()
99117
capture.presentPicker(settings: settings)

0 commit comments

Comments
 (0)