This commit is contained in:
Ilya Laktyushin 2019-11-01 22:53:32 +04:00
parent cd64a206b6
commit 0505eb574e
6 changed files with 10 additions and 7 deletions

View File

@ -5,6 +5,8 @@ import Foundation
import Postbox
#endif
public let scheduleWhenOnlineTimestamp: Int32 = 0x7ffffffe
public class OutgoingScheduleInfoMessageAttribute: MessageAttribute {
public let scheduleTime: Int32

View File

@ -195,7 +195,7 @@ public extension Message {
func effectivelyFailed(timestamp: Int32) -> Bool {
if self.flags.contains(.Failed) {
return true
} else if self.id.namespace == Namespaces.Message.ScheduledCloud && self.timestamp != 0x7FFFFFFE {
} else if self.id.namespace == Namespaces.Message.ScheduledCloud && self.timestamp != scheduleWhenOnlineTimestamp {
return timestamp > self.timestamp + 60
} else {
return false

View File

@ -4,6 +4,7 @@ import Display
import AsyncDisplayKit
import TelegramPresentationData
import Postbox
import SyncCore
import AccountContext
private let timezoneOffset: Int32 = {
@ -32,8 +33,8 @@ final class ChatMessageDateHeader: ListViewItemHeader {
self.presentationData = presentationData
self.context = context
self.action = action
if timestamp == 0x7FFFFFFE {
self.roundedTimestamp = 0x7FFFFFFE
if timestamp == scheduleWhenOnlineTimestamp {
self.roundedTimestamp = scheduleWhenOnlineTimestamp
} else if timestamp == Int32.max {
self.roundedTimestamp = timestamp / (granularity) * (granularity)
} else {
@ -153,7 +154,7 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
}
if scheduled {
if localTimestamp == 0x7FFFFFFE {
if localTimestamp == scheduleWhenOnlineTimestamp {
text = presentationData.strings.ScheduledMessages_ScheduledOnline
} else if timeinfo.tm_year == timeinfoNow.tm_year && timeinfo.tm_yday == timeinfoNow.tm_yday {
text = presentationData.strings.ScheduledMessages_ScheduledToday

View File

@ -64,7 +64,7 @@ final class ChatScheduleTimeController: ViewController {
override public func loadDisplayNode() {
self.displayNode = ChatScheduleTimeControllerNode(context: self.context, mode: self.mode, currentTime: self.currentTime, minimalTime: self.minimalTime, dismissByTapOutside: self.dismissByTapOutside)
self.controllerNode.completion = { [weak self] time in
self?.completion(time != 0x7FFFFFFE ? time + 5 : time)
self?.completion(time != scheduleWhenOnlineTimestamp ? time + 5 : time)
self?.dismiss()
}
self.controllerNode.dismiss = { [weak self] in

View File

@ -245,7 +245,7 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel
}
@objc func onlineButtonPressed() {
self.completion?(0x7FFFFFFE)
self.completion?(scheduleWhenOnlineTimestamp)
}
@objc func dimTapGesture(_ recognizer: UITapGestureRecognizer) {

View File

@ -20,7 +20,7 @@ func stringForMessageTimestampStatus(accountPeerId: PeerId, message: Message, da
timestamp = message.timestamp
}
var dateText = stringForMessageTimestamp(timestamp: timestamp, dateTimeFormat: dateTimeFormat)
if timestamp == 0x7FFFFFFE {
if timestamp == scheduleWhenOnlineTimestamp {
dateText = " "
}