Gate push toggle on backend notification method

Add a GET /api/config endpoint exposing the front-end-facing backend
configuration (currently the notification delivery method, grouped under
a nested "notifications" object so the shape can grow). The settings
screen fetches it on init and only shows the per-device push toggle when
the backend method is "push" (and the platform supports push, which keeps
it off the browser).

Also fold in related push-notifications cleanups: fix the Android app
label ("frontend" -> "OOTT") so the notification permission dialog reads
correctly, remove the completed push_notifications.md plan, and update
TODO.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-06-08 17:26:53 -04:00
co-authored by Claude Opus 4.8
parent bef1a2987d
commit 1d85ec6f83
14 changed files with 209 additions and 299 deletions
+13 -1
View File
@@ -9,17 +9,27 @@ import '../helpers/pump_app.dart';
void main() {
setUp(() async {
await setUpBackendForTest(
final adapter = await setUpBackendForTest(
prefs: {
'base_url': 'http://my.server/api',
'api_key': XOR().xorEncode('topsecret'),
'theme': 'catppuccin_mocha',
},
);
// Settings loads the backend config on init; these tests don't exercise the
// push toggle, so report a non-push method to keep it hidden.
adapter.onGet(
'/config',
(server) => server.reply(200, {
'notifications': {'method': 'none'},
}),
);
});
testWidgets('prefills the form from stored preferences', (tester) async {
await pumpScreen(tester, const Settings());
// Let the on-init config request resolve so its timer doesn't leak.
await tester.pump(const Duration(milliseconds: 10));
expect(find.text('http://my.server/api'), findsOneWidget);
expect(find.text('Catppuccin Mocha'), findsOneWidget);
@@ -78,6 +88,7 @@ void main() {
) async {
await PrefUtil.setValue('base_url', '');
await pumpScreen(tester, const Settings());
await tester.pump(const Duration(milliseconds: 10));
expect(find.textContaining('Welcome to OOTT'), findsOneWidget);
});
@@ -87,6 +98,7 @@ void main() {
) async {
await PrefUtil.setValue('base_url', 'http://my.server/api');
await pumpScreen(tester, const Settings());
await tester.pump(const Duration(milliseconds: 10));
expect(find.textContaining('Welcome to OOTT'), findsNothing);
});