diff --git a/waosSwift/config/default/development.json b/waosSwift/config/default/development.json index e4b2f29..fc22a61 100644 --- a/waosSwift/config/default/development.json +++ b/waosSwift/config/default/development.json @@ -102,6 +102,7 @@ "margin": 15, }, "navigationBar": { + "transparent": "false", "shadow": "false", }, "tableView": { diff --git a/waosSwift/config/localizations/en.lproj/Localizable.strings b/waosSwift/config/localizations/en.lproj/Localizable.strings index 620b491..7b3502a 100644 --- a/waosSwift/config/localizations/en.lproj/Localizable.strings +++ b/waosSwift/config/localizations/en.lproj/Localizable.strings @@ -34,7 +34,7 @@ "auth_firstname"= "Firstname"; "auth_lastname"= "Lastname"; "auth_forgot"= "Forgot password?"; -"auth_reset"= "Reset"; +"auth_reset"= "Reset password"; // task "tasks_title"= "Tasks"; diff --git a/waosSwift/config/localizations/fr.lproj/Localizable.strings b/waosSwift/config/localizations/fr.lproj/Localizable.strings index dcff7e5..782c34d 100644 --- a/waosSwift/config/localizations/fr.lproj/Localizable.strings +++ b/waosSwift/config/localizations/fr.lproj/Localizable.strings @@ -34,7 +34,7 @@ "auth_firstname"= "Prénom"; "auth_lastname"= "Nom"; "auth_forgot"= "Mot de passe oublié?"; -"auth_reset"= "Reset"; +"auth_reset"= "Reset du mot de passe"; // task "tasks_title"= "Tasks"; diff --git a/waosSwift/modules/auth/controllers/AuthForgotController.swift b/waosSwift/modules/auth/controllers/AuthForgotController.swift index 11d4d97..bd337ed 100644 --- a/waosSwift/modules/auth/controllers/AuthForgotController.swift +++ b/waosSwift/modules/auth/controllers/AuthForgotController.swift @@ -18,6 +18,8 @@ final class AuthForgotController: CoreController, View, Stepper { var width: CGFloat = 0 // MARK: UI + + let barButtonClose = UIBarButtonItem(barButtonSystemItem: .close, target: nil, action: nil) let inputEmail = CoreUITextField().then { $0.autocorrectionType = .no @@ -31,9 +33,6 @@ final class AuthForgotController: CoreController, View, Stepper { $0.setTitle(L10n.authReset, for: .normal) $0.setTitleColor(Metric.secondary, for: .normal) } - let buttonSignin = CoreUIButton().then { - $0.setTitle(L10n.authSignInTitle, for: .normal) - } let labelErrors = CoreUILabel().then { $0.numberOfLines = 4 $0.textAlignment = .center @@ -48,13 +47,9 @@ final class AuthForgotController: CoreController, View, Stepper { // background let backgroundImage = UIImageView().then { $0.contentMode = .scaleToFill - $0.alpha = 1 $0.image = UIImage(named: "authBackground") $0.alpha = 0.4 } - let backgroundView = UIView().then { - $0.backgroundColor = .clear - } // MARK: Properties @@ -75,19 +70,21 @@ final class AuthForgotController: CoreController, View, Stepper { override func viewDidLoad() { super.viewDidLoad() + // navigation + self.navigationController?.navigationBar.standardAppearance = self.transparentNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.transparentNavigationBar // background self.view.addSubview(self.backgroundImage) - self.view.addSubview(self.backgroundView) // content self.view.registerAutomaticKeyboardConstraints() // active layout with snapkit self.view.addSubview(self.inputEmail) self.view.addSubview(self.buttonReset) - self.view.addSubview(self.buttonSignin) self.view.addSubview(self.labelErrors) self.view.addSubview(self.labelSuccess) // config - self.view.backgroundColor = Metric.primary self.navigationController?.clear() + self.view.backgroundColor = Metric.primary + self.navigationItem.rightBarButtonItem = self.barButtonClose } override func setupConstraints() { @@ -111,19 +108,11 @@ final class AuthForgotController: CoreController, View, Stepper { inputEmail.snp.prepareConstraints { (make) -> Void in make.centerY.equalTo(self.view).offset(-130).keyboard(true, in: self.view) } - buttonSignin.snp.makeConstraints { (make) -> Void in - make.width.equalTo(140) - make.height.equalTo(50) - make.centerX.equalTo(self.view).offset(-80) - make.centerY.equalTo(self.view).offset(30).keyboard(false, in: self.view) - } - buttonSignin.snp.prepareConstraints { (make) -> Void in - make.centerY.equalTo(self.view).offset(-70).keyboard(true, in: self.view) - } buttonReset.snp.makeConstraints { (make) -> Void in - make.width.equalTo(140) + make.width.equalTo(300) + make.height.equalTo(50) - make.centerX.equalTo(self.view).offset(80) + make.centerX.equalTo(self.view) make.centerY.equalTo(self.view).offset(30).keyboard(false, in: self.view) } buttonReset.snp.prepareConstraints { (make) -> Void in @@ -139,11 +128,6 @@ final class AuthForgotController: CoreController, View, Stepper { make.centerY.equalTo(self.view).offset(20).keyboard(true, in: self.view) } // background - self.backgroundView.snp.makeConstraints { make in - make.bottom.equalTo(self.view) - make.width.equalTo(self.view) - make.height.equalTo(self.view.snp.width) - } self.backgroundImage.snp.makeConstraints { make in make.top.equalTo(self.view) make.centerX.equalTo(self.view) @@ -169,6 +153,13 @@ private extension AuthForgotController { // MARK: views (View -> View) func bindView(_ reactor: AuthForgotReactor) { + // cancel + self.barButtonClose.rx.tap + .subscribe(onNext: { [weak self] _ in + guard let `self` = self else { return } + self.dismiss(animated: true, completion: nil) + }) + .disposed(by: self.disposeBag) // error self.error.button?.rx.tap .subscribe(onNext: { _ in @@ -193,11 +184,6 @@ private extension AuthForgotController { .map { _ in Reactor.Action.reset } .bind(to: reactor.action) .disposed(by: self.disposeBag) - // button signin - buttonSignin.rx.tap - .map { _ in Reactor.Action.signIn } - .bind(to: reactor.action) - .disposed(by: self.disposeBag) // form Observable.combineLatest([self.inputEmail].map { $0.rx.text.orEmpty }) .map { $0.map { $0.isEmpty } } @@ -246,15 +232,6 @@ private extension AuthForgotController { self.labelSuccess.text = success }) .disposed(by: self.disposeBag) - reactor.state - .map { $0.success } - .filter { $0 != "" && $0 != "email" } - .distinctUntilChanged() - .debounce(.milliseconds(7000), scheduler: MainScheduler.instance) - .subscribe(onNext: { _ in - self.buttonSignin.sendActions(for: .touchUpInside) - }) - .disposed(by: self.disposeBag) // validation errors reactor.state .map { $0.errors } diff --git a/waosSwift/modules/auth/controllers/AuthSigninController.swift b/waosSwift/modules/auth/controllers/AuthSigninController.swift index 19f3022..dce77f3 100644 --- a/waosSwift/modules/auth/controllers/AuthSigninController.swift +++ b/waosSwift/modules/auth/controllers/AuthSigninController.swift @@ -65,13 +65,9 @@ final class AuthSignInController: CoreController, View, Stepper { // background let backgroundImage = UIImageView().then { $0.contentMode = .scaleToFill - $0.alpha = 1 $0.image = UIImage(named: "authBackground") $0.alpha = 0.4 } - let backgroundView = UIView().then { - $0.backgroundColor = .clear - } // MARK: Properties @@ -92,9 +88,11 @@ final class AuthSignInController: CoreController, View, Stepper { override func viewDidLoad() { super.viewDidLoad() + // navigation + self.navigationController?.navigationBar.standardAppearance = self.transparentNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.transparentNavigationBar // background self.view.addSubview(self.backgroundImage) - self.view.addSubview(self.backgroundView) // content self.view.registerAutomaticKeyboardConstraints() // active layout with snapkit self.view.addSubview(self.inputEmail) @@ -106,7 +104,6 @@ final class AuthSignInController: CoreController, View, Stepper { self.view.addSubview(self.buttonSignInApple) // config self.view.backgroundColor = Metric.primary - self.navigationController?.navigationBar.isHidden = true } override func setupConstraints() { @@ -177,11 +174,6 @@ final class AuthSignInController: CoreController, View, Stepper { make.bottom.equalTo(self.view).offset(-25) } // background - self.backgroundView.snp.makeConstraints { make in - make.bottom.equalTo(self.view) - make.width.equalTo(self.view) - make.height.equalTo(self.view.snp.width) - } self.backgroundImage.snp.makeConstraints { make in make.top.equalTo(self.view) make.centerX.equalTo(self.view) @@ -224,7 +216,6 @@ private extension AuthSignInController { .subscribe(onNext: { [weak self] reactor in guard let `self` = self else { return } let viewController = AuthForgotController(reactor: reactor) - viewController.title = L10n.authForgot let navigationController = UINavigationController(rootViewController: viewController) self.present(navigationController, animated: true, completion: nil) }) diff --git a/waosSwift/modules/auth/controllers/AuthSignupController.swift b/waosSwift/modules/auth/controllers/AuthSignupController.swift index 5d7ec73..8e3f76f 100644 --- a/waosSwift/modules/auth/controllers/AuthSignupController.swift +++ b/waosSwift/modules/auth/controllers/AuthSignupController.swift @@ -20,6 +20,8 @@ final class AuthSignUpController: CoreController, View, Stepper { // MARK: UI + let barButtonClose = UIBarButtonItem(barButtonSystemItem: .close, target: nil, action: nil) + let inputFirstName = CoreUITextField().then { $0.autocorrectionType = .no $0.setFontAwesomeIcon("fa-user") @@ -50,9 +52,6 @@ final class AuthSignUpController: CoreController, View, Stepper { $0.setProgress(0, animated: true) } - let buttonSignin = CoreUIButton().then { - $0.setTitle(L10n.authSignInTitle, for: .normal) - } let buttonSignup = CoreUIButton().then { $0.setTitle(L10n.authSignUpTitle, for: .normal) $0.setTitleColor(Metric.secondary, for: .normal) @@ -66,13 +65,9 @@ final class AuthSignUpController: CoreController, View, Stepper { // background let backgroundImage = UIImageView().then { $0.contentMode = .scaleToFill - $0.alpha = 1 $0.image = UIImage(named: "authBackground") $0.alpha = 0.4 } - let backgroundView = UIView().then { - $0.backgroundColor = .clear - } // MARK: Properties @@ -93,9 +88,11 @@ final class AuthSignUpController: CoreController, View, Stepper { override func viewDidLoad() { super.viewDidLoad() + // navigation + self.navigationController?.navigationBar.standardAppearance = self.transparentNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.transparentNavigationBar // background self.view.addSubview(self.backgroundImage) - self.view.addSubview(self.backgroundView) // content self.view.registerAutomaticKeyboardConstraints() // active layout with snapkit self.view.addSubview(self.inputFirstName) @@ -103,12 +100,12 @@ final class AuthSignUpController: CoreController, View, Stepper { self.view.addSubview(self.inputEmail) self.view.addSubview(self.inputPassword) self.view.addSubview(self.progressPassword) - self.view.addSubview(self.buttonSignin) self.view.addSubview(self.buttonSignup) self.view.addSubview(self.labelErrors) // config - self.view.backgroundColor = Metric.primary self.navigationController?.clear() + self.view.backgroundColor = Metric.primary + self.navigationItem.rightBarButtonItem = self.barButtonClose } override func setupConstraints() { @@ -163,23 +160,14 @@ final class AuthSignUpController: CoreController, View, Stepper { } buttonSignup.snp.makeConstraints { (make) -> Void in - make.width.equalTo(140) + make.width.equalTo(300) make.height.equalTo(50) - make.centerX.equalTo(self.view).offset(80) + make.centerX.equalTo(self.view) make.centerY.equalTo(self.view).offset(140).keyboard(false, in: self.view) } buttonSignup.snp.prepareConstraints { (make) -> Void in make.centerY.equalTo(self.view).offset(40).keyboard(true, in: self.view) } - buttonSignin.snp.makeConstraints { (make) -> Void in - make.width.equalTo(140) - make.height.equalTo(50) - make.centerX.equalTo(self.view).offset(-80) - make.centerY.equalTo(self.view).offset(140).keyboard(false, in: self.view) - } - buttonSignin.snp.prepareConstraints { (make) -> Void in - make.centerY.equalTo(self.view).offset(40).keyboard(true, in: self.view) - } labelErrors.snp.makeConstraints { (make) -> Void in make.left.equalTo(25) make.right.equalTo(-25) @@ -190,11 +178,6 @@ final class AuthSignUpController: CoreController, View, Stepper { make.centerY.equalTo(self.view).offset(60).keyboard(true, in: self.view) } // background - self.backgroundView.snp.makeConstraints { make in - make.bottom.equalTo(self.view) - make.width.equalTo(self.view) - make.height.equalTo(self.view.snp.width) - } self.backgroundImage.snp.makeConstraints { make in make.top.equalTo(self.view) make.centerX.equalTo(self.view) @@ -220,6 +203,13 @@ private extension AuthSignUpController { // MARK: views (View -> View) func bindView(_ reactor: AuthSignUpReactor) { + // cancel + self.barButtonClose.rx.tap + .subscribe(onNext: { [weak self] _ in + guard let `self` = self else { return } + self.dismiss(animated: true, completion: nil) + }) + .disposed(by: self.disposeBag) // error self.error.button?.rx.tap .subscribe(onNext: { _ in @@ -238,11 +228,6 @@ private extension AuthSignUpController { // MARK: actions (View -> Reactor) func bindAction(_ reactor: AuthSignUpReactor) { - // button signin - buttonSignin.rx.tap - .map { _ in Reactor.Action.signIn } - .bind(to: reactor.action) - .disposed(by: self.disposeBag) // button signup buttonSignup.rx.tap .throttle(.milliseconds(Metric.timesButtonsThrottle), latest: false, scheduler: MainScheduler.instance) diff --git a/waosSwift/modules/auth/flow/AuthFlow.swift b/waosSwift/modules/auth/flow/AuthFlow.swift index 5f25fb6..506603c 100644 --- a/waosSwift/modules/auth/flow/AuthFlow.swift +++ b/waosSwift/modules/auth/flow/AuthFlow.swift @@ -40,7 +40,6 @@ final class AuthFlow: Flow { private func navigateToAuthScreen() -> FlowContributors { let reactor = AuthSigninReactor(provider: self.services) let viewController = AuthSignInController(reactor: reactor) - viewController.title = L10n.authSignInTitle self.rootViewController.pushViewController(viewController, animated: false) return .one(flowContributor: .contribute(withNextPresentable: viewController, withNextStepper: viewController)) diff --git a/waosSwift/modules/core/controllers/CoreController.swift b/waosSwift/modules/core/controllers/CoreController.swift index ce0a300..0fc15f7 100644 --- a/waosSwift/modules/core/controllers/CoreController.swift +++ b/waosSwift/modules/core/controllers/CoreController.swift @@ -22,6 +22,7 @@ class CoreController: UIViewController { static let secondary = UIColor(named: config["theme"]["themes"]["waos"]["secondary"].string ?? "") static let background = UIColor(named: config["theme"]["themes"]["waos"]["background"].string ?? "") static let onBackground = UIColor(named: config["theme"]["themes"]["waos"]["onBackground"].string ?? "") + static let navigationBarTransparent = NSString(string: config["theme"]["navigationBar"]["transparent"].string ?? "").boolValue static let navigationBarShadow = NSString(string: config["theme"]["navigationBar"]["shadow"].string ?? "").boolValue static let tabBarColor = NSString(string: config["theme"]["tabBar"]["color"].string ?? "").boolValue static let tabBarTintColor = NSString(string: config["theme"]["tabBar"]["tintColor"].string ?? "").boolValue @@ -41,8 +42,13 @@ class CoreController: UIViewController { // MARK: UI - let clearNavigationBar = UINavigationBarAppearance().then { - $0.backgroundColor = .clear + let transparentNavigationBar = UINavigationBarAppearance().then { + $0.configureWithTransparentBackground() + $0.titleTextAttributes = [.foregroundColor: Metric.onPrimary!] + } + let defaultNavigationBar = UINavigationBarAppearance().then { + $0.configureWithDefaultBackground() + $0.backgroundColor = Metric.primary $0.titleTextAttributes = [.foregroundColor: Metric.onPrimary!] } @@ -81,18 +87,17 @@ class CoreController: UIViewController { override func viewDidLoad() { self.view.setNeedsUpdateConstraints() // navigation - self.navigationController?.navigationBar.standardAppearance = UINavigationBarAppearance().then { - $0.backgroundColor = Metric.primary - $0.titleTextAttributes = [.foregroundColor: Metric.onPrimary!] - } - self.navigationController?.navigationBar.scrollEdgeAppearance = UINavigationBarAppearance().then { - $0.backgroundColor = Metric.primary?.withAlphaComponent(0.9) - $0.titleTextAttributes = [.foregroundColor: Metric.onPrimary!] + if Metric.navigationBarTransparent == true { + self.navigationController?.navigationBar.standardAppearance = self.transparentNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.transparentNavigationBar + } else { + self.navigationController?.navigationBar.standardAppearance = self.defaultNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.defaultNavigationBar } if Metric.navigationBarShadow == false { self.navigationController?.navigationBar.scrollEdgeAppearance?.shadowColor = .clear self.navigationController?.navigationBar.standardAppearance.shadowColor = .clear - self.clearNavigationBar.shadowColor = .clear + self.transparentNavigationBar.shadowColor = .clear } self.navigationController?.navigationBar.tintColor = Metric.onPrimary // tabar diff --git a/waosSwift/modules/core/controllers/CoreFormController.swift b/waosSwift/modules/core/controllers/CoreFormController.swift index 936bcee..f7b74fd 100644 --- a/waosSwift/modules/core/controllers/CoreFormController.swift +++ b/waosSwift/modules/core/controllers/CoreFormController.swift @@ -30,6 +30,7 @@ class CoreFormController: FormViewController { static let twitter = UIColor(named: config["theme"]["themes"]["waos"]["twitter"].string ?? "") static let linkedin = UIColor(named: config["theme"]["themes"]["waos"]["linkedin"].string ?? "") static let facebook = UIColor(named: config["theme"]["themes"]["waos"]["facebook"].string ?? "") + static let navigationBarTransparent = NSString(string: config["theme"]["navigationBar"]["transparent"].string ?? "").boolValue static let navigationBarShadow = NSString(string: config["theme"]["navigationBar"]["shadow"].string ?? "").boolValue static let tableViewRowHeight = CGFloat(config["theme"]["tableView"]["rowHeight"].int ?? 0) static let tableViewSectionHeaderHeight = CGFloat(config["theme"]["tableView"]["sectionHeaderHeight"].int ?? 0) @@ -55,8 +56,13 @@ class CoreFormController: FormViewController { // MARK: UI - let clearNavigationBar = UINavigationBarAppearance().then { - $0.backgroundColor = .clear + let transparentNavigationBar = UINavigationBarAppearance().then { + $0.configureWithTransparentBackground() + $0.titleTextAttributes = [.foregroundColor: Metric.onPrimary!] + } + let defaultNavigationBar = UINavigationBarAppearance().then { + $0.configureWithDefaultBackground() + $0.backgroundColor = Metric.primary $0.titleTextAttributes = [.foregroundColor: Metric.onPrimary!] } @@ -95,18 +101,17 @@ class CoreFormController: FormViewController { override func viewDidLoad() { super.viewDidLoad() // navigation - self.navigationController?.navigationBar.standardAppearance = UINavigationBarAppearance().then { - $0.backgroundColor = Metric.primary - $0.titleTextAttributes = [.foregroundColor: Metric.onPrimary!] - } - self.navigationController?.navigationBar.scrollEdgeAppearance = UINavigationBarAppearance().then { - $0.backgroundColor = Metric.primary?.withAlphaComponent(0.9) - $0.titleTextAttributes = [.foregroundColor: Metric.onPrimary!] + if Metric.navigationBarTransparent == true { + self.navigationController?.navigationBar.standardAppearance = self.transparentNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.transparentNavigationBar + } else { + self.navigationController?.navigationBar.standardAppearance = self.defaultNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.defaultNavigationBar } if Metric.navigationBarShadow == false { self.navigationController?.navigationBar.scrollEdgeAppearance?.shadowColor = .clear self.navigationController?.navigationBar.standardAppearance.shadowColor = .clear - self.clearNavigationBar.shadowColor = .clear + self.transparentNavigationBar.shadowColor = .clear } self.navigationController?.navigationBar.tintColor = Metric.onPrimary // tabar diff --git a/waosSwift/modules/home/controllers/HomePageController.swift b/waosSwift/modules/home/controllers/HomePageController.swift index 2e02e14..4361462 100644 --- a/waosSwift/modules/home/controllers/HomePageController.swift +++ b/waosSwift/modules/home/controllers/HomePageController.swift @@ -47,14 +47,14 @@ class HomePageController: CoreController, View { override func viewDidLoad() { super.viewDidLoad() - self.navigationController?.navigationBar.standardAppearance = self.clearNavigationBar - self.navigationController?.navigationBar.scrollEdgeAppearance = self.clearNavigationBar + self.navigationController?.navigationBar.standardAppearance = self.transparentNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.transparentNavigationBar self.view.addSubview(self.webView) self.view.addSubview(self.segmentedControlTitles) self.navigationController?.clear() - self.navigationItem.leftBarButtonItem = self.barButtonClose + self.navigationItem.rightBarButtonItem = self.barButtonClose } override func setupConstraints() { diff --git a/waosSwift/modules/home/controllers/HomeTermsController.swift b/waosSwift/modules/home/controllers/HomeTermsController.swift index 8335cd3..80c9f25 100644 --- a/waosSwift/modules/home/controllers/HomeTermsController.swift +++ b/waosSwift/modules/home/controllers/HomeTermsController.swift @@ -42,8 +42,8 @@ class HomeTermsController: CoreController, View { override func viewDidLoad() { super.viewDidLoad() - self.navigationController?.navigationBar.standardAppearance = self.clearNavigationBar - self.navigationController?.navigationBar.scrollEdgeAppearance = self.clearNavigationBar + self.navigationController?.navigationBar.standardAppearance = self.transparentNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.transparentNavigationBar self.view.addSubview(self.webView) self.view.addSubview(self.buttonAccept) diff --git a/waosSwift/modules/users/controllers/UserMoreController.swift b/waosSwift/modules/users/controllers/UserMoreController.swift index 4c2bb87..041d642 100644 --- a/waosSwift/modules/users/controllers/UserMoreController.swift +++ b/waosSwift/modules/users/controllers/UserMoreController.swift @@ -57,8 +57,8 @@ class UserMoreController: CoreFormController, View { override func viewDidLoad() { super.viewDidLoad() - self.navigationController?.navigationBar.standardAppearance = self.clearNavigationBar - self.navigationController?.navigationBar.scrollEdgeAppearance = self.clearNavigationBar + self.navigationController?.navigationBar.standardAppearance = self.transparentNavigationBar + self.navigationController?.navigationBar.scrollEdgeAppearance = self.transparentNavigationBar form +++ Section(header: L10n.userSectionAbout, footer: "") @@ -68,8 +68,7 @@ class UserMoreController: CoreFormController, View { <<< self.buttonLegalNotice self.navigationController?.clear() - self.navigationItem.leftBarButtonItem = self.barButtonClose - + self.navigationItem.rightBarButtonItem = self.barButtonClose self.view.addSubview(self.tableView) }