Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/cs/support digital touch #370

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Installation instructions for the binary are located [here](imessage-exporter/RE

## Library

The `imessage_database` library provides models that allow us to access iMessage information as native data structures.
The `imessage_database` library provides models that allow us to access iMessage information as native, cross-platform data structures.

Documentation for the library is located [here](imessage-database/README.md).

Expand All @@ -40,6 +40,7 @@ This crate supports every iMessage feature as of macOS 15.1 (24B83) and iOS 18.1
- Tapbacks
- Stickers
- Apple Pay
- Digital Touch
- URL Previews
- App Integrations
- Edited messages
Expand Down
3 changes: 3 additions & 0 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ This tool targets the current latest public release for macOS and iMessage. It m
- TXT export behavior depends on attachment settings:
- `disabled`: embedded inline as an `ascii` graphic
- `compatible, efficient`: saved as an `svg` file
- Digital Touch
- Parses the protobuf payload to extract [Digital Touch](https://support.apple.com/guide/ipod-touch/send-a-digital-touch-effect-iph3fadba219/ios) message data
- Displayed as text that describes the type of message sent in HTML and TXT exports
- Duplicated group chats
- Handles (participants) and chats (threads) can become duplicated
- On startup:
Expand Down
26 changes: 18 additions & 8 deletions imessage-database/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,32 @@ use std::{
};

fn main() {
if !exists("src/message_types/handwriting/handwriting_proto.rs").unwrap() {
build_proto(
"src/message_types/handwriting/handwriting.proto",
"handwriting.rs",
"src/message_types/handwriting/handwriting_proto.rs",
);
build_proto(
"src/message_types/digital_touch/digital_touch.proto",
"digital_touch.rs",
"src/message_types/digital_touch/digital_touch_proto.rs",
);
}

fn build_proto(input_proto: &str, generated_name: &str, output_rs: &str) {
if !exists(output_rs).unwrap() {
protobuf_codegen::Codegen::new()
.pure()
.input("src/message_types/handwriting/handwriting.proto")
.input(input_proto)
.include(".")
.cargo_out_dir("p")
.run_from_script();

// Move generated file to correct location
let mut generated = PathBuf::from(env::var("OUT_DIR").unwrap());
generated.push("p");
generated.push("handwriting.rs");
copy(
generated,
"src/message_types/handwriting/handwriting_proto.rs",
)
.unwrap();
generated.push(generated_name);
println!("{}", generated.to_str().unwrap());
copy(generated, output_rs).unwrap();
}
}
4 changes: 4 additions & 0 deletions imessage-database/src/error/plist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub enum PlistParseError {
InvalidEditedMessage(String),
StreamTypedError(StreamTypedError),
HandwritingError(HandwritingError),
DigitalTouchError,
}

impl Display for PlistParseError {
Expand Down Expand Up @@ -48,6 +49,9 @@ impl Display for PlistParseError {
}
PlistParseError::StreamTypedError(why) => write!(fmt, "{why}"),
PlistParseError::HandwritingError(why) => write!(fmt, "{why}"),
PlistParseError::DigitalTouchError => {
write!(fmt, "Unable to parse Digital Touch Message!")
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
syntax = 'proto3';
package digital_touch;

message BaseMessage {
TouchKind TouchKind = 1;
bytes TouchPayload = 3;
string ID = 5;
}

enum TouchKind {
Unknown = 0;
Tap = 1;
// 2?
Heartbeat = 3; // Also broken heart
Sketch = 4;
// 5?
// 6?
Kiss = 7;
Fireball = 8;
}

message TapMessage {
bytes Delays = 2;
bytes Location = 3;
bytes Color = 4;
}

message SketchMessage {
int64 StrokesCount = 1;
bytes Strokes = 2;
bytes Colors = 3;
}

message KissMessage {
bytes Delays = 1;
bytes Points = 2;
bytes Rotations = 3;
}

message HeartbeatMessage {
float BPM = 1;
uint64 Duration = 2;
float HeartBrokenAt = 6;
}

message FireballMessage {
float Duration = 1;
float StartX = 2;
float StartY = 3;
bytes Delays = 4;
bytes Points = 5;
}
Loading
Loading