mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Update API
This commit is contained in:
parent
6240a14697
commit
c0f7cda4eb
17 changed files with 126 additions and 71 deletions
|
|
@ -30,7 +30,8 @@ public func stringForEntityFormattedDate(timestamp: Int32, format: MessageTextEn
|
|||
return strings.FormattedDate_InDays(Int32(round(Float(value) / (24 * 60 * 60))))
|
||||
}
|
||||
}
|
||||
case let .full(timeFormat, dateFormat):
|
||||
case let .full(timeFormat, dateFormat, dayOfWeek):
|
||||
let _ = dayOfWeek
|
||||
var string = ""
|
||||
if let dateFormat {
|
||||
switch dateFormat {
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ public func generateTextEntities(_ text: String, enabledTypes: EnabledEntityType
|
|||
type = .Url
|
||||
} else if result.resultType == NSTextCheckingResult.CheckingType.date, let date = result.date?.timeIntervalSince1970 {
|
||||
#if DEBUG
|
||||
var dayOfWeek = false
|
||||
var format: MessageTextEntityType.DateTimeFormat?
|
||||
if text.contains("[rel]") {
|
||||
format = .relative
|
||||
|
|
@ -316,8 +317,11 @@ public func generateTextEntities(_ text: String, enabledTypes: EnabledEntityType
|
|||
} else if text.contains("[ld]") {
|
||||
dateFormat = .long
|
||||
}
|
||||
if text.contains("[d]") {
|
||||
dayOfWeek = true
|
||||
}
|
||||
if timeFormat != nil || dateFormat != nil {
|
||||
format = .full(timeFormat: timeFormat, dateFormat: dateFormat)
|
||||
format = .full(timeFormat: timeFormat, dateFormat: dateFormat, dayOfWeek: dayOfWeek)
|
||||
}
|
||||
type = .FormattedDate(format: format, date: Int32(date))
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue