mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-30 09:21:28 +00:00
Improve storage usage selection
This commit is contained in:
parent
dc6e7b82c5
commit
2bdda2bc17
@ -8609,3 +8609,5 @@ Sorry for the inconvenience.";
|
||||
"GroupMembers.HideMembers" = "Hide Members";
|
||||
"GroupMembers.MembersHiddenOn" = "Switch this off to show the list of members in this group.";
|
||||
"GroupMembers.MembersHiddenOff" = "Switch this on to hide the list of members in this group. Admins will remain visible.";
|
||||
|
||||
"StorageManagement.ClearCache" = "Clear Cache";
|
||||
|
@ -40,6 +40,7 @@ final class StorageCategoriesComponent: Component {
|
||||
let strings: PresentationStrings
|
||||
let categories: [CategoryData]
|
||||
let isOtherExpanded: Bool
|
||||
let displayAction: Bool
|
||||
let toggleCategorySelection: (StorageUsageScreenComponent.Category) -> Void
|
||||
let toggleOtherExpanded: () -> Void
|
||||
let clearAction: () -> Void
|
||||
@ -49,6 +50,7 @@ final class StorageCategoriesComponent: Component {
|
||||
strings: PresentationStrings,
|
||||
categories: [CategoryData],
|
||||
isOtherExpanded: Bool,
|
||||
displayAction: Bool,
|
||||
toggleCategorySelection: @escaping (StorageUsageScreenComponent.Category) -> Void,
|
||||
toggleOtherExpanded: @escaping () -> Void,
|
||||
clearAction: @escaping () -> Void
|
||||
@ -57,6 +59,7 @@ final class StorageCategoriesComponent: Component {
|
||||
self.strings = strings
|
||||
self.categories = categories
|
||||
self.isOtherExpanded = isOtherExpanded
|
||||
self.displayAction = displayAction
|
||||
self.toggleCategorySelection = toggleCategorySelection
|
||||
self.toggleOtherExpanded = toggleOtherExpanded
|
||||
self.clearAction = clearAction
|
||||
@ -75,6 +78,9 @@ final class StorageCategoriesComponent: Component {
|
||||
if lhs.isOtherExpanded != rhs.isOtherExpanded {
|
||||
return false
|
||||
}
|
||||
if lhs.displayAction != rhs.displayAction {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@ -195,6 +201,7 @@ final class StorageCategoriesComponent: Component {
|
||||
self.itemViews.removeValue(forKey: key)
|
||||
}
|
||||
|
||||
if component.displayAction {
|
||||
let clearTitle: String
|
||||
let label: String?
|
||||
if totalSelectedSize == 0 {
|
||||
@ -239,7 +246,7 @@ final class StorageCategoriesComponent: Component {
|
||||
containerSize: CGSize(width: availableSize.width - 16.0 * 2.0, height: 50.0)
|
||||
)
|
||||
let buttonFrame = CGRect(origin: CGPoint(x: 16.0, y: contentHeight), size: buttonSize)
|
||||
if let buttonView = button.view {
|
||||
if let buttonView = self.button.view {
|
||||
if buttonView.superview == nil {
|
||||
self.addSubview(buttonView)
|
||||
}
|
||||
@ -248,6 +255,11 @@ final class StorageCategoriesComponent: Component {
|
||||
contentHeight += buttonSize.height
|
||||
|
||||
contentHeight += 16.0
|
||||
} else {
|
||||
if let buttonView = self.button.view {
|
||||
buttonView.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
|
||||
self.backgroundColor = component.theme.list.itemBlocksBackgroundColor
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user