mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branches 'master' and 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
e4e810ae29
@ -840,37 +840,40 @@ private func internalChatListFilterAddChatsController(context: AccountContext, f
|
|||||||
}
|
}
|
||||||
includePeers.sort()
|
includePeers.sort()
|
||||||
|
|
||||||
let newPeers = includePeers.filter({ !(filter.data?.includePeers.peers.contains($0) ?? false) })
|
if filter.id > 1, case let .filter(_, _, _, data) = filter, data.hasSharedLinks {
|
||||||
var removedPeers: [PeerId] = []
|
let newPeers = includePeers.filter({ !(filter.data?.includePeers.peers.contains($0) ?? false) })
|
||||||
if let data = filter.data {
|
var removedPeers: [PeerId] = []
|
||||||
removedPeers = data.includePeers.peers.filter({ !includePeers.contains($0) })
|
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 newPeers.count != 0 {
|
||||||
presentUndo(.info(title: title, text: text, timeout: nil))
|
let title: String
|
||||||
} else if removedPeers.count != 0 {
|
let text: String
|
||||||
let title: String
|
|
||||||
let text: String
|
//TODO:localize
|
||||||
|
if newPeers.count == 1 {
|
||||||
if newPeers.count == 1 {
|
title = "Сhat added to folder"
|
||||||
title = "Сhat removed from folder"
|
text = "It will not affect chatlist of the links of this folder"
|
||||||
text = "It will not affect chatlist of the links of this folder"
|
} else {
|
||||||
} else {
|
title = "\(newPeers.count) chats added to folder"
|
||||||
title = "\(newPeers.count) chats removed from folder"
|
text = "It will not affect chatlist of the links of this 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 = []
|
var categories: ChatListFilterPeerCategories = []
|
||||||
@ -1321,6 +1324,21 @@ func chatListFilterPresetController(context: AccountContext, currentPreset initi
|
|||||||
}
|
}
|
||||||
return state
|
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
|
deleteExcludePeer: { peerId in
|
||||||
updateState { state in
|
updateState { state in
|
||||||
@ -1581,6 +1599,21 @@ func chatListFilterPresetController(context: AccountContext, currentPreset initi
|
|||||||
}
|
}
|
||||||
return state
|
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)
|
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)
|
let activityPosition = floor(context.availableSize.width * component.badgeGraphPosition)
|
||||||
|
|
||||||
|
var inactiveTitleOpacity: CGFloat = 1.0
|
||||||
var inactiveValueOpacity: 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
|
context.add(inactiveTitle
|
||||||
.position(CGPoint(x: inactiveTitle.size.width / 2.0 + 12.0, y: height - lineHeight / 2.0))
|
.position(CGPoint(x: inactiveTitle.size.width / 2.0 + 12.0, y: height - lineHeight / 2.0))
|
||||||
.opacity(inactiveValueOpacity)
|
.opacity(inactiveTitleOpacity)
|
||||||
)
|
)
|
||||||
|
|
||||||
context.add(inactiveValue
|
context.add(inactiveValue
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user