Skip to content

feat: Add mail template - #2277

Draft
Muuushuuu wants to merge 23 commits into
masterfrom
feat/add-mail-model
Draft

feat: Add mail template#2277
Muuushuuu wants to merge 23 commits into
masterfrom
feat/add-mail-model

Conversation

@Muuushuuu

@Muuushuuu Muuushuuu commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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

Copilot AI balanced review requested due to automatic review settings August 12, 2026 13:16
@Muuushuuu
Muuushuuu marked this pull request as draft August 12, 2026 13:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Comment thread MailCore/Models/MailTemplate.swift Outdated
Comment thread Mail/Views/Template/MailTemplateFloatingPanel.swift Outdated
Comment thread Mail/Views/Template/MailTemplateFloatingPanel.swift Outdated
Comment thread Mail/Views/Template/MailTemplateFloatingPanel.swift Outdated
availableOptions.append(.ai)
}

availableOptions.append(.mailTemplate)
Comment thread Mail/Views/Template/MailTemplateFloatingPanel.swift Outdated
Comment thread Mail/Views/Template/MailTemplateFloatingPanel.swift
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
Comment thread Mail/Views/Template/MailTemplateFloatingPanel.swift Outdated
@Muuushuuu
Muuushuuu force-pushed the feat/add-mail-model branch 5 times, most recently from ad8f6b2 to 270b702 Compare August 18, 2026 08:41
@Muuushuuu
Muuushuuu force-pushed the feat/add-mail-model branch from a196f93 to 8394073 Compare August 19, 2026 11:58
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants