diff --git a/Dear-World/Dear-World/Resource/Assets.xcassets/back.imageset/Contents.json b/Dear-World/Dear-World/Resource/Assets.xcassets/back.imageset/Contents.json new file mode 100644 index 0000000..e405ac6 --- /dev/null +++ b/Dear-World/Dear-World/Resource/Assets.xcassets/back.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "back.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Dear-World/Dear-World/Resource/Assets.xcassets/back.imageset/back.png b/Dear-World/Dear-World/Resource/Assets.xcassets/back.imageset/back.png new file mode 100644 index 0000000..1465c49 Binary files /dev/null and b/Dear-World/Dear-World/Resource/Assets.xcassets/back.imageset/back.png differ diff --git a/Dear-World/Dear-World/Source/Presentation/Scene/About/AboutReactor.swift b/Dear-World/Dear-World/Source/Presentation/Scene/About/AboutReactor.swift index 17f4fdc..3f173ae 100644 --- a/Dear-World/Dear-World/Source/Presentation/Scene/About/AboutReactor.swift +++ b/Dear-World/Dear-World/Source/Presentation/Scene/About/AboutReactor.swift @@ -12,6 +12,7 @@ final class AboutReactor: Reactor { enum Action { case initalize + case tapClose case tapCrewInfo case tapNotice case tapVersion @@ -21,6 +22,7 @@ final class AboutReactor: Reactor { case setPresentCrewInfo(Bool) case setPresentNotice(Bool) case setPresentAppStore(Bool) + case setWillDismiss(Bool) case setNoticeCount(Int) case setCurrentVersion(String) } @@ -29,6 +31,7 @@ final class AboutReactor: Reactor { @Revision var isPresentCrewInfo: Bool = false @Revision var isPresentNotice: Bool = false @Revision var isPresentAppStore: Bool = false + @Revision var willDismiss: Bool = false var noticeCount: Int? var currentVersion: String? = "10.1.1" } @@ -53,6 +56,9 @@ final class AboutReactor: Reactor { case .tapVersion: return .just(.setPresentAppStore(true)) + + case .tapClose: + return .just(.setWillDismiss(true)) } } @@ -74,6 +80,9 @@ final class AboutReactor: Reactor { case .setCurrentVersion(let version): newState.currentVersion = version + + case .setWillDismiss(let willDismiss): + newState.willDismiss = willDismiss } return newState diff --git a/Dear-World/Dear-World/Source/Presentation/Scene/About/AboutViewController.swift b/Dear-World/Dear-World/Source/Presentation/Scene/About/AboutViewController.swift index 678207b..3749c62 100644 --- a/Dear-World/Dear-World/Source/Presentation/Scene/About/AboutViewController.swift +++ b/Dear-World/Dear-World/Source/Presentation/Scene/About/AboutViewController.swift @@ -19,6 +19,13 @@ final class AboutViewController: UIViewController, View { private let noticeInfoView: UIView = UIView() private let noticeBadge: NoticeBadge = NoticeBadge() private let versionInfoView: UIView = UIView() + private let versionLabel: UILabel = UILabel() + private let backButton: UIBarButtonItem = UIBarButtonItem( + image: UIImage(named: "back")!, + style: .plain, + target: nil, + action: nil + ) var disposeBag: DisposeBag = DisposeBag() @@ -38,6 +45,9 @@ final class AboutViewController: UIViewController, View { // MARK: 🎛 Setup private func setupUI() { view.backgroundColor = .breathingWhite + backButton.tintColor = .warmBlue + navigationItem.leftBarButtonItem = backButton + navigationItem.title = "About" view.addSubview(stackView) stackView.do { @@ -108,7 +118,7 @@ final class AboutViewController: UIViewController, View { $0.font = .systemFont(ofSize: 14) $0.textColor = .warmBlue } - let versionLabel: UILabel = UILabel().then { + versionLabel.do { $0.text = "New Version" $0.textColor = .livelyBlue } @@ -140,6 +150,12 @@ final class AboutViewController: UIViewController, View { .bind(to: reactor.action) .disposed(by: disposeBag) + backButton.rx.tap + .throttle(.milliseconds(300), scheduler: MainScheduler.instance) + .map { Action.tapClose } + .bind(to: reactor.action) + .disposed(by: disposeBag) + noticeInfoView.rx.tapGesture() .when(.recognized) .throttle(.milliseconds(300), scheduler: MainScheduler.instance) @@ -188,5 +204,19 @@ final class AboutViewController: UIViewController, View { print("isPresentAppStore") }) .disposed(by: disposeBag) + + reactor.state + .distinctUntilChanged(\.$willDismiss) + .map { $0.willDismiss } + .filter { $0 } + .subscribe(onNext: { [weak self] _ in + self?.dismiss(animated: true, completion: nil) + }) + .disposed(by: disposeBag) + + reactor.state.map { $0.currentVersion } + .distinctUntilChanged() + .bind(to: versionLabel.rx.text) + .disposed(by: disposeBag) } } diff --git a/Dear-World/Dear-World/Source/Presentation/Scene/Cheering Map/CheeringMapViewController.swift b/Dear-World/Dear-World/Source/Presentation/Scene/Cheering Map/CheeringMapViewController.swift index 8604ec9..fc0b248 100644 --- a/Dear-World/Dear-World/Source/Presentation/Scene/Cheering Map/CheeringMapViewController.swift +++ b/Dear-World/Dear-World/Source/Presentation/Scene/Cheering Map/CheeringMapViewController.swift @@ -88,6 +88,10 @@ final class CheeringMapViewController: UIViewController, ReactorKit.View { }) .disposed(by: self.disposeBag) + aboutButton.rx.tap + .map { Action.tapAbout } + .bind(to: reactor.action) + .disposed(by: self.disposeBag) rankingTableView.rx.didScroll .map { [weak self] in self?.rankingTableView.contentOffset.y } diff --git a/Dear-World/Dear-World/Source/Presentation/Scene/Discover/DiscoverViewController.swift b/Dear-World/Dear-World/Source/Presentation/Scene/Discover/DiscoverViewController.swift index 402e834..043b795 100644 --- a/Dear-World/Dear-World/Source/Presentation/Scene/Discover/DiscoverViewController.swift +++ b/Dear-World/Dear-World/Source/Presentation/Scene/Discover/DiscoverViewController.swift @@ -150,6 +150,20 @@ final class DiscoverViewController: UIViewController, View { }) .disposed(by: self.disposeBag) + reactor.state + .distinctUntilChanged(\.$isPresentAboutPage) + .map { $0.isPresentAboutPage } + .subscribe(onNext: { [weak self] in + let viewController = AboutViewController().then { + $0.reactor = AboutReactor() + } + let naviController = UINavigationController(rootViewController: viewController).then { + $0.modalPresentationStyle = .fullScreen + } + self?.present(naviController, animated: false, completion: nil) + }) + .disposed(by: self.disposeBag) + reactor.state .map(\.isRefreshing) .distinctUntilChanged() @@ -199,23 +213,10 @@ final class DiscoverViewController: UIViewController, View { .disposed(by: self.disposeBag) self.aboutButton.rx.tap + .throttle(.milliseconds(300), scheduler: MainScheduler.instance) .map { Reactor.Action.tapAbout } .bind(to: reactor.action) .disposed(by: self.disposeBag) - - reactor.state - .distinctUntilChanged(\.$isPresentAboutPage) - .map { $0.isPresentAboutPage } - .subscribe(onNext: { [weak self] in - let viewController = AboutViewController().then { - $0.reactor = AboutReactor() - } - let naviController = UINavigationController(rootViewController: viewController).then { - $0.modalPresentationStyle = .fullScreen - } - self?.present(naviController, animated: false, completion: nil) - }) - .disposed(by: self.disposeBag) } } extension DiscoverViewController: UITableViewDelegate, UITableViewDataSource {