From 02e632aae4ec35b64c7b2c320693c86dfe4436cf Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Tue, 11 Oct 2022 11:30:10 +1100 Subject: [PATCH] Fixed a couple of bugs with the release Fixed a bug where you couldn't start a conversation with an ONS Fixed a bug where some dropdown settings wouldn't refresh their UI when returning from an update via a child screen --- Session/Home/New Conversation/NewDMVC.swift | 2 +- .../NotificationSettingsViewModel.swift | 17 +++++------- .../Shared/Types/SessionCell+Accessory.swift | 26 ------------------- 3 files changed, 8 insertions(+), 37 deletions(-) diff --git a/Session/Home/New Conversation/NewDMVC.swift b/Session/Home/New Conversation/NewDMVC.swift index 6db28a78f..6e9bd16ba 100644 --- a/Session/Home/New Conversation/NewDMVC.swift +++ b/Session/Home/New Conversation/NewDMVC.swift @@ -238,7 +238,7 @@ private final class EnterPublicKeyVC: UIViewController { private lazy var publicKeyTextView: TextView = { let result = TextView(placeholder: "vc_enter_public_key_text_field_hint".localized()) { [weak self] text in - self?.nextButton.isEnabled = (SessionId(from: text) != nil) + self?.nextButton.isEnabled = !text.isEmpty } result.autocapitalizationType = .none diff --git a/Session/Settings/NotificationSettingsViewModel.swift b/Session/Settings/NotificationSettingsViewModel.swift index bbf17b534..081582582 100644 --- a/Session/Settings/NotificationSettingsViewModel.swift +++ b/Session/Settings/NotificationSettingsViewModel.swift @@ -56,6 +56,11 @@ class NotificationSettingsViewModel: SessionTableViewModel [SectionModel] in + let notificationSound: Preferences.Sound = db[.defaultNotificationSound] + .defaulting(to: Preferences.Sound.defaultNotificationSound) + let previewType: Preferences.NotificationPreviewType = db[.preferencesNotificationPreviewType] + .defaulting(to: Preferences.NotificationPreviewType.defaultPreviewType) + return [ SectionModel( model: .strategy, @@ -90,11 +95,7 @@ class NotificationSettingsViewModel: SessionTableViewModel( - type: ET.Type, - key: Setting.EnumKey, - value: @escaping ((ET?) -> String?) - ) -> DataSource { - return .dynamicString { - let currentValue: ET? = Storage.shared[key] - - return value(currentValue) - } - } - - public static func dynamicString( - type: ET.Type, - key: Setting.EnumKey, - value: @escaping ((ET?) -> String?) - ) -> DataSource { - return .dynamicString { - let currentValue: ET? = Storage.shared[key] - - return value(currentValue) - } - } - // MARK: - Convenience public var currentBoolValue: Bool {