Clean up onboarding

This commit is contained in:
Niels Andriesse 2021-04-29 16:30:39 +10:00
parent a9dcf93474
commit 06e4672a12
2 changed files with 6 additions and 12 deletions

View File

@ -12,14 +12,14 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
// MARK: Components // MARK: Components
private lazy var apnsOptionView: OptionView = { private lazy var apnsOptionView: OptionView = {
let explanation = "Youll be notified of new messages reliably and immediately using Apples notification servers. The contents of your messages, and who youre messaging, are never exposed to Apple." let explanation = "Youll be notified of new messages reliably and immediately using Apples notification servers."
let result = OptionView(title: "Fast Mode", explanation: explanation, delegate: self, isRecommended: true) let result = OptionView(title: "Fast Mode", explanation: explanation, delegate: self, isRecommended: true)
result.accessibilityLabel = "Fast mode option" result.accessibilityLabel = "Fast mode option"
return result return result
}() }()
private lazy var backgroundPollingOptionView: OptionView = { private lazy var backgroundPollingOptionView: OptionView = {
let explanation = "Session will occasionally check for new messages in the background. Full metadata protection is guaranteed, but message notifications will be unreliable." let explanation = "Session will occasionally check for new messages in the background."
let result = OptionView(title: "Slow Mode", explanation: explanation, delegate: self) let result = OptionView(title: "Slow Mode", explanation: explanation, delegate: self)
result.accessibilityLabel = "Slow mode option" result.accessibilityLabel = "Slow mode option"
return result return result
@ -41,13 +41,6 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
titleLabel.text = "Message Notifications" titleLabel.text = "Message Notifications"
titleLabel.numberOfLines = 0 titleLabel.numberOfLines = 0
titleLabel.lineBreakMode = .byWordWrapping titleLabel.lineBreakMode = .byWordWrapping
// Set up explanation label
let explanationLabel = UILabel()
explanationLabel.textColor = Colors.text
explanationLabel.font = .systemFont(ofSize: Values.smallFontSize)
explanationLabel.text = "There are two ways Session can notify you of new messages."
explanationLabel.numberOfLines = 0
explanationLabel.lineBreakMode = .byWordWrapping
// Set up spacers // Set up spacers
let topSpacer = UIView.vStretchingSpacer() let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer() let bottomSpacer = UIView.vStretchingSpacer()
@ -66,8 +59,7 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
optionsStackView.spacing = Values.smallSpacing optionsStackView.spacing = Values.smallSpacing
optionsStackView.alignment = .fill optionsStackView.alignment = .fill
// Set up top stack view // Set up top stack view
let topStackView = UIStackView(arrangedSubviews: [ titleLabel, UIView.spacer(withHeight: isIPhone6OrSmaller ? Values.mediumSpacing : Values.veryLargeSpacing), let topStackView = UIStackView(arrangedSubviews: [ titleLabel, UIView.spacer(withHeight: isIPhone6OrSmaller ? Values.mediumSpacing : Values.veryLargeSpacing), optionsStackView ])
explanationLabel, UIView.spacer(withHeight: isIPhone6OrSmaller ? Values.mediumSpacing : Values.veryLargeSpacing), optionsStackView ])
topStackView.axis = .vertical topStackView.axis = .vertical
topStackView.alignment = .fill topStackView.alignment = .fill
// Set up top stack view container // Set up top stack view container
@ -79,6 +71,8 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
view.addSubview(mainStackView) view.addSubview(mainStackView)
mainStackView.pin(to: view) mainStackView.pin(to: view)
topSpacer.heightAnchor.constraint(equalTo: bottomSpacer.heightAnchor, multiplier: 1).isActive = true topSpacer.heightAnchor.constraint(equalTo: bottomSpacer.heightAnchor, multiplier: 1).isActive = true
// Preselect APNs mode
optionViews[0].isSelected = true
} }
// MARK: Interaction // MARK: Interaction

View File

@ -54,7 +54,7 @@
} }
target:weakSelf target:weakSelf
selector:@selector(didToggleAPNsSwitch:)]]; selector:@selector(didToggleAPNsSwitch:)]];
strategySection.footerTitle = @"Youll be notified of new messages reliably and immediately using Apples notification servers. The contents of your messages, and who youre messaging, are never exposed to Apple."; strategySection.footerTitle = @"Youll be notified of new messages reliably and immediately using Apples notification servers.";
[contents addSection:strategySection]; [contents addSection:strategySection];
// Sounds section. // Sounds section.