Skip to content

Commit

Permalink
v0.2.0 Portable mode and data sync option
Browse files Browse the repository at this point in the history
  • Loading branch information
h-akatsuki committed Aug 25, 2024
1 parent bda2e53 commit 9b7a9c1
Show file tree
Hide file tree
Showing 19 changed files with 1,779 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Hitomi Search Plus is a lightweight and fast Flutter application that provides a
- Per-query bookmarking with automatic updates
- Modern UI design with Material Design
- Standard features including gallery view and favorites
- `New!` Data synchronization between devices

### Installation

Expand Down
17 changes: 17 additions & 0 deletions lib/component/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hitomi_search_plus/page/history.dart';
import 'package:hitomi_search_plus/page/search.dart';
import 'package:hitomi_search_plus/page/settings.dart';
import 'package:hitomi_search_plus/page/sync.dart';
import 'package:hitomi_search_plus/tools/suger.dart';
import 'package:hitomi_search_plus/tools/url.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
Expand Down Expand Up @@ -209,6 +210,14 @@ class CustomDrawerPC extends HookConsumerWidget {
colorScheme: colorScheme,
textTheme: textTheme,
),
_buildExcludedListTile(
context: context,
icon: Icons.sync_alt,
title: 'Sync',
onTap: () => context.push(const DataSyncScreen()),
colorScheme: colorScheme,
textTheme: textTheme,
),
const Divider(),
...links.map((link) => _buildExcludedListTile(
context: context,
Expand Down Expand Up @@ -322,6 +331,14 @@ class CustomDrawer extends HookConsumerWidget {
context.push(const HistoryScreenPage());
},
),
ListTile(
leading: Icon(Icons.sync_alt, color: colorScheme.primary),
title: Text('Sync', style: textTheme.titleMedium),
onTap: () {
Navigator.pop(context);
context.push(const DataSyncScreen());
},
),
const Divider(),
...links.map((link) => ListTile(
leading: Icon(link.icon, color: colorScheme.secondary),
Expand Down
2 changes: 2 additions & 0 deletions lib/db/bookmark.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:hitomi_search_plus/db/default_query.dart';
import 'package:hitomi_search_plus/db/export.dart';
import 'package:hitomi_search_plus/db/kv.dart';
import 'package:hitomi_search_plus/main.dart';
import 'package:hitomi_search_plus/server/query.dart';
Expand Down Expand Up @@ -272,6 +273,7 @@ class Bookmark extends _$Bookmark {

@override
List<BookmarkItem> build() {
ref.watch(dataSyncProvider);
Future(() async {
await load();
await update();
Expand Down
2 changes: 1 addition & 1 deletion lib/db/bookmark.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions lib/db/default_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ class DefaultQueryData extends _$DefaultQueryData {
}
return buffer.toString();
}

Future<void> set(DefaultQueryList data) {
state = data;
return _saveToStorage();
}
}

@riverpod
Expand Down
2 changes: 1 addition & 1 deletion lib/db/default_query.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9b7a9c1

Please sign in to comment.