- Account model gains `username` field (default empty → falls back to email then local-part) - ConnectionTestService returns the effective username that succeeded; tries email then local-part when blank - JMAP connection probe uses Basic-auth GET to /.well-known/jmap (401/403 = auth failure) - IMAP/SMTP factory passes explicit username parameter - Add/edit account screens show username field and "Try connection" button - EditAccountScreen reuses stored password when no new password is entered - Unit tests for ConnectionTestServiceImpl (IMAP + JMAP paths, fallback logic) - Fix unit test lambda signatures for updated ImapConnectFn/SmtpConnectFn Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
39 lines
883 B
Dart
39 lines
883 B
Dart
enum AccountType { imap, jmap }
|
|
|
|
class Account {
|
|
final String id;
|
|
final String displayName;
|
|
final String email;
|
|
final AccountType type;
|
|
|
|
// Used when type == AccountType.imap
|
|
final String imapHost;
|
|
final int imapPort;
|
|
final bool imapSsl;
|
|
final String smtpHost;
|
|
final int smtpPort;
|
|
final bool smtpSsl;
|
|
|
|
// Used when type == AccountType.jmap
|
|
final String? jmapUrl;
|
|
|
|
/// Login username for IMAP/SMTP/JMAP. Empty means fall back to [email],
|
|
/// then to the local part of [email] (the part before '@').
|
|
final String username;
|
|
|
|
const Account({
|
|
required this.id,
|
|
required this.displayName,
|
|
required this.email,
|
|
this.username = '',
|
|
this.type = AccountType.imap,
|
|
this.imapHost = '',
|
|
this.imapPort = 993,
|
|
this.imapSsl = true,
|
|
this.smtpHost = '',
|
|
this.smtpPort = 587,
|
|
this.smtpSsl = false,
|
|
this.jmapUrl,
|
|
});
|
|
}
|