Skip to content

Commit bac6eed

Browse files
Added support for new interactive math inline objects, com.apple.notes.inlinetextattachment.calculateresult and com.apple.notes.inlinetextattachment.calculategraphexpression.
1 parent deb42f6 commit bac6eed

4 files changed

Lines changed: 66 additions & 0 deletions

lib/AppleNote.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
require_relative 'AppleNotesEmbeddedObject.rb'
99
require_relative 'AppleDecrypter.rb'
1010
require_relative 'AppleNotesEmbeddedInlineAttachment.rb'
11+
require_relative 'AppleNotesEmbeddedInlineCalculateGraphExpression.rb'
12+
require_relative 'AppleNotesEmbeddedInlineCalculateResult.rb'
1113
require_relative 'AppleNotesEmbeddedInlineHashtag.rb'
1214
require_relative 'AppleNotesEmbeddedInlineLink.rb'
1315
require_relative 'AppleNotesEmbeddedInlineMention.rb'
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require_relative 'AppleNotesEmbeddedInlineAttachment'
2+
3+
##
4+
# This class represents an inline interactive math graph embedded in an AppleNote.
5+
# These were added in iOS 18.
6+
class AppleNotesEmbeddedInlineCalculateGraphExpression < AppleNotesEmbeddedInlineAttachment
7+
8+
##
9+
# Creates a new AppleNotesEmbeddedInlineCalculateGraphExpression.
10+
# Expects an Integer +primary_key+ from ZICCLOUDSYNCINGOBJECT.Z_PK, String +uuid+ from ZICCLOUDSYNCINGOBJECT.ZIDENTIFIER,
11+
# String +uti+ from ZICCLOUDSYNCINGOBJECT.ZTYPEUTI1, AppleNote +note+ object representing the parent AppleNote,
12+
# a String +alt_text+ from ZICCLOUDSYNCINGOBJECT.ZALTTEXT, and a String +token_identifier+ from
13+
# ZICCLOUDSYNCINGOBJECT.ZTOKENCONTENTIDENTIFIER representing what the result stands for.
14+
def initialize(primary_key, uuid, uti, note, alt_text, token_identifier)
15+
super(primary_key, uuid, uti, note, alt_text, token_identifier)
16+
end
17+
18+
##
19+
# This method just returns the graph equation's variable, which is found in alt_text.
20+
def to_s
21+
return "" if !@alt_text
22+
@alt_text
23+
end
24+
25+
end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require_relative 'AppleNotesEmbeddedInlineAttachment'
2+
3+
##
4+
# This class represents an inline interactive math result embedded in an AppleNote.
5+
# These were added in iOS 18.
6+
class AppleNotesEmbeddedInlineCalculateResult < AppleNotesEmbeddedInlineAttachment
7+
8+
##
9+
# Creates a new AppleNotesEmbeddedInlineCalculateResult.
10+
# Expects an Integer +primary_key+ from ZICCLOUDSYNCINGOBJECT.Z_PK, String +uuid+ from ZICCLOUDSYNCINGOBJECT.ZIDENTIFIER,
11+
# String +uti+ from ZICCLOUDSYNCINGOBJECT.ZTYPEUTI1, AppleNote +note+ object representing the parent AppleNote,
12+
# a String +alt_text+ from ZICCLOUDSYNCINGOBJECT.ZALTTEXT, and a String +token_identifier+ from
13+
# ZICCLOUDSYNCINGOBJECT.ZTOKENCONTENTIDENTIFIER representing what the result stands for.
14+
def initialize(primary_key, uuid, uti, note, alt_text, token_identifier)
15+
super(primary_key, uuid, uti, note, alt_text, token_identifier)
16+
end
17+
18+
##
19+
# This method just returns the calculation result's text, which is found in alt_text.
20+
def to_s
21+
return "" if !@alt_text
22+
@alt_text
23+
end
24+
25+
end

lib/AppleNotesEmbeddedObject.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,20 @@ def self.generate_embedded_objects(note, note_proto)
449449
note,
450450
row["ZALTTEXT"],
451451
row["ZTOKENCONTENTIDENTIFIER"])
452+
elsif tmp_uti.uti == "com.apple.notes.inlinetextattachment.calculateresult"
453+
tmp_embedded_object = AppleNotesEmbeddedInlineCalculateResult.new(row["Z_PK"],
454+
row["ZIDENTIFIER"],
455+
row["ZTYPEUTI1"],
456+
note,
457+
row["ZALTTEXT"],
458+
row["ZTOKENCONTENTIDENTIFIER"])
459+
elsif tmp_uti.uti == "com.apple.notes.inlinetextattachment.calculategraphexpression"
460+
tmp_embedded_object = AppleNotesEmbeddedInlineCalculateGraphExpression.new(row["Z_PK"],
461+
row["ZIDENTIFIER"],
462+
row["ZTYPEUTI1"],
463+
note,
464+
row["ZALTTEXT"],
465+
row["ZTOKENCONTENTIDENTIFIER"])
452466
else
453467
puts "#{row["ZTYPEUTI1"]} is unrecognized ZTYPEUTI1, please submit a bug report to this project's GitHub repo to report this: https://github.com/threeplanetssoftware/apple_cloud_notes_parser/issues"
454468
logger.debug("Note #{note.note_id}: #{row["ZTYPEUTI1"]} is unrecognized ZTYPEUTI1, check ZICCLOUDSYNCINGOBJECT Z_PK: #{row["Z_PK"]}")

0 commit comments

Comments
 (0)