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
eb28692e92
commit
5f433dc140
@ -47,7 +47,7 @@ private func getUserPeer(engine: TelegramEngine, peerId: EnginePeer.Id) -> Signa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func openAddPersonContactImpl(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, peerId: EnginePeer.Id, pushController: @escaping (ViewController) -> Void, present: @escaping (ViewController, Any?) -> Void) {
|
public func openAddPersonContactImpl(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, peerId: EnginePeer.Id, pushController: @escaping (ViewController) -> Void, present: @escaping (ViewController, Any?) -> Void, completion: @escaping () -> Void = {}) {
|
||||||
let _ = (getUserPeer(engine: context.engine, peerId: peerId)
|
let _ = (getUserPeer(engine: context.engine, peerId: peerId)
|
||||||
|> deliverOnMainQueue).start(next: { peer, statusSettings in
|
|> deliverOnMainQueue).start(next: { peer, statusSettings in
|
||||||
guard let peer, case let .user(user) = peer, let contactData = DeviceContactExtendedData(peer: peer) else {
|
guard let peer, case let .user(user) = peer, let contactData = DeviceContactExtendedData(peer: peer) else {
|
||||||
@ -61,8 +61,7 @@ public func openAddPersonContactImpl(context: AccountContext, updatedPresentatio
|
|||||||
|
|
||||||
pushController(deviceContactInfoController(context: context, updatedPresentationData: updatedPresentationData, subject: .create(peer: user, contactData: contactData, isSharing: true, shareViaException: shareViaException, completion: { peer, stableId, contactData in
|
pushController(deviceContactInfoController(context: context, updatedPresentationData: updatedPresentationData, subject: .create(peer: user, contactData: contactData, isSharing: true, shareViaException: shareViaException, completion: { peer, stableId, contactData in
|
||||||
if let peer = peer as? TelegramUser {
|
if let peer = peer as? TelegramUser {
|
||||||
if let phone = peer.phone, !phone.isEmpty {
|
completion()
|
||||||
}
|
|
||||||
|
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
present(OverlayStatusController(theme: presentationData.theme, type: .genericSuccess(presentationData.strings.AddContact_StatusSuccess(EnginePeer(peer).compactDisplayTitle).string, true)), nil)
|
present(OverlayStatusController(theme: presentationData.theme, type: .genericSuccess(presentationData.strings.AddContact_StatusSuccess(EnginePeer(peer).compactDisplayTitle).string, true)), nil)
|
||||||
|
@ -187,7 +187,6 @@ final class PeerInfoScreenData {
|
|||||||
let peerNotificationSettings: TelegramPeerNotificationSettings?
|
let peerNotificationSettings: TelegramPeerNotificationSettings?
|
||||||
let threadNotificationSettings: TelegramPeerNotificationSettings?
|
let threadNotificationSettings: TelegramPeerNotificationSettings?
|
||||||
let globalNotificationSettings: EngineGlobalNotificationSettings?
|
let globalNotificationSettings: EngineGlobalNotificationSettings?
|
||||||
let isContact: Bool
|
|
||||||
let availablePanes: [PeerInfoPaneKey]
|
let availablePanes: [PeerInfoPaneKey]
|
||||||
let groupsInCommon: GroupsInCommonContext?
|
let groupsInCommon: GroupsInCommonContext?
|
||||||
let linkedDiscussionPeer: Peer?
|
let linkedDiscussionPeer: Peer?
|
||||||
@ -202,6 +201,17 @@ final class PeerInfoScreenData {
|
|||||||
let appConfiguration: AppConfiguration?
|
let appConfiguration: AppConfiguration?
|
||||||
let isPowerSavingEnabled: Bool?
|
let isPowerSavingEnabled: Bool?
|
||||||
|
|
||||||
|
let _isContact: Bool
|
||||||
|
var forceIsContact: Bool = false
|
||||||
|
|
||||||
|
var isContact: Bool {
|
||||||
|
if self.forceIsContact {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return self._isContact
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init(
|
init(
|
||||||
peer: Peer?,
|
peer: Peer?,
|
||||||
chatPeer: Peer?,
|
chatPeer: Peer?,
|
||||||
@ -232,7 +242,7 @@ final class PeerInfoScreenData {
|
|||||||
self.peerNotificationSettings = peerNotificationSettings
|
self.peerNotificationSettings = peerNotificationSettings
|
||||||
self.threadNotificationSettings = threadNotificationSettings
|
self.threadNotificationSettings = threadNotificationSettings
|
||||||
self.globalNotificationSettings = globalNotificationSettings
|
self.globalNotificationSettings = globalNotificationSettings
|
||||||
self.isContact = isContact
|
self._isContact = isContact
|
||||||
self.availablePanes = availablePanes
|
self.availablePanes = availablePanes
|
||||||
self.groupsInCommon = groupsInCommon
|
self.groupsInCommon = groupsInCommon
|
||||||
self.linkedDiscussionPeer = linkedDiscussionPeer
|
self.linkedDiscussionPeer = linkedDiscussionPeer
|
||||||
|
@ -2107,6 +2107,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
avatarUploadProgress: nil,
|
avatarUploadProgress: nil,
|
||||||
highlightedButton: nil
|
highlightedButton: nil
|
||||||
)
|
)
|
||||||
|
private var forceIsContactPromise = ValuePromise<Bool>(false)
|
||||||
private let nearbyPeerDistance: Int32?
|
private let nearbyPeerDistance: Int32?
|
||||||
private let reactionSourceMessageId: MessageId?
|
private let reactionSourceMessageId: MessageId?
|
||||||
private var dataDisposable: Disposable?
|
private var dataDisposable: Disposable?
|
||||||
@ -3833,11 +3834,19 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
self?.updateNavigation(transition: .immediate, additive: true)
|
self?.updateNavigation(transition: .immediate, additive: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.dataDisposable = (screenData
|
self.dataDisposable = combineLatest(
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] data in
|
queue: Queue.mainQueue(),
|
||||||
|
screenData,
|
||||||
|
self.forceIsContactPromise.get()
|
||||||
|
).start(next: { [weak self] data, forceIsContact in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if data.isContact && forceIsContact {
|
||||||
|
strongSelf.forceIsContactPromise.set(false)
|
||||||
|
} else {
|
||||||
|
data.forceIsContact = forceIsContact
|
||||||
|
}
|
||||||
strongSelf.updateData(data)
|
strongSelf.updateData(data)
|
||||||
strongSelf.cachedDataPromise.set(.single(data.cachedData))
|
strongSelf.cachedDataPromise.set(.single(data.cachedData))
|
||||||
})
|
})
|
||||||
@ -6351,6 +6360,10 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
self?.controller?.push(c)
|
self?.controller?.push(c)
|
||||||
}, present: { c, a in
|
}, present: { c, a in
|
||||||
self?.controller?.present(c, in: .window(.root), with: a)
|
self?.controller?.present(c, in: .window(.root), with: a)
|
||||||
|
}, completion: { [weak self] in
|
||||||
|
if let self {
|
||||||
|
self.forceIsContactPromise.set(true)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user