@ -12,14 +12,14 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
// MARK: C o m p o n e n t s
// MARK: C o m p o n e n t s
private lazy var apnsOptionView : OptionView = {
private lazy var apnsOptionView : OptionView = {
let explanation = " You’ ll be notified of new messages reliably and immediately using Apple’ s notification servers. The contents of your messages, and who you’ re messaging, are never exposed to Apple. "
let explanation = " You’ ll be notified of new messages reliably and immediately using Apple’ s 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
// S e t u p e x p l a n a t i o n l a b e l
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
// S e t u p s p a c e r s
// S e t u p s p a c e r s
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
// S e t u p t o p s t a c k v i e w
// S e t u p t o p s t a c k v i e w
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
// S e t u p t o p s t a c k v i e w c o n t a i n e r
// S e t u p t o p s t a c k v i e w c o n t a i n e r
@ -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
// P r e s e l e c t A P N s m o d e
optionViews [ 0 ] . isSelected = true
}
}
// MARK: I n t e r a c t i o n
// MARK: I n t e r a c t i o n