Rich text wip
This commit is contained in:
parent
0d5b051820
commit
a5825d5a67
3 changed files with 31 additions and 25 deletions
|
|
@ -39,6 +39,8 @@ final class InstantPageV2SlideshowView: UIView, InstantPageItemView, UIScrollVie
|
|||
self.backgroundColor = theme.panelSecondaryColor // structural
|
||||
self.clipsToBounds = true // structural
|
||||
|
||||
self.scrollView.disablesInteractiveTransitionGestureRecognizer = true
|
||||
|
||||
self.scrollView.isPagingEnabled = true
|
||||
self.scrollView.showsHorizontalScrollIndicator = false
|
||||
self.scrollView.showsVerticalScrollIndicator = false
|
||||
|
|
|
|||
|
|
@ -6,34 +6,10 @@ public class RichTextMessageAttribute: MessageAttribute, Equatable {
|
|||
public let instantPage: InstantPage
|
||||
|
||||
public var associatedPeerIds: [PeerId] {
|
||||
/*var result: [PeerId] = []
|
||||
for entity in entities {
|
||||
switch entity.type {
|
||||
case let .TextMention(peerId):
|
||||
result.append(peerId)
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
return result*/
|
||||
return []
|
||||
}
|
||||
|
||||
public var associatedMediaIds: [MediaId] {
|
||||
/*var result: [MediaId] = []
|
||||
for entity in self.entities {
|
||||
switch entity.type {
|
||||
case let .CustomEmoji(_, fileId):
|
||||
result.append(MediaId(namespace: Namespaces.Media.CloudFile, id: fileId))
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
if result.isEmpty {
|
||||
return result
|
||||
} else {
|
||||
return Array(Set(result))
|
||||
}*/
|
||||
return []
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,8 +129,15 @@ public let telegramPostboxSeedConfiguration: SeedConfiguration = {
|
|||
break
|
||||
}
|
||||
}
|
||||
var previousRichText: RichTextMessageAttribute?
|
||||
for attribute in previous {
|
||||
if let attribute = attribute as? RichTextMessageAttribute {
|
||||
previousRichText = attribute
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if let audioTranscription = audioTranscription {
|
||||
if let audioTranscription {
|
||||
var found = false
|
||||
for i in 0 ..< updated.count {
|
||||
if let attribute = updated[i] as? AudioTranscriptionMessageAttribute {
|
||||
|
|
@ -155,6 +162,27 @@ public let telegramPostboxSeedConfiguration: SeedConfiguration = {
|
|||
updated.append(previousDerivedData)
|
||||
}
|
||||
}
|
||||
if let previousRichText, previousRichText.instantPage.isComplete {
|
||||
for i in 0 ..< updated.count {
|
||||
if let attribute = updated[i] as? RichTextMessageAttribute {
|
||||
if !attribute.instantPage.isComplete {
|
||||
var prefixEquals = true
|
||||
if attribute.instantPage.blocks.count <= previousRichText.instantPage.blocks.count {
|
||||
inner: for j in 0 ..< attribute.instantPage.blocks.count {
|
||||
if attribute.instantPage.blocks[j] != attribute.instantPage.blocks[j] {
|
||||
prefixEquals = false
|
||||
break inner
|
||||
}
|
||||
}
|
||||
}
|
||||
if prefixEquals {
|
||||
updated[i] = previousRichText
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
decodeMessageThreadInfo: { entry in
|
||||
guard let data = entry.get(MessageHistoryThreadData.self) else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue