Wide Tab bar

This commit is contained in:
Kylmakalle
2025-12-22 00:06:14 +02:00
parent 57634e545f
commit 61ef315407
4 changed files with 15 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ private enum SGBoolSetting: String {
case showTabNames
case showContactsTab
case showCallsTab
case wideTabBar
case foldersAtBottom
case startTelescopeWithRearCam
case hideStories
@@ -166,6 +167,8 @@ private func SGControllerEntries(presentationData: PresentationData, callListSet
entries.append(.toggle(id: id.count, section: .tabs, settingName: .showContactsTab, value: callListSettings.showContactsTab, text: i18n("Settings.Tabs.ShowContacts", lang), enabled: !SGSimpleSettings.shared.hideTabBar))
entries.append(.toggle(id: id.count, section: .tabs, settingName: .showCallsTab, value: callListSettings.showTab, text: strings.CallSettings_TabIcon, enabled: !SGSimpleSettings.shared.hideTabBar))
entries.append(.toggle(id: id.count, section: .tabs, settingName: .showTabNames, value: SGSimpleSettings.shared.showTabNames, text: i18n("Settings.Tabs.ShowNames", lang), enabled: !SGSimpleSettings.shared.hideTabBar))
entries.append(.toggle(id: id.count, section: .tabs, settingName: .wideTabBar, value: SGSimpleSettings.shared.wideTabBar, text: i18n("Settings.Tabs.WideTabBar", lang), enabled: !SGSimpleSettings.shared.hideTabBar))
entries.append(.notice(id: id.count, section: .tabs, text: i18n("Settings.Tabs.WideTabBar.Notice", lang)))
entries.append(.header(id: id.count, section: .folders, text: strings.Settings_ChatFolders.uppercased(), badge: nil))
entries.append(.toggle(id: id.count, section: .folders, settingName: .foldersAtBottom, value: experimentalUISettings.foldersTabAtBottom, text: i18n("Settings.Folders.BottomTab", lang), enabled: true))
@@ -373,6 +376,9 @@ public func sgSettingsController(context: AccountContext/*, focusOnItemTag: Int?
accountManager: context.sharedContext.accountManager, { $0.withUpdatedShowTab(value) }
)
).start()
case .wideTabBar:
SGSimpleSettings.shared.wideTabBar = value
askForRestart?()
case .foldersAtBottom:
let _ = (
updateExperimentalUISettingsInteractively(accountManager: context.sharedContext.accountManager, { settings in

View File

@@ -154,6 +154,7 @@ public class SGSimpleSettings {
case customAppBadge
case canUseNY
case nyStyle
case wideTabBar
}
public enum DownloadSpeedBoostValues: String, CaseIterable {
@@ -292,6 +293,7 @@ public class SGSimpleSettings {
Keys.customAppBadge.rawValue: "",
Keys.canUseNY.rawValue: false,
Keys.nyStyle.rawValue: NYStyle.default.rawValue,
Keys.wideTabBar.rawValue: false,
]
public static let groupDefaultValues: [String: Any] = [
@@ -534,6 +536,9 @@ public class SGSimpleSettings {
@UserDefault(key: Keys.nyStyle.rawValue)
public var nyStyle: String
@UserDefault(key: Keys.wideTabBar.rawValue)
public var wideTabBar: Bool
}
extension SGSimpleSettings {

View File

@@ -4,6 +4,8 @@
"Settings.Tabs.HideTabBar" = "Hide Tab bar";
"Settings.Tabs.ShowContacts" = "Show Contacts Tab";
"Settings.Tabs.ShowNames" = "Show Tab Names";
"Settings.Tabs.WideTabBar" = "Wide Tab bar";
"Settings.Tabs.WideTabBar.Notice" = "When enabled, the Tab bar keeps full width even when one or more tabs are hidden.";
"Settings.Folders.BottomTab" = "Folders at Bottom";
"Settings.Folders.BottomTabStyle" = "Bottom Folders Style";

View File

@@ -369,7 +369,8 @@ public final class TabBarComponent: Component {
self.overrideUserInterfaceStyle = component.theme.overallDarkAppearance ? .dark : .light
let itemSize = CGSize(width: floor((availableSize.width - innerInset * 2.0) / CGFloat(component.items.count)), height: SGSimpleSettings.shared.showTabNames ? 56.0 : 40.0)
var itemSize = CGSize(width: floor((availableSize.width - innerInset * 2.0) / CGFloat(component.items.count)), height: SGSimpleSettings.shared.showTabNames ? 56.0 : 40.0)
if !SGSimpleSettings.shared.wideTabBar { itemSize.width = min(94.0, itemSize.width) }
let contentWidth: CGFloat = innerInset * 2.0 + CGFloat(component.items.count) * itemSize.width
let size = CGSize(width: min(availableSize.width, contentWidth), height: itemSize.height + innerInset * 2.0)