Trait AttributedBody

Source
pub trait AttributedBody {
    // Required method
    fn body(&self) -> Vec<BubbleComponent<'_>>;
}
Expand description

Defines behavior for deserializing a message’s typedstream body data in native Rust

Required Methods§

Source

fn body(&self) -> Vec<BubbleComponent<'_>>

Get a vector of a message body’s components. If the text has not been captured, the vector will be empty.

§Parsing

There are two different ways this crate will attempt to parse this data.

§Default parsing

In most cases, the message body will be deserialized using the typedstream deserializer.

Note: message body text can be formatted with a Vec of TextAttributes.

§Legacy parsing

If the typedstream data cannot be deserialized, this method falls back to a 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, TextEffect::Default)]),
];

Implementors§