@ -7,7 +7,7 @@ import SignalMessaging
private class IntroducingCustomNotificationAudioExperienceUpgradeViewController : ExperienceUpgradeViewController {
var b uttonAction: ( ( UIButton ) -> Void ) ?
var primaryB uttonAction: ( ( UIButton ) -> Void ) ?
override func loadView ( ) {
self . view = UIView . container ( )
@ -41,7 +41,7 @@ private class IntroducingCustomNotificationAudioExperienceUpgradeViewController:
imageView . contentMode = . scaleAspectFit
let buttonTitle = NSLocalizedString ( " UPGRADE_EXPERIENCE_INTRODUCING_NOTIFICATION_AUDIO_SETTINGS_BUTTON " , comment : " button label shown one time, after upgrade " )
let button = add Button( title : buttonTitle ) { _ in
let button = add Primary Button( title : buttonTitle ) { _ in
// d i s m i s s t h e m o d a l l y p r e s e n t e d v i e w c o n t r o l l e r , t h e n p r o c e e d .
self . experienceUpgradesPageViewController . dismiss ( animated : true ) {
guard let fromViewController = UIApplication . shared . frontmostViewController else {
@ -89,8 +89,8 @@ private class IntroducingCustomNotificationAudioExperienceUpgradeViewController:
// MARK: - A c t i o n s
func add Button( title : String , action : @ escaping ( UIButton ) -> Void ) -> UIButton {
self . b uttonAction = action
func add Primary Button( title : String , action : @ escaping ( UIButton ) -> Void ) -> UIButton {
self . primaryB uttonAction = action
let button = MultiLineButton ( )
view . addSubview ( button )
button . setTitle ( title , for : . normal )
@ -106,18 +106,18 @@ private class IntroducingCustomNotificationAudioExperienceUpgradeViewController:
@objc func didTapButton ( sender : UIButton ) {
Logger . debug ( " " )
guard let buttonAction = self . b uttonAction else {
guard let primaryButtonAction = self . primaryB uttonAction else {
owsFailDebug ( " button action was nil " )
return
}
b uttonAction( sender )
primaryB uttonAction( sender )
}
}
private class IntroductingReadReceiptsExperienceUpgradeViewController : ExperienceUpgradeViewController {
var b uttonAction: ( ( UIButton ) -> Void ) ?
var primaryB uttonAction: ( ( UIButton ) -> Void ) ?
override func loadView ( ) {
self . view = UIView . container ( )
@ -151,7 +151,7 @@ private class IntroductingReadReceiptsExperienceUpgradeViewController: Experienc
imageView . contentMode = . scaleAspectFit
let buttonTitle = NSLocalizedString ( " UPGRADE_EXPERIENCE_INTRODUCING_READ_RECEIPTS_PRIVACY_SETTINGS " , comment : " button label shown one time, after upgrade " )
let button = add Button( title : buttonTitle ) { _ in
let button = add Primary Button( title : buttonTitle ) { _ in
// d i s m i s s t h e m o d a l l y p r e s e n t e d v i e w c o n t r o l l e r , t h e n p r o c e e d .
self . experienceUpgradesPageViewController . dismiss ( animated : true ) {
guard let fromViewController = UIApplication . shared . frontmostViewController as ? HomeViewController else {
@ -199,8 +199,8 @@ private class IntroductingReadReceiptsExperienceUpgradeViewController: Experienc
// MARK: - A c t i o n s
func add Button( title : String , action : @ escaping ( UIButton ) -> Void ) -> UIButton {
self . b uttonAction = action
func add Primary Button( title : String , action : @ escaping ( UIButton ) -> Void ) -> UIButton {
self . primaryB uttonAction = action
let button = MultiLineButton ( )
view . addSubview ( button )
button . setTitle ( title , for : . normal )
@ -216,18 +216,22 @@ private class IntroductingReadReceiptsExperienceUpgradeViewController: Experienc
@objc func didTapButton ( sender : UIButton ) {
Logger . debug ( " " )
guard let buttonAction = self . b uttonAction else {
guard let primaryButtonAction = self . primaryB uttonAction else {
owsFailDebug ( " button action was nil " )
return
}
b uttonAction( sender )
primaryB uttonAction( sender )
}
}
private class IntroductingTypingIndicatorsExperienceUpgradeViewController : ExperienceUpgradeViewController {
var buttonAction : ( ( UIButton ) -> Void ) ?
var primaryButtonAction : ( ( UIButton ) -> Void ) ?
var typingIndicators : TypingIndicators {
return SSKEnvironment . shared . typingIndicators
}
override func loadView ( ) {
self . view = UIView . container ( )
@ -270,21 +274,10 @@ private class IntroductingTypingIndicatorsExperienceUpgradeViewController: Exper
view . addSubview ( imageView )
imageView . contentMode = . scaleAspectFit
let buttonTitle = NSLocalizedString ( " UPGRADE_EXPERIENCE_INTRODUCING_TYPING_INDICATOR_PRIVACY_SETTINGS " , comment : " button label shown one time, after upgrade " )
let button = addButton ( title : buttonTitle ) { _ in
// d i s m i s s t h e m o d a l l y p r e s e n t e d v i e w c o n t r o l l e r , t h e n p r o c e e d .
self . experienceUpgradesPageViewController . dismiss ( animated : true ) {
guard let fromViewController = UIApplication . shared . frontmostViewController as ? HomeViewController else {
owsFailDebug ( " unexpected frontmostViewController: \( String ( describing : UIApplication . shared . frontmostViewController ) ) " )
return
}
// C o n s t r u c t t h e " s e t t i n g s " v i e w & p u s h t h e " p r i v a c y s e t t i n g s " v i e w .
let navigationController = AppSettingsViewController . inModalNavigationController ( )
navigationController . pushViewController ( PrivacySettingsTableViewController ( ) , animated : false )
fromViewController . present ( navigationController , animated : true )
}
let buttonTitle = NSLocalizedString ( " UPGRADE_EXPERIENCE_ENABLE_TYPING_INDICATOR_BUTTON " , comment : " button label shown one time, after upgrade " )
let button = addPrimaryButton ( title : buttonTitle ) { _ in
self . typingIndicators . setTypingIndicatorsEnabled ( value : true )
self . experienceUpgradesPageViewController . dismiss ( animated : true )
}
let bottomSpacer = UIView ( )
@ -319,8 +312,8 @@ private class IntroductingTypingIndicatorsExperienceUpgradeViewController: Exper
// MARK: - A c t i o n s
func add Button( title : String , action : @ escaping ( UIButton ) -> Void ) -> UIButton {
self . b uttonAction = action
func add Primary Button( title : String , action : @ escaping ( UIButton ) -> Void ) -> UIButton {
self . primaryB uttonAction = action
let button = MultiLineButton ( )
view . addSubview ( button )
button . setTitle ( title , for : . normal )
@ -336,12 +329,12 @@ private class IntroductingTypingIndicatorsExperienceUpgradeViewController: Exper
@objc func didTapButton ( sender : UIButton ) {
Logger . debug ( " " )
guard let buttonAction = self . b uttonAction else {
guard let primaryButtonAction = self . primaryB uttonAction else {
owsFailDebug ( " button action was nil " )
return
}
b uttonAction( sender )
primaryB uttonAction( sender )
}
}
@ -665,7 +658,7 @@ public class ExperienceUpgradesPageViewController: OWSViewController, UIPageView
// D i s m i s s b u t t o n
let dismissButton = UIButton ( )
view . addSubview ( dismissButton )
dismissButton . setTitle ( CommonStrings. dismissButton , for : . normal )
dismissButton . setTitle ( NSLocalizedString( " EXPERIENCE_UPGRADE_DISMISS_BUTTON " , comment : " Button to dismiss/ignore the one time splash screen that appears after upgrading " ) , for : . normal )
dismissButton . setTitleColor ( UIColor . ows_signalBrandBlue , for : . normal )
dismissButton . isUserInteractionEnabled = true
dismissButton . addTarget ( self , action : #selector ( didTapDismissButton ) , for : . touchUpInside )