feat: check every subscription in the background and add the posts page
This commit is contained in:
parent
953ae798eb
commit
1b426ccd8b
15 changed files with 688 additions and 58 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import '../../database/database.dart';
|
||||
import '../../l10n/strings.dart';
|
||||
import '../../mews/document.dart';
|
||||
import '../controllers/subscriptions_controller.dart';
|
||||
import 'mews_urls.dart';
|
||||
import 'page_blocks.dart';
|
||||
|
||||
|
|
@ -10,11 +11,13 @@ import 'page_blocks.dart';
|
|||
Future<MewsPage> buildHubPage(
|
||||
Uri url, {
|
||||
required MewsDatabase db,
|
||||
required SubscriptionsController subscriptions,
|
||||
required Strings strings,
|
||||
}) async {
|
||||
final bookmarks = await db.countBookmarks();
|
||||
final sites = await db.countSubscriptions();
|
||||
final visits = await db.countHistory();
|
||||
final unread = await db.unreadCount();
|
||||
|
||||
return internalPage(
|
||||
url: url,
|
||||
|
|
@ -22,6 +25,14 @@ Future<MewsPage> buildHubPage(
|
|||
body: [
|
||||
HeadingBlock(1, [MewsText(strings.t('hub-title'))]),
|
||||
itemList([
|
||||
itemRow(
|
||||
href: MewsUrls.posts,
|
||||
label: strings.t('nav-posts'),
|
||||
note: countText(strings, unread,
|
||||
none: 'count-unread-none',
|
||||
one: 'count-unread-one',
|
||||
many: 'count-unread-many'),
|
||||
),
|
||||
itemRow(
|
||||
href: MewsUrls.bookmarks,
|
||||
label: strings.t('nav-bookmarks'),
|
||||
|
|
@ -48,6 +59,14 @@ Future<MewsPage> buildHubPage(
|
|||
),
|
||||
itemRow(href: MewsUrls.settings, label: strings.t('nav-settings')),
|
||||
]),
|
||||
ParagraphBlock([
|
||||
if (subscriptions.refreshing.value)
|
||||
MewsEmphasis(EmphasisStyle.emphasis,
|
||||
[MewsText(strings.t('posts-checking'))])
|
||||
else
|
||||
MewsLink(MewsUrls.action('refresh-subscriptions'),
|
||||
[MewsText(strings.t('action-refresh'))]),
|
||||
]),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue