fix code review issues: deferral date format, storeFlags SELECT, event loop leaks, GTD selection tracking
- fix deferral resurfacing using VTODOParser.formatDateOnly instead of ISO8601 (date format mismatch) - add SELECT mailbox before UID STORE in storeFlags (IMAP protocol requirement) - pass credentials to SyncCoordinator so IDLE monitoring activates - add selectedItem tracking to MailViewModel, wire List selection in GTD views - fix startPeriodicSync to sleep-first, preventing duplicate sync on launch - add deinit cleanup for EventLoopGroup in IMAPConnection, SMTPConnection - use separate IMAP client for attachment downloads, avoid shared connection interference - remove [weak self] from IMAPIdleClient actor Task to prevent orphaned connections - fix isGTDPerspective to check selectedMailbox instead of items.isEmpty - fix fetchBody to use complete RFC822 fetch instead of BODY[TEXT] - reuse single IMAP connection per ActionQueue.flush() batch - add requiresIMAP to ActionPayload for connection batching - load task categories from label store instead of hardcoded empty array - suppress NIOSSLHandler Sendable warnings via Package.swift unsafeFlags - fix unused variable warnings across codebase Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import Foundation
|
||||
import NIO
|
||||
import NIOIMAPCore
|
||||
@preconcurrency import NIOIMAP
|
||||
@preconcurrency import NIOSSL
|
||||
import NIOIMAP
|
||||
import NIOSSL
|
||||
import Models
|
||||
|
||||
public actor IMAPIdleClient {
|
||||
@@ -29,10 +29,9 @@ public actor IMAPIdleClient {
|
||||
try await connectAndLogin()
|
||||
try await selectInbox()
|
||||
|
||||
monitorTask = Task { [weak self] in
|
||||
monitorTask = Task {
|
||||
var backoffSeconds: UInt64 = 5
|
||||
while !Task.isCancelled {
|
||||
guard let self else { break }
|
||||
do {
|
||||
try await self.idleLoop(onNewMail: onNewMail)
|
||||
} catch {
|
||||
@@ -79,11 +78,11 @@ public actor IMAPIdleClient {
|
||||
|
||||
let responseHandler = IMAPResponseHandler()
|
||||
|
||||
nonisolated(unsafe) let sslHandler = try NIOSSLClientHandler(context: sslContext, serverHostname: hostname)
|
||||
let bootstrap = ClientBootstrap(group: eventLoopGroup)
|
||||
.channelOption(ChannelOptions.socketOption(.so_reuseaddr), value: 1)
|
||||
.channelInitializer { channel in
|
||||
let sslHandler = try! NIOSSLClientHandler(context: sslContext, serverHostname: hostname)
|
||||
return channel.pipeline.addHandlers([
|
||||
channel.pipeline.addHandlers([
|
||||
sslHandler,
|
||||
IMAPClientHandler(),
|
||||
responseHandler,
|
||||
|
||||
Reference in New Issue
Block a user