mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
f869c0450b
commit
bba3b82cf5
@ -1667,6 +1667,10 @@ final class ShareWithPeersScreenComponent: Component {
|
|||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: itemsContainerWidth, height: 1000.0)
|
containerSize: CGSize(width: itemsContainerWidth, height: 1000.0)
|
||||||
)
|
)
|
||||||
|
var isContactsSearch = false
|
||||||
|
if let searchStateContext = self.searchStateContext, case .search(_, true) = searchStateContext.subject {
|
||||||
|
isContactsSearch = true
|
||||||
|
}
|
||||||
let peerItemSize = self.peerTemplateItem.update(
|
let peerItemSize = self.peerTemplateItem.update(
|
||||||
transition: transition,
|
transition: transition,
|
||||||
component: AnyComponent(PeerListItemComponent(
|
component: AnyComponent(PeerListItemComponent(
|
||||||
@ -1677,7 +1681,7 @@ final class ShareWithPeersScreenComponent: Component {
|
|||||||
sideInset: sideInset,
|
sideInset: sideInset,
|
||||||
title: "Name",
|
title: "Name",
|
||||||
peer: nil,
|
peer: nil,
|
||||||
subtitle: self.searchStateContext != nil ? "" : "sub",
|
subtitle: isContactsSearch ? "" : "sub",
|
||||||
subtitleAccessory: .none,
|
subtitleAccessory: .none,
|
||||||
presence: nil,
|
presence: nil,
|
||||||
selectionState: .editing(isSelected: false, isTinted: false),
|
selectionState: .editing(isSelected: false, isTinted: false),
|
||||||
@ -2596,7 +2600,7 @@ public class ShareWithPeersScreen: ViewControllerComponentContainer {
|
|||||||
self.readySubject.set(true)
|
self.readySubject.set(true)
|
||||||
})
|
})
|
||||||
case let .search(query, onlyContacts):
|
case let .search(query, onlyContacts):
|
||||||
let signal: Signal<([EngineRenderedPeer], [EnginePeer.Id: Optional<Int>]), NoError>
|
let signal: Signal<([EngineRenderedPeer], [EnginePeer.Id: Optional<EnginePeer.Presence>], [EnginePeer.Id: Optional<Int>]), NoError>
|
||||||
if onlyContacts {
|
if onlyContacts {
|
||||||
signal = combineLatest(
|
signal = combineLatest(
|
||||||
context.engine.contacts.searchLocalPeers(query: query),
|
context.engine.contacts.searchLocalPeers(query: query),
|
||||||
@ -2604,25 +2608,33 @@ public class ShareWithPeersScreen: ViewControllerComponentContainer {
|
|||||||
)
|
)
|
||||||
|> map { peers, contacts in
|
|> map { peers, contacts in
|
||||||
let contactIds = Set(contacts.0.map { $0.id })
|
let contactIds = Set(contacts.0.map { $0.id })
|
||||||
return (peers.filter { contactIds.contains($0.peerId) }, [:])
|
return (peers.filter { contactIds.contains($0.peerId) }, [:], [:])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
signal = context.engine.contacts.searchLocalPeers(query: query)
|
signal = context.engine.contacts.searchLocalPeers(query: query)
|
||||||
|> mapToSignal { peers in
|
|> mapToSignal { peers in
|
||||||
return context.engine.data.subscribe(
|
return context.engine.data.subscribe(
|
||||||
|
EngineDataMap(peers.map(\.peerId).map(TelegramEngine.EngineData.Item.Peer.Presence.init)),
|
||||||
EngineDataMap(peers.map(\.peerId).map(TelegramEngine.EngineData.Item.Peer.ParticipantCount.init))
|
EngineDataMap(peers.map(\.peerId).map(TelegramEngine.EngineData.Item.Peer.ParticipantCount.init))
|
||||||
)
|
)
|
||||||
|> map { participantCountMap -> ([EngineRenderedPeer], [EnginePeer.Id: Optional<Int>]) in
|
|> map { presenceMap, participantCountMap -> ([EngineRenderedPeer], [EnginePeer.Id: Optional<EnginePeer.Presence>], [EnginePeer.Id: Optional<Int>]) in
|
||||||
return (peers, participantCountMap)
|
return (peers, presenceMap, participantCountMap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.stateDisposable = (signal
|
self.stateDisposable = (signal
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] peers, participantCounts in
|
|> deliverOnMainQueue).start(next: { [weak self] peers, presenceMap, participantCounts in
|
||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var presences: [EnginePeer.Id: EnginePeer.Presence] = [:]
|
||||||
|
for (key, value) in presenceMap {
|
||||||
|
if let value {
|
||||||
|
presences[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var participants: [EnginePeer.Id: Int] = [:]
|
var participants: [EnginePeer.Id: Int] = [:]
|
||||||
for (key, value) in participantCounts {
|
for (key, value) in participantCounts {
|
||||||
if let value {
|
if let value {
|
||||||
@ -2658,7 +2670,7 @@ public class ShareWithPeersScreen: ViewControllerComponentContainer {
|
|||||||
},
|
},
|
||||||
peersMap: [:],
|
peersMap: [:],
|
||||||
savedSelectedPeers: [:],
|
savedSelectedPeers: [:],
|
||||||
presences: [:],
|
presences: presences,
|
||||||
participants: participants,
|
participants: participants,
|
||||||
closeFriendsPeers: [],
|
closeFriendsPeers: [],
|
||||||
grayListPeers: []
|
grayListPeers: []
|
||||||
|
@ -4277,9 +4277,12 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let context = component.context
|
let context = component.context
|
||||||
|
|
||||||
let currentPrivacy = component.slice.item.storyItem.privacy ?? EngineStoryPrivacy(base: .everyone, additionallyIncludePeers: [])
|
let currentPrivacy = component.slice.item.storyItem.privacy ?? EngineStoryPrivacy(base: .everyone, additionallyIncludePeers: [])
|
||||||
|
|
||||||
|
if component.slice.item.storyItem.privacy == nil {
|
||||||
|
Logger.shared.log("EditStoryPrivacy", "Story privacy is unknown")
|
||||||
|
}
|
||||||
|
|
||||||
let privacy = updatedPrivacy ?? component.slice.item.storyItem.privacy
|
let privacy = updatedPrivacy ?? component.slice.item.storyItem.privacy
|
||||||
guard let privacy else {
|
guard let privacy else {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user