feat: support smol:// QR sharing, deep links and in-dialog scanning

This commit is contained in:
randogoth 2026-09-30 17:14:47 +03:00
parent 7d2a147fec
commit aa74e12ee7
20 changed files with 591 additions and 101 deletions

View file

@ -1,5 +1,6 @@
import "dart:io";
import "package:app_links_platform_interface/app_links_platform_interface.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:flutter_test/flutter_test.dart";
import "package:hive_flutter/hive_flutter.dart";
@ -10,11 +11,22 @@ import "package:smol_mail/smol/store.dart";
late final SmolStore store;
// AppWidget subscribes to app_links on boot; in the test shell there is no
// platform plugin to talk to, so the subscription points at this no-op.
class _NoopAppLinks extends AppLinksPlatform {
@override
Future<Uri?> getInitialLink() async => null;
@override
Stream<Uri> get uriLinkStream => const Stream.empty();
}
void main() {
// Hive's box opening is real file IO, which never completes inside a
// testWidgets fake-async zone — so it happens here, outside one.
setUpAll(() async {
TestWidgetsFlutterBinding.ensureInitialized();
AppLinksPlatform.instance = _NoopAppLinks();
final dir = await Directory.systemTemp.createTemp("smol-widget-test");
Hive.init(dir.path);
store = await SmolStore.open(dbPath: "${dir.path}/widget.db");