From f357e5596f2a71c56a67fd99a9f0e11c9be3c455 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sat, 26 Oct 2019 02:50:36 +0400 Subject: [PATCH] Enabled Send When Online option --- .../TelegramUI/TelegramUI/ChatController.swift | 12 ++++++------ .../TelegramUI/ChatScheduleTimeController.swift | 2 +- .../TelegramUI/ChatScheduleTimeControllerNode.swift | 9 +++++++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/submodules/TelegramUI/TelegramUI/ChatController.swift b/submodules/TelegramUI/TelegramUI/ChatController.swift index 5a60922053..e64271029b 100644 --- a/submodules/TelegramUI/TelegramUI/ChatController.swift +++ b/submodules/TelegramUI/TelegramUI/ChatController.swift @@ -1580,7 +1580,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G if peer.id == strongSelf.context.account.peerId { mode = .reminders } else { - mode = .scheduledMessages + mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser) } let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] scheduleTime in @@ -1612,7 +1612,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G if peer.id == strongSelf.context.account.peerId { mode = .reminders } else { - mode = .scheduledMessages + mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser) } let _ = (strongSelf.context.account.postbox.transaction { transaction -> Message? in @@ -5463,7 +5463,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G if peer.id == strongSelf.context.account.peerId { mode = .reminders } else { - mode = .scheduledMessages + mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser) } let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] time in if let strongSelf = self { @@ -5504,7 +5504,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G if peer.id == strongSelf.context.account.peerId { mode = .reminders } else { - mode = .scheduledMessages + mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser) } let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] time in if let strongSelf = self { @@ -5693,7 +5693,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G if peer.id == strongSelf.context.account.peerId { mode = .reminders } else { - mode = .scheduledMessages + mode = .scheduledMessages(sendWhenOnlineAvailable: peer.id.namespace == Namespaces.Peer.CloudUser) } let controller = ChatScheduleTimeController(context: strongSelf.context, mode: mode, minimalTime: strongSelf.presentationInterfaceState.slowmodeState?.timeout, completion: { [weak self] time in if let strongSelf = self { @@ -5980,7 +5980,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G if peerId == self.context.account.peerId { mode = .reminders } else { - mode = .scheduledMessages + mode = .scheduledMessages(sendWhenOnlineAvailable: peerId.namespace == Namespaces.Peer.CloudUser) } let controller = ChatScheduleTimeController(context: self.context, mode: mode, minimalTime: self.presentationInterfaceState.slowmodeState?.timeout, dismissByTapOutside: false, completion: { [weak self] time in if let strongSelf = self { diff --git a/submodules/TelegramUI/TelegramUI/ChatScheduleTimeController.swift b/submodules/TelegramUI/TelegramUI/ChatScheduleTimeController.swift index 949d343aa0..682b838a13 100644 --- a/submodules/TelegramUI/TelegramUI/ChatScheduleTimeController.swift +++ b/submodules/TelegramUI/TelegramUI/ChatScheduleTimeController.swift @@ -9,7 +9,7 @@ import SwiftSignalKit import AccountContext enum ChatScheduleTimeControllerMode { - case scheduledMessages + case scheduledMessages(sendWhenOnlineAvailable: Bool) case reminders } diff --git a/submodules/TelegramUI/TelegramUI/ChatScheduleTimeControllerNode.swift b/submodules/TelegramUI/TelegramUI/ChatScheduleTimeControllerNode.swift index c72b17af5f..859f4c309b 100644 --- a/submodules/TelegramUI/TelegramUI/ChatScheduleTimeControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatScheduleTimeControllerNode.swift @@ -102,7 +102,9 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel self.contentContainerNode.addSubnode(self.titleNode) self.contentContainerNode.addSubnode(self.cancelButton) self.contentContainerNode.addSubnode(self.doneButton) - //self.contentContainerNode.addSubnode(self.onlineButton) + if case .scheduledMessages(true) = self.mode { + self.contentContainerNode.addSubnode(self.onlineButton) + } self.cancelButton.addTarget(self, action: #selector(self.cancelButtonPressed), forControlEvents: .touchUpInside) self.doneButton.pressed = { [weak self] in @@ -311,7 +313,10 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel let cleanInsets = layout.insets(options: [.statusBar]) insets.top = max(10.0, insets.top) - var buttonOffset: CGFloat = 0.0 //44.0 + var buttonOffset: CGFloat = 0.0 + if case .scheduledMessages(true) = self.mode { + buttonOffset += 44.0 + } let bottomInset: CGFloat = 10.0 + cleanInsets.bottom let titleHeight: CGFloat = 54.0