mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Fixed sharing to secret chats
Revert email confirmation API
This commit is contained in:
parent
a3c55e7c0d
commit
dd4aaf45ea
@ -102,7 +102,7 @@ public struct AutomaticMediaDownloadSettings: PreferencesEntry, Equatable {
|
||||
video: AutomaticMediaDownloadCategory(cellular: false, wifi: false, sizeLimit: 1 * 1024 * 1024),
|
||||
file: AutomaticMediaDownloadCategory(cellular: false, wifi: false, sizeLimit: 1 * 1024 * 1024),
|
||||
voiceMessage: AutomaticMediaDownloadCategory(cellular: true, wifi: true, sizeLimit: 1 * 1024 * 1024),
|
||||
videoMessage: AutomaticMediaDownloadCategory(cellular: true, wifi: true, sizeLimit: 1 * 1024 * 1024),
|
||||
videoMessage: AutomaticMediaDownloadCategory(cellular: true, wifi: true, sizeLimit: 4 * 1024 * 1024),
|
||||
saveDownloadedPhotos: false
|
||||
)
|
||||
return AutomaticMediaDownloadSettings(masterEnabled: true, peers: AutomaticMediaDownloadPeers(
|
||||
@ -202,10 +202,14 @@ private func categoryForPeerAndMedia(settings: AutomaticMediaDownloadSettings, p
|
||||
switch attribute {
|
||||
case let .Video(_, _, flags):
|
||||
if flags.contains(.instantRoundVideo) {
|
||||
return (categories.videoMessage, file.size.flatMap(Int32.init))
|
||||
var category = categories.videoMessage
|
||||
category.sizeLimit = max(category.sizeLimit, 4 * 1024 * 1024)
|
||||
return (category, file.size.flatMap(Int32.init))
|
||||
} else {
|
||||
if file.isAnimated {
|
||||
return (categories.videoMessage, file.size.flatMap(Int32.init))
|
||||
var category = categories.videoMessage
|
||||
category.sizeLimit = max(category.sizeLimit, 1 * 1024 * 1024)
|
||||
return (category, file.size.flatMap(Int32.init))
|
||||
} else {
|
||||
return (categories.video, file.size.flatMap(Int32.init))
|
||||
}
|
||||
|
@ -313,6 +313,8 @@ final class CallControllerNode: ASDisplayNode {
|
||||
self.containerNode.layer.animateScale(from: 1.0, to: 1.04, duration: 0.3, removeOnCompletion: false, completion: { _ in
|
||||
completion()
|
||||
})
|
||||
} else {
|
||||
completion()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,12 +295,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID
|
||||
}
|
||||
}
|
||||
|
||||
if case .stream = mode {
|
||||
strongSelf.debugStreamSingleVideo(message.id)
|
||||
return true
|
||||
}
|
||||
|
||||
return openChatMessage(account: account, message: message, standalone: false, reverseMessageGalleryOrder: false, navigationController: strongSelf.navigationController as? NavigationController, dismissInput: {
|
||||
return openChatMessage(account: account, message: message, standalone: false, reverseMessageGalleryOrder: false, stream: mode == .stream, navigationController: strongSelf.navigationController as? NavigationController, dismissInput: {
|
||||
self?.chatDisplayNode.dismissInput()
|
||||
}, present: { c, a in
|
||||
self?.present(c, in: .window(.root), with: a, blockInteraction: true)
|
||||
@ -4194,7 +4189,11 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID
|
||||
}
|
||||
}
|
||||
|
||||
if case let .peer(peerId) = self.chatLocation, messageLocation.messageId.peerId == peerId {
|
||||
if case let .peer(peerId) = self.chatLocation, messageLocation.messageId.peerId != peerId {
|
||||
if let navigationController = self.navigationController as? NavigationController {
|
||||
navigateToChatController(navigationController: navigationController, account: self.account, chatLocation: .peer(messageLocation.messageId.peerId), messageId: messageLocation.messageId)
|
||||
}
|
||||
} else if case let .peer(peerId) = self.chatLocation, messageLocation.messageId.peerId == peerId {
|
||||
if let fromIndex = fromIndex {
|
||||
if let _ = fromId, rememberInStack {
|
||||
self.historyNavigationStack.add(fromIndex)
|
||||
@ -4216,36 +4215,72 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID
|
||||
}
|
||||
let historyView = chatHistoryViewForLocation(.InitialSearch(location: searchLocation, count: 50), account: self.account, chatLocation: self.chatLocation, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
||||
let signal = historyView
|
||||
|> mapToSignal { historyView -> Signal<MessageIndex?, NoError> in
|
||||
|> mapToSignal { historyView -> Signal<(MessageIndex?, Bool), NoError> in
|
||||
switch historyView {
|
||||
case .Loading:
|
||||
return .complete()
|
||||
return .single((nil, true))
|
||||
case let .HistoryView(view, _, _, _, _):
|
||||
for entry in view.entries {
|
||||
if case let .MessageEntry(message, _, _, _) = entry {
|
||||
if message.id == messageLocation.messageId {
|
||||
return .single(MessageIndex(message))
|
||||
return .single((MessageIndex(message), false))
|
||||
}
|
||||
}
|
||||
}
|
||||
if case let .index(index) = searchLocation {
|
||||
return .single(index)
|
||||
return .single((index, false))
|
||||
}
|
||||
return .single(nil)
|
||||
return .single((nil, false))
|
||||
}
|
||||
}
|
||||
|> take(1)
|
||||
|> take(until: { index in
|
||||
return SignalTakeAction(passthrough: true, complete: !index.1)
|
||||
})
|
||||
|
||||
var cancelImpl: (() -> Void)?
|
||||
let presentationData = self.presentationData
|
||||
let progressSignal = Signal<Never, NoError> { [weak self] subscriber in
|
||||
let controller = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: {
|
||||
cancelImpl?()
|
||||
}))
|
||||
self?.present(controller, in: .window(.root))
|
||||
return ActionDisposable { [weak controller] in
|
||||
Queue.mainQueue().async() {
|
||||
controller?.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|> runOn(Queue.mainQueue())
|
||||
|> delay(0.15, queue: Queue.mainQueue())
|
||||
let progressDisposable = MetaDisposable()
|
||||
var progressStarted = false
|
||||
self.messageIndexDisposable.set((signal
|
||||
|> afterDisposed {
|
||||
Queue.mainQueue().async {
|
||||
progressDisposable.dispose()
|
||||
}
|
||||
}
|
||||
|> deliverOnMainQueue).start(next: { [weak self] index in
|
||||
if let strongSelf = self, let index = index {
|
||||
if let strongSelf = self, let index = index.0 {
|
||||
strongSelf.chatDisplayNode.historyNode.scrollToMessage(from: fromIndex, to: index, animated: animated, scrollPosition: scrollPosition)
|
||||
completion?()
|
||||
} else if index.1 {
|
||||
if !progressStarted {
|
||||
progressStarted = true
|
||||
progressDisposable.set(progressSignal.start())
|
||||
}
|
||||
}
|
||||
}, completed: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
strongSelf.loadingMessage.set(false)
|
||||
}
|
||||
}))
|
||||
cancelImpl = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
strongSelf.loadingMessage.set(false)
|
||||
strongSelf.messageIndexDisposable.set(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
completion?()
|
||||
|
@ -215,14 +215,14 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
|
||||
} else if let group = messages[0].peers[messages[0].id.peerId] as? TelegramGroup {
|
||||
if !isAction {
|
||||
if group.flags.contains(.adminsEnabled) {
|
||||
canPin = true
|
||||
} else {
|
||||
switch group.role {
|
||||
case .creator, .admin:
|
||||
canPin = true
|
||||
default:
|
||||
canPin = false
|
||||
}
|
||||
} else {
|
||||
canPin = true
|
||||
}
|
||||
}
|
||||
} else if let _ = messages[0].peers[messages[0].id.peerId] as? TelegramUser, chatPresentationInterfaceState.explicitelyCanPinMessages {
|
||||
|
@ -47,6 +47,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
|
||||
private var status: FileMediaResourceMediaStatus?
|
||||
private let playbackStatusDisposable = MetaDisposable()
|
||||
private let fetchedThumbnailDisposable = MetaDisposable()
|
||||
|
||||
private var shouldAcquireVideoContext: Bool {
|
||||
if case .visible = self.visibility {
|
||||
@ -97,6 +98,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
deinit {
|
||||
self.fetchDisposable.dispose()
|
||||
self.playbackStatusDisposable.dispose()
|
||||
self.fetchedThumbnailDisposable.dispose()
|
||||
}
|
||||
|
||||
override func didLoad() {
|
||||
@ -288,6 +290,14 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
}))
|
||||
}
|
||||
|
||||
if let updatedFile = updatedFile, updatedMedia {
|
||||
if let resource = updatedFile.previewRepresentations.first?.resource {
|
||||
strongSelf.fetchedThumbnailDisposable.set(fetchedMediaResource(postbox: item.account.postbox, reference: FileMediaReference.message(message: MessageReference(item.message), media: updatedFile).resourceReference(resource)).start())
|
||||
} else {
|
||||
strongSelf.fetchedThumbnailDisposable.set(nil)
|
||||
}
|
||||
}
|
||||
|
||||
dateAndStatusApply(false)
|
||||
switch layoutData {
|
||||
case let .unconstrained(width):
|
||||
|
@ -132,7 +132,7 @@ func galleryItemForEntry(account: Account, presentationData: PresentationData, e
|
||||
if file.isVideo {
|
||||
let content: UniversalVideoContent
|
||||
if file.isAnimated {
|
||||
content = NativeVideoContent(id: .message(message.id, message.stableId + 1, file.fileId), fileReference: .message(message: MessageReference(message), media: file), streamVideo: streamVideos, loopVideo: true, enableSound: false)
|
||||
content = NativeVideoContent(id: .message(message.id, message.stableId + 1, file.fileId), fileReference: .message(message: MessageReference(message), media: file), streamVideo: true, loopVideo: true, enableSound: false)
|
||||
} else {
|
||||
if true || (file.mimeType == "video/mpeg4" || file.mimeType == "video/mov" || file.mimeType == "video/mp4") {
|
||||
content = NativeVideoContent(id: .message(message.id, message.stableId, file.fileId), fileReference: .message(message: MessageReference(message), media: file), streamVideo: streamVideos, loopVideo: loopVideos)
|
||||
@ -307,7 +307,7 @@ class GalleryController: ViewController {
|
||||
|> mapToSignal { message -> Signal<GalleryMessageHistoryView?, NoError> in
|
||||
switch source {
|
||||
case .peerMessagesAtId:
|
||||
if !streamSingleVideo, let tags = tagsForMessage(message!) {
|
||||
if let tags = tagsForMessage(message!) {
|
||||
let view = account.postbox.aroundMessageHistoryViewForLocation(.peer(message!.id.peerId), index: .message(MessageIndex(message!)), anchorIndex: .message(MessageIndex(message!)), count: 50, clipHoles: false, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: [], tagMask: tags, orderStatistics: [.combinedLocation])
|
||||
|
||||
return view
|
||||
|
@ -124,9 +124,9 @@ final class HorizontalPeerItemNode: ListViewItemNode {
|
||||
let itemTheme: SelectablePeerNodeTheme
|
||||
switch item.mode {
|
||||
case .list:
|
||||
itemTheme = SelectablePeerNodeTheme(textColor: item.theme.list.itemPrimaryTextColor, secretTextColor: .green, selectedTextColor: item.theme.list.itemAccentColor, checkBackgroundColor: item.theme.list.plainBackgroundColor, checkFillColor: item.theme.list.itemAccentColor, checkColor: item.theme.list.plainBackgroundColor)
|
||||
itemTheme = SelectablePeerNodeTheme(textColor: item.theme.list.itemPrimaryTextColor, secretTextColor: item.theme.chatList.secretTitleColor, selectedTextColor: item.theme.list.itemAccentColor, checkBackgroundColor: item.theme.list.plainBackgroundColor, checkFillColor: item.theme.list.itemAccentColor, checkColor: item.theme.list.plainBackgroundColor)
|
||||
case .actionSheet:
|
||||
itemTheme = SelectablePeerNodeTheme(textColor: item.theme.actionSheet.primaryTextColor, secretTextColor: .green, selectedTextColor: item.theme.actionSheet.controlAccentColor, checkBackgroundColor: item.theme.actionSheet.opaqueItemBackgroundColor, checkFillColor: item.theme.actionSheet.controlAccentColor, checkColor: item.theme.actionSheet.opaqueItemBackgroundColor)
|
||||
itemTheme = SelectablePeerNodeTheme(textColor: item.theme.actionSheet.primaryTextColor, secretTextColor: item.theme.chatList.secretTitleColor, selectedTextColor: item.theme.actionSheet.controlAccentColor, checkBackgroundColor: item.theme.actionSheet.opaqueItemBackgroundColor, checkFillColor: item.theme.actionSheet.controlAccentColor, checkColor: item.theme.actionSheet.opaqueItemBackgroundColor)
|
||||
}
|
||||
let currentBadgeBackgroundImage: UIImage?
|
||||
let badgeAttributedString: NSAttributedString
|
||||
|
@ -20,7 +20,7 @@ private enum ChatMessageGalleryControllerData {
|
||||
case chatAvatars(AvatarGalleryController, Media)
|
||||
}
|
||||
|
||||
private func chatMessageGalleryControllerData(account: Account, message: Message, navigationController: NavigationController?, standalone: Bool, reverseMessageGalleryOrder: Bool, synchronousLoad: Bool) -> ChatMessageGalleryControllerData? {
|
||||
private func chatMessageGalleryControllerData(account: Account, message: Message, navigationController: NavigationController?, standalone: Bool, reverseMessageGalleryOrder: Bool, stream: Bool, synchronousLoad: Bool) -> ChatMessageGalleryControllerData? {
|
||||
var galleryMedia: Media?
|
||||
var otherMedia: Media?
|
||||
var instantPageMedia: (TelegramMediaWebpage, [InstantPageGalleryEntry])?
|
||||
@ -118,7 +118,7 @@ private func chatMessageGalleryControllerData(account: Account, message: Message
|
||||
let gallery = SecretMediaPreviewController(account: account, messageId: message.id)
|
||||
return .secretGallery(gallery)
|
||||
} else {
|
||||
let gallery = GalleryController(account: account, source: standalone ? .standaloneMessage(message) : .peerMessagesAtId(message.id), invertItemOrder: reverseMessageGalleryOrder, synchronousLoad: synchronousLoad, replaceRootController: { [weak navigationController] controller, ready in
|
||||
let gallery = GalleryController(account: account, source: standalone ? .standaloneMessage(message) : .peerMessagesAtId(message.id), invertItemOrder: reverseMessageGalleryOrder, streamSingleVideo: stream, synchronousLoad: synchronousLoad, replaceRootController: { [weak navigationController] controller, ready in
|
||||
navigationController?.replaceTopController(controller, animated: false, ready: ready)
|
||||
}, baseNavigationController: navigationController)
|
||||
return .gallery(gallery)
|
||||
@ -138,7 +138,7 @@ enum ChatMessagePreviewControllerData {
|
||||
}
|
||||
|
||||
func chatMessagePreviewControllerData(account: Account, message: Message, standalone: Bool, reverseMessageGalleryOrder: Bool, navigationController: NavigationController?) -> ChatMessagePreviewControllerData? {
|
||||
if let mediaData = chatMessageGalleryControllerData(account: account, message: message, navigationController: navigationController, standalone: standalone, reverseMessageGalleryOrder: reverseMessageGalleryOrder, synchronousLoad: true) {
|
||||
if let mediaData = chatMessageGalleryControllerData(account: account, message: message, navigationController: navigationController, standalone: standalone, reverseMessageGalleryOrder: reverseMessageGalleryOrder, stream: false, synchronousLoad: true) {
|
||||
switch mediaData {
|
||||
case let .gallery(gallery):
|
||||
return .gallery(gallery)
|
||||
@ -151,8 +151,8 @@ func chatMessagePreviewControllerData(account: Account, message: Message, standa
|
||||
return nil
|
||||
}
|
||||
|
||||
func openChatMessage(account: Account, message: Message, standalone: Bool, reverseMessageGalleryOrder: Bool, navigationController: NavigationController?, modal: Bool = false, dismissInput: @escaping () -> Void, present: @escaping (ViewController, Any?) -> Void, transitionNode: @escaping (MessageId, Media) -> (ASDisplayNode, () -> UIView?)?, addToTransitionSurface: @escaping (UIView) -> Void, openUrl: @escaping (String) -> Void, openPeer: @escaping (Peer, ChatControllerInteractionNavigateToPeer) -> Void, callPeer: @escaping (PeerId) -> Void, enqueueMessage: @escaping (EnqueueMessage) -> Void, sendSticker: ((FileMediaReference) -> Void)?, setupTemporaryHiddenMedia: @escaping (Signal<InstantPageGalleryEntry?, NoError>, Int, Media) -> Void, chatAvatarHiddenMedia: @escaping (Signal<MessageId?, NoError>, Media) -> Void) -> Bool {
|
||||
if let mediaData = chatMessageGalleryControllerData(account: account, message: message, navigationController: navigationController, standalone: standalone, reverseMessageGalleryOrder: reverseMessageGalleryOrder, synchronousLoad: false) {
|
||||
func openChatMessage(account: Account, message: Message, standalone: Bool, reverseMessageGalleryOrder: Bool, stream: Bool = false, navigationController: NavigationController?, modal: Bool = false, dismissInput: @escaping () -> Void, present: @escaping (ViewController, Any?) -> Void, transitionNode: @escaping (MessageId, Media) -> (ASDisplayNode, () -> UIView?)?, addToTransitionSurface: @escaping (UIView) -> Void, openUrl: @escaping (String) -> Void, openPeer: @escaping (Peer, ChatControllerInteractionNavigateToPeer) -> Void, callPeer: @escaping (PeerId) -> Void, enqueueMessage: @escaping (EnqueueMessage) -> Void, sendSticker: ((FileMediaReference) -> Void)?, setupTemporaryHiddenMedia: @escaping (Signal<InstantPageGalleryEntry?, NoError>, Int, Media) -> Void, chatAvatarHiddenMedia: @escaping (Signal<MessageId?, NoError>, Media) -> Void) -> Bool {
|
||||
if let mediaData = chatMessageGalleryControllerData(account: account, message: message, navigationController: navigationController, standalone: standalone, reverseMessageGalleryOrder: reverseMessageGalleryOrder, stream: stream, synchronousLoad: false) {
|
||||
switch mediaData {
|
||||
case let .url(url):
|
||||
openUrl(url)
|
||||
|
@ -1394,8 +1394,9 @@ func internalMediaGridMessageVideo(postbox: Postbox, videoReference: FileMediaRe
|
||||
}
|
||||
telegramFastBlur(Int32(thumbnailContextSize.width), Int32(thumbnailContextSize.height), Int32(thumbnailContext.bytesPerRow), thumbnailContext.bytes)
|
||||
|
||||
if true || initialThumbnailContextFittingSize.width < arguments.drawingSize.width * 0.5 {
|
||||
let thumbnailContextFittingSize = CGSize(width: floor(arguments.drawingSize.width * 0.5), height: floor(arguments.drawingSize.width * 0.5))
|
||||
|
||||
if thumbnailContextFittingSize.width > thumbnailContextSize.width {
|
||||
let additionalContextSize = thumbnailContextFittingSize
|
||||
let additionalBlurContext = DrawingContext(size: additionalContextSize, scale: 1.0)
|
||||
additionalBlurContext.withFlippedContext { c in
|
||||
|
@ -133,7 +133,7 @@ final class SelectablePeerNode: ASDisplayNode {
|
||||
self.currentSelected = selected
|
||||
|
||||
if let attributedText = self.textNode.attributedText {
|
||||
self.textNode.attributedText = NSAttributedString(string: attributedText.string, font: textFont, textColor: selected ? self.theme.selectedTextColor : self.theme.textColor, paragraphAlignment: .center)
|
||||
self.textNode.attributedText = NSAttributedString(string: attributedText.string, font: textFont, textColor: selected ? self.theme.selectedTextColor : (self.peer?.peerId.namespace == Namespaces.Peer.SecretChat ? self.theme.secretTextColor : self.theme.textColor), paragraphAlignment: .center)
|
||||
}
|
||||
|
||||
if selected {
|
||||
|
@ -142,20 +142,20 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
self.controllerInteraction = ShareControllerInteraction(togglePeer: { [weak self] peer, search in
|
||||
if let strongSelf = self {
|
||||
var added = false
|
||||
if strongSelf.controllerInteraction!.selectedPeerIds.contains(peer.id) {
|
||||
strongSelf.controllerInteraction!.selectedPeerIds.remove(peer.id)
|
||||
strongSelf.controllerInteraction!.selectedPeers = strongSelf.controllerInteraction!.selectedPeers.filter({ $0.id != peer.id })
|
||||
if strongSelf.controllerInteraction!.selectedPeerIds.contains(peer.peerId) {
|
||||
strongSelf.controllerInteraction!.selectedPeerIds.remove(peer.peerId)
|
||||
strongSelf.controllerInteraction!.selectedPeers = strongSelf.controllerInteraction!.selectedPeers.filter({ $0.peerId != peer.peerId })
|
||||
} else {
|
||||
strongSelf.controllerInteraction!.selectedPeerIds.insert(peer.id)
|
||||
strongSelf.controllerInteraction!.selectedPeerIds.insert(peer.peerId)
|
||||
strongSelf.controllerInteraction!.selectedPeers.append(peer)
|
||||
|
||||
strongSelf.contentNode?.setEnsurePeerVisibleOnLayout(peer.id)
|
||||
strongSelf.contentNode?.setEnsurePeerVisibleOnLayout(peer.peerId)
|
||||
added = true
|
||||
}
|
||||
|
||||
if search && added {
|
||||
strongSelf.controllerInteraction!.foundPeers = strongSelf.controllerInteraction!.foundPeers.filter { otherPeer in
|
||||
return peer.id != otherPeer.id
|
||||
return peer.peerId != otherPeer.peerId
|
||||
}
|
||||
strongSelf.controllerInteraction!.foundPeers.append(peer)
|
||||
strongSelf.peersContentNode?.updateFoundPeers()
|
||||
@ -445,7 +445,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
transition.updateAlpha(node: self.actionSeparatorNode, alpha: 0.0)
|
||||
transition.updateAlpha(node: self.actionsBackgroundNode, alpha: 0.0)
|
||||
|
||||
if let signal = self.share?(self.inputFieldNode.text, self.controllerInteraction!.selectedPeers.map { $0.id }) {
|
||||
if let signal = self.share?(self.inputFieldNode.text, self.controllerInteraction!.selectedPeers.map { $0.peerId }) {
|
||||
self.transitionToContentNode(ShareLoadingContainerNode(theme: self.presentationData.theme, forceNativeAppearance: true), fastOut: true)
|
||||
let timestamp = CACurrentMediaTime()
|
||||
var wasDone = false
|
||||
|
@ -6,12 +6,12 @@ import AsyncDisplayKit
|
||||
import Postbox
|
||||
|
||||
final class ShareControllerInteraction {
|
||||
var foundPeers: [Peer] = []
|
||||
var foundPeers: [RenderedPeer] = []
|
||||
var selectedPeerIds = Set<PeerId>()
|
||||
var selectedPeers: [Peer] = []
|
||||
let togglePeer: (Peer, Bool) -> Void
|
||||
var selectedPeers: [RenderedPeer] = []
|
||||
let togglePeer: (RenderedPeer, Bool) -> Void
|
||||
|
||||
init(togglePeer: @escaping (Peer, Bool) -> Void) {
|
||||
init(togglePeer: @escaping (RenderedPeer, Bool) -> Void) {
|
||||
self.togglePeer = togglePeer
|
||||
}
|
||||
}
|
||||
@ -136,7 +136,7 @@ final class ShareControllerPeerGridItemNode: GridItemNode {
|
||||
if let strongSelf = self {
|
||||
if let (_, peer, search) = strongSelf.currentState {
|
||||
if let actualPeer = peer.peers[peer.peerId] {
|
||||
strongSelf.controllerInteraction?.togglePeer(actualPeer, search)
|
||||
strongSelf.controllerInteraction?.togglePeer(peer, search)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ final class ShareControllerRecentPeersGridItemNode: GridItemNode {
|
||||
peersNode.updateThemeAndStrings(theme: theme, strings: strings)
|
||||
} else {
|
||||
peersNode = ChatListSearchRecentPeersNode(account: account, theme: theme, mode: .actionSheet, strings: strings, peerSelected: { [weak self] peer in
|
||||
self?.controllerInteraction?.togglePeer(peer, true)
|
||||
self?.controllerInteraction?.togglePeer(RenderedPeer(peer: peer), true)
|
||||
}, peerLongTapped: {_ in }, isPeerSelected: { [weak self] peerId in
|
||||
return self?.controllerInteraction?.selectedPeerIds.contains(peerId) ?? false
|
||||
}, share: true)
|
||||
|
@ -60,7 +60,7 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
||||
private let controllerInteraction: ShareControllerInteraction
|
||||
|
||||
private let accountPeer: Peer
|
||||
private let foundPeers = Promise<[Peer]>([])
|
||||
private let foundPeers = Promise<[RenderedPeer]>([])
|
||||
|
||||
private let disposable = MetaDisposable()
|
||||
private var entries: [SharePeerEntry] = []
|
||||
@ -100,8 +100,8 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
||||
index += 1
|
||||
|
||||
for peer in foundPeers.reversed() {
|
||||
entries.append(SharePeerEntry(index: index, peer: RenderedPeer(peer: peer), theme: theme, strings: strings))
|
||||
existingPeerIds.insert(peer.id)
|
||||
entries.append(SharePeerEntry(index: index, peer: peer, theme: theme, strings: strings))
|
||||
existingPeerIds.insert(peer.peerId)
|
||||
index += 1
|
||||
}
|
||||
|
||||
@ -325,10 +325,10 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
||||
if !self.controllerInteraction.selectedPeers.isEmpty {
|
||||
subtitleText = self.controllerInteraction.selectedPeers.reduce("", { string, peer in
|
||||
let text: String
|
||||
if peer.id == self.accountPeer.id {
|
||||
if peer.peerId == self.accountPeer.id {
|
||||
text = self.strings.DialogList_SavedMessages
|
||||
} else {
|
||||
text = peer.displayTitle
|
||||
text = peer.chatMainPeer?.displayTitle ?? ""
|
||||
}
|
||||
|
||||
if !string.isEmpty {
|
||||
|
@ -106,19 +106,19 @@ private enum ShareSearchRecentEntry: Comparable, Identifiable {
|
||||
|
||||
private struct ShareSearchPeerEntry: Comparable, Identifiable {
|
||||
let index: Int32
|
||||
let peer: Peer
|
||||
let peer: RenderedPeer
|
||||
let theme: PresentationTheme
|
||||
let strings: PresentationStrings
|
||||
|
||||
var stableId: Int64 {
|
||||
return self.peer.id.toInt64()
|
||||
return self.peer.peerId.toInt64()
|
||||
}
|
||||
|
||||
static func ==(lhs: ShareSearchPeerEntry, rhs: ShareSearchPeerEntry) -> Bool {
|
||||
if lhs.index != rhs.index {
|
||||
return false
|
||||
}
|
||||
if !arePeersEqual(lhs.peer, rhs.peer) {
|
||||
if lhs.peer != rhs.peer {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -129,7 +129,7 @@ private struct ShareSearchPeerEntry: Comparable, Identifiable {
|
||||
}
|
||||
|
||||
func item(account: Account, interfaceInteraction: ShareControllerInteraction) -> GridItem {
|
||||
return ShareControllerPeerGridItem(account: account, theme: self.theme, strings: self.strings, peer: RenderedPeer(peer: self.peer), controllerInteraction: interfaceInteraction, search: true)
|
||||
return ShareControllerPeerGridItem(account: account, theme: self.theme, strings: self.strings, peer: peer, controllerInteraction: interfaceInteraction, search: true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,20 +252,16 @@ final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode {
|
||||
if strings.DialogList_SavedMessages.lowercased().hasPrefix(query.lowercased()) {
|
||||
if !existingPeerIds.contains(accountPeer.id) {
|
||||
existingPeerIds.insert(accountPeer.id)
|
||||
entries.append(ShareSearchPeerEntry(index: index, peer: accountPeer, theme: theme, strings: strings))
|
||||
entries.append(ShareSearchPeerEntry(index: index, peer: RenderedPeer(peer: accountPeer), theme: theme, strings: strings))
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
|
||||
for renderedPeer in foundLocalPeers {
|
||||
if let peer = renderedPeer.peers[renderedPeer.peerId], peer.id != accountPeer.id, peer.id.namespace != Namespaces.Peer.SecretChat {
|
||||
if !existingPeerIds.contains(peer.id) && canSendMessagesToPeer(peer) {
|
||||
existingPeerIds.insert(peer.id)
|
||||
var associatedPeer: Peer?
|
||||
if let associatedPeerId = peer.associatedPeerId {
|
||||
associatedPeer = renderedPeer.peers[associatedPeerId]
|
||||
}
|
||||
entries.append(ShareSearchPeerEntry(index: index, peer: peer, theme: theme, strings: strings))
|
||||
if let peer = renderedPeer.peers[renderedPeer.peerId], peer.id != accountPeer.id {
|
||||
if !existingPeerIds.contains(renderedPeer.peerId) && canSendMessagesToPeer(peer) {
|
||||
existingPeerIds.insert(renderedPeer.peerId)
|
||||
entries.append(ShareSearchPeerEntry(index: index, peer: renderedPeer, theme: theme, strings: strings))
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
@ -275,7 +271,7 @@ final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode {
|
||||
let peer = foundPeer.peer
|
||||
if !existingPeerIds.contains(peer.id) && canSendMessagesToPeer(peer) {
|
||||
existingPeerIds.insert(peer.id)
|
||||
entries.append(ShareSearchPeerEntry(index: index, peer: foundPeer.peer, theme: theme, strings: strings))
|
||||
entries.append(ShareSearchPeerEntry(index: index, peer: RenderedPeer(peer: foundPeer.peer), theme: theme, strings: strings))
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
@ -284,7 +280,7 @@ final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode {
|
||||
let peer = foundPeer.peer
|
||||
if !existingPeerIds.contains(peer.id) && canSendMessagesToPeer(peer) {
|
||||
existingPeerIds.insert(peer.id)
|
||||
entries.append(ShareSearchPeerEntry(index: index, peer: peer, theme: theme, strings: strings))
|
||||
entries.append(ShareSearchPeerEntry(index: index, peer: RenderedPeer(peer: peer), theme: theme, strings: strings))
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
@ -414,7 +410,7 @@ final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode {
|
||||
var scrollToItem: GridNodeScrollToItem?
|
||||
if !self.contentGridNode.isHidden, let ensurePeerVisibleOnLayout = self.ensurePeerVisibleOnLayout {
|
||||
self.ensurePeerVisibleOnLayout = nil
|
||||
if let index = self.entries.index(where: { $0.peer.id == ensurePeerVisibleOnLayout }) {
|
||||
if let index = self.entries.index(where: { $0.peer.peerId == ensurePeerVisibleOnLayout }) {
|
||||
scrollToItem = GridNodeScrollToItem(index: index, position: .visible, transition: transition, directionHint: .up, adjustForSection: false)
|
||||
}
|
||||
}
|
||||
|
@ -183,14 +183,15 @@ private func twoStepVerificationUnlockSettingsControllerEntries(presentationData
|
||||
switch configuration {
|
||||
case let .notSet(pendingEmailAndValue):
|
||||
if let pendingEmailAndValue = pendingEmailAndValue {
|
||||
entries.append(.pendingEmailConfirmInfo(presentationData.theme, presentationData.strings.TwoStepAuth_EmailSent))
|
||||
/*entries.append(.pendingEmailConfirmInfo(presentationData.theme, presentationData.strings.TwoStepAuth_EmailSent))
|
||||
if pendingEmailAndValue.email != nil {
|
||||
} else {
|
||||
entries.append(.pendingEmailConfirmAddress(presentationData.theme, presentationData.strings.TwoStepAuth_EmailTitle, state.emailAddress))
|
||||
}
|
||||
entries.append(.pendingEmailConfirmCode(presentationData.theme, presentationData.strings.TwoStepAuth_RecoveryCode, state.emailCode))
|
||||
//entries.append(.pendingEmailInfo(presentationData.theme, presentationData.strings.TwoStepAuth_ConfirmationText + "\n\n\(pendingEmail.pattern)\n\n[" + presentationData.strings.TwoStepAuth_ConfirmationAbort + "]()"))
|
||||
entries.append(.pendingEmailInfo(presentationData.theme, "[" + presentationData.strings.TwoStepAuth_ConfirmationAbort + "]()"))
|
||||
*/
|
||||
entries.append(.pendingEmailInfo(presentationData.theme, presentationData.strings.TwoStepAuth_ConfirmationText + "\n\n\(pendingEmailAndValue.pendingEmail.pattern)\n\n[" + presentationData.strings.TwoStepAuth_ConfirmationAbort + "]()"))
|
||||
} else {
|
||||
entries.append(.passwordSetup(presentationData.theme, presentationData.strings.TwoStepAuth_SetPassword))
|
||||
entries.append(.passwordSetupInfo(presentationData.theme, presentationData.strings.TwoStepAuth_SetPasswordHelp))
|
||||
@ -209,14 +210,14 @@ private func twoStepVerificationUnlockSettingsControllerEntries(presentationData
|
||||
entries.append(.turnPasswordOff(presentationData.theme, presentationData.strings.TwoStepAuth_RemovePassword))
|
||||
entries.append(.setupRecoveryEmail(presentationData.theme, emailSet ? presentationData.strings.TwoStepAuth_ChangeEmail : presentationData.strings.TwoStepAuth_SetupEmail))
|
||||
if let pendingEmailAndValue = pendingEmailAndValue {
|
||||
entries.append(.pendingEmailConfirmInfo(presentationData.theme, presentationData.strings.TwoStepAuth_EmailSent))
|
||||
/*entries.append(.pendingEmailConfirmInfo(presentationData.theme, presentationData.strings.TwoStepAuth_EmailSent))
|
||||
if pendingEmailAndValue.email != nil {
|
||||
} else {
|
||||
entries.append(.pendingEmailConfirmAddress(presentationData.theme, presentationData.strings.TwoStepAuth_EmailTitle, state.emailAddress))
|
||||
}
|
||||
entries.append(.pendingEmailConfirmCode(presentationData.theme, presentationData.strings.TwoStepAuth_RecoveryCode, state.emailCode))
|
||||
//entries.append(.pendingEmailInfo(presentationData.theme, presentationData.strings.TwoStepAuth_ConfirmationText + "\n\n\(pendingEmail.pattern)\n\n[" + presentationData.strings.TwoStepAuth_ConfirmationAbort + "]()"))
|
||||
//entries.append(.pendingEmailInfo(presentationData.theme, "[" + presentationData.strings.TwoStepAuth_ConfirmationAbort + "]()"))
|
||||
entries.append(.pendingEmailConfirmCode(presentationData.theme, presentationData.strings.TwoStepAuth_RecoveryCode, state.emailCode))*/
|
||||
//entries.append(.pendingEmailInfo(presentationData.theme, presentationData.strings.TwoStepAuth_ConfirmationText + "\n\n\(pendingEmailAndValue.pendingEmail.pattern)\n\n[" + presentationData.strings.TwoStepAuth_ConfirmationAbort + "]()"))
|
||||
entries.append(.pendingEmailInfo(presentationData.theme, presentationData.strings.TwoStepAuth_EmailSent))
|
||||
} else {
|
||||
entries.append(.passwordInfo(presentationData.theme, presentationData.strings.TwoStepAuth_GenericHelp))
|
||||
}
|
||||
@ -697,11 +698,12 @@ func twoStepVerificationUnlockSettingsController(account: Account, mode: TwoStep
|
||||
} else {
|
||||
switch configuration {
|
||||
case let .notSet(pendingEmail):
|
||||
if let pendingEmailAndValue = pendingEmail {
|
||||
/*if let pendingEmailAndValue = pendingEmail {
|
||||
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Next), style: .bold, enabled: (pendingEmailAndValue.email != nil || !state.emailAddress.isEmpty) && !state.emailCode.isEmpty, action: {
|
||||
checkEmailConfirmation()
|
||||
})
|
||||
}
|
||||
}*/
|
||||
break
|
||||
case .set:
|
||||
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Next), style: .bold, enabled: true, action: {
|
||||
arguments.checkPassword()
|
||||
@ -716,11 +718,11 @@ func twoStepVerificationUnlockSettingsController(account: Account, mode: TwoStep
|
||||
if state.checking {
|
||||
rightNavigationButton = ItemListNavigationButton(content: .none, style: .activity, enabled: true, action: {})
|
||||
} else {
|
||||
if let pendingEmailAndValue = manage.pendingEmail {
|
||||
/*if let pendingEmailAndValue = manage.pendingEmail {
|
||||
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Next), style: .bold, enabled: (pendingEmailAndValue.email != nil || !state.emailAddress.isEmpty) && !state.emailCode.isEmpty, action: {
|
||||
checkEmailConfirmation()
|
||||
})
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,16 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
initialBuffering = true
|
||||
//buffering = true
|
||||
isPaused = !whilePlaying
|
||||
if let content = item.content as? NativeVideoContent, !content.streamVideo {
|
||||
var isStreaming = false
|
||||
if let fetchStatus = strongSelf.fetchStatus {
|
||||
switch fetchStatus {
|
||||
case .Local:
|
||||
break
|
||||
default:
|
||||
isStreaming = true
|
||||
}
|
||||
}
|
||||
if let content = item.content as? NativeVideoContent, !isStreaming {
|
||||
initialBuffering = false
|
||||
if !content.enableSound {
|
||||
isPaused = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user