@ -12,10 +12,7 @@ public class OnboardingPermissionsViewController: OnboardingBaseViewController {
super . loadView ( )
view . backgroundColor = Theme . backgroundColor
view . layoutMargins = UIEdgeInsets ( top : 32 , left : 32 , bottom : 32 , right : 32 )
// TODO:
// n a v i g a t i o n I t e m . t i t l e = N S L o c a l i z e d S t r i n g ( " S E T T I N G S _ B A C K U P " , c o m m e n t : " L a b e l f o r t h e b a c k u p v i e w i n a p p s e t t i n g s . " )
view . layoutMargins = . zero
navigationItem . rightBarButtonItem = UIBarButtonItem ( title : NSLocalizedString ( " NAVIGATION_ITEM_SKIP_BUTTON " , comment : " A button to skip a view. " ) ,
style : . plain ,
@ -23,46 +20,42 @@ public class OnboardingPermissionsViewController: OnboardingBaseViewController {
action : #selector ( skipWasPressed ) )
let titleLabel = self . titleLabel ( text : NSLocalizedString ( " ONBOARDING_PERMISSIONS_TITLE " , comment : " Title of the 'onboarding permissions' view. " ) )
view . addSubview ( titleLabel )
titleLabel . autoPinEdges ( toSuperviewMarginsExcludingEdge : . bottom )
// TODO: F i n a l i z e c o p y .
let explanationLabel = self . explanationLabel ( explanationText : NSLocalizedString ( " ONBOARDING_PERMISSIONS_EXPLANATION " ,
comment : " Explanation in the 'onboarding permissions' view. " ) ,
linkText : NSLocalizedString ( " ONBOARDING_PERMISSIONS_LEARN_MORE_LINK " ,
comment : " Link to the 'learn more' in the 'onboarding permissions' view. " ) ,
selector : #selector ( explanationLabelTapped ) )
comment : " Explanation in the 'onboarding permissions' view. " ) )
// TODO: M a k e s u r e t h i s a l l f i t s i f d y n a m i c f o n t s i z e s a r e m a x e d o u t .
let giveAccessButton = self . button ( title : NSLocalizedString ( " ONBOARDING_PERMISSIONS_ GIVE_ACCES S_BUTTON" ,
let giveAccessButton = self . button ( title : NSLocalizedString ( " ONBOARDING_PERMISSIONS_ENABLE_PERMISSIONS_BUTTON " ,
comment : " Label for the 'give access' button in the 'onboarding permissions' view. " ) ,
selector : #selector ( giveAccessPressed ) )
let notNowButton = self . b utton( title : NSLocalizedString ( " ONBOARDING_PERMISSIONS_NOT_NOW_BUTTON " ,
comment : " Label for the 'not now' button in the 'onboarding permissions' view. " ) ,
let notNowButton = self . linkB utton( title : NSLocalizedString ( " ONBOARDING_PERMISSIONS_NOT_NOW_BUTTON " ,
comment : " Label for the 'not now' button in the 'onboarding permissions' view. " ) ,
selector : #selector ( notNowPressed ) )
let buttonStack = UIStackView ( arrangedSubviews : [
giveAccessButton ,
notNowButton
] )
buttonStack . axis = . vertical
buttonStack . alignment = . fill
buttonStack . spacing = 12
let topSpacer = UIView . vStretchingSpacer ( )
let bottomSpacer = UIView . vStretchingSpacer ( )
let stackView = UIStackView ( arrangedSubviews : [
titleLabel ,
UIView . spacer ( withHeight : 20 ) ,
explanationLabel ,
buttonStack
topSpacer ,
giveAccessButton ,
UIView . spacer ( withHeight : 12 ) ,
notNowButton ,
bottomSpacer
] )
stackView . axis = . vertical
stackView . alignment = . fill
stackView . spacing = 40
stackView . layoutMargins = UIEdgeInsets ( top : 32 , left : 32 , bottom : 32 , right : 32 )
stackView . isLayoutMarginsRelativeArrangement = true
view . addSubview ( stackView )
stackView . autoPinWidthToSuperviewMargins ( )
stackView . autoPinEdge ( . top , to : . bottom , of : titleLabel , withOffset : 20 , relation : . greaterThanOrEqual )
NSLayoutConstraint . autoSetPriority ( . defaultHigh ) {
stackView . autoVCenterInSuperview ( )
}
stackView . autoPinWidthToSuperview ( )
stackView . autoPin ( toTopLayoutGuideOf : self , withInset : 0 )
stackView . autoPin ( toBottomLayoutGuideOf : self , withInset : 0 )
// E n s u r e w h i t e s p a c e i s b a l a n c e d , s o i n p u t s a r e v e r t i c a l l y c e n t e r e d .
topSpacer . autoMatch ( . height , to : . height , of : bottomSpacer )
}
// MARK: R e q u e s t A c c e s s
@ -105,13 +98,6 @@ public class OnboardingPermissionsViewController: OnboardingBaseViewController {
onboardingController . onboardingPermissionsWasSkipped ( viewController : self )
}
@objc func explanationLabelTapped ( sender : UIGestureRecognizer ) {
guard sender . state = = . recognized else {
return
}
// TODO:
}
@objc func giveAccessPressed ( ) {
Logger . info ( " " )