initial multi user feature

This commit is contained in:
Fabian Freund
2025-11-27 07:51:16 +01:00
parent 6d3c2757c3
commit 00d0599dde
49 changed files with 1341 additions and 258 deletions
@@ -130,8 +130,8 @@ GeckoSelectionActionService selectionActionService(Ref ref) {
GeckoEventService eventService(Ref ref) {
final service = GeckoEventService.setUp();
ref.onDispose(() {
service.dispose();
ref.onDispose(() async {
await service.dispose();
});
return service;
@@ -141,8 +141,8 @@ GeckoEventService eventService(Ref ref) {
GeckoAddonService addonService(Ref ref) {
final service = GeckoAddonService.setUp();
ref.onDispose(() {
service.dispose();
ref.onDispose(() async {
await service.dispose();
});
return service;
@@ -152,8 +152,8 @@ GeckoAddonService addonService(Ref ref) {
GeckoTabContentService tabContentService(Ref ref) {
final service = GeckoTabContentService.setUp();
ref.onDispose(() {
service.dispose();
ref.onDispose(() async {
await service.dispose();
});
return service;
@@ -163,8 +163,8 @@ GeckoTabContentService tabContentService(Ref ref) {
GeckoSuggestionsService engineSuggestionsService(Ref ref) {
final service = GeckoSuggestionsService.setUp();
ref.onDispose(() {
service.dispose();
ref.onDispose(() async {
await service.dispose();
});
return service;
@@ -102,7 +102,7 @@ final class EventServiceProvider
}
}
String _$eventServiceHash() => r'166b01f636fbdd4355dbc55a18ca4f83e0006de8';
String _$eventServiceHash() => r'3a297348fadda05dc60433d7ce8f662b2ff62c26';
@ProviderFor(addonService)
const addonServiceProvider = AddonServiceProvider._();
@@ -149,7 +149,7 @@ final class AddonServiceProvider
}
}
String _$addonServiceHash() => r'c7aca09b99c3810908176f3464f5f90a185aa5e7';
String _$addonServiceHash() => r'30fedb35c68943159246df79b5f1b62a25767fa0';
@ProviderFor(tabContentService)
const tabContentServiceProvider = TabContentServiceProvider._();
@@ -196,7 +196,7 @@ final class TabContentServiceProvider
}
}
String _$tabContentServiceHash() => r'd9a991add907ecc138c62790883e59d8e9aa9266';
String _$tabContentServiceHash() => r'12d8322c37ded4ad3344af327d884bbf7f089594';
@ProviderFor(engineSuggestionsService)
const engineSuggestionsServiceProvider = EngineSuggestionsServiceProvider._();
@@ -244,7 +244,7 @@ final class EngineSuggestionsServiceProvider
}
String _$engineSuggestionsServiceHash() =>
r'f7414b335564578b2c7f6a86baf8bf13f2d5ba2d';
r'1ec1192f0c5c86cecc7ad448ee2b039f7a48e32b';
@ProviderFor(EngineReadyState)
const engineReadyStateProvider = EngineReadyStateProvider._();
@@ -24,7 +24,6 @@ import 'package:flutter_material_design_icons/flutter_material_design_icons.dart
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:weblibre/core/providers/defaults.dart';
import 'package:weblibre/core/routing/routes.dart';
import 'package:weblibre/features/geckoview/domain/controllers/bottom_sheet.dart';
import 'package:weblibre/features/geckoview/domain/entities/states/readerable.dart';
@@ -45,6 +44,7 @@ import 'package:weblibre/features/geckoview/features/readerview/presentation/con
import 'package:weblibre/features/geckoview/features/readerview/presentation/widgets/reader_button.dart';
import 'package:weblibre/features/tor/domain/services/tor_proxy.dart';
import 'package:weblibre/features/user/data/models/general_settings.dart';
import 'package:weblibre/features/user/domain/providers.dart';
import 'package:weblibre/features/user/domain/repositories/general_settings.dart';
import 'package:weblibre/presentation/hooks/menu_controller.dart';
import 'package:weblibre/presentation/icons/tor_icons.dart';
@@ -236,7 +236,7 @@ class BrowserBottomAppBar extends HookConsumerWidget {
.show(ViewTabsSheet());
}
} else {
await TabViewRoute().push(context);
await const TabViewRoute().push(context);
}
},
onLongPress: () {
@@ -272,6 +272,19 @@ class BrowserBottomAppBar extends HookConsumerWidget {
);
},
menuChildren: [
MenuItemButton(
onPressed: () async {
await const SelectProfileRoute().push(context);
},
leadingIcon: const Icon(Icons.person),
child: Consumer(
builder: (context, ref, child) {
final profile = ref.watch(selectedProfileProvider);
return Text(profile.value?.name ?? 'Profile');
},
),
),
const Divider(),
Consumer(
builder: (context, childRef, child) {
final pageExtensions = childRef.watch(
@@ -309,25 +322,25 @@ class BrowserBottomAppBar extends HookConsumerWidget {
leadingIcon: const Icon(Icons.info),
child: const Text('About'),
),
MenuItemButton(
onPressed: () async {
final isPrivate =
ref
.read(generalSettingsWithDefaultsProvider)
.defaultCreateTabType ==
TabType.private;
// MenuItemButton(
// onPressed: () async {
// final isPrivate =
// ref
// .read(generalSettingsWithDefaultsProvider)
// .defaultCreateTabType ==
// TabType.private;
await ref
.read(tabRepositoryProvider.notifier)
.addTab(
url: ref.read(docsUriProvider),
private: isPrivate,
container: const Value(null),
);
},
leadingIcon: const Icon(Icons.help),
child: const Text('Help and feedback'),
),
// await ref
// .read(tabRepositoryProvider.notifier)
// .addTab(
// url: ref.read(docsUriProvider),
// private: isPrivate,
// container: const Value(null),
// );
// },
// leadingIcon: const Icon(Icons.help),
// child: const Text('Help and feedback'),
// ),
const Divider(),
MenuItemButton(
onPressed: () async {
@@ -338,7 +351,7 @@ class BrowserBottomAppBar extends HookConsumerWidget {
),
MenuItemButton(
onPressed: () async {
await HistoryRoute().push(context);
await const HistoryRoute().push(context);
},
leadingIcon: const Icon(Icons.history),
child: const Text('History'),
@@ -403,7 +416,7 @@ class BrowserBottomAppBar extends HookConsumerWidget {
),
MenuItemButton(
onPressed: () async {
await TorProxyRoute().push(context);
await const TorProxyRoute().push(context);
},
leadingIcon: const Icon(TorIcons.onionAlt),
child: Consumer(
@@ -433,7 +446,7 @@ class BrowserBottomAppBar extends HookConsumerWidget {
),
MenuItemButton(
onPressed: () async {
await ContainerListRoute().push(context);
await const ContainerListRoute().push(context);
},
leadingIcon: const Icon(MdiIcons.folder),
child: const Text('Containers'),
@@ -26,8 +26,8 @@ part 'readerable.g.dart';
GeckoReaderableService readerableService(Ref ref) {
final service = GeckoReaderableService.setUp();
ref.onDispose(() {
service.dispose();
ref.onDispose(() async {
await service.dispose();
});
return service;
@@ -54,7 +54,7 @@ final class ReaderableServiceProvider
}
}
String _$readerableServiceHash() => r'03182c8afc41f5184322a3206473cbfa96df5819';
String _$readerableServiceHash() => r'0c432ede496d85ed6a7d028af346b129d97f7502';
@ProviderFor(appearanceButtonVisibility)
const appearanceButtonVisibilityProvider =
@@ -17,14 +17,15 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import 'dart:io';
import 'package:drift/drift.dart';
import 'package:drift/native.dart';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:sqlite3/sqlite3.dart';
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
import 'package:universal_io/io.dart';
import 'package:weblibre/core/filesystem.dart';
import 'package:weblibre/data/database/functions/lexo_rank_functions.dart';
import 'package:weblibre/features/geckoview/features/tabs/data/database/database.dart';
@@ -34,23 +35,13 @@ part 'providers.g.dart';
TabDatabase tabDatabase(Ref ref) {
final db = TabDatabase(
LazyDatabase(() async {
// put the database file, called db.sqlite here, into the documents folder
// for your app.
final dbFolder = await path_provider.getApplicationDocumentsDirectory();
final file = File(p.join(dbFolder.path, 'tab2.db'));
final file = File(p.join(filesystem.profileDatabasesDir.path, 'tab.db'));
// Also work around limitations on old Android versions
if (Platform.isAndroid) {
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
}
// Make sqlite3 pick a more suitable location for temporary files - the
// one from the system may be inaccessible due to sandboxing.
final cachebase = (await path_provider.getTemporaryDirectory()).path;
// We can't access /tmp on Android, which sqlite3 would try by default.
// Explicitly tell it about the correct temporary directory.
sqlite3.tempDirectory = cachebase;
return NativeDatabase.createInBackground(
file,
setup: (database) {
@@ -48,4 +48,4 @@ final class TabDatabaseProvider
}
}
String _$tabDatabaseHash() => r'422bd4789296dc271fabbd5906f2e2ab16bccaa3';
String _$tabDatabaseHash() => r'337dbcf30bd57dcee409aec0aa93f1f6f2783368';