pub fn parse(stream: Vec<u8>) -> Result<String, StreamTypedError>Expand description
Parse plain body text from a streamtyped attributedBody blob.
attributedBody typedstream data looks like:
streamtyped���@���NSAttributedString�NSObject����NSString��+Example message ��iI���� NSDictionary��i����__kIMMessagePartAttributeName����NSNumber��NSValue��*������In that example, the returned body text would be "Example message".
§Parser scope
This string parser only supports unstyled text.
If the message has attachments, there will be one U+FFFC character
for each attachment and one U+FFFD for app messages that we need
to format.
§Sample
An iMessage that contains body text like:
let message_text = "\u{FFFC}Check out this photo!";produces fallback body components like:
use imessage_database::message_types::text_effects::text_effect::TextEffect;
use imessage_database::tables::messages::{models::{AttributedRange, BubbleComponent, AttachmentMeta}};
let result = vec![
BubbleComponent::Run(vec![AttributedRange::attachment(0, 3, AttachmentMeta::default())]),
BubbleComponent::Run(vec![AttributedRange::text(3, 24, vec![TextEffect::Default])]),
];