forked from Foxyz/sync_replay_project
Restructure step 3: your server, Invite, version gate, AppGraph
- One server per app run (loopback, no password); Invite attaches an all-interfaces listener to the same server and Stop sharing detaches it (guests told with 4016); members, media and Up next never reset. No solo mode: you're home on your own server unless in a friend's. - Navigation: none / yours / friend; a join passes a version gate on /health first (clear "they/you need to update", update offer). - Invite as a value (host, port, name, password flag, version, fp reserved); addresses filtered (loopback, link-local, 198.18/15, bridges) and ranked; Sharing chip, Copy invite, Stop sharing. - Alone looks like a plain player (alone replaces solo). - AppGraph builds and disposes systems; widgets use AppScope; SessionState deleted; a test caps the remaining singletons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
629be0d9ed
commit
4d00b7455e
86 files changed
+2993
-2071
No files matched your search
@@ -1,5 +1,3 @@
|
||||
// restructure: rewrite in step 3 (Your server): "solo: the button says
|
||||
// Play"; the rest stays.
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
@@ -16,6 +14,11 @@ import 'package:starsync/src/screens/home/picked_media.dart';
|
||||
|
||||
import 'schedule_fake_server.dart';
|
||||
|
||||
import 'test_graph.dart';
|
||||
|
||||
/// This file's composition root (see test_graph.dart).
|
||||
final _graph = testGraph();
|
||||
|
||||
/// Serves [snap] without any network; [animeFlow] is a real client (over
|
||||
/// the fake server) for the page's actions.
|
||||
class FakeRepo extends ScheduleRepository {
|
||||
@@ -234,7 +237,7 @@ void main() {
|
||||
WidgetTester tester, {
|
||||
Size size = const Size(2560, 1080),
|
||||
ScheduleSnapshot Function()? snap,
|
||||
bool solo = false,
|
||||
bool alone = false,
|
||||
JellyfinAccounts? accounts,
|
||||
}) async {
|
||||
toasts.clear();
|
||||
@@ -243,12 +246,12 @@ void main() {
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final repo = FakeRepo(snap ?? snapshot, animeFlow: flow);
|
||||
await tester.pumpWidget(
|
||||
await tester.pumpWidget(scoped(_graph,
|
||||
MaterialApp(
|
||||
theme: ThemeData.dark(),
|
||||
home: Scaffold(
|
||||
body: SchedulePage(
|
||||
solo: solo,
|
||||
alone: alone,
|
||||
repository: repo,
|
||||
accounts: accounts,
|
||||
onToast: toasts.add,
|
||||
@@ -258,8 +261,7 @@ void main() {
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
)));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
await io(tester, rounds: 4);
|
||||
@@ -269,7 +271,7 @@ void main() {
|
||||
/// Unmounts the page and lets the HttpClient's idle keep-alive timers
|
||||
/// (made in the fake clock) run out.
|
||||
Future<void> done(WidgetTester tester) async {
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
await tester.pumpWidget(scoped(_graph, const SizedBox()));
|
||||
await tester.pump(const Duration(seconds: 20));
|
||||
}
|
||||
|
||||
@@ -482,8 +484,8 @@ void main() {
|
||||
await done(tester);
|
||||
});
|
||||
|
||||
testWidgets('solo: the button says Play and works', (tester) async {
|
||||
await pumpPage(tester, solo: true);
|
||||
testWidgets('nobody else in the server (D9): the button says Play and works', (tester) async {
|
||||
await pumpPage(tester, alone: true);
|
||||
expect(find.text('Put it up'), findsNothing);
|
||||
final b = widgetOf<ButtonStyleButton>(tester, action(111, 3));
|
||||
expect(b.onPressed, isNotNull);
|
||||
|
||||
Reference in new issue
Block a user