pub fn parse(stream: Vec<u8>) -> Result<String, StreamTypedError>Expand description
Parse the body text from a known type of typedstream attributedBody file.
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".
§Legacy parsing
If the typedstream data cannot be deserialized, we fall back to this legacy string parsing algorithm that
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!";Will have a body() of:
use imessage_database::message_types::text_effects::TextEffect;
use imessage_database::tables::messages::{models::{TextAttributes, BubbleComponent, AttachmentMeta}};
let result = vec![
BubbleComponent::Attachment(AttachmentMeta::default()),
BubbleComponent::Text(vec![TextAttributes::new(3, 24, vec![TextEffect::Default])]),
];