mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Folder improvements
This commit is contained in:
parent
dc9e1b7e2e
commit
bf13f17521
@ -840,37 +840,40 @@ private func internalChatListFilterAddChatsController(context: AccountContext, f
|
||||
}
|
||||
includePeers.sort()
|
||||
|
||||
let newPeers = includePeers.filter({ !(filter.data?.includePeers.peers.contains($0) ?? false) })
|
||||
var removedPeers: [PeerId] = []
|
||||
if let data = filter.data {
|
||||
removedPeers = data.includePeers.peers.filter({ !includePeers.contains($0) })
|
||||
}
|
||||
if newPeers.count != 0 {
|
||||
let title: String
|
||||
let text: String
|
||||
|
||||
if newPeers.count == 1 {
|
||||
title = "Сhat added to folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
} else {
|
||||
title = "\(newPeers.count) chats added to folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
if filter.id > 1, case let .filter(_, _, _, data) = filter, data.hasSharedLinks {
|
||||
let newPeers = includePeers.filter({ !(filter.data?.includePeers.peers.contains($0) ?? false) })
|
||||
var removedPeers: [PeerId] = []
|
||||
if let data = filter.data {
|
||||
removedPeers = data.includePeers.peers.filter({ !includePeers.contains($0) })
|
||||
}
|
||||
|
||||
presentUndo(.info(title: title, text: text, timeout: nil))
|
||||
} else if removedPeers.count != 0 {
|
||||
let title: String
|
||||
let text: String
|
||||
|
||||
if newPeers.count == 1 {
|
||||
title = "Сhat removed from folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
} else {
|
||||
title = "\(newPeers.count) chats removed from folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
if newPeers.count != 0 {
|
||||
let title: String
|
||||
let text: String
|
||||
|
||||
//TODO:localize
|
||||
if newPeers.count == 1 {
|
||||
title = "Сhat added to folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
} else {
|
||||
title = "\(newPeers.count) chats added to folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
}
|
||||
|
||||
presentUndo(.universal(animation: "anim_add_to_folder", scale: 0.1, colors: ["__allcolors__": UIColor.white], title: title, text: text, customUndoText: nil, timeout: nil))
|
||||
} else if removedPeers.count != 0 {
|
||||
let title: String
|
||||
let text: String
|
||||
|
||||
if newPeers.count == 1 {
|
||||
title = "Сhat removed from folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
} else {
|
||||
title = "\(newPeers.count) chats removed from folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
}
|
||||
|
||||
presentUndo(.universal(animation: "anim_remove_from_folder", scale: 0.1, colors: ["__allcolors__": UIColor.white], title: title, text: text, customUndoText: nil, timeout: nil))
|
||||
}
|
||||
|
||||
presentUndo(.info(title: title, text: text, timeout: nil))
|
||||
}
|
||||
|
||||
var categories: ChatListFilterPeerCategories = []
|
||||
@ -1321,6 +1324,21 @@ func chatListFilterPresetController(context: AccountContext, currentPreset initi
|
||||
}
|
||||
return state
|
||||
}
|
||||
|
||||
let _ = (updatedCurrentPreset |> take(1) |> deliverOnMainQueue).start(next: { currentPreset in
|
||||
if let currentPreset, let data = currentPreset.data, data.hasSharedLinks {
|
||||
//TODO:localize
|
||||
let title: String
|
||||
let text: String
|
||||
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
title = "Сhat removed from folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_remove_from_folder", scale: 0.1, colors: ["__allcolors__": UIColor.white], title: title, text: text, customUndoText: nil, timeout: nil), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteExcludePeer: { peerId in
|
||||
updateState { state in
|
||||
@ -1581,6 +1599,21 @@ func chatListFilterPresetController(context: AccountContext, currentPreset initi
|
||||
}
|
||||
return state
|
||||
}
|
||||
|
||||
let _ = (updatedCurrentPreset |> take(1) |> deliverOnMainQueue).start(next: { currentPreset in
|
||||
if let currentPreset, let data = currentPreset.data, data.hasSharedLinks {
|
||||
//TODO:localize
|
||||
let title: String
|
||||
let text: String
|
||||
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
title = "Сhat removed from folder"
|
||||
text = "It will not affect chatlist of the links of this folder"
|
||||
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_remove_from_folder", scale: 0.1, colors: ["__allcolors__": UIColor.white], title: title, text: text, customUndoText: nil, timeout: nil), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
})
|
||||
})))
|
||||
|
||||
let contextController = ContextController(account: context.account, presentationData: presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node)), items: .single(ContextController.Items(content: .list(items))), gesture: gesture)
|
||||
|
@ -606,14 +606,19 @@ public final class PremiumLimitDisplayComponent: CombinedComponent {
|
||||
|
||||
let activityPosition = floor(context.availableSize.width * component.badgeGraphPosition)
|
||||
|
||||
var inactiveTitleOpacity: CGFloat = 1.0
|
||||
var inactiveValueOpacity: CGFloat = 1.0
|
||||
if inactiveValue.size.width + inactiveTitle.size.width >= activityPosition - 8.0 {
|
||||
inactiveValueOpacity = 0.0
|
||||
|
||||
if 12.0 + inactiveValue.size.width + 4.0 + inactiveTitle.size.width + 12.0 >= activityPosition - 8.0 {
|
||||
inactiveTitleOpacity = 0.0
|
||||
if 12.0 + inactiveValue.size.width + 12.0 >= activityPosition - 8.0 {
|
||||
inactiveValueOpacity = 0.0
|
||||
}
|
||||
}
|
||||
|
||||
context.add(inactiveTitle
|
||||
.position(CGPoint(x: inactiveTitle.size.width / 2.0 + 12.0, y: height - lineHeight / 2.0))
|
||||
.opacity(inactiveValueOpacity)
|
||||
.opacity(inactiveTitleOpacity)
|
||||
)
|
||||
|
||||
context.add(inactiveValue
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user