Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a2a6c7b49 | ||
|
|
f1f7de7b4d | ||
|
|
de2b9d22b4 | ||
|
|
0297701829 | ||
|
|
ee238b85c7 | ||
|
|
f0eff7dc7c | ||
|
|
8ea5237991 |
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "SharedInbox Dev",
|
||||
"build": {
|
||||
"dockerfile": "../Dockerfile.dev",
|
||||
"context": ".."
|
||||
},
|
||||
"workspaceFolder": "/src",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/src,type=bind,consistency=cached",
|
||||
"remoteUser": "ci"
|
||||
}
|
||||
@@ -135,7 +135,7 @@ jobs:
|
||||
repo_labels = api_get("/labels")
|
||||
label_map = {l["name"]: l["id"] for l in repo_labels}
|
||||
|
||||
label_ids = [label_map["Ready"]] if "Ready" in label_map else []
|
||||
label_ids = [label_map["loop/code"]] if "loop/code" in label_map else []
|
||||
|
||||
title = "Firebase Tests failed — find root cause and fix"
|
||||
body = (
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
name: Publish Dev Container
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'Dockerfile.dev'
|
||||
- '.devcontainer/devcontainer.json'
|
||||
- '.forgejo/workflows/publish-dev-container.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Build & Push sharedinbox-dev
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
REGISTRY: codeberg.org
|
||||
IMAGE: codeberg.org/guettli/sharedinbox-dev
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Codeberg container registry
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
echo "$FORGEJO_TOKEN" \
|
||||
| docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA:0:7}"
|
||||
docker build \
|
||||
-t "$IMAGE:latest" \
|
||||
-t "$IMAGE:$SHORT_SHA" \
|
||||
-f Dockerfile.dev \
|
||||
.
|
||||
|
||||
- name: Push image
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA:0:7}"
|
||||
docker push "$IMAGE:latest"
|
||||
docker push "$IMAGE:$SHORT_SHA"
|
||||
@@ -0,0 +1 @@
|
||||
Agentloop is working on sialoop!
|
||||
+8
-1
@@ -814,7 +814,14 @@ func (m *Ci) DeployApk(
|
||||
// Returns a flat directory with app-debug.apk and app-debug-androidTest.apk.
|
||||
func (m *Ci) BuildAndroidDebugApks() *dagger.Directory {
|
||||
built := m.firebaseBase().
|
||||
WithExec([]string{"flutter", "build", "apk", "--debug", "--no-pub"}).
|
||||
// `flutter build apk` spawns a Gradle daemon. When this WithExec ends the
|
||||
// container is torn down and the daemon is killed, but its journal-cache
|
||||
// lock file on the persistent gradle-cache volume keeps its dead PID — the
|
||||
// next gradlew invocation then times out waiting for that lock. `gradlew
|
||||
// --stop` shuts the daemon down gracefully so the lock is released before
|
||||
// Dagger snapshots the layer.
|
||||
WithExec([]string{"/bin/bash", "-c",
|
||||
`flutter build apk --debug --no-pub && (cd android && ./gradlew --stop)`}).
|
||||
WithWorkdir("/src/android").
|
||||
// --no-daemon avoids connecting to a stale daemon whose registry file was
|
||||
// preserved in the Dagger layer snapshot but whose process no longer exists.
|
||||
|
||||
@@ -239,6 +239,10 @@ class _EmailDetailScreenState extends ConsumerState<EmailDetailScreen> {
|
||||
ScaffoldMessenger.of(ctx).showSnackBar(
|
||||
SnackBar(
|
||||
duration: const Duration(seconds: 3),
|
||||
// SnackBar defaults to persist=true when an action
|
||||
// is set, which disables the auto-dismiss timer.
|
||||
// Explicitly opt back into duration-based dismiss.
|
||||
persist: false,
|
||||
content: const Text(
|
||||
'Images will be loaded automatically for this sender.',
|
||||
),
|
||||
|
||||
@@ -214,6 +214,10 @@ class _EmailMessageCardState extends ConsumerState<_EmailMessageCard> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
duration: const Duration(seconds: 3),
|
||||
// SnackBar defaults to persist=true when an
|
||||
// action is set, which disables auto-dismiss.
|
||||
// Explicitly opt into duration-based dismiss.
|
||||
persist: false,
|
||||
content: const Text(
|
||||
'Images will be loaded automatically for this sender.',
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:sharedinbox/core/models/email.dart';
|
||||
import 'package:sharedinbox/core/models/undo_action.dart';
|
||||
@@ -93,7 +94,9 @@ class UndoLogDetailScreen extends ConsumerWidget {
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
...action.originalEmails.map((email) => _EmailTile(email: email)),
|
||||
...action.originalEmails.map(
|
||||
(email) => _EmailTile(email: email, accountId: action.accountId),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -120,13 +123,14 @@ class _SectionHeader extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _EmailTile extends StatelessWidget {
|
||||
const _EmailTile({required this.email});
|
||||
class _EmailTile extends ConsumerWidget {
|
||||
const _EmailTile({required this.email, required this.accountId});
|
||||
|
||||
final Email email;
|
||||
final String accountId;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final sender = email.from.isNotEmpty
|
||||
? (email.from.first.name ?? email.from.first.email)
|
||||
: '(Unknown Sender)';
|
||||
@@ -134,6 +138,43 @@ class _EmailTile extends StatelessWidget {
|
||||
leading: const Icon(Icons.email_outlined),
|
||||
title: Text(email.subject ?? '(No Subject)'),
|
||||
subtitle: Text(sender, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => _openEmail(context, ref),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _openEmail(BuildContext context, WidgetRef ref) async {
|
||||
final messageId = email.messageId;
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
if (messageId == null) {
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(
|
||||
duration: Duration(seconds: 5),
|
||||
content: Text('Cannot locate this email — no Message-ID.'),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
final found = await ref
|
||||
.read(emailRepositoryProvider)
|
||||
.findEmailByMessageId(accountId, messageId);
|
||||
if (!context.mounted) return;
|
||||
if (found == null) {
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(
|
||||
duration: Duration(seconds: 5),
|
||||
content: Text(
|
||||
'Email no longer exists at its previous location. '
|
||||
'Use Undo to restore it.',
|
||||
),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
context.go(
|
||||
'/accounts/$accountId'
|
||||
'/mailboxes/${Uri.encodeComponent(found.mailboxPath)}'
|
||||
'/emails/${Uri.encodeComponent(found.id)}',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -582,6 +582,54 @@ void main() {
|
||||
|
||||
expect(find.textContaining('Structure not available'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'Load remote images snack bar auto-dismisses after 3 seconds',
|
||||
(tester) async {
|
||||
const body = EmailBody(
|
||||
emailId: 'acc-1:42',
|
||||
htmlBody: '<p>Hello <img src="https://example.com/x.png"/></p>',
|
||||
attachments: [],
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
buildApp(
|
||||
initialLocation:
|
||||
'/accounts/acc-1/mailboxes/INBOX/emails/acc-1%3A42',
|
||||
overrides: _overrides(body: body),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// The "Load remote images" button is visible because the sender is
|
||||
// not yet trusted.
|
||||
expect(find.text('Load remote images'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Load remote images'));
|
||||
// Settle the snack bar enter animation and the setState rebuild
|
||||
// that swaps in the image-loading WebView.
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
|
||||
// Snack bar must be visible.
|
||||
expect(
|
||||
find.text('Images will be loaded automatically for this sender.'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// After 3 seconds (the snack bar's duration) plus the reverse
|
||||
// animation, the snack bar must be gone.
|
||||
// Regression test for #484: SnackBar with an action defaults to
|
||||
// persist=true, which disables auto-dismiss — explicit persist:false
|
||||
// restores duration-based dismissal.
|
||||
await tester.pump(const Duration(seconds: 4));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.text('Images will be loaded automatically for this sender.'),
|
||||
findsNothing,
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -249,5 +249,59 @@ void main() {
|
||||
|
||||
expect(find.text('Body content here'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'Load remote images snack bar auto-dismisses after 3 seconds',
|
||||
(tester) async {
|
||||
final email = _threadEmail();
|
||||
await tester.pumpWidget(
|
||||
buildApp(
|
||||
initialLocation: '/accounts/acc-1/mailboxes/INBOX/threads/thread-1',
|
||||
overrides: [
|
||||
accountRepositoryProvider.overrideWithValue(
|
||||
FakeAccountRepository([kTestAccount]),
|
||||
),
|
||||
mailboxRepositoryProvider.overrideWithValue(
|
||||
FakeMailboxRepository(),
|
||||
),
|
||||
emailRepositoryProvider.overrideWithValue(
|
||||
FakeEmailRepository(
|
||||
emails: [email],
|
||||
emailBody: const EmailBody(
|
||||
emailId: 'acc-1:10',
|
||||
htmlBody:
|
||||
'<p>Hi <img src="https://example.com/x.png"/></p>',
|
||||
attachments: [],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Load remote images'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Load remote images'));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
|
||||
expect(
|
||||
find.text('Images will be loaded automatically for this sender.'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// Regression test for #484: SnackBar with an action defaults to
|
||||
// persist=true, which disables auto-dismiss — explicit persist:false
|
||||
// restores duration-based dismissal.
|
||||
await tester.pump(const Duration(seconds: 4));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.text('Images will be loaded automatically for this sender.'),
|
||||
findsNothing,
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'package:sharedinbox/core/models/email.dart';
|
||||
import 'package:sharedinbox/core/models/undo_action.dart';
|
||||
import 'package:sharedinbox/di.dart';
|
||||
import 'package:sharedinbox/ui/screens/undo_log_detail_screen.dart';
|
||||
|
||||
import 'helpers.dart';
|
||||
|
||||
// FakeEmailRepository subclass that returns a pre-configured email from
|
||||
// findEmailByMessageId, so the tap handler in UndoLogDetailScreen can be
|
||||
// exercised without a real database.
|
||||
class _LookupEmailRepository extends FakeEmailRepository {
|
||||
_LookupEmailRepository(this._lookup);
|
||||
|
||||
final Email? _lookup;
|
||||
|
||||
@override
|
||||
Future<Email?> findEmailByMessageId(
|
||||
String accountId,
|
||||
String messageId,
|
||||
) async =>
|
||||
_lookup;
|
||||
}
|
||||
|
||||
UndoAction _action({
|
||||
required List<Email> originalEmails,
|
||||
String accountId = 'acc-1',
|
||||
}) =>
|
||||
UndoAction(
|
||||
id: 'undo-1',
|
||||
accountId: accountId,
|
||||
type: UndoType.move,
|
||||
emailIds: originalEmails.map((e) => e.id).toList(),
|
||||
sourceMailboxPath: 'INBOX',
|
||||
destinationMailboxPath: 'Archive',
|
||||
originalEmails: originalEmails,
|
||||
timestamp: DateTime(2024, 6),
|
||||
);
|
||||
|
||||
Email _emailWith({
|
||||
String id = 'acc-1:42',
|
||||
String mailboxPath = 'INBOX',
|
||||
String? messageId = '<msg-1@example.com>',
|
||||
}) =>
|
||||
Email(
|
||||
id: id,
|
||||
accountId: 'acc-1',
|
||||
mailboxPath: mailboxPath,
|
||||
uid: 42,
|
||||
subject: 'Hello world',
|
||||
receivedAt: DateTime(2024, 6),
|
||||
sentAt: DateTime(2024, 6),
|
||||
from: const [EmailAddress(name: 'Bob', email: 'bob@example.com')],
|
||||
to: const [EmailAddress(email: 'alice@example.com')],
|
||||
cc: const [],
|
||||
isSeen: false,
|
||||
isFlagged: false,
|
||||
hasAttachment: false,
|
||||
messageId: messageId,
|
||||
);
|
||||
|
||||
// Builds a minimal app whose initial location is the undo log detail screen
|
||||
// for [action]. A placeholder email-detail route records its visit so the
|
||||
// test can assert which path the tap navigated to.
|
||||
Widget _buildApp({
|
||||
required UndoAction action,
|
||||
required FakeEmailRepository emailRepo,
|
||||
ValueNotifier<String?>? lastEmailRoute,
|
||||
}) {
|
||||
final router = GoRouter(
|
||||
initialLocation: '/undo-detail',
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/undo-detail',
|
||||
builder: (ctx, state) => UndoLogDetailScreen(action: action),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/accounts/:accountId/mailboxes/:mailboxPath/emails/:emailId',
|
||||
builder: (ctx, state) {
|
||||
lastEmailRoute?.value = state.uri.toString();
|
||||
return const Scaffold(body: Text('email-detail-route'));
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
return ProviderScope(
|
||||
overrides: [
|
||||
emailRepositoryProvider.overrideWithValue(emailRepo),
|
||||
],
|
||||
child: MaterialApp.router(routerConfig: router),
|
||||
);
|
||||
}
|
||||
|
||||
void main() {
|
||||
group('UndoLogDetailScreen email row tap', () {
|
||||
testWidgets('navigates to the current location returned by lookup', (
|
||||
tester,
|
||||
) async {
|
||||
// Original row recorded INBOX/42; after the move it now lives in
|
||||
// Archive with a fresh UID — the lookup is what bridges that gap.
|
||||
final original = _emailWith();
|
||||
final current = _emailWith(id: 'acc-1:77', mailboxPath: 'Archive');
|
||||
final lastRoute = ValueNotifier<String?>(null);
|
||||
|
||||
await tester.pumpWidget(
|
||||
_buildApp(
|
||||
action: _action(originalEmails: [original]),
|
||||
emailRepo: _LookupEmailRepository(current),
|
||||
lastEmailRoute: lastRoute,
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.text('Hello world'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('email-detail-route'), findsOneWidget);
|
||||
expect(
|
||||
lastRoute.value,
|
||||
'/accounts/acc-1/mailboxes/Archive/emails/acc-1%3A77',
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('shows snackbar when lookup returns null', (tester) async {
|
||||
final original = _emailWith();
|
||||
final lastRoute = ValueNotifier<String?>(null);
|
||||
|
||||
await tester.pumpWidget(
|
||||
_buildApp(
|
||||
action: _action(originalEmails: [original]),
|
||||
emailRepo: _LookupEmailRepository(null),
|
||||
lastEmailRoute: lastRoute,
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.text('Hello world'));
|
||||
await tester.pump();
|
||||
|
||||
expect(
|
||||
find.textContaining('Email no longer exists'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(lastRoute.value, isNull);
|
||||
expect(find.text('email-detail-route'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('shows snackbar when email has no Message-ID', (tester) async {
|
||||
final original = _emailWith(messageId: null);
|
||||
final lastRoute = ValueNotifier<String?>(null);
|
||||
|
||||
await tester.pumpWidget(
|
||||
_buildApp(
|
||||
action: _action(originalEmails: [original]),
|
||||
// Lookup would succeed if called, but with no Message-ID the
|
||||
// tap handler must short-circuit before reaching it.
|
||||
emailRepo: _LookupEmailRepository(_emailWith()),
|
||||
lastEmailRoute: lastRoute,
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.text('Hello world'));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.textContaining('no Message-ID'), findsOneWidget);
|
||||
expect(lastRoute.value, isNull);
|
||||
expect(find.text('email-detail-route'), findsNothing);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user