@ -21,6 +21,21 @@ final class PublicKeyVC : UIViewController {
return result
return result
} ( )
} ( )
private lazy var legalLabel : UILabel = {
let result = UILabel ( )
result . textColor = Colors . text
result . font = . systemFont ( ofSize : Values . verySmallFontSize )
let text = " By using this service, you agree to our Terms and Conditions and Privacy Statement "
let attributedText = NSMutableAttributedString ( string : text )
attributedText . addAttribute ( . font , value : UIFont . boldSystemFont ( ofSize : Values . verySmallFontSize ) , range : ( text as NSString ) . range ( of : " Terms and Conditions " ) )
attributedText . addAttribute ( . font , value : UIFont . boldSystemFont ( ofSize : Values . verySmallFontSize ) , range : ( text as NSString ) . range ( of : " Privacy Statement " ) )
result . attributedText = attributedText
result . numberOfLines = 0
result . textAlignment = . center
result . lineBreakMode = . byWordWrapping
return result
} ( )
// MARK: S e t t i n g s
// MARK: S e t t i n g s
override var preferredStatusBarStyle : UIStatusBarStyle { return . lightContent }
override var preferredStatusBarStyle : UIStatusBarStyle { return . lightContent }
@ -85,18 +100,17 @@ final class PublicKeyVC : UIViewController {
buttonStackViewContainer . pin ( . trailing , to : . trailing , of : buttonStackView , withInset : Values . massiveSpacing )
buttonStackViewContainer . pin ( . trailing , to : . trailing , of : buttonStackView , withInset : Values . massiveSpacing )
buttonStackViewContainer . pin ( . bottom , to : . bottom , of : buttonStackView )
buttonStackViewContainer . pin ( . bottom , to : . bottom , of : buttonStackView )
// S e t u p l e g a l l a b e l
// S e t u p l e g a l l a b e l
let legalLabel = UILabel ( )
legalLabel . isUserInteractionEnabled = true
legalLabel . set ( . height , to : Values . onboardingButtonBottomOffset )
let tapGestureRecognizer = UITapGestureRecognizer ( target : self , action : #selector ( handleLegalLabelTapped ) )
legalLabel . textColor = Colors . text
legalLabel . addGestureRecognizer ( tapGestureRecognizer )
legalLabel . font = . systemFont ( ofSize : Values . verySmallFontSize )
// S e t u p l e g a l l a b e l c o n t a i n e r
let legalLabelText = " By using this service, you agree to our Terms and Conditions and Privacy Statement "
let legalLabelContainer = UIView ( )
let attributedLegalLabelText = NSMutableAttributedString ( string : legalLabelText )
legalLabelContainer . set ( . height , to : Values . onboardingButtonBottomOffset )
attributedLegalLabelText . addAttribute ( . font , value : UIFont . boldSystemFont ( ofSize : Values . verySmallFontSize ) , range : ( legalLabelText as NSString ) . range ( of : " Terms and Conditions " ) )
legalLabelContainer . addSubview ( legalLabel )
attributedLegalLabelText . addAttribute ( . font , value : UIFont . boldSystemFont ( ofSize : Values . verySmallFontSize ) , range : ( legalLabelText as NSString ) . range ( of : " Privacy Statement " ) )
legalLabel . pin ( . leading , to : . leading , of : legalLabelContainer , withInset : Values . massiveSpacing )
legalLabel . attributedText = attributedLegalLabelText
legalLabel . pin ( . top , to : . top , of : legalLabelContainer )
legalLabel . numberOfLines = 0
legalLabelContainer . pin ( . trailing , to : . trailing , of : legalLabel , withInset : Values . massiveSpacing )
legalLabel . textAlignment = . center
legalLabelContainer . pin ( . bottom , to : . bottom , of : legalLabel , withInset : 10 )
legalLabel . lineBreakMode = . byWordWrapping
// 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 , explanationLabel , publicKeyLabelContainer ] )
let topStackView = UIStackView ( arrangedSubviews : [ titleLabel , explanationLabel , publicKeyLabelContainer ] )
topStackView . axis = . vertical
topStackView . axis = . vertical
@ -110,7 +124,7 @@ final class PublicKeyVC : UIViewController {
topStackViewContainer . pin ( . trailing , to : . trailing , of : topStackView , withInset : Values . veryLargeSpacing )
topStackViewContainer . pin ( . trailing , to : . trailing , of : topStackView , withInset : Values . veryLargeSpacing )
topStackViewContainer . pin ( . bottom , to : . bottom , of : topStackView )
topStackViewContainer . pin ( . bottom , to : . bottom , of : topStackView )
// S e t u p m a i n s t a c k v i e w
// S e t u p m a i n s t a c k v i e w
let mainStackView = UIStackView ( arrangedSubviews : [ topSpacer , topStackViewContainer , bottomSpacer , buttonStackViewContainer , legalLabel ] )
let mainStackView = UIStackView ( arrangedSubviews : [ topSpacer , topStackViewContainer , bottomSpacer , buttonStackViewContainer , legalLabel Container ] )
mainStackView . axis = . vertical
mainStackView . axis = . vertical
mainStackView . alignment = . fill
mainStackView . alignment = . fill
view . addSubview ( mainStackView )
view . addSubview ( mainStackView )
@ -164,4 +178,9 @@ final class PublicKeyVC : UIViewController {
} , completion : nil )
} , completion : nil )
Timer . scheduledTimer ( timeInterval : 4 , target : self , selector : #selector ( enableCopyButton ) , userInfo : nil , repeats : false )
Timer . scheduledTimer ( timeInterval : 4 , target : self , selector : #selector ( enableCopyButton ) , userInfo : nil , repeats : false )
}
}
@objc private func handleLegalLabelTapped ( _ tapGestureRecognizer : UITapGestureRecognizer ) {
let url = URL ( string : " https://github.com/loki-project/loki-messenger-ios/blob/master/privacy-policy.md " ) !
UIApplication . shared . open ( url )
}
}
}