Fix compose poll durations not being set/persisted

This commit is contained in:
Shadowfacts 2021-05-06 21:52:14 -04:00
parent f7127b84d8
commit 2c9f00d19f
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 4 additions and 5 deletions

View File

@ -22,11 +22,7 @@ struct ComposePollView: View {
@Environment(\.colorScheme) var colorScheme: ColorScheme
@State private var duration: Duration {
didSet {
poll.duration = duration.timeInterval
}
}
@State private var duration: Duration
init(draft: Draft, poll: Draft.Poll) {
self.draft = draft
@ -84,6 +80,9 @@ struct ComposePollView: View {
backgroundColor
.cornerRadius(10)
)
.onChange(of: duration, perform: { (value) in
poll.duration = value.timeInterval
})
}
private var backgroundColor: Color {