From 8727d3b91b6ee229d0e4c2a593cd3d18b4ac3c2e Mon Sep 17 00:00:00 2001 From: Diogo Date: Sat, 5 Oct 2024 19:44:26 +0100 Subject: [PATCH] core: add chat message tail and roundness settings (#4977) * core: add chat message tail and roundness settings * ios: import/export chat message tail and roundness settings (#4978) --- apps/ios/Shared/Views/UserSettings/AppSettings.swift | 4 ++++ apps/ios/SimpleXChat/APITypes.swift | 6 ++++++ src/Simplex/Chat/AppSettings.hs | 12 ++++++++++++ 3 files changed, 22 insertions(+) diff --git a/apps/ios/Shared/Views/UserSettings/AppSettings.swift b/apps/ios/Shared/Views/UserSettings/AppSettings.swift index 19260ce573..aa7f885ac6 100644 --- a/apps/ios/Shared/Views/UserSettings/AppSettings.swift +++ b/apps/ios/Shared/Views/UserSettings/AppSettings.swift @@ -58,6 +58,8 @@ extension AppSettings { profileImageCornerRadiusGroupDefault.set(val) def.setValue(val, forKey: DEFAULT_PROFILE_IMAGE_CORNER_RADIUS) } + if let val = uiChatItemRoundness { def.setValue(val, forKey: DEFAULT_CHAT_ITEM_ROUNDNESS)} + if let val = uiChatItemTail { def.setValue(val, forKey: DEFAULT_CHAT_ITEM_TAIL)} if let val = uiColorScheme { currentThemeDefault.set(val) } if let val = uiDarkColorScheme { systemDarkThemeDefault.set(val) } if let val = uiCurrentThemeIds { currentThemeIdsDefault.set(val) } @@ -91,6 +93,8 @@ extension AppSettings { c.iosCallKitEnabled = callKitEnabledGroupDefault.get() c.iosCallKitCallsInRecents = def.bool(forKey: DEFAULT_CALL_KIT_CALLS_IN_RECENTS) c.uiProfileImageCornerRadius = def.double(forKey: DEFAULT_PROFILE_IMAGE_CORNER_RADIUS) + c.uiChatItemRoundness = def.double(forKey: DEFAULT_CHAT_ITEM_ROUNDNESS) + c.uiChatItemTail = def.bool(forKey: DEFAULT_CHAT_ITEM_TAIL) c.uiColorScheme = currentThemeDefault.get() c.uiDarkColorScheme = systemDarkThemeDefault.get() c.uiCurrentThemeIds = currentThemeIdsDefault.get() diff --git a/apps/ios/SimpleXChat/APITypes.swift b/apps/ios/SimpleXChat/APITypes.swift index 96371ff0e0..c2c18b16ce 100644 --- a/apps/ios/SimpleXChat/APITypes.swift +++ b/apps/ios/SimpleXChat/APITypes.swift @@ -2251,6 +2251,8 @@ public struct AppSettings: Codable, Equatable { public var iosCallKitEnabled: Bool? = nil public var iosCallKitCallsInRecents: Bool? = nil public var uiProfileImageCornerRadius: Double? = nil + public var uiChatItemRoundness: Double? = nil + public var uiChatItemTail: Bool? = nil public var uiColorScheme: String? = nil public var uiDarkColorScheme: String? = nil public var uiCurrentThemeIds: [String: String]? = nil @@ -2283,6 +2285,8 @@ public struct AppSettings: Codable, Equatable { if iosCallKitEnabled != def.iosCallKitEnabled { empty.iosCallKitEnabled = iosCallKitEnabled } if iosCallKitCallsInRecents != def.iosCallKitCallsInRecents { empty.iosCallKitCallsInRecents = iosCallKitCallsInRecents } if uiProfileImageCornerRadius != def.uiProfileImageCornerRadius { empty.uiProfileImageCornerRadius = uiProfileImageCornerRadius } + if uiChatItemRoundness != def.uiChatItemRoundness { empty.uiChatItemRoundness = uiChatItemRoundness } + if uiChatItemTail != def.uiChatItemTail { empty.uiChatItemTail = uiChatItemTail } if uiColorScheme != def.uiColorScheme { empty.uiColorScheme = uiColorScheme } if uiDarkColorScheme != def.uiDarkColorScheme { empty.uiDarkColorScheme = uiDarkColorScheme } if uiCurrentThemeIds != def.uiCurrentThemeIds { empty.uiCurrentThemeIds = uiCurrentThemeIds } @@ -2316,6 +2320,8 @@ public struct AppSettings: Codable, Equatable { iosCallKitEnabled: true, iosCallKitCallsInRecents: false, uiProfileImageCornerRadius: 22.5, + uiChatItemRoundness: 0.75, + uiChatItemTail: true, uiColorScheme: DefaultTheme.SYSTEM_THEME_NAME, uiDarkColorScheme: DefaultTheme.SIMPLEX.themeName, uiCurrentThemeIds: nil as [String: String]?, diff --git a/src/Simplex/Chat/AppSettings.hs b/src/Simplex/Chat/AppSettings.hs index 863302fad2..e75546d206 100644 --- a/src/Simplex/Chat/AppSettings.hs +++ b/src/Simplex/Chat/AppSettings.hs @@ -50,6 +50,8 @@ data AppSettings = AppSettings iosCallKitEnabled :: Maybe Bool, iosCallKitCallsInRecents :: Maybe Bool, uiProfileImageCornerRadius :: Maybe Double, + uiChatItemRoundness :: Maybe Double, + uiChatItemTail :: Maybe Bool, uiColorScheme :: Maybe UIColorScheme, uiDarkColorScheme :: Maybe DarkColorScheme, uiCurrentThemeIds :: Maybe (Map ThemeColorScheme Text), @@ -97,6 +99,8 @@ defaultAppSettings = iosCallKitEnabled = Just True, iosCallKitCallsInRecents = Just False, uiProfileImageCornerRadius = Just 22.5, + uiChatItemRoundness = Just 0.75, + uiChatItemTail = Just True, uiColorScheme = Just UCSSystem, uiDarkColorScheme = Just DCSSimplex, uiCurrentThemeIds = Nothing, @@ -131,6 +135,8 @@ defaultParseAppSettings = iosCallKitEnabled = Nothing, iosCallKitCallsInRecents = Nothing, uiProfileImageCornerRadius = Nothing, + uiChatItemRoundness = Nothing, + uiChatItemTail = Nothing, uiColorScheme = Nothing, uiDarkColorScheme = Nothing, uiCurrentThemeIds = Nothing, @@ -165,6 +171,8 @@ combineAppSettings platformDefaults storedSettings = iosCallKitCallsInRecents = p iosCallKitCallsInRecents, androidCallOnLockScreen = p androidCallOnLockScreen, uiProfileImageCornerRadius = p uiProfileImageCornerRadius, + uiChatItemRoundness = p uiChatItemRoundness, + uiChatItemTail = p uiChatItemTail, uiColorScheme = p uiColorScheme, uiDarkColorScheme = p uiDarkColorScheme, uiCurrentThemeIds = p uiCurrentThemeIds, @@ -215,6 +223,8 @@ instance FromJSON AppSettings where iosCallKitCallsInRecents <- p "iosCallKitCallsInRecents" androidCallOnLockScreen <- p "androidCallOnLockScreen" uiProfileImageCornerRadius <- p "uiProfileImageCornerRadius" + uiChatItemRoundness <- p "uiChatItemRoundness" + uiChatItemTail <- p "uiChatItemTail" uiColorScheme <- p "uiColorScheme" uiDarkColorScheme <- p "uiDarkColorScheme" uiCurrentThemeIds <- p "uiCurrentThemeIds" @@ -246,6 +256,8 @@ instance FromJSON AppSettings where iosCallKitCallsInRecents, androidCallOnLockScreen, uiProfileImageCornerRadius, + uiChatItemRoundness, + uiChatItemTail, uiColorScheme, uiDarkColorScheme, uiCurrentThemeIds,