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
This commit is contained in:
Morgan Pretty 2022-10-11 11:30:10 +11:00
parent 76536a8293
commit 02e632aae4
3 changed files with 8 additions and 37 deletions

View file

@ -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

View file

@ -56,6 +56,11 @@ class NotificationSettingsViewModel: SessionTableViewModel<NoNav, NotificationSe
/// just in case the database has changed between the two reads - unfortunately it doesn't look like there is a way to prevent this
private lazy var _observableSettingsData: ObservableData = ValueObservation
.trackingConstantRegion { db -> [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<NoNav, NotificationSe
id: .styleSound,
title: "NOTIFICATIONS_STYLE_SOUND_TITLE".localized(),
rightAccessory: .dropDown(
.dynamicString(
type: Preferences.Sound.self,
key: .defaultNotificationSound,
value: { $0.defaulting(to: .defaultNotificationSound).displayName }
)
.dynamicString { notificationSound.displayName }
),
onTap: { [weak self] in
self?.transitionToScreen(
@ -122,11 +123,7 @@ class NotificationSettingsViewModel: SessionTableViewModel<NoNav, NotificationSe
title: "NOTIFICATIONS_STYLE_CONTENT_TITLE".localized(),
subtitle: "NOTIFICATIONS_STYLE_CONTENT_DESCRIPTION".localized(),
rightAccessory: .dropDown(
.dynamicString(
type: Preferences.NotificationPreviewType.self,
key: .preferencesNotificationPreviewType,
value: { $0.defaulting(to: .defaultPreviewType).name }
)
.dynamicString { previewType.name }
),
onTap: { [weak self] in
self?.transitionToScreen(

View file

@ -222,32 +222,6 @@ extension SessionCell.Accessory {
case userDefaults(UserDefaults, key: String)
case settingBool(key: Setting.BoolKey)
// MARK: - Convenience Types
public static func dynamicString<ET: EnumIntSetting>(
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<ET: EnumStringSetting>(
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 {