feat: check every subscription in the background and add the posts page

This commit is contained in:
randogoth 2026-10-11 13:20:00 +03:00
parent 953ae798eb
commit 1b426ccd8b
15 changed files with 688 additions and 58 deletions

View file

@ -1,3 +1,5 @@
import 'dart:async' show unawaited;
import 'package:actors/actors.dart';
import 'package:flutter/material.dart';
import 'package:signals/signals_flutter.dart' show SignalBuilder;
@ -27,16 +29,23 @@ class AppDependencies {
strings = strings ?? Strings() {
settings = ReaderSettingsController(db);
bookmarks = BookmarksController(db);
subscriptions = SubscriptionsController(db);
internalPages =
InternalPages(db: db, settings: settings, strings: this.strings);
internalActions = InternalActions(settings: settings);
subscriptions = SubscriptionsController(db: db, fetch: this.fetch);
internalPages = InternalPages(
db: db,
settings: settings,
subscriptions: subscriptions,
strings: this.strings);
internalActions =
InternalActions(settings: settings, subscriptions: subscriptions);
browser = BrowserController(
db: db,
fetch: this.fetch,
internalPages: internalPages,
internalActions: internalActions,
);
// A check running in the background redraws whichever of our pages is
// open, so a new post shows up without the reader navigating.
subscriptions.onChanged = browser.refreshInternalPage;
}
/// Localized strings, also used to title the internal pages.
@ -56,6 +65,9 @@ class AppDependencies {
await bookmarks.load();
await subscriptions.load();
await browser.restoreLastSession();
// Subscriptions are checked in the background: the reader never waits on
// the network to see their last page.
unawaited(subscriptions.refreshAll());
}
}