mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Polls refinements (#1608)
* Refine focus behavior * Begin draft mode * Add alert on poll form * Add poll ended asset * Add fallback text for ended poll event * Cleanup * Fix assets * Remove poll feature flags * Fix UI tests * Fix ui tests * Refine discard poll alert * Remove unused import * Rename hasDraftContent -> hasContent * Restore createPoll-2 ref screenshots
This commit is contained in:
@@ -39,6 +39,8 @@ struct CreatePollScreen: View {
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar { toolbar }
|
||||
.animation(.elementDefault, value: context.options)
|
||||
.interactiveDismissDisabled(context.viewState.bindings.hasContent)
|
||||
.alert(item: $context.alertInfo)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
@@ -55,6 +57,10 @@ struct CreatePollScreen: View {
|
||||
.textFieldStyle(.compoundForm)
|
||||
.focused($focus, equals: .question)
|
||||
.accessibilityIdentifier(A11yIdentifiers.createPollScreen.question)
|
||||
.onSubmit {
|
||||
focus = context.options.indices.first.map { .option(index: $0) }
|
||||
}
|
||||
.submitLabel(.next)
|
||||
}
|
||||
.compoundFormSection()
|
||||
}
|
||||
@@ -74,6 +80,11 @@ struct CreatePollScreen: View {
|
||||
}
|
||||
.focused($focus, equals: .option(index: index))
|
||||
.accessibilityIdentifier(A11yIdentifiers.createPollScreen.optionID(index))
|
||||
.onSubmit {
|
||||
let nextOptionIndex = index == context.options.endIndex - 1 ? nil : index + 1
|
||||
focus = nextOptionIndex.map { .option(index: $0) }
|
||||
}
|
||||
.submitLabel(index == context.options.endIndex - 1 ? .done : .next)
|
||||
}
|
||||
}
|
||||
.onMove { offsets, toOffset in
|
||||
@@ -83,6 +94,7 @@ struct CreatePollScreen: View {
|
||||
if context.options.count < context.viewState.maxNumberOfOptions {
|
||||
Button(L10n.screenCreatePollAddOptionBtn) {
|
||||
context.send(viewAction: .addOption)
|
||||
focus = context.options.indices.last.map { .option(index: $0) }
|
||||
}
|
||||
.accessibilityIdentifier(A11yIdentifiers.createPollScreen.addOption)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user