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),
|
video: AutomaticMediaDownloadCategory(cellular: false, wifi: false, sizeLimit: 1 * 1024 * 1024),
|
||||||
file: 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),
|
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
|
saveDownloadedPhotos: false
|
||||||
)
|
)
|
||||||
return AutomaticMediaDownloadSettings(masterEnabled: true, peers: AutomaticMediaDownloadPeers(
|
return AutomaticMediaDownloadSettings(masterEnabled: true, peers: AutomaticMediaDownloadPeers(
|
||||||
@ -202,10 +202,14 @@ private func categoryForPeerAndMedia(settings: AutomaticMediaDownloadSettings, p
|
|||||||
switch attribute {
|
switch attribute {
|
||||||
case let .Video(_, _, flags):
|
case let .Video(_, _, flags):
|
||||||
if flags.contains(.instantRoundVideo) {
|
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 {
|
} else {
|
||||||
if file.isAnimated {
|
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 {
|
} else {
|
||||||
return (categories.video, file.size.flatMap(Int32.init))
|
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
|
self.containerNode.layer.animateScale(from: 1.0, to: 1.04, duration: 0.3, removeOnCompletion: false, completion: { _ in
|
||||||
completion()
|
completion()
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
completion()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,12 +295,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if case .stream = mode {
|
return openChatMessage(account: account, message: message, standalone: false, reverseMessageGalleryOrder: false, stream: mode == .stream, navigationController: strongSelf.navigationController as? NavigationController, dismissInput: {
|
||||||
strongSelf.debugStreamSingleVideo(message.id)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return openChatMessage(account: account, message: message, standalone: false, reverseMessageGalleryOrder: false, navigationController: strongSelf.navigationController as? NavigationController, dismissInput: {
|
|
||||||
self?.chatDisplayNode.dismissInput()
|
self?.chatDisplayNode.dismissInput()
|
||||||
}, present: { c, a in
|
}, present: { c, a in
|
||||||
self?.present(c, in: .window(.root), with: a, blockInteraction: true)
|
self?.present(c, in: .window(.root), with: a, blockInteraction: true)
|
||||||
@ -2565,10 +2560,10 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID
|
|||||||
} else if let group = peer as? TelegramGroup {
|
} else if let group = peer as? TelegramGroup {
|
||||||
if group.flags.contains(.adminsEnabled) {
|
if group.flags.contains(.adminsEnabled) {
|
||||||
switch group.role {
|
switch group.role {
|
||||||
case .creator, .admin:
|
case .creator, .admin:
|
||||||
canManagePin = true
|
canManagePin = true
|
||||||
default:
|
default:
|
||||||
canManagePin = false
|
canManagePin = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
canManagePin = true
|
canManagePin = 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 fromIndex = fromIndex {
|
||||||
if let _ = fromId, rememberInStack {
|
if let _ = fromId, rememberInStack {
|
||||||
self.historyNavigationStack.add(fromIndex)
|
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 historyView = chatHistoryViewForLocation(.InitialSearch(location: searchLocation, count: 50), account: self.account, chatLocation: self.chatLocation, fixedCombinedReadStates: nil, tagMask: nil, additionalData: [])
|
||||||
let signal = historyView
|
let signal = historyView
|
||||||
|> mapToSignal { historyView -> Signal<MessageIndex?, NoError> in
|
|> mapToSignal { historyView -> Signal<(MessageIndex?, Bool), NoError> in
|
||||||
switch historyView {
|
switch historyView {
|
||||||
case .Loading:
|
case .Loading:
|
||||||
return .complete()
|
return .single((nil, true))
|
||||||
case let .HistoryView(view, _, _, _, _):
|
case let .HistoryView(view, _, _, _, _):
|
||||||
for entry in view.entries {
|
for entry in view.entries {
|
||||||
if case let .MessageEntry(message, _, _, _) = entry {
|
if case let .MessageEntry(message, _, _, _) = entry {
|
||||||
if message.id == messageLocation.messageId {
|
if message.id == messageLocation.messageId {
|
||||||
return .single(MessageIndex(message))
|
return .single((MessageIndex(message), false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if case let .index(index) = searchLocation {
|
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
|
self.messageIndexDisposable.set((signal
|
||||||
|
|> afterDisposed {
|
||||||
|
Queue.mainQueue().async {
|
||||||
|
progressDisposable.dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] index in
|
|> 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)
|
strongSelf.chatDisplayNode.historyNode.scrollToMessage(from: fromIndex, to: index, animated: animated, scrollPosition: scrollPosition)
|
||||||
completion?()
|
completion?()
|
||||||
|
} else if index.1 {
|
||||||
|
if !progressStarted {
|
||||||
|
progressStarted = true
|
||||||
|
progressDisposable.set(progressSignal.start())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, completed: { [weak self] in
|
}, completed: { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.loadingMessage.set(false)
|
strongSelf.loadingMessage.set(false)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
cancelImpl = { [weak self] in
|
||||||
|
if let strongSelf = self {
|
||||||
|
strongSelf.loadingMessage.set(false)
|
||||||
|
strongSelf.messageIndexDisposable.set(nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
completion?()
|
completion?()
|
||||||
|
@ -215,14 +215,14 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
|
|||||||
} else if let group = messages[0].peers[messages[0].id.peerId] as? TelegramGroup {
|
} else if let group = messages[0].peers[messages[0].id.peerId] as? TelegramGroup {
|
||||||
if !isAction {
|
if !isAction {
|
||||||
if group.flags.contains(.adminsEnabled) {
|
if group.flags.contains(.adminsEnabled) {
|
||||||
canPin = true
|
|
||||||
} else {
|
|
||||||
switch group.role {
|
switch group.role {
|
||||||
case .creator, .admin:
|
case .creator, .admin:
|
||||||
canPin = true
|
canPin = true
|
||||||
default:
|
default:
|
||||||
canPin = false
|
canPin = false
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
canPin = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if let _ = messages[0].peers[messages[0].id.peerId] as? TelegramUser, chatPresentationInterfaceState.explicitelyCanPinMessages {
|
} 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 var status: FileMediaResourceMediaStatus?
|
||||||
private let playbackStatusDisposable = MetaDisposable()
|
private let playbackStatusDisposable = MetaDisposable()
|
||||||
|
private let fetchedThumbnailDisposable = MetaDisposable()
|
||||||
|
|
||||||
private var shouldAcquireVideoContext: Bool {
|
private var shouldAcquireVideoContext: Bool {
|
||||||
if case .visible = self.visibility {
|
if case .visible = self.visibility {
|
||||||
@ -97,6 +98,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
|||||||
deinit {
|
deinit {
|
||||||
self.fetchDisposable.dispose()
|
self.fetchDisposable.dispose()
|
||||||
self.playbackStatusDisposable.dispose()
|
self.playbackStatusDisposable.dispose()
|
||||||
|
self.fetchedThumbnailDisposable.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func didLoad() {
|
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)
|
dateAndStatusApply(false)
|
||||||
switch layoutData {
|
switch layoutData {
|
||||||
case let .unconstrained(width):
|
case let .unconstrained(width):
|
||||||
|
@ -132,7 +132,7 @@ func galleryItemForEntry(account: Account, presentationData: PresentationData, e
|
|||||||
if file.isVideo {
|
if file.isVideo {
|
||||||
let content: UniversalVideoContent
|
let content: UniversalVideoContent
|
||||||
if file.isAnimated {
|
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 {
|
} else {
|
||||||
if true || (file.mimeType == "video/mpeg4" || file.mimeType == "video/mov" || file.mimeType == "video/mp4") {
|
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)
|
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
|
|> mapToSignal { message -> Signal<GalleryMessageHistoryView?, NoError> in
|
||||||
switch source {
|
switch source {
|
||||||
case .peerMessagesAtId:
|
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])
|
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
|
return view
|
||||||
|
@ -124,9 +124,9 @@ final class HorizontalPeerItemNode: ListViewItemNode {
|
|||||||
let itemTheme: SelectablePeerNodeTheme
|
let itemTheme: SelectablePeerNodeTheme
|
||||||
switch item.mode {
|
switch item.mode {
|
||||||
case .list:
|
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:
|
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 currentBadgeBackgroundImage: UIImage?
|
||||||
let badgeAttributedString: NSAttributedString
|
let badgeAttributedString: NSAttributedString
|
||||||
|
@ -20,7 +20,7 @@ private enum ChatMessageGalleryControllerData {
|
|||||||
case chatAvatars(AvatarGalleryController, Media)
|
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 galleryMedia: Media?
|
||||||
var otherMedia: Media?
|
var otherMedia: Media?
|
||||||
var instantPageMedia: (TelegramMediaWebpage, [InstantPageGalleryEntry])?
|
var instantPageMedia: (TelegramMediaWebpage, [InstantPageGalleryEntry])?
|
||||||
@ -118,7 +118,7 @@ private func chatMessageGalleryControllerData(account: Account, message: Message
|
|||||||
let gallery = SecretMediaPreviewController(account: account, messageId: message.id)
|
let gallery = SecretMediaPreviewController(account: account, messageId: message.id)
|
||||||
return .secretGallery(gallery)
|
return .secretGallery(gallery)
|
||||||
} else {
|
} 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)
|
navigationController?.replaceTopController(controller, animated: false, ready: ready)
|
||||||
}, baseNavigationController: navigationController)
|
}, baseNavigationController: navigationController)
|
||||||
return .gallery(gallery)
|
return .gallery(gallery)
|
||||||
@ -138,7 +138,7 @@ enum ChatMessagePreviewControllerData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func chatMessagePreviewControllerData(account: Account, message: Message, standalone: Bool, reverseMessageGalleryOrder: Bool, navigationController: NavigationController?) -> 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 {
|
switch mediaData {
|
||||||
case let .gallery(gallery):
|
case let .gallery(gallery):
|
||||||
return .gallery(gallery)
|
return .gallery(gallery)
|
||||||
@ -151,8 +151,8 @@ func chatMessagePreviewControllerData(account: Account, message: Message, standa
|
|||||||
return nil
|
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 {
|
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, synchronousLoad: false) {
|
if let mediaData = chatMessageGalleryControllerData(account: account, message: message, navigationController: navigationController, standalone: standalone, reverseMessageGalleryOrder: reverseMessageGalleryOrder, stream: stream, synchronousLoad: false) {
|
||||||
switch mediaData {
|
switch mediaData {
|
||||||
case let .url(url):
|
case let .url(url):
|
||||||
openUrl(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)
|
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))
|
||||||
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 additionalContextSize = thumbnailContextFittingSize
|
||||||
let additionalBlurContext = DrawingContext(size: additionalContextSize, scale: 1.0)
|
let additionalBlurContext = DrawingContext(size: additionalContextSize, scale: 1.0)
|
||||||
additionalBlurContext.withFlippedContext { c in
|
additionalBlurContext.withFlippedContext { c in
|
||||||
|
@ -133,7 +133,7 @@ final class SelectablePeerNode: ASDisplayNode {
|
|||||||
self.currentSelected = selected
|
self.currentSelected = selected
|
||||||
|
|
||||||
if let attributedText = self.textNode.attributedText {
|
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 {
|
if selected {
|
||||||
|
@ -142,20 +142,20 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
self.controllerInteraction = ShareControllerInteraction(togglePeer: { [weak self] peer, search in
|
self.controllerInteraction = ShareControllerInteraction(togglePeer: { [weak self] peer, search in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
var added = false
|
var added = false
|
||||||
if strongSelf.controllerInteraction!.selectedPeerIds.contains(peer.id) {
|
if strongSelf.controllerInteraction!.selectedPeerIds.contains(peer.peerId) {
|
||||||
strongSelf.controllerInteraction!.selectedPeerIds.remove(peer.id)
|
strongSelf.controllerInteraction!.selectedPeerIds.remove(peer.peerId)
|
||||||
strongSelf.controllerInteraction!.selectedPeers = strongSelf.controllerInteraction!.selectedPeers.filter({ $0.id != peer.id })
|
strongSelf.controllerInteraction!.selectedPeers = strongSelf.controllerInteraction!.selectedPeers.filter({ $0.peerId != peer.peerId })
|
||||||
} else {
|
} else {
|
||||||
strongSelf.controllerInteraction!.selectedPeerIds.insert(peer.id)
|
strongSelf.controllerInteraction!.selectedPeerIds.insert(peer.peerId)
|
||||||
strongSelf.controllerInteraction!.selectedPeers.append(peer)
|
strongSelf.controllerInteraction!.selectedPeers.append(peer)
|
||||||
|
|
||||||
strongSelf.contentNode?.setEnsurePeerVisibleOnLayout(peer.id)
|
strongSelf.contentNode?.setEnsurePeerVisibleOnLayout(peer.peerId)
|
||||||
added = true
|
added = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if search && added {
|
if search && added {
|
||||||
strongSelf.controllerInteraction!.foundPeers = strongSelf.controllerInteraction!.foundPeers.filter { otherPeer in
|
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.controllerInteraction!.foundPeers.append(peer)
|
||||||
strongSelf.peersContentNode?.updateFoundPeers()
|
strongSelf.peersContentNode?.updateFoundPeers()
|
||||||
@ -445,7 +445,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
transition.updateAlpha(node: self.actionSeparatorNode, alpha: 0.0)
|
transition.updateAlpha(node: self.actionSeparatorNode, alpha: 0.0)
|
||||||
transition.updateAlpha(node: self.actionsBackgroundNode, 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)
|
self.transitionToContentNode(ShareLoadingContainerNode(theme: self.presentationData.theme, forceNativeAppearance: true), fastOut: true)
|
||||||
let timestamp = CACurrentMediaTime()
|
let timestamp = CACurrentMediaTime()
|
||||||
var wasDone = false
|
var wasDone = false
|
||||||
|
@ -6,12 +6,12 @@ import AsyncDisplayKit
|
|||||||
import Postbox
|
import Postbox
|
||||||
|
|
||||||
final class ShareControllerInteraction {
|
final class ShareControllerInteraction {
|
||||||
var foundPeers: [Peer] = []
|
var foundPeers: [RenderedPeer] = []
|
||||||
var selectedPeerIds = Set<PeerId>()
|
var selectedPeerIds = Set<PeerId>()
|
||||||
var selectedPeers: [Peer] = []
|
var selectedPeers: [RenderedPeer] = []
|
||||||
let togglePeer: (Peer, Bool) -> Void
|
let togglePeer: (RenderedPeer, Bool) -> Void
|
||||||
|
|
||||||
init(togglePeer: @escaping (Peer, Bool) -> Void) {
|
init(togglePeer: @escaping (RenderedPeer, Bool) -> Void) {
|
||||||
self.togglePeer = togglePeer
|
self.togglePeer = togglePeer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ final class ShareControllerPeerGridItemNode: GridItemNode {
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let (_, peer, search) = strongSelf.currentState {
|
if let (_, peer, search) = strongSelf.currentState {
|
||||||
if let actualPeer = peer.peers[peer.peerId] {
|
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)
|
peersNode.updateThemeAndStrings(theme: theme, strings: strings)
|
||||||
} else {
|
} else {
|
||||||
peersNode = ChatListSearchRecentPeersNode(account: account, theme: theme, mode: .actionSheet, strings: strings, peerSelected: { [weak self] peer in
|
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
|
}, peerLongTapped: {_ in }, isPeerSelected: { [weak self] peerId in
|
||||||
return self?.controllerInteraction?.selectedPeerIds.contains(peerId) ?? false
|
return self?.controllerInteraction?.selectedPeerIds.contains(peerId) ?? false
|
||||||
}, share: true)
|
}, share: true)
|
||||||
|
@ -60,7 +60,7 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
private let controllerInteraction: ShareControllerInteraction
|
private let controllerInteraction: ShareControllerInteraction
|
||||||
|
|
||||||
private let accountPeer: Peer
|
private let accountPeer: Peer
|
||||||
private let foundPeers = Promise<[Peer]>([])
|
private let foundPeers = Promise<[RenderedPeer]>([])
|
||||||
|
|
||||||
private let disposable = MetaDisposable()
|
private let disposable = MetaDisposable()
|
||||||
private var entries: [SharePeerEntry] = []
|
private var entries: [SharePeerEntry] = []
|
||||||
@ -100,8 +100,8 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
for peer in foundPeers.reversed() {
|
for peer in foundPeers.reversed() {
|
||||||
entries.append(SharePeerEntry(index: index, peer: RenderedPeer(peer: peer), theme: theme, strings: strings))
|
entries.append(SharePeerEntry(index: index, peer: peer, theme: theme, strings: strings))
|
||||||
existingPeerIds.insert(peer.id)
|
existingPeerIds.insert(peer.peerId)
|
||||||
index += 1
|
index += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,10 +325,10 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
if !self.controllerInteraction.selectedPeers.isEmpty {
|
if !self.controllerInteraction.selectedPeers.isEmpty {
|
||||||
subtitleText = self.controllerInteraction.selectedPeers.reduce("", { string, peer in
|
subtitleText = self.controllerInteraction.selectedPeers.reduce("", { string, peer in
|
||||||
let text: String
|
let text: String
|
||||||
if peer.id == self.accountPeer.id {
|
if peer.peerId == self.accountPeer.id {
|
||||||
text = self.strings.DialogList_SavedMessages
|
text = self.strings.DialogList_SavedMessages
|
||||||
} else {
|
} else {
|
||||||
text = peer.displayTitle
|
text = peer.chatMainPeer?.displayTitle ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if !string.isEmpty {
|
if !string.isEmpty {
|
||||||
|
@ -106,19 +106,19 @@ private enum ShareSearchRecentEntry: Comparable, Identifiable {
|
|||||||
|
|
||||||
private struct ShareSearchPeerEntry: Comparable, Identifiable {
|
private struct ShareSearchPeerEntry: Comparable, Identifiable {
|
||||||
let index: Int32
|
let index: Int32
|
||||||
let peer: Peer
|
let peer: RenderedPeer
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
let strings: PresentationStrings
|
let strings: PresentationStrings
|
||||||
|
|
||||||
var stableId: Int64 {
|
var stableId: Int64 {
|
||||||
return self.peer.id.toInt64()
|
return self.peer.peerId.toInt64()
|
||||||
}
|
}
|
||||||
|
|
||||||
static func ==(lhs: ShareSearchPeerEntry, rhs: ShareSearchPeerEntry) -> Bool {
|
static func ==(lhs: ShareSearchPeerEntry, rhs: ShareSearchPeerEntry) -> Bool {
|
||||||
if lhs.index != rhs.index {
|
if lhs.index != rhs.index {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !arePeersEqual(lhs.peer, rhs.peer) {
|
if lhs.peer != rhs.peer {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@ -129,7 +129,7 @@ private struct ShareSearchPeerEntry: Comparable, Identifiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func item(account: Account, interfaceInteraction: ShareControllerInteraction) -> GridItem {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,53 +243,49 @@ final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
|> delay(0.2, queue: Queue.concurrentDefaultQueue()))
|
|> delay(0.2, queue: Queue.concurrentDefaultQueue()))
|
||||||
|
|
||||||
return combineLatest(accountPeer, foundLocalPeers, foundRemotePeers)
|
return combineLatest(accountPeer, foundLocalPeers, foundRemotePeers)
|
||||||
|> map { accountPeer, foundLocalPeers, foundRemotePeers -> [ShareSearchPeerEntry]? in
|
|> map { accountPeer, foundLocalPeers, foundRemotePeers -> [ShareSearchPeerEntry]? in
|
||||||
var entries: [ShareSearchPeerEntry] = []
|
var entries: [ShareSearchPeerEntry] = []
|
||||||
var index: Int32 = 0
|
var index: Int32 = 0
|
||||||
|
|
||||||
var existingPeerIds = Set<PeerId>()
|
var existingPeerIds = Set<PeerId>()
|
||||||
|
|
||||||
if strings.DialogList_SavedMessages.lowercased().hasPrefix(query.lowercased()) {
|
if strings.DialogList_SavedMessages.lowercased().hasPrefix(query.lowercased()) {
|
||||||
if !existingPeerIds.contains(accountPeer.id) {
|
if !existingPeerIds.contains(accountPeer.id) {
|
||||||
existingPeerIds.insert(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 {
|
||||||
|
if !existingPeerIds.contains(renderedPeer.peerId) && canSendMessagesToPeer(peer) {
|
||||||
|
existingPeerIds.insert(renderedPeer.peerId)
|
||||||
|
entries.append(ShareSearchPeerEntry(index: index, peer: renderedPeer, theme: theme, strings: strings))
|
||||||
index += 1
|
index += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for renderedPeer in foundLocalPeers {
|
|
||||||
if let peer = renderedPeer.peers[renderedPeer.peerId], peer.id != accountPeer.id, peer.id.namespace != Namespaces.Peer.SecretChat {
|
for foundPeer in foundRemotePeers.0 {
|
||||||
if !existingPeerIds.contains(peer.id) && canSendMessagesToPeer(peer) {
|
let peer = foundPeer.peer
|
||||||
existingPeerIds.insert(peer.id)
|
if !existingPeerIds.contains(peer.id) && canSendMessagesToPeer(peer) {
|
||||||
var associatedPeer: Peer?
|
existingPeerIds.insert(peer.id)
|
||||||
if let associatedPeerId = peer.associatedPeerId {
|
entries.append(ShareSearchPeerEntry(index: index, peer: RenderedPeer(peer: foundPeer.peer), theme: theme, strings: strings))
|
||||||
associatedPeer = renderedPeer.peers[associatedPeerId]
|
index += 1
|
||||||
}
|
|
||||||
entries.append(ShareSearchPeerEntry(index: index, peer: peer, theme: theme, strings: strings))
|
|
||||||
index += 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for foundPeer in foundRemotePeers.0 {
|
|
||||||
let peer = foundPeer.peer
|
for foundPeer in foundRemotePeers.1 {
|
||||||
if !existingPeerIds.contains(peer.id) && canSendMessagesToPeer(peer) {
|
let peer = foundPeer.peer
|
||||||
existingPeerIds.insert(peer.id)
|
if !existingPeerIds.contains(peer.id) && canSendMessagesToPeer(peer) {
|
||||||
entries.append(ShareSearchPeerEntry(index: index, peer: foundPeer.peer, theme: theme, strings: strings))
|
existingPeerIds.insert(peer.id)
|
||||||
index += 1
|
entries.append(ShareSearchPeerEntry(index: index, peer: RenderedPeer(peer: peer), theme: theme, strings: strings))
|
||||||
}
|
index += 1
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for foundPeer in foundRemotePeers.1 {
|
|
||||||
let peer = foundPeer.peer
|
return entries
|
||||||
if !existingPeerIds.contains(peer.id) && canSendMessagesToPeer(peer) {
|
|
||||||
existingPeerIds.insert(peer.id)
|
|
||||||
entries.append(ShareSearchPeerEntry(index: index, peer: peer, theme: theme, strings: strings))
|
|
||||||
index += 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return entries
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return .single(nil)
|
return .single(nil)
|
||||||
@ -298,28 +294,28 @@ final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
|
|
||||||
let previousSearchItems = Atomic<[ShareSearchPeerEntry]?>(value: nil)
|
let previousSearchItems = Atomic<[ShareSearchPeerEntry]?>(value: nil)
|
||||||
self.searchDisposable.set((foundItems
|
self.searchDisposable.set((foundItems
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] entries in
|
|> deliverOnMainQueue).start(next: { [weak self] entries in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let previousEntries = previousSearchItems.swap(entries)
|
let previousEntries = previousSearchItems.swap(entries)
|
||||||
strongSelf.entries = entries ?? []
|
strongSelf.entries = entries ?? []
|
||||||
|
|
||||||
let firstTime = previousEntries == nil
|
let firstTime = previousEntries == nil
|
||||||
let transition = preparedGridEntryTransition(account: account, from: previousEntries ?? [], to: entries ?? [], interfaceInteraction: controllerInteraction)
|
let transition = preparedGridEntryTransition(account: account, from: previousEntries ?? [], to: entries ?? [], interfaceInteraction: controllerInteraction)
|
||||||
strongSelf.enqueueTransition(transition, firstTime: firstTime)
|
strongSelf.enqueueTransition(transition, firstTime: firstTime)
|
||||||
|
|
||||||
if (previousEntries == nil) != (entries == nil) {
|
if (previousEntries == nil) != (entries == nil) {
|
||||||
if previousEntries == nil {
|
if previousEntries == nil {
|
||||||
strongSelf.recentGridNode.isHidden = true
|
strongSelf.recentGridNode.isHidden = true
|
||||||
strongSelf.contentGridNode.isHidden = false
|
strongSelf.contentGridNode.isHidden = false
|
||||||
strongSelf.transitionToContentGridLayout()
|
strongSelf.transitionToContentGridLayout()
|
||||||
} else {
|
} else {
|
||||||
strongSelf.recentGridNode.isHidden = false
|
strongSelf.recentGridNode.isHidden = false
|
||||||
strongSelf.contentGridNode.isHidden = true
|
strongSelf.contentGridNode.isHidden = true
|
||||||
strongSelf.transitionToRecentGridLayout()
|
strongSelf.transitionToRecentGridLayout()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}))
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
self.searchNode.textUpdated = { [weak self] text in
|
self.searchNode.textUpdated = { [weak self] text in
|
||||||
self?.searchQuery.set(text)
|
self?.searchQuery.set(text)
|
||||||
@ -414,7 +410,7 @@ final class ShareSearchContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
var scrollToItem: GridNodeScrollToItem?
|
var scrollToItem: GridNodeScrollToItem?
|
||||||
if !self.contentGridNode.isHidden, let ensurePeerVisibleOnLayout = self.ensurePeerVisibleOnLayout {
|
if !self.contentGridNode.isHidden, let ensurePeerVisibleOnLayout = self.ensurePeerVisibleOnLayout {
|
||||||
self.ensurePeerVisibleOnLayout = nil
|
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)
|
scrollToItem = GridNodeScrollToItem(index: index, position: .visible, transition: transition, directionHint: .up, adjustForSection: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,14 +183,15 @@ private func twoStepVerificationUnlockSettingsControllerEntries(presentationData
|
|||||||
switch configuration {
|
switch configuration {
|
||||||
case let .notSet(pendingEmailAndValue):
|
case let .notSet(pendingEmailAndValue):
|
||||||
if let pendingEmailAndValue = 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 {
|
if pendingEmailAndValue.email != nil {
|
||||||
} else {
|
} else {
|
||||||
entries.append(.pendingEmailConfirmAddress(presentationData.theme, presentationData.strings.TwoStepAuth_EmailTitle, state.emailAddress))
|
entries.append(.pendingEmailConfirmAddress(presentationData.theme, presentationData.strings.TwoStepAuth_EmailTitle, state.emailAddress))
|
||||||
}
|
}
|
||||||
entries.append(.pendingEmailConfirmCode(presentationData.theme, presentationData.strings.TwoStepAuth_RecoveryCode, state.emailCode))
|
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_ConfirmationAbort + "]()"))
|
*/
|
||||||
|
entries.append(.pendingEmailInfo(presentationData.theme, presentationData.strings.TwoStepAuth_ConfirmationText + "\n\n\(pendingEmailAndValue.pendingEmail.pattern)\n\n[" + presentationData.strings.TwoStepAuth_ConfirmationAbort + "]()"))
|
||||||
} else {
|
} else {
|
||||||
entries.append(.passwordSetup(presentationData.theme, presentationData.strings.TwoStepAuth_SetPassword))
|
entries.append(.passwordSetup(presentationData.theme, presentationData.strings.TwoStepAuth_SetPassword))
|
||||||
entries.append(.passwordSetupInfo(presentationData.theme, presentationData.strings.TwoStepAuth_SetPasswordHelp))
|
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(.turnPasswordOff(presentationData.theme, presentationData.strings.TwoStepAuth_RemovePassword))
|
||||||
entries.append(.setupRecoveryEmail(presentationData.theme, emailSet ? presentationData.strings.TwoStepAuth_ChangeEmail : presentationData.strings.TwoStepAuth_SetupEmail))
|
entries.append(.setupRecoveryEmail(presentationData.theme, emailSet ? presentationData.strings.TwoStepAuth_ChangeEmail : presentationData.strings.TwoStepAuth_SetupEmail))
|
||||||
if let pendingEmailAndValue = 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 {
|
if pendingEmailAndValue.email != nil {
|
||||||
} else {
|
} else {
|
||||||
entries.append(.pendingEmailConfirmAddress(presentationData.theme, presentationData.strings.TwoStepAuth_EmailTitle, state.emailAddress))
|
entries.append(.pendingEmailConfirmAddress(presentationData.theme, presentationData.strings.TwoStepAuth_EmailTitle, state.emailAddress))
|
||||||
}
|
}
|
||||||
entries.append(.pendingEmailConfirmCode(presentationData.theme, presentationData.strings.TwoStepAuth_RecoveryCode, state.emailCode))
|
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_ConfirmationText + "\n\n\(pendingEmailAndValue.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_EmailSent))
|
||||||
} else {
|
} else {
|
||||||
entries.append(.passwordInfo(presentationData.theme, presentationData.strings.TwoStepAuth_GenericHelp))
|
entries.append(.passwordInfo(presentationData.theme, presentationData.strings.TwoStepAuth_GenericHelp))
|
||||||
}
|
}
|
||||||
@ -697,11 +698,12 @@ func twoStepVerificationUnlockSettingsController(account: Account, mode: TwoStep
|
|||||||
} else {
|
} else {
|
||||||
switch configuration {
|
switch configuration {
|
||||||
case let .notSet(pendingEmail):
|
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: {
|
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Next), style: .bold, enabled: (pendingEmailAndValue.email != nil || !state.emailAddress.isEmpty) && !state.emailCode.isEmpty, action: {
|
||||||
checkEmailConfirmation()
|
checkEmailConfirmation()
|
||||||
})
|
})
|
||||||
}
|
}*/
|
||||||
|
break
|
||||||
case .set:
|
case .set:
|
||||||
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Next), style: .bold, enabled: true, action: {
|
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Next), style: .bold, enabled: true, action: {
|
||||||
arguments.checkPassword()
|
arguments.checkPassword()
|
||||||
@ -716,11 +718,11 @@ func twoStepVerificationUnlockSettingsController(account: Account, mode: TwoStep
|
|||||||
if state.checking {
|
if state.checking {
|
||||||
rightNavigationButton = ItemListNavigationButton(content: .none, style: .activity, enabled: true, action: {})
|
rightNavigationButton = ItemListNavigationButton(content: .none, style: .activity, enabled: true, action: {})
|
||||||
} else {
|
} 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: {
|
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Next), style: .bold, enabled: (pendingEmailAndValue.email != nil || !state.emailAddress.isEmpty) && !state.emailCode.isEmpty, action: {
|
||||||
checkEmailConfirmation()
|
checkEmailConfirmation()
|
||||||
})
|
})
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +374,16 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||||||
initialBuffering = true
|
initialBuffering = true
|
||||||
//buffering = true
|
//buffering = true
|
||||||
isPaused = !whilePlaying
|
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
|
initialBuffering = false
|
||||||
if !content.enableSound {
|
if !content.enableSound {
|
||||||
isPaused = false
|
isPaused = false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user