feat: restore compose poll expire option
This commit is contained in:
parent
0a3f19bdd3
commit
b12825a96a
|
@ -39,6 +39,7 @@ public final class ComposeContentViewModel: NSObject, ObservableObject {
|
||||||
options.append(PollComposeItem.Option())
|
options.append(PollComposeItem.Option())
|
||||||
return options
|
return options
|
||||||
}()
|
}()
|
||||||
|
@Published public var pollExpireConfigurationOption: PollComposeItem.ExpireConfiguration.Option = .oneDay
|
||||||
@Published public var maxPollOptionLimit = 4
|
@Published public var maxPollOptionLimit = 4
|
||||||
|
|
||||||
@Published var isEmojiActive = false
|
@Published var isEmojiActive = false
|
||||||
|
|
|
@ -56,7 +56,11 @@ public struct ComposeContentView: View {
|
||||||
}
|
}
|
||||||
.onPreferenceChange(ViewFramePreferenceKey.self) { frame in
|
.onPreferenceChange(ViewFramePreferenceKey.self) { frame in
|
||||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): content frame: \(frame.debugDescription)")
|
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): content frame: \(frame.debugDescription)")
|
||||||
viewModel.contentCellFrame = frame
|
let rect = frame.standardized
|
||||||
|
viewModel.contentCellFrame = CGRect(
|
||||||
|
origin: frame.origin,
|
||||||
|
size: CGSize(width: floor(rect.width), height: floor(rect.height))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Spacer()
|
Spacer()
|
||||||
|
@ -113,58 +117,23 @@ extension ComposeContentView {
|
||||||
viewModel.createNewPollOptionIfCould()
|
viewModel.createNewPollOptionIfCould()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
VStack(spacing: .zero) {
|
|
||||||
// expire configuration
|
|
||||||
Menu {
|
Menu {
|
||||||
|
Picker(selection: $viewModel.pollExpireConfigurationOption) {
|
||||||
ForEach(PollComposeItem.ExpireConfiguration.Option.allCases, id: \.self) { option in
|
ForEach(PollComposeItem.ExpireConfiguration.Option.allCases, id: \.self) { option in
|
||||||
Button {
|
|
||||||
// viewModel.pollExpireConfiguration.option = option
|
|
||||||
// viewModel.pollExpireConfiguration = viewModel.pollExpireConfiguration
|
|
||||||
} label: {
|
|
||||||
Text(option.title)
|
Text(option.title)
|
||||||
}
|
}
|
||||||
|
} label: {
|
||||||
|
Text(L10n.Scene.Compose.Poll.durationTime(viewModel.pollExpireConfigurationOption.title))
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
HStack {
|
HStack {
|
||||||
// VectorImageView(
|
Text(L10n.Scene.Compose.Poll.durationTime(viewModel.pollExpireConfigurationOption.title))
|
||||||
// image: Asset.ObjectTools.clock.image.withRenderingMode(.alwaysTemplate),
|
.foregroundColor(Color(UIColor.label.withAlphaComponent(0.8))) // Gray/800
|
||||||
// tintColor: .secondaryLabel
|
.font(Font(UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .systemFont(ofSize: 13, weight: .semibold))))
|
||||||
// )
|
Spacer()
|
||||||
// .frame(width: 24, height: 24)
|
|
||||||
// .padding(.vertical, 12)
|
|
||||||
// let text = viewModel.pollExpireConfigurationFormatter.string(from: TimeInterval(viewModel.pollExpireConfiguration.option.seconds)) ?? "-"
|
|
||||||
// Text(text)
|
|
||||||
// .font(.callout)
|
|
||||||
// .foregroundColor(.primary)
|
|
||||||
// Spacer()
|
|
||||||
// VectorImageView(
|
|
||||||
// image: Asset.Arrows.tablerChevronDown.image.withRenderingMode(.alwaysTemplate),
|
|
||||||
// tintColor: .secondaryLabel
|
|
||||||
// )
|
|
||||||
// .frame(width: 24, height: 24)
|
|
||||||
// .padding(.vertical, 12)
|
|
||||||
}
|
}
|
||||||
|
.padding(.vertical, 8)
|
||||||
}
|
}
|
||||||
// multi-selection configuration
|
|
||||||
// Button {
|
|
||||||
// viewModel.pollMultipleConfiguration.isMultiple.toggle()
|
|
||||||
// viewModel.pollMultipleConfiguration = viewModel.pollMultipleConfiguration
|
|
||||||
// } label: {
|
|
||||||
// HStack {
|
|
||||||
// let selectionImage = viewModel.pollMultipleConfiguration.isMultiple ? Asset.Indices.checkmarkSquare.image.withRenderingMode(.alwaysTemplate) : Asset.Indices.square.image.withRenderingMode(.alwaysTemplate)
|
|
||||||
// VectorImageView(
|
|
||||||
// image: selectionImage,
|
|
||||||
// tintColor: .secondaryLabel
|
|
||||||
// )
|
|
||||||
// .frame(width: 24, height: 24)
|
|
||||||
// .padding(.vertical, 12)
|
|
||||||
// Text(L10n.Scene.Compose.Vote.multiple)
|
|
||||||
// .font(.callout)
|
|
||||||
// .foregroundColor(.primary)
|
|
||||||
// Spacer()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
} // end VStack
|
} // end VStack
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue