More Polls UI polish
This commit is contained in:
parent
43432a4d2d
commit
bd862eae0e
@ -607,11 +607,10 @@ public class CVPollView: ManualStackView {
|
||||
let checkMark = UIImageView(image: UIImage(named: Theme.iconName(.checkmark)))
|
||||
checkbox.addSubview(spinningEllipse, withLayoutBlock: { [weak self] _ in
|
||||
guard let self else { return }
|
||||
spinningEllipse.frame = checkbox.bounds
|
||||
spinView(view: spinningEllipse)
|
||||
checkMark.frame = CGRect(
|
||||
x: (checkbox.bounds.width - 15) / 2,
|
||||
y: (checkbox.bounds.height - 15) / 2,
|
||||
x: (spinningEllipse.frame.width - 15) / 2,
|
||||
y: (spinningEllipse.frame.height - 15) / 2,
|
||||
width: 15,
|
||||
height: 15
|
||||
)
|
||||
@ -638,7 +637,9 @@ public class CVPollView: ManualStackView {
|
||||
|
||||
switch localUserVoteState {
|
||||
case .vote:
|
||||
checkbox.addSubview(UIImageView(image: UIImage(named: Theme.iconName(.checkCircleFill))))
|
||||
let checkMarkCircle = UIImageView(image: UIImage(named: Theme.iconName(.checkCircleFill)))
|
||||
checkbox.addSubview(checkMarkCircle)
|
||||
|
||||
checkbox.tintColor = configurator.colorConfigurator.checkboxSelectedColor
|
||||
case .pendingVote, .pendingUnvote:
|
||||
displayPendingUI(type: localUserVoteState)
|
||||
|
||||
15
Signal/Symbols.xcassets/arrow/arrow-up-30.imageset/Contents.json
vendored
Normal file
15
Signal/Symbols.xcassets/arrow/arrow-up-30.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "arrow-up-30.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
BIN
Signal/Symbols.xcassets/arrow/arrow-up-30.imageset/arrow-up-30.pdf
vendored
Normal file
BIN
Signal/Symbols.xcassets/arrow/arrow-up-30.imageset/arrow-up-30.pdf
vendored
Normal file
Binary file not shown.
15
Signal/Symbols.xcassets/x/x-26.imageset/Contents.json
vendored
Normal file
15
Signal/Symbols.xcassets/x/x-26.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "x26.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
BIN
Signal/Symbols.xcassets/x/x-26.imageset/x26.pdf
vendored
Normal file
BIN
Signal/Symbols.xcassets/x/x-26.imageset/x26.pdf
vendored
Normal file
Binary file not shown.
@ -190,6 +190,11 @@ struct NewPollView: View {
|
||||
.onAppear {
|
||||
focusQuestionField = true
|
||||
}
|
||||
.onSubmit {
|
||||
if let nextBlankRow = findFirstBlankRow() {
|
||||
focusedItemID = nextBlankRow.id
|
||||
}
|
||||
}
|
||||
} header: {
|
||||
Text(
|
||||
OWSLocalizedString(
|
||||
@ -212,6 +217,11 @@ struct NewPollView: View {
|
||||
option.text = ""
|
||||
}
|
||||
}
|
||||
.onSubmit {
|
||||
if let nextBlankRow = findFirstBlankRow() {
|
||||
focusedItemID = nextBlankRow.id
|
||||
}
|
||||
}
|
||||
.focused($focusedItemID, equals: option.id)
|
||||
}
|
||||
.onMove(perform: { from, to in
|
||||
@ -254,9 +264,10 @@ struct NewPollView: View {
|
||||
Button(action: {
|
||||
viewModel.onDismiss()
|
||||
}) {
|
||||
Image(Theme.iconName(.xBold))
|
||||
Image(Theme.iconName(.x26))
|
||||
}
|
||||
.accessibilityLabel(CommonStrings.cancelButton)
|
||||
.foregroundColor(Color.Signal.label)
|
||||
} else {
|
||||
Button(CommonStrings.cancelButton, action: {
|
||||
viewModel.onDismiss()
|
||||
@ -273,7 +284,8 @@ struct NewPollView: View {
|
||||
Button(action: {
|
||||
sendButtonPressed(sendButtonEnabled: sendButtonEnabled)
|
||||
}) {
|
||||
Image(Theme.iconName(.arrowUp))
|
||||
Image(Theme.iconName(.arrowUp30))
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
.accessibilityLabel(MessageStrings.sendButton)
|
||||
.tint(Color.Signal.ultramarine)
|
||||
@ -292,6 +304,15 @@ struct NewPollView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func findFirstBlankRow() -> NewOption? {
|
||||
for option in pollOptions {
|
||||
if option.text.isEmpty {
|
||||
return option
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
private func sendButtonPressed(sendButtonEnabled: Bool) {
|
||||
if sendButtonEnabled {
|
||||
viewModel.onSend(
|
||||
|
||||
@ -76,6 +76,13 @@ struct PollDetailsView: View {
|
||||
Text(poll.question)
|
||||
.font(.body)
|
||||
.foregroundColor(Color.Signal.label)
|
||||
} header: {
|
||||
Text(
|
||||
OWSLocalizedString(
|
||||
"POLL_QUESTION_LABEL",
|
||||
comment: "Header for the poll question text box when making a new poll"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if !poll.isEnded, poll.ownerIsLocalUser {
|
||||
@ -137,14 +144,15 @@ struct PollDetailsView: View {
|
||||
}
|
||||
.navigationTitle(titleString)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarLeading) {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
if #available(iOS 26.0, *) {
|
||||
Button(action: {
|
||||
viewModel.onDismiss()
|
||||
}) {
|
||||
Image(Theme.iconName(.xBold))
|
||||
Image(Theme.iconName(.x26))
|
||||
}
|
||||
.accessibilityLabel(CommonStrings.doneButton)
|
||||
.foregroundColor(Color.Signal.label)
|
||||
} else {
|
||||
Button(CommonStrings.doneButton, action: {
|
||||
viewModel.onDismiss()
|
||||
|
||||
@ -69,11 +69,13 @@ public enum ThemeIcon: UInt {
|
||||
case checkCircleFill
|
||||
case xCircle
|
||||
case xBold
|
||||
case x26
|
||||
case checkmark
|
||||
case checkmarkBold
|
||||
case circle
|
||||
case arrowDown
|
||||
case arrowUp
|
||||
case arrowUp30
|
||||
case arrowRight
|
||||
case chevronUp
|
||||
case chevronDown
|
||||
@ -339,6 +341,8 @@ public extension Theme {
|
||||
return "x-circle"
|
||||
case .xBold:
|
||||
return "x-bold"
|
||||
case .x26:
|
||||
return "x-26"
|
||||
case .checkmark:
|
||||
return "check"
|
||||
case .checkmarkBold:
|
||||
@ -349,6 +353,8 @@ public extension Theme {
|
||||
return "arrow-down"
|
||||
case .arrowUp:
|
||||
return "arrow-up"
|
||||
case .arrowUp30:
|
||||
return "arrow-up-30"
|
||||
case .arrowRight:
|
||||
return "arrow-right"
|
||||
case .chevronUp:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user