fix: Gast-Zugang-Sperre, veralteter Token, Doppel-Tap, Hinweistext (Branch-Review)
Behebt die Findings aus dem abschließenden Gesamt-Branch-Review für feature/youtube-gast-zugang, alle in einem Rutsch: - KRITISCH: Gast-Modus war eine Einbahnstraße — einmal "Als Gast fortfahren" getippt, war _AnmeldeDialog (einziger Baka-Login-Einstieg, auch für Melo-Cloud-Sync) dauerhaft unerreichbar. Neu: GastZugang.verwerfen() plus "Anmelden"-Knopf neben der Gast-Statuszeile in beiden Screens. - WICHTIG: zugriffOk prüfte den rohen gast.hatToken statt istGastModus — ein alter Gast-Token konnte den Auto-Login-Rückfallweg für Server-User verdecken. istGastModus wird jetzt vor zugriffOk berechnet und dort verwendet. - WICHTIG: CHANGELOG ergänzt — der Server-Endpunkt POST /api/guest-token fehlt noch (separates Vorhaben). - Doppel-Tap-Schutz für den Gast-Button in beiden Screens. - Widersprüchlicher Hinweistext im YT-Suche-Tab (verlangte Baka-Login direkt über dem Gast-Button) korrigiert. - Zwei Gast-Tests in youtube_search_screen_test.dart bekommen jetzt echtes gast:-Wiring in YtSearchService/YtDownloadService. - 2 neue Regressionstests fürs Anmelden-Escape-Hatch. Getestet: volle Suite grün (602 Tests, 1 skipped, 0 failed), flutter analyze ohne Befund. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CcDiyJdVRqh1TtJk5JiabX
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
b32f3198f8
commit
d20f01adee
@@ -92,7 +92,7 @@ void main() {
|
||||
db: db, auth: auth, search: search, download: download));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Baka-Anmeldung'), findsOneWidget);
|
||||
expect(find.textContaining('Baka-Server'), findsOneWidget);
|
||||
expect(find.text('Nach Musikvideos suchen'), findsOneWidget);
|
||||
|
||||
await db.close();
|
||||
@@ -191,11 +191,15 @@ void main() {
|
||||
final auth = BakaAuth(
|
||||
client: MockClient((_) async => http.Response('', 500)),
|
||||
speicher: _MemorySpeicher());
|
||||
final search = YtSearchService(auth: auth);
|
||||
final download = YtDownloadService(auth: auth);
|
||||
final gast = GastZugang(
|
||||
client: MockClient((_) async => http.Response('', 500)),
|
||||
speicher: _MemorySpeicher(),
|
||||
);
|
||||
final search = YtSearchService(auth: auth, gast: gast);
|
||||
final download = YtDownloadService(auth: auth, gast: gast);
|
||||
|
||||
await tester.pumpWidget(_wrap(
|
||||
db: db, auth: auth, search: search, download: download));
|
||||
db: db, auth: auth, search: search, download: download, gast: gast));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
@@ -208,6 +212,34 @@ void main() {
|
||||
'Als Gast fortfahren blendet den Baka-Hinweis aus und zeigt den Zähler',
|
||||
(tester) async {
|
||||
final db = MeloDb(NativeDatabase.memory());
|
||||
final auth = BakaAuth(
|
||||
client: MockClient((_) async => http.Response('', 500)),
|
||||
speicher: _MemorySpeicher());
|
||||
final gast = GastZugang(
|
||||
client: MockClient((_) async =>
|
||||
http.Response(jsonEncode({'guest_token': 'g-1'}), 200)),
|
||||
speicher: _MemorySpeicher(),
|
||||
);
|
||||
final search = YtSearchService(auth: auth, gast: gast);
|
||||
final download = YtDownloadService(auth: auth, gast: gast);
|
||||
|
||||
await tester.pumpWidget(_wrap(
|
||||
db: db, auth: auth, search: search, download: download, gast: gast));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.text('Als Gast fortfahren (5 Downloads/Tag)'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Baka-Anmeldung'), findsNothing);
|
||||
expect(find.text('Als Gast unterwegs (5 Downloads/Tag)'), findsOneWidget);
|
||||
|
||||
await db.close();
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'Anmelden im Gast-Modus verwirft den Gast-Token und zeigt wieder den '
|
||||
'Hinweis', (tester) async {
|
||||
final db = MeloDb(NativeDatabase.memory());
|
||||
final auth = BakaAuth(
|
||||
client: MockClient((_) async => http.Response('', 500)),
|
||||
speicher: _MemorySpeicher());
|
||||
@@ -225,10 +257,14 @@ void main() {
|
||||
|
||||
await tester.tap(find.text('Als Gast fortfahren (5 Downloads/Tag)'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Baka-Anmeldung'), findsNothing);
|
||||
expect(find.text('Als Gast unterwegs (5 Downloads/Tag)'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Anmelden'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.textContaining('Baka-Server'), findsOneWidget);
|
||||
expect(gast.hatToken, isFalse);
|
||||
|
||||
await db.close();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user