diff --git a/SOOUM/SOOUM.xcodeproj/project.pbxproj b/SOOUM/SOOUM.xcodeproj/project.pbxproj index dd253cb6..ab57272f 100644 --- a/SOOUM/SOOUM.xcodeproj/project.pbxproj +++ b/SOOUM/SOOUM.xcodeproj/project.pbxproj @@ -3942,7 +3942,7 @@ CODE_SIGN_ENTITLEMENTS = "SOOUM/Resources/SOOUM-Dev.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 201020; + CURRENT_PROJECT_VERSION = 201050; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 99FRG743RX; GENERATE_INFOPLIST_FILE = YES; @@ -3966,7 +3966,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.1.2; + MARKETING_VERSION = 2.1.5; OTHER_SWIFT_FLAGS = "$(inherited) -D DEVELOP"; PRODUCT_BUNDLE_IDENTIFIER = com.sooum.dev; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3995,7 +3995,7 @@ CODE_SIGN_ENTITLEMENTS = "SOOUM/Resources/SOOUM-Dev.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 201020; + CURRENT_PROJECT_VERSION = 201050; DEVELOPMENT_TEAM = 99FRG743RX; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "SOOUM/Resources/Develop/Info-dev.plist"; @@ -4018,7 +4018,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.1.2; + MARKETING_VERSION = 2.1.5; OTHER_SWIFT_FLAGS = "$(inherited) -D DEVELOP"; PRODUCT_BUNDLE_IDENTIFIER = com.sooum.dev; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4234,7 +4234,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "SOOUM/Resources//SOOUM.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 201020; + CURRENT_PROJECT_VERSION = 201040; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 99FRG743RX; GENERATE_INFOPLIST_FILE = YES; @@ -4257,7 +4257,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.1.2; + MARKETING_VERSION = 2.1.4; OTHER_SWIFT_FLAGS = "$(inherited) -D PRODUCTION"; PRODUCT_BUNDLE_IDENTIFIER = com.sooum.prod; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4284,7 +4284,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "SOOUM/Resources//SOOUM.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 201020; + CURRENT_PROJECT_VERSION = 201040; DEVELOPMENT_TEAM = 99FRG743RX; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "SOOUM/Resources/Production/Info-prod.plist"; @@ -4306,7 +4306,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.1.2; + MARKETING_VERSION = 2.1.4; OTHER_SWIFT_FLAGS = "$(inherited) -D PRODUCTION"; PRODUCT_BUNDLE_IDENTIFIER = com.sooum.prod; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/SOOUM/SOOUM/Base/BaseViewController.swift b/SOOUM/SOOUM/Base/BaseViewController.swift index 9b0ef414..4360adea 100644 --- a/SOOUM/SOOUM/Base/BaseViewController.swift +++ b/SOOUM/SOOUM/Base/BaseViewController.swift @@ -7,8 +7,6 @@ import UIKit -import Network - import RxKeyboard import RxSwift @@ -26,10 +24,6 @@ class BaseViewController: UIViewController { var disposeBag = DisposeBag() - private let monitor = NWPathMonitor() - - private let instabilityNetworkToastView = SOMBottomToastView(title: Text.instabilityNetworkToastTitle, actions: nil) - let activityIndicatorView = SOMActivityIndicatorView() let loadingIndicatorView = SOMLoadingIndicatorView() @@ -94,7 +88,12 @@ class BaseViewController: UIViewController { .subscribe(with: self) { object, _ in guard object.isViewLoaded, object.view.window != nil else { return } - var wrapper: SwiftEntryKitViewWrapper = object.instabilityNetworkToastView.sek + let instabilityNetworkToastView = SOMBottomToastView( + title: Text.instabilityNetworkToastTitle, + actions: nil + ) + + var wrapper: SwiftEntryKitViewWrapper = instabilityNetworkToastView.sek wrapper.entryName = Text.bottomToastEntryName wrapper.showBottomToast(verticalOffset: object.bottomToastMessageOffset, displayDuration: 4) } diff --git a/SOOUM/SOOUM/Data/Managers/NetworkManager/Interceptor/CompositeInterceptor.swift b/SOOUM/SOOUM/Data/Managers/NetworkManager/Interceptor/CompositeInterceptor.swift index 28eed697..6d6cb74d 100644 --- a/SOOUM/SOOUM/Data/Managers/NetworkManager/Interceptor/CompositeInterceptor.swift +++ b/SOOUM/SOOUM/Data/Managers/NetworkManager/Interceptor/CompositeInterceptor.swift @@ -11,7 +11,7 @@ final class CompositeInterceptor: RequestInterceptor { private let interceptors: [RequestInterceptor] - private let timeoutInterval: TimeInterval = 20.0 + private let timeoutInterval: TimeInterval = 10.0 init(provider: ManagerTypeDelegate) { diff --git a/SOOUM/SOOUM/Data/Managers/NetworkManager/Interceptor/ErrorInterceptor.swift b/SOOUM/SOOUM/Data/Managers/NetworkManager/Interceptor/ErrorInterceptor.swift index f1f4af57..e37b2dbb 100644 --- a/SOOUM/SOOUM/Data/Managers/NetworkManager/Interceptor/ErrorInterceptor.swift +++ b/SOOUM/SOOUM/Data/Managers/NetworkManager/Interceptor/ErrorInterceptor.swift @@ -52,8 +52,8 @@ final class ErrorInterceptor: RequestInterceptor { URLError.cannotConnectToHost ] if networkErrors.contains(urlError.code) { - self.showNetworkErrorDialog() - completion(.doNotRetry) + session.cancelAllRequests { [weak self] in self?.showNetworkErrorDialog() } + completion(.doNotRetryWithError(error)) return } } diff --git a/SOOUM/SOOUM/Data/Managers/NetworkManager/NetworkManagerConfiguration.swift b/SOOUM/SOOUM/Data/Managers/NetworkManager/NetworkManagerConfiguration.swift index 09564ff2..ee4cf960 100644 --- a/SOOUM/SOOUM/Data/Managers/NetworkManager/NetworkManagerConfiguration.swift +++ b/SOOUM/SOOUM/Data/Managers/NetworkManager/NetworkManagerConfiguration.swift @@ -32,8 +32,8 @@ struct NetworkManagerConfiguration: ManagerConfiguration { ) { self.sessionConfiguration = sessionConfiguration - self.sessionConfiguration.timeoutIntervalForRequest = 20.0 - self.sessionConfiguration.timeoutIntervalForResource = 20.0 + self.sessionConfiguration.timeoutIntervalForRequest = 10.0 + self.sessionConfiguration.timeoutIntervalForResource = 10.0 self.sessionDelegate = sessionDelegate self.sessionDelegateQueue = sessionDelegateQueue diff --git a/SOOUM/SOOUM/DesignSystem/Components/SOMPageViews/SOMPageView.swift b/SOOUM/SOOUM/DesignSystem/Components/SOMPageViews/SOMPageView.swift index fb923644..c267f54b 100644 --- a/SOOUM/SOOUM/DesignSystem/Components/SOMPageViews/SOMPageView.swift +++ b/SOOUM/SOOUM/DesignSystem/Components/SOMPageViews/SOMPageView.swift @@ -83,7 +83,7 @@ class SOMPageView: UICollectionViewCell { contentsContainer.snp.makeConstraints { $0.centerY.equalToSuperview() $0.leading.equalTo(iconBackgroundView.snp.trailing).offset(10) - $0.trailing.greaterThanOrEqualToSuperview().offset(-16) + $0.trailing.equalToSuperview().offset(-16) } } diff --git a/SOOUM/SOOUM/DesignSystem/Components/SOMPageViews/SOMPageViews.swift b/SOOUM/SOOUM/DesignSystem/Components/SOMPageViews/SOMPageViews.swift index 0f647808..349c14b1 100644 --- a/SOOUM/SOOUM/DesignSystem/Components/SOMPageViews/SOMPageViews.swift +++ b/SOOUM/SOOUM/DesignSystem/Components/SOMPageViews/SOMPageViews.swift @@ -197,15 +197,17 @@ class SOMPageViews: UIView { func setModels(_ models: [SOMPageModel]) { self.indicatorContainer.arrangedSubviews.forEach { $0.removeFromSuperview() } - for index in 0.. 1 { + for index in 0.. 1 else { return } + let cellWidth: CGFloat = scrollView.bounds.width let currentIndex: Int = Int(round(scrollView.contentOffset.x / cellWidth)) diff --git a/SOOUM/SOOUM/Domain/Models/NoticeInfo.swift b/SOOUM/SOOUM/Domain/Models/NoticeInfo.swift index 91383295..e0ab88fe 100644 --- a/SOOUM/SOOUM/Domain/Models/NoticeInfo.swift +++ b/SOOUM/SOOUM/Domain/Models/NoticeInfo.swift @@ -7,7 +7,7 @@ import UIKit -struct NoticeInfo { +struct NoticeInfo: Hashable { let id: String let noticeType: NoticeType @@ -69,17 +69,6 @@ extension NoticeInfo { ) } -extension NoticeInfo: Hashable { - - static func == (lhs: NoticeInfo, rhs: NoticeInfo) -> Bool { - return lhs.id == rhs.id - } - - func hash(into hasher: inout Hasher) { - hasher.combine(self.id) - } -} - extension NoticeInfo: Decodable { enum CodingKeys: String, CodingKey { diff --git a/SOOUM/SOOUM/Presentations/Main/Home/Detail/DetailViewController.swift b/SOOUM/SOOUM/Presentations/Main/Home/Detail/DetailViewController.swift index acecb0ae..d83d6bc9 100644 --- a/SOOUM/SOOUM/Presentations/Main/Home/Detail/DetailViewController.swift +++ b/SOOUM/SOOUM/Presentations/Main/Home/Detail/DetailViewController.swift @@ -634,17 +634,18 @@ extension DetailViewController: UICollectionViewDataSource { cell.tags.tagDidTap .throttle(.seconds(3), scheduler: MainScheduler.instance) + .do(onNext: { + GAHelper.shared.logEvent( + event: GAEvent.DetailView.cardDetailTag_btnClick(tag_name: $0.text) + ) + }) .subscribe(with: self) { object, tagInfo in let tagCollectViewController = TagCollectViewController() tagCollectViewController.reactor = reactor.reactorForTagCollect( with: tagInfo.id, title: tagInfo.text ) - object.navigationPush(tagCollectViewController, animated: true) { _ in - GAHelper.shared.logEvent( - event: GAEvent.DetailView.cardDetailTag_btnClick(tag_name: tagInfo.text) - ) - } + object.navigationPush(tagCollectViewController, animated: true) } .disposed(by: cell.disposeBag) @@ -675,20 +676,20 @@ extension DetailViewController: UICollectionViewDataSource { } else { if prevCardInfo.isPrevCardDeleted { + reactor.action.onNext(.cleanup) + + GAHelper.shared.logEvent( + event: GAEvent.DetailView.cardDetail_tracePathClick( + previous_path: .detail + ) + ) + let detailViewController = DetailViewController() detailViewController.reactor = reactor.reactorForPush( prevCardInfo.prevCardId, hasDeleted: true ) - object.navigationPush(detailViewController, animated: true) { _ in - reactor.action.onNext(.cleanup) - - GAHelper.shared.logEvent( - event: GAEvent.DetailView.cardDetail_tracePathClick( - previous_path: .detail - ) - ) - } + object.navigationPush(detailViewController, animated: true) } else { reactor.action.onNext(.willPushToDetail(prevCardInfo.prevCardId)) } @@ -718,6 +719,7 @@ extension DetailViewController: UICollectionViewDataSource { guard let reactor = self.reactor else { return footer } footer.didTap + .throttle(.seconds(3), scheduler: MainScheduler.instance) .subscribe(with: self) { object, selectedId in let viewController = DetailViewController() viewController.reactor = reactor.reactorForPush(selectedId) diff --git a/SOOUM/SOOUM/Presentations/Main/Home/HomeViewController.swift b/SOOUM/SOOUM/Presentations/Main/Home/HomeViewController.swift index e337176b..da162222 100644 --- a/SOOUM/SOOUM/Presentations/Main/Home/HomeViewController.swift +++ b/SOOUM/SOOUM/Presentations/Main/Home/HomeViewController.swift @@ -253,6 +253,24 @@ class HomeViewController: BaseNavigationViewController, View { #endif } + override func setupConstraints() { + super.setupConstraints() + + self.view.addSubview(self.tableView) + self.tableView.snp.makeConstraints { + $0.top.equalTo(self.view.safeAreaLayoutGuide.snp.top) + $0.bottom.horizontalEdges.equalToSuperview() + } + + self.view.addSubview(self.headerContainer) + self.headerContainer.snp.makeConstraints { + self.headerViewContainerTopConstraint = $0.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).priority(.high).constraint + $0.horizontalEdges.equalToSuperview() + } + self.headerContainer.addArrangedSubview(self.stickyTabBar) + self.headerContainer.addArrangedSubview(self.distanceFilterView) + } + override func setupNaviBar() { super.setupNaviBar() @@ -277,22 +295,10 @@ class HomeViewController: BaseNavigationViewController, View { self.navigationBar.setRightButtons([self.rightAlamButton]) } - override func setupConstraints() { - super.setupConstraints() + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) - self.view.addSubview(self.tableView) - self.tableView.snp.makeConstraints { - $0.top.equalTo(self.view.safeAreaLayoutGuide.snp.top) - $0.bottom.horizontalEdges.equalToSuperview() - } - - self.view.addSubview(self.headerContainer) - self.headerContainer.snp.makeConstraints { - self.headerViewContainerTopConstraint = $0.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).priority(.high).constraint - $0.horizontalEdges.equalToSuperview() - } - self.headerContainer.addArrangedSubview(self.stickyTabBar) - self.headerContainer.addArrangedSubview(self.distanceFilterView) + self.view.isUserInteractionEnabled = true } @@ -361,10 +367,16 @@ class HomeViewController: BaseNavigationViewController, View { cardIsDeleted .filter { $0.isDeleted } .map { $0.selectedId } - .observe(on: MainScheduler.instance) - .subscribe(with: self) { object, selectedId in - object.showPungedCardDialog(reactor, with: selectedId) - } + .observe(on: MainScheduler.asyncInstance) + .subscribe( + with: self, + onNext: { object, selectedId in + object.showPungedCardDialog(reactor, with: selectedId) + }, + onError: { object, _ in + object.view.isUserInteractionEnabled = true + } + ) .disposed(by: self.disposeBag) cardIsDeleted .filter { $0.isDeleted == false } @@ -377,12 +389,18 @@ class HomeViewController: BaseNavigationViewController, View { event: GAEvent.DetailView.cardDetail_tracePathClick(previous_path: .home) ) }) - .observe(on: MainScheduler.instance) - .subscribe(with: self) { object, selectedId in - let detailViewController = DetailViewController() - detailViewController.reactor = reactor.reactorForDetail(with: selectedId) - object.parent?.navigationPush(detailViewController, animated: true) - } + .observe(on: MainScheduler.asyncInstance) + .subscribe( + with: self, + onNext: { object, selectedId in + let detailViewController = DetailViewController() + detailViewController.reactor = reactor.reactorForDetail(with: selectedId) + object.parent?.navigationPush(detailViewController, animated: true) + }, + onError: { object, _ in + object.view.isUserInteractionEnabled = true + } + ) .disposed(by: self.disposeBag) reactor.state.map { @@ -670,6 +688,8 @@ private extension HomeViewController { style: .primary, action: { SOMDialogViewController.dismiss { + self.view.isUserInteractionEnabled = true + reactor.action.onNext(.cleanup) reactor.action.onNext( @@ -765,37 +785,31 @@ extension HomeViewController: UITableViewDelegate { let reactor = self.reactor else { return } - var isPunged: Bool { - switch item { - case let .latest(selectedCard): - guard let expireAt = selectedCard.storyExpirationTime else { return false } - return expireAt < Date() - case let .popular(selectedCard): - guard let expireAt = selectedCard.storyExpirationTime else { return false } - return expireAt < Date() - case let .distance(selectedCard): - guard let expireAt = selectedCard.storyExpirationTime else { return false } - return expireAt < Date() - case .empty: - return false - } - } - var selectedId: String? { switch item { - case let .latest(selectedCard): - return selectedCard.id - case let .popular(selectedCard): - return selectedCard.id - case let .distance(selectedCard): + case let .latest(selectedCard), + let .popular(selectedCard), + let .distance(selectedCard): + return selectedCard.id case .empty: return nil } } - guard let selectedId = selectedId else { return } + var isPunged: Bool { + switch item { + case let .latest(selectedCard), + let .popular(selectedCard), + let .distance(selectedCard): + + guard let expireAt = selectedCard.storyExpirationTime else { return false } + return expireAt < Date() + case .empty: + return false + } + } guard isPunged == false else { self.showPungedCardDialog(reactor, with: selectedId) return @@ -803,17 +817,21 @@ extension HomeViewController: UITableViewDelegate { var isEventCard: Bool { switch item { - case let .latest(selectedCard): - return selectedCard.cardImgName.contains(Text.eventCardTitle) - case let .popular(selectedCard): - return selectedCard.cardImgName.contains(Text.eventCardTitle) - case let .distance(selectedCard): + case let .latest(selectedCard), + let .popular(selectedCard), + let .distance(selectedCard): + return selectedCard.cardImgName.contains(Text.eventCardTitle) case .empty: return false } } + // 화면 전환 전 사용자 행동 방지 + guard SimpleReachability.shared.isCurrentStatus else { return } + + self.view.isUserInteractionEnabled = false + reactor.action.onNext(.hasDetailCard(selectedId, isEventCard)) } diff --git a/SOOUM/SOOUM/Presentations/Main/Home/Notification/NotificationViewController.swift b/SOOUM/SOOUM/Presentations/Main/Home/Notification/NotificationViewController.swift index 5ca73a5c..850c243a 100644 --- a/SOOUM/SOOUM/Presentations/Main/Home/Notification/NotificationViewController.swift +++ b/SOOUM/SOOUM/Presentations/Main/Home/Notification/NotificationViewController.swift @@ -135,6 +135,12 @@ class NotificationViewController: BaseNavigationViewController, View { self.navigationBar.title = Text.navigationTitle } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + self.view.isUserInteractionEnabled = true + } + override func setupConstraints() { super.setupConstraints() @@ -249,9 +255,15 @@ class NotificationViewController: BaseNavigationViewController, View { cardIsDeleted .filter { $0.isDeleted } .observe(on: MainScheduler.instance) - .subscribe(with: self) { object, _ in - object.showPungedCardDialog(reactor) - } + .subscribe( + with: self, + onNext: { object, _ in + object.showPungedCardDialog(reactor) + }, + onError: { object, _ in + object.view.isUserInteractionEnabled = true + } + ) .disposed(by: self.disposeBag) cardIsDeleted .filter { $0.isDeleted == false } @@ -269,12 +281,17 @@ class NotificationViewController: BaseNavigationViewController, View { }) .map { $0.selectedId } .observe(on: MainScheduler.instance) - .subscribe(with: self) { object, selectedId in - - let detailViewController = DetailViewController() - detailViewController.reactor = reactor.reactorForDetail(with: selectedId) - object.navigationPush(detailViewController, animated: true) - } + .subscribe( + with: self, + onNext: { object, selectedId in + let detailViewController = DetailViewController() + detailViewController.reactor = reactor.reactorForDetail(with: selectedId) + object.navigationPush(detailViewController, animated: true) + }, + onError: { object, _ in + object.view.isUserInteractionEnabled = true + } + ) .disposed(by: self.disposeBag) } } @@ -327,6 +344,8 @@ private extension NotificationViewController { style: .primary, action: { SOMDialogViewController.dismiss { + self.view.isUserInteractionEnabled = true + reactor.action.onNext(.cleanup) reactor.action.onNext(.updateNotifications) @@ -366,6 +385,10 @@ extension NotificationViewController: UITableViewDelegate { switch notification { case let .default(notification): + guard SimpleReachability.shared.isCurrentStatus else { return } + + self.view.isUserInteractionEnabled = false + reactor.action.onNext( .hasDetailCard( selectedId: notification.targetCardId, @@ -374,6 +397,10 @@ extension NotificationViewController: UITableViewDelegate { ) case let .tag(notification): + guard SimpleReachability.shared.isCurrentStatus else { return } + + self.view.isUserInteractionEnabled = false + reactor.action.onNext( .hasDetailCard( selectedId: notification.targetCardId, @@ -395,6 +422,10 @@ extension NotificationViewController: UITableViewDelegate { switch notification { case let .default(notification): + guard SimpleReachability.shared.isCurrentStatus else { return } + + self.view.isUserInteractionEnabled = false + reactor.action.onNext( .hasDetailCard( selectedId: notification.targetCardId, @@ -403,6 +434,10 @@ extension NotificationViewController: UITableViewDelegate { ) case let .tag(notification): + guard SimpleReachability.shared.isCurrentStatus else { return } + + self.view.isUserInteractionEnabled = false + reactor.action.onNext( .hasDetailCard( selectedId: notification.targetCardId, diff --git a/SOOUM/SOOUM/Presentations/Main/MainTabBarController.swift b/SOOUM/SOOUM/Presentations/Main/MainTabBarController.swift index 4f3b7855..61213c81 100644 --- a/SOOUM/SOOUM/Presentations/Main/MainTabBarController.swift +++ b/SOOUM/SOOUM/Presentations/Main/MainTabBarController.swift @@ -231,6 +231,7 @@ class MainTabBarController: SOMTabBarController, View { let couldPosting = reactor.pulse(\.$couldPosting).distinctUntilChanged().filterNil() couldPosting .filter { $0.isBaned == false } + .do(onNext: { _ in reactor.action.onNext(.cleanup) }) .observe(on: MainScheduler.instance) .subscribe(with: self) { object, _ in @@ -239,12 +240,7 @@ class MainTabBarController: SOMTabBarController, View { let writeCardViewController = WriteCardViewController() writeCardViewController.reactor = reactor.reactorForWriteCard() if let selectedViewController = object.selectedViewController { - selectedViewController.navigationPush( - writeCardViewController, - animated: true - ) { _ in - reactor.action.onNext(.cleanup) - } + selectedViewController.navigationPush(writeCardViewController, animated: true) } } .disposed(by: self.disposeBag) diff --git a/SOOUM/SOOUM/Presentations/Main/Tags/TagViewController.swift b/SOOUM/SOOUM/Presentations/Main/Tags/TagViewController.swift index 2917cc1a..aef3e872 100644 --- a/SOOUM/SOOUM/Presentations/Main/Tags/TagViewController.swift +++ b/SOOUM/SOOUM/Presentations/Main/Tags/TagViewController.swift @@ -141,12 +141,11 @@ class TagViewController: BaseNavigationViewController, View { func bind(reactor: TagViewReactor) { self.searchViewButtonView.rx.didTap + .do(onNext: { _ in GAHelper.shared.logEvent(event: GAEvent.TagView.tagMenuSearchBar_click) }) .subscribe(with: self) { object, _ in let tagSearchViewController = TagSearchViewController() tagSearchViewController.reactor = reactor.reactorForSearch() - object.parent?.navigationPush(tagSearchViewController, animated: true) { _ in - GAHelper.shared.logEvent(event: GAEvent.TagView.tagMenuSearchBar_click) - } + object.parent?.navigationPush(tagSearchViewController, animated: true) } .disposed(by: self.disposeBag) @@ -164,6 +163,7 @@ class TagViewController: BaseNavigationViewController, View { self.popularTagsView.backgroundDidTap .throttle(.seconds(2), scheduler: MainScheduler.instance) + .do(onNext: { _ in GAHelper.shared.logEvent(event: GAEvent.TagView.popularTag_itemClick) }) .subscribe(with: self) { object, model in let tagCollectViewController = TagCollectViewController() tagCollectViewController.reactor = reactor.reactorForCollect( @@ -171,9 +171,7 @@ class TagViewController: BaseNavigationViewController, View { title: model.name, isFavorite: reactor.currentState.favoriteTags.contains(where: { $0.id == model.id }) ) - object.parent?.navigationPush(tagCollectViewController, animated: true) { _ in - GAHelper.shared.logEvent(event: GAEvent.TagView.popularTag_itemClick) - } + object.parent?.navigationPush(tagCollectViewController, animated: true) } .disposed(by: self.disposeBag) diff --git a/SOOUM/SOOUM/Utilities/SimpleReachability.swift b/SOOUM/SOOUM/Utilities/SimpleReachability.swift index 6463c137..3317cbed 100644 --- a/SOOUM/SOOUM/Utilities/SimpleReachability.swift +++ b/SOOUM/SOOUM/Utilities/SimpleReachability.swift @@ -19,7 +19,11 @@ final class SimpleReachability { static let shared = SimpleReachability() private let monitor = NWPathMonitor() - private let isConnect = BehaviorRelay(value: false) + private let isConnect = BehaviorRelay(value: true) + + var isCurrentStatus: Bool { + return self.isConnect.value + } lazy var isConnected: Observable = { return self.isConnect @@ -33,7 +37,7 @@ final class SimpleReachability { self.monitor.pathUpdateHandler = { [weak self] path in let isAvailable = path.status == .satisfied - Log.info("Network is \(isAvailable ? "available" : "unavailable")") + Log.info("Network status: \(path.status) and is connected: \(isAvailable ? "available" : "unavailable")") self?.isConnect.accept(isAvailable) } self.monitor.start(queue: DispatchQueue(label: Text.networkMoniterQueueLabel, qos: .background))