From 20950cc34c40e761c63d29d090e9d7dcc54bcd24 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryhoriev Date: Thu, 20 Sep 2018 11:56:55 +0300 Subject: [PATCH 1/3] Uncomment `logs`, add `delete account` feature only for DEBUG versions. --- Nynja/DatabaseManager.swift | 4 +--- Nynja/LogService/LogService.swift | 1 - Nynja/OptionsItemsFactory.swift | 16 ++++++++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Nynja/DatabaseManager.swift b/Nynja/DatabaseManager.swift index 17a16503b..bae92e216 100644 --- a/Nynja/DatabaseManager.swift +++ b/Nynja/DatabaseManager.swift @@ -94,9 +94,7 @@ final class DatabaseManager: DBManagerProtocol { private func makeConfiguration(with passphrase: String?) -> Configuration { var configuration = Configuration() configuration.passphrase = passphrase - configuration.trace = nil //{ info in -// LogService.log(topic: .db) { return "DB Path: \(self.dbPool?.path ?? "")" + "\n" + info } -// } + configuration.trace = nil return configuration } diff --git a/Nynja/LogService/LogService.swift b/Nynja/LogService/LogService.swift index 56708486e..d25ebea87 100644 --- a/Nynja/LogService/LogService.swift +++ b/Nynja/LogService/LogService.swift @@ -50,7 +50,6 @@ class LogService { } static func log(topic: LogServiceTopic, block: () -> String) { - return #if !RELEASE if !enable.contains(topic) { return } LogService.executeLogs(topic: topic, text: block(), thread: Thread.current.debugDescription) diff --git a/Nynja/OptionsItemsFactory.swift b/Nynja/OptionsItemsFactory.swift index 4f28559b6..5d261d632 100644 --- a/Nynja/OptionsItemsFactory.swift +++ b/Nynja/OptionsItemsFactory.swift @@ -17,7 +17,16 @@ class OptionsItemsFactory: WCBaseItemsFactory { // MARK: - Second lvl override var secondLevelItems: ItemModels { - return [logout, notifications, changeNumber, wheelPosition, buildNumber, support, languageSettings, theme, dataAndStorage, security, privacy] + var items = [ + logout, notifications, changeNumber, wheelPosition, buildNumber, + support, languageSettings, theme, dataAndStorage, security, privacy + ] + + #if DEBUG + items.append(deleteAccount) + #endif + + return items } // MARK: - Items @@ -82,8 +91,11 @@ class OptionsItemsFactory: WCBaseItemsFactory { var deleteAccount: ImageActionItemModel { let item = ImageActionItemModel(navItem: .deleteAccount, action: { [weak navigateDelegate] (item, indexPath) in -// navigateDelegate?.deleteAccount(indexPath: indexPath) + #if DEBUG + navigateDelegate?.deleteAccount(indexPath: indexPath) + #else navigateDelegate?.unavailableFunctionality() + #endif }) return item } -- GitLab From 466b3af5166dae2d2b8d4c6ef94e5ac5c0cf94a9 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryhoriev Date: Wed, 19 Sep 2018 18:44:45 +0300 Subject: [PATCH 2/3] [NY-3660] Fix issue with `Lists are not updated when user receives Profile` which was found on `Chat List`, `Group List`, `Channel List` screens. --- .../Interactor/ChannelsListInteractor.swift | 26 +++++++++++++------ .../Interactor/ChatsListInteractor.swift | 17 +++++++----- .../Interactor/GroupsListInteractor.swift | 9 ++++++- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Nynja/Modules/ChannelsList/Interactor/ChannelsListInteractor.swift b/Nynja/Modules/ChannelsList/Interactor/ChannelsListInteractor.swift index af4fdb8d1..69b2c0e4f 100644 --- a/Nynja/Modules/ChannelsList/Interactor/ChannelsListInteractor.swift +++ b/Nynja/Modules/ChannelsList/Interactor/ChannelsListInteractor.swift @@ -55,15 +55,22 @@ final class ChannelsListInteractor: BaseInteractor, ChannelsListInteractorInputP // MARK: - StorageSubscriber override func update(with changes: [StorageChange], type: SubscribeType) { - guard let dbRoom = changes.first?.entity as? DBRoom else { + guard case .room = type else { return } - let room = Room(room: dbRoom) - if room.kind == .channel { - if mode == .mine && ![.owner, .admin].contains(room.role) { - return + + if changes.count == 1, let dbRoom = changes.first?.entity as? DBRoom { + let room = Room(room: dbRoom) + if room.kind == .channel { + if mode == .mine && ![.owner, .admin].contains(room.role) { + return + } + + channels = updateChatsList(with: room) + applyFilter(with: searchText) } - channels = updateChatsList(with: room) + } else { + loadChannels() applyFilter(with: searchText) } } @@ -71,13 +78,16 @@ final class ChannelsListInteractor: BaseInteractor, ChannelsListInteractorInputP //MARK: - Private - private func fetchChannels() { + private func loadChannels() { if mode == .all { channels = conversationsProvider.fetchChannels() } else { channels = conversationsProvider.fetchMyChannels() } - + } + + private func fetchChannels() { + loadChannels() presenter.channelsFetched(channels) } diff --git a/Nynja/Modules/ChatsList/Interactor/ChatsListInteractor.swift b/Nynja/Modules/ChatsList/Interactor/ChatsListInteractor.swift index c40b768de..02aa17311 100644 --- a/Nynja/Modules/ChatsList/Interactor/ChatsListInteractor.swift +++ b/Nynja/Modules/ChatsList/Interactor/ChatsListInteractor.swift @@ -53,13 +53,18 @@ class ChatsListInteractor: BaseInteractor, ChatsListInteractorInputProtocol, Ini // MARK: - StorageSubscriber override func update(with changes: [StorageChange], type: SubscribeType) { - if case .contact = type { - if let dbContact = changes.first?.entity as? DBContact { - let contact = Contact(contact: dbContact) - chats = updateChatsList(with: contact) - applyFilter(with: searchText) - } + guard case .contact = type else { + return + } + + if changes.count == 1, let dbContact = changes.first?.entity as? DBContact { + let contact = Contact(contact: dbContact) + chats = updateChatsList(with: contact) + } else { + chats = conversationsProvider.fetchChats() } + + applyFilter(with: searchText) } diff --git a/Nynja/Modules/GroupsList/Interactor/GroupsListInteractor.swift b/Nynja/Modules/GroupsList/Interactor/GroupsListInteractor.swift index 438b2c88a..c16ee18b5 100644 --- a/Nynja/Modules/GroupsList/Interactor/GroupsListInteractor.swift +++ b/Nynja/Modules/GroupsList/Interactor/GroupsListInteractor.swift @@ -56,12 +56,19 @@ class GroupsListInteractor: BaseInteractor, GroupsListInteractorInputProtocol, I // MARK: - StorageSubscriber override func update(with changes: [StorageChange], type: SubscribeType) { - if let dbRoom = changes.first?.entity as? DBRoom { + guard case .room = type else { + return + } + + if changes.count == 1, let dbRoom = changes.first?.entity as? DBRoom { let room = Room(room: dbRoom) if room.kind == .group { chats = updateChatsList(with: room) applyFilter(with: searchText) } + } else { + chats = conversationsProvider.fetchGroups() + applyFilter(with: searchText) } } -- GitLab From 9cf673134a5d1a49a182d943359e05d87ff2d863 Mon Sep 17 00:00:00 2001 From: Romito2015 Date: Thu, 20 Sep 2018 23:23:41 +0300 Subject: [PATCH 3/3] fixed coming soon alert ui --- Nynja/Library/UI/AlertManager.swift | 8 ++++++++ .../Main/View/MainViewController+NavigateProtocol.swift | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Nynja/Library/UI/AlertManager.swift b/Nynja/Library/UI/AlertManager.swift index cbea0456e..dd5a6d519 100644 --- a/Nynja/Library/UI/AlertManager.swift +++ b/Nynja/Library/UI/AlertManager.swift @@ -29,6 +29,14 @@ class AlertManager { presentingController?.present(alert, animated: true, completion: nil) } + func showAlert(title: String, dismissInterval: TimeInterval) { + let alert = UIAlertController(title: "\n\(title)\n ", message: "", preferredStyle: .alert) + dispatchAsyncMainAfter(dismissInterval) { + alert.dismiss(animated: true, completion: nil) + } + presentingController?.present(alert, animated: true, completion: nil) + } + func showAlertOk(message: String, completion:(()->Void)? = nil) { showAlertOk(title: "", message: message, completion: completion) } diff --git a/Nynja/Modules/Main/View/MainViewController+NavigateProtocol.swift b/Nynja/Modules/Main/View/MainViewController+NavigateProtocol.swift index 80311b819..8ccbf35d3 100644 --- a/Nynja/Modules/Main/View/MainViewController+NavigateProtocol.swift +++ b/Nynja/Modules/Main/View/MainViewController+NavigateProtocol.swift @@ -11,7 +11,7 @@ import Photos extension MainViewController: NavigateProtocol { func unavailableFunctionality() { - AlertManager.sharedInstance.showAlertOk(message: "coming_soon".localized) + AlertManager.sharedInstance.showAlert(title: "coming_soon".localized, dismissInterval: 3) } //MARK: - First lvl -- GitLab