2026-05-09 09:47:42 +02:00
|
|
|
import 'dart:async';
|
2026-05-27 21:20:19 +02:00
|
|
|
import 'dart:convert';
|
2026-05-09 09:47:42 +02:00
|
|
|
|
2026-04-16 07:35:56 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
|
import 'package:go_router/go_router.dart';
|
2026-04-24 16:30:59 +02:00
|
|
|
import 'package:sharedinbox/core/models/account.dart';
|
2026-05-14 23:46:29 +02:00
|
|
|
import 'package:sharedinbox/core/services/update_service.dart';
|
2026-04-24 16:30:59 +02:00
|
|
|
import 'package:sharedinbox/di.dart';
|
2026-05-14 23:46:29 +02:00
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
2026-04-16 07:35:56 +02:00
|
|
|
|
|
|
|
|
class AccountListScreen extends ConsumerWidget {
|
|
|
|
|
const AccountListScreen({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
|
return Scaffold(
|
2026-05-08 01:01:18 +02:00
|
|
|
appBar: AppBar(
|
2026-05-16 01:33:13 +02:00
|
|
|
title: const Text('sharedinbox.de'),
|
2026-05-08 01:01:18 +02:00
|
|
|
actions: [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: const Icon(Icons.search),
|
|
|
|
|
tooltip: 'Search all accounts',
|
|
|
|
|
onPressed: () => context.push('/search'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2026-05-10 11:23:39 +02:00
|
|
|
drawer: Drawer(
|
|
|
|
|
child: ListView(
|
|
|
|
|
children: [
|
|
|
|
|
const DrawerHeader(
|
|
|
|
|
decoration: BoxDecoration(color: Colors.blueGrey),
|
|
|
|
|
child: Text(
|
2026-05-16 01:33:13 +02:00
|
|
|
'sharedinbox.de',
|
2026-05-10 11:23:39 +02:00
|
|
|
style: TextStyle(color: Colors.white, fontSize: 24),
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-05-16 01:19:01 +02:00
|
|
|
ListTile(
|
|
|
|
|
leading: const Icon(Icons.qr_code_scanner),
|
|
|
|
|
title: const Text('Receive accounts'),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
unawaited(context.push('/accounts/receive'));
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-05-10 18:43:19 +02:00
|
|
|
ListTile(
|
|
|
|
|
leading: const Icon(Icons.history),
|
|
|
|
|
title: const Text('Undo Log'),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context); // Close drawer
|
|
|
|
|
unawaited(context.push('/accounts/undo-log'));
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-05-10 11:23:39 +02:00
|
|
|
ListTile(
|
|
|
|
|
leading: const Icon(Icons.update),
|
|
|
|
|
title: const Text('ChangeLog'),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context); // Close drawer
|
|
|
|
|
unawaited(context.push('/accounts/changelog'));
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-05-15 23:50:55 +02:00
|
|
|
ListTile(
|
|
|
|
|
leading: const Icon(Icons.info_outline),
|
|
|
|
|
title: const Text('About'),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context); // Close drawer
|
|
|
|
|
unawaited(context.push('/accounts/about'));
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-05-27 22:07:12 +02:00
|
|
|
ListTile(
|
|
|
|
|
leading: const Icon(Icons.settings),
|
|
|
|
|
title: const Text('Preferences'),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context); // Close drawer
|
|
|
|
|
unawaited(context.push('/accounts/preferences'));
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-05-10 11:23:39 +02:00
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-05-14 23:46:29 +02:00
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
const _UpdateBanner(),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: StreamBuilder(
|
|
|
|
|
stream: ref.watch(accountRepositoryProvider).observeAccounts(),
|
|
|
|
|
builder: (ctx, snap) {
|
|
|
|
|
if (!snap.hasData) {
|
|
|
|
|
return const Center(child: CircularProgressIndicator());
|
|
|
|
|
}
|
|
|
|
|
final accounts = snap.data!;
|
|
|
|
|
if (accounts.isEmpty) {
|
|
|
|
|
return const _OnboardingView();
|
|
|
|
|
}
|
|
|
|
|
return ListView.builder(
|
|
|
|
|
itemCount: accounts.length,
|
|
|
|
|
itemBuilder: (ctx, i) => _AccountTile(account: accounts[i]),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
2026-04-16 07:35:56 +02:00
|
|
|
),
|
|
|
|
|
floatingActionButton: FloatingActionButton(
|
|
|
|
|
onPressed: () => context.push('/accounts/add'),
|
|
|
|
|
child: const Icon(Icons.add),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-04-18 15:13:47 +02:00
|
|
|
|
|
|
|
|
class _AccountTile extends ConsumerWidget {
|
|
|
|
|
const _AccountTile({required this.account});
|
|
|
|
|
|
|
|
|
|
final Account account;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
|
final status = ref.watch(accountConnectionStatusProvider(account.id));
|
2026-05-09 09:47:42 +02:00
|
|
|
final health = ref.watch(syncHealthProvider(account.id));
|
2026-04-18 15:13:47 +02:00
|
|
|
final typeLabel = account.type == AccountType.jmap ? 'JMAP' : 'IMAP';
|
|
|
|
|
|
|
|
|
|
return ListTile(
|
|
|
|
|
leading: const Icon(Icons.account_circle),
|
|
|
|
|
title: Text(account.displayName),
|
2026-05-09 09:47:42 +02:00
|
|
|
subtitle: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text('${account.email}\n$typeLabel'),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
health.when(
|
|
|
|
|
data: (h) {
|
|
|
|
|
if (h == null) return const Text('Sync health: Not verified yet');
|
|
|
|
|
final date = h.lastVerifiedAt.toLocal().toString().split('.')[0];
|
|
|
|
|
return Row(
|
|
|
|
|
children: [
|
|
|
|
|
const Text('Sync health: '),
|
|
|
|
|
Icon(
|
|
|
|
|
h.isHealthy ? Icons.verified : Icons.warning_amber,
|
|
|
|
|
size: 14,
|
|
|
|
|
color: h.isHealthy ? Colors.green : Colors.orange,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 4),
|
2026-05-27 21:20:19 +02:00
|
|
|
Flexible(
|
|
|
|
|
child: Text(
|
|
|
|
|
h.isHealthy
|
|
|
|
|
? 'Healthy'
|
|
|
|
|
: _formatDiscrepancies(h.discrepancySummary),
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-05-09 09:47:42 +02:00
|
|
|
Text(' ($date)', style: const TextStyle(fontSize: 10)),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
loading: () => const Text('Sync health: checking...'),
|
|
|
|
|
error: (e, _) => Text('Sync health error: $e'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2026-04-18 15:13:47 +02:00
|
|
|
isThreeLine: true,
|
|
|
|
|
trailing: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
status.when(
|
|
|
|
|
loading: () => const SizedBox(
|
|
|
|
|
width: 20,
|
|
|
|
|
height: 20,
|
|
|
|
|
child: CircularProgressIndicator(strokeWidth: 2),
|
|
|
|
|
),
|
|
|
|
|
data: (_) => const Icon(Icons.check_circle, color: Colors.green),
|
|
|
|
|
error: (e, _) => Tooltip(
|
|
|
|
|
message: e.toString(),
|
|
|
|
|
child: const Icon(Icons.error_outline, color: Colors.red),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
PopupMenuButton<_AccountAction>(
|
|
|
|
|
onSelected: (action) => _onAction(context, action),
|
2026-04-24 08:01:53 +02:00
|
|
|
itemBuilder: (_) => [
|
|
|
|
|
const PopupMenuItem(
|
2026-04-21 16:42:05 +02:00
|
|
|
value: _AccountAction.syncLog,
|
|
|
|
|
child: Text('Sync log'),
|
|
|
|
|
),
|
2026-05-09 09:47:42 +02:00
|
|
|
const PopupMenuItem(
|
|
|
|
|
value: _AccountAction.verifySync,
|
|
|
|
|
child: Text('Verify sync health'),
|
|
|
|
|
),
|
2026-05-15 21:29:43 +02:00
|
|
|
const PopupMenuItem(
|
|
|
|
|
value: _AccountAction.forceSync,
|
|
|
|
|
child: Text('Force full sync'),
|
|
|
|
|
),
|
2026-04-24 08:01:53 +02:00
|
|
|
const PopupMenuItem(
|
2026-04-18 15:13:47 +02:00
|
|
|
value: _AccountAction.edit,
|
|
|
|
|
child: Text('Edit'),
|
|
|
|
|
),
|
2026-04-29 16:14:41 +02:00
|
|
|
if (_sieveSupported(account))
|
|
|
|
|
const PopupMenuItem(
|
2026-05-15 18:32:47 +02:00
|
|
|
value: _AccountAction.emailFiltersRemote,
|
|
|
|
|
child: Text('Server email filters'),
|
2026-04-29 16:14:41 +02:00
|
|
|
),
|
2026-05-15 18:32:47 +02:00
|
|
|
const PopupMenuItem(
|
|
|
|
|
value: _AccountAction.emailFiltersLocal,
|
|
|
|
|
child: Text('Local email filters'),
|
|
|
|
|
),
|
2026-05-15 16:53:36 +02:00
|
|
|
const PopupMenuItem(
|
2026-05-16 01:19:01 +02:00
|
|
|
value: _AccountAction.send,
|
|
|
|
|
child: Text('Send accounts'),
|
2026-05-15 16:53:36 +02:00
|
|
|
),
|
2026-04-24 08:01:53 +02:00
|
|
|
const PopupMenuDivider(),
|
|
|
|
|
const PopupMenuItem(
|
2026-04-18 15:13:47 +02:00
|
|
|
value: _AccountAction.delete,
|
|
|
|
|
child: Text('Delete'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2026-04-21 16:50:15 +02:00
|
|
|
onTap: () => context.push('/accounts/${account.id}/mailboxes'),
|
2026-04-18 15:13:47 +02:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _onAction(BuildContext context, _AccountAction action) async {
|
|
|
|
|
switch (action) {
|
2026-04-21 16:42:05 +02:00
|
|
|
case _AccountAction.syncLog:
|
|
|
|
|
await context.push('/accounts/${account.id}/sync-log');
|
2026-05-09 09:47:42 +02:00
|
|
|
break;
|
|
|
|
|
case _AccountAction.verifySync:
|
|
|
|
|
unawaited(
|
2026-05-12 21:55:06 +02:00
|
|
|
ProviderScope.containerOf(
|
|
|
|
|
context,
|
|
|
|
|
).read(reliabilityRunnerProvider).checkNow(),
|
2026-05-09 09:47:42 +02:00
|
|
|
);
|
|
|
|
|
if (context.mounted) {
|
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
2026-05-14 20:37:06 +02:00
|
|
|
const SnackBar(
|
|
|
|
|
duration: Duration(seconds: 5),
|
|
|
|
|
content: Text('Starting sync verification...'),
|
|
|
|
|
),
|
2026-05-09 09:47:42 +02:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-05-15 21:29:43 +02:00
|
|
|
case _AccountAction.forceSync:
|
|
|
|
|
final confirmed = await showDialog<bool>(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (ctx) => AlertDialog(
|
|
|
|
|
title: const Text('Force full sync?'),
|
|
|
|
|
content: const Text(
|
|
|
|
|
'This clears all locally-cached emails and mailboxes for this '
|
|
|
|
|
'account and immediately re-downloads everything from the server. '
|
|
|
|
|
'Previously viewed email content will not need to be re-downloaded.',
|
|
|
|
|
),
|
|
|
|
|
actions: [
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () => Navigator.of(ctx).pop(false),
|
|
|
|
|
child: const Text('Cancel'),
|
|
|
|
|
),
|
|
|
|
|
FilledButton(
|
|
|
|
|
onPressed: () => Navigator.of(ctx).pop(true),
|
|
|
|
|
child: const Text('Force sync'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
if (confirmed == true && context.mounted) {
|
|
|
|
|
await ProviderScope.containerOf(
|
|
|
|
|
context,
|
|
|
|
|
).read(syncManagerProvider).forceResync(account.id);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2026-04-18 15:13:47 +02:00
|
|
|
case _AccountAction.edit:
|
|
|
|
|
await context.push('/accounts/${account.id}/edit');
|
2026-05-09 09:47:42 +02:00
|
|
|
break;
|
2026-05-15 18:32:47 +02:00
|
|
|
case _AccountAction.emailFiltersRemote:
|
2026-04-24 08:01:53 +02:00
|
|
|
await context.push('/accounts/${account.id}/sieve');
|
2026-05-09 09:47:42 +02:00
|
|
|
break;
|
2026-05-15 18:32:47 +02:00
|
|
|
case _AccountAction.emailFiltersLocal:
|
|
|
|
|
await context.push('/accounts/${account.id}/sieve/local');
|
|
|
|
|
break;
|
2026-05-16 01:19:01 +02:00
|
|
|
case _AccountAction.send:
|
|
|
|
|
await context.push('/accounts/send');
|
2026-05-15 16:53:36 +02:00
|
|
|
break;
|
2026-04-18 15:13:47 +02:00
|
|
|
case _AccountAction.delete:
|
|
|
|
|
final confirmed = await showDialog<bool>(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (ctx) => AlertDialog(
|
|
|
|
|
title: const Text('Delete account'),
|
|
|
|
|
content: Text(
|
2026-04-20 18:08:09 +02:00
|
|
|
'Remove "${account.displayName}" (${account.email})? This cannot be undone.',
|
|
|
|
|
),
|
2026-04-18 15:13:47 +02:00
|
|
|
actions: [
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
|
|
|
child: const Text('Cancel'),
|
|
|
|
|
),
|
|
|
|
|
FilledButton(
|
|
|
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
|
|
|
child: const Text('Delete'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
if ((confirmed ?? false) && context.mounted) {
|
2026-05-12 21:55:06 +02:00
|
|
|
await ProviderScope.containerOf(
|
|
|
|
|
context,
|
|
|
|
|
).read(accountRepositoryProvider).removeAccount(account.id);
|
2026-04-18 15:13:47 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-27 21:20:19 +02:00
|
|
|
String _formatDiscrepancies(String? summary) {
|
|
|
|
|
if (summary == null) return 'Discrepancies found';
|
|
|
|
|
try {
|
|
|
|
|
final decoded = jsonDecode(summary) as Map<String, dynamic>;
|
|
|
|
|
var missingLocally = 0;
|
|
|
|
|
var missingOnServer = 0;
|
|
|
|
|
var flagMismatches = 0;
|
|
|
|
|
for (final v in decoded.values) {
|
|
|
|
|
final m = v as Map<String, dynamic>;
|
|
|
|
|
missingLocally += (m['missingLocally'] as int? ?? 0);
|
|
|
|
|
missingOnServer += (m['missingOnServer'] as int? ?? 0);
|
|
|
|
|
flagMismatches += (m['flagMismatches'] as int? ?? 0);
|
|
|
|
|
}
|
|
|
|
|
final parts = <String>[];
|
|
|
|
|
if (missingLocally > 0) parts.add('missing locally: $missingLocally');
|
|
|
|
|
if (missingOnServer > 0) parts.add('missing on server: $missingOnServer');
|
|
|
|
|
if (flagMismatches > 0) parts.add('flag mismatches: $flagMismatches');
|
|
|
|
|
if (parts.isEmpty) return 'Discrepancies found';
|
|
|
|
|
return 'Discrepancies found (${parts.join(', ')})';
|
|
|
|
|
} catch (_) {
|
|
|
|
|
return 'Discrepancies found';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-14 11:57:08 +02:00
|
|
|
class _OnboardingView extends StatelessWidget {
|
|
|
|
|
const _OnboardingView();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final theme = Theme.of(context);
|
|
|
|
|
return Center(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.all(24),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.mail_outline,
|
|
|
|
|
size: 64,
|
|
|
|
|
color: theme.colorScheme.primary,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
|
Text(
|
2026-05-16 01:33:13 +02:00
|
|
|
'Welcome to sharedinbox.de',
|
2026-05-14 11:57:08 +02:00
|
|
|
style: theme.textTheme.headlineSmall,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
Text(
|
|
|
|
|
'Get started in three steps:',
|
|
|
|
|
style: theme.textTheme.bodyMedium,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 24),
|
|
|
|
|
const _Step(
|
|
|
|
|
number: '1',
|
|
|
|
|
title: 'Add an account',
|
|
|
|
|
description: 'Connect your IMAP or JMAP email account.',
|
|
|
|
|
),
|
|
|
|
|
const _Step(
|
|
|
|
|
number: '2',
|
|
|
|
|
title: 'Wait for sync',
|
|
|
|
|
description:
|
2026-05-16 01:33:13 +02:00
|
|
|
'sharedinbox.de downloads your messages in the background.',
|
2026-05-14 11:57:08 +02:00
|
|
|
),
|
|
|
|
|
const _Step(
|
|
|
|
|
number: '3',
|
|
|
|
|
title: 'Open your inbox',
|
|
|
|
|
description:
|
|
|
|
|
'Tap the account to browse mailboxes and read emails.',
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 32),
|
|
|
|
|
FilledButton.icon(
|
|
|
|
|
onPressed: () => context.push('/accounts/add'),
|
|
|
|
|
icon: const Icon(Icons.add),
|
|
|
|
|
label: const Text('Add account'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _Step extends StatelessWidget {
|
|
|
|
|
const _Step({
|
|
|
|
|
required this.number,
|
|
|
|
|
required this.title,
|
|
|
|
|
required this.description,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
final String number;
|
|
|
|
|
final String title;
|
|
|
|
|
final String description;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final theme = Theme.of(context);
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
CircleAvatar(
|
|
|
|
|
radius: 16,
|
|
|
|
|
backgroundColor: theme.colorScheme.primaryContainer,
|
|
|
|
|
child: Text(
|
|
|
|
|
number,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: theme.colorScheme.onPrimaryContainer,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 16),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(title, style: theme.textTheme.titleSmall),
|
|
|
|
|
Text(description, style: theme.textTheme.bodySmall),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-15 18:32:47 +02:00
|
|
|
enum _AccountAction {
|
|
|
|
|
syncLog,
|
|
|
|
|
verifySync,
|
2026-05-15 21:29:43 +02:00
|
|
|
forceSync,
|
2026-05-15 18:32:47 +02:00
|
|
|
edit,
|
|
|
|
|
emailFiltersRemote,
|
|
|
|
|
emailFiltersLocal,
|
2026-05-16 01:19:01 +02:00
|
|
|
send,
|
2026-05-15 18:32:47 +02:00
|
|
|
delete,
|
|
|
|
|
}
|
2026-04-29 16:14:41 +02:00
|
|
|
|
|
|
|
|
/// Whether to surface the "Email filters" (Sieve) entry for [account].
|
|
|
|
|
///
|
|
|
|
|
/// JMAP accounts always show it (Sieve over JMAP, no separate probe).
|
|
|
|
|
/// IMAP accounts hide it only when a previous ManageSieve probe failed
|
|
|
|
|
/// (manageSieveAvailable == false). Null means "not yet probed" — we
|
|
|
|
|
/// optimistically show it and let the menu disappear once the probe lands.
|
|
|
|
|
bool _sieveSupported(Account account) {
|
|
|
|
|
if (account.type == AccountType.jmap) return true;
|
|
|
|
|
return account.manageSieveAvailable != false;
|
|
|
|
|
}
|
2026-05-14 23:46:29 +02:00
|
|
|
|
|
|
|
|
/// Shown on Linux desktop when a newer build is available on the server.
|
|
|
|
|
class _UpdateBanner extends ConsumerWidget {
|
|
|
|
|
const _UpdateBanner();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
|
final update = ref.watch(updateInfoProvider);
|
|
|
|
|
return update.when(
|
|
|
|
|
data: (info) {
|
|
|
|
|
if (info == null) return const SizedBox.shrink();
|
|
|
|
|
return MaterialBanner(
|
|
|
|
|
content: Text('Update available: ${info.latestVersion}'),
|
|
|
|
|
leading: const Icon(Icons.system_update),
|
|
|
|
|
actions: [
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () =>
|
|
|
|
|
unawaited(launchUrl(Uri.parse(info.downloadUrl))),
|
|
|
|
|
child: const Text('Download'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
loading: () => const SizedBox.shrink(),
|
|
|
|
|
error: (_, __) => const SizedBox.shrink(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|