mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-01 18:33:10 +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.HideMembers" = "Hide Members";
|
||||||
"GroupMembers.MembersHiddenOn" = "Switch this off to show the list of members in this group.";
|
"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.";
|
"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 strings: PresentationStrings
|
||||||
let categories: [CategoryData]
|
let categories: [CategoryData]
|
||||||
let isOtherExpanded: Bool
|
let isOtherExpanded: Bool
|
||||||
|
let displayAction: Bool
|
||||||
let toggleCategorySelection: (StorageUsageScreenComponent.Category) -> Void
|
let toggleCategorySelection: (StorageUsageScreenComponent.Category) -> Void
|
||||||
let toggleOtherExpanded: () -> Void
|
let toggleOtherExpanded: () -> Void
|
||||||
let clearAction: () -> Void
|
let clearAction: () -> Void
|
||||||
@ -49,6 +50,7 @@ final class StorageCategoriesComponent: Component {
|
|||||||
strings: PresentationStrings,
|
strings: PresentationStrings,
|
||||||
categories: [CategoryData],
|
categories: [CategoryData],
|
||||||
isOtherExpanded: Bool,
|
isOtherExpanded: Bool,
|
||||||
|
displayAction: Bool,
|
||||||
toggleCategorySelection: @escaping (StorageUsageScreenComponent.Category) -> Void,
|
toggleCategorySelection: @escaping (StorageUsageScreenComponent.Category) -> Void,
|
||||||
toggleOtherExpanded: @escaping () -> Void,
|
toggleOtherExpanded: @escaping () -> Void,
|
||||||
clearAction: @escaping () -> Void
|
clearAction: @escaping () -> Void
|
||||||
@ -57,6 +59,7 @@ final class StorageCategoriesComponent: Component {
|
|||||||
self.strings = strings
|
self.strings = strings
|
||||||
self.categories = categories
|
self.categories = categories
|
||||||
self.isOtherExpanded = isOtherExpanded
|
self.isOtherExpanded = isOtherExpanded
|
||||||
|
self.displayAction = displayAction
|
||||||
self.toggleCategorySelection = toggleCategorySelection
|
self.toggleCategorySelection = toggleCategorySelection
|
||||||
self.toggleOtherExpanded = toggleOtherExpanded
|
self.toggleOtherExpanded = toggleOtherExpanded
|
||||||
self.clearAction = clearAction
|
self.clearAction = clearAction
|
||||||
@ -75,6 +78,9 @@ final class StorageCategoriesComponent: Component {
|
|||||||
if lhs.isOtherExpanded != rhs.isOtherExpanded {
|
if lhs.isOtherExpanded != rhs.isOtherExpanded {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.displayAction != rhs.displayAction {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,6 +201,7 @@ final class StorageCategoriesComponent: Component {
|
|||||||
self.itemViews.removeValue(forKey: key)
|
self.itemViews.removeValue(forKey: key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if component.displayAction {
|
||||||
let clearTitle: String
|
let clearTitle: String
|
||||||
let label: String?
|
let label: String?
|
||||||
if totalSelectedSize == 0 {
|
if totalSelectedSize == 0 {
|
||||||
@ -239,7 +246,7 @@ final class StorageCategoriesComponent: Component {
|
|||||||
containerSize: CGSize(width: availableSize.width - 16.0 * 2.0, height: 50.0)
|
containerSize: CGSize(width: availableSize.width - 16.0 * 2.0, height: 50.0)
|
||||||
)
|
)
|
||||||
let buttonFrame = CGRect(origin: CGPoint(x: 16.0, y: contentHeight), size: buttonSize)
|
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 {
|
if buttonView.superview == nil {
|
||||||
self.addSubview(buttonView)
|
self.addSubview(buttonView)
|
||||||
}
|
}
|
||||||
@ -248,6 +255,11 @@ final class StorageCategoriesComponent: Component {
|
|||||||
contentHeight += buttonSize.height
|
contentHeight += buttonSize.height
|
||||||
|
|
||||||
contentHeight += 16.0
|
contentHeight += 16.0
|
||||||
|
} else {
|
||||||
|
if let buttonView = self.button.view {
|
||||||
|
buttonView.removeFromSuperview()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.backgroundColor = component.theme.list.itemBlocksBackgroundColor
|
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