feat: Add mail template - #2277
Draft
Muuushuuu wants to merge 23 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Adds mail-template browsing, previewing, and insertion to the message composer.
Changes:
- Adds template models, mock fetching, and template UI.
- Adds caret-based HTML insertion through JavaScript.
- Adds a mobile composer toolbar action and icon asset.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
MailResources/js/insertHTMLAtCaret.js |
Inserts template HTML at the editor caret. |
MailResources/Assets.xcassets/models.imageset/models.svg |
Adds the template icon. |
MailResources/Assets.xcassets/models.imageset/Contents.json |
Configures the icon asset. |
MailCore/Utils/JavaScriptDeclaration.swift |
Exposes template insertion to Swift. |
MailCore/Models/MailTemplate.swift |
Defines the template model and fixtures. |
MailCore/API/MailApiFetcher/MailApiFetcher+Extended.swift |
Adds mock template fetching. |
MailCore/API/MailApiFetcher/MailApiFetchable.swift |
Extends the fetcher protocol. |
Mail/Views/Template/MailTemplateFloatingPanel.swift |
Implements listing, preview, and insertion UI. |
Mail/Views/New Message/ComposeMessageView.swift |
Presents the template sheet. |
Mail/Views/New Message/ComposeMessageBodyView.swift |
Loads the insertion script. |
Mail/Views/New Message/ComposeEditor/Mobile/MobileMainToolbarView.swift |
Adds the mobile template action. |
Mail/Views/New Message/ComposeEditor/Mobile/EditorMobileToolbarView.swift |
Propagates presentation state. |
Mail/Views/New Message/ComposeEditor/EditorToolbarAction.swift |
Defines template action metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+74
to
+77
| func mailTemplate() async throws -> [MailTemplate] { | ||
| try await Task { | ||
| MailTemplate.mocks | ||
| }.value |
| availableOptions.append(.ai) | ||
| } | ||
|
|
||
| availableOptions.append(.mailTemplate) |
Comment on lines
+152
to
+159
| try? await editorBox.editor?.webView | ||
| .evaluateJavaScript(.insertHTMLAtCaret(template.body)) | ||
| } | ||
|
|
||
| if let liveDraft = draft.thaw(), let realm = liveDraft.realm { | ||
| try? realm.write { | ||
| if liveDraft.subject.isEmpty { | ||
| liveDraft.subject = template.title |
Muuushuuu
force-pushed
the
feat/add-mail-model
branch
5 times, most recently
from
August 18, 2026 08:41
ad8f6b2 to
270b702
Compare
Replace with real method after
Change accessibility and icon after
…edString() to apply html balise)
Muuushuuu
force-pushed
the
feat/add-mail-model
branch
from
August 19, 2026 11:58
a196f93 to
8394073
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Error handling is missing (user feedback?)
InlineImage handling is missing