skip segments with keyboard

Closes #1379

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-09-30 22:15:50 +08:00
parent 15b05cc454
commit 929c51e059
3 changed files with 34 additions and 7 deletions

View File

@@ -843,6 +843,11 @@ class VideoDetailController extends GetxController
});
}
void cancelSkipTimer() {
skipTimer?.cancel();
skipTimer = null;
}
void onRemoveItem(int index, item) {
EasyThrottle.throttle(
'onRemoveItem',
@@ -851,8 +856,7 @@ class VideoDetailController extends GetxController
try {
listData.removeAt(index);
if (listData.isEmpty) {
skipTimer?.cancel();
skipTimer = null;
cancelSkipTimer();
}
listKey.currentState?.removeItem(
index,
@@ -1689,4 +1693,19 @@ class VideoDetailController extends GetxController
);
}
}
bool onSkipSegment() {
try {
if (plPlayerController.enableSponsorBlock) {
if (listData.lastOrNull case SegmentModel item) {
onSkip(item);
onRemoveItem(listData.indexOf(item), item);
return true;
}
}
} catch (_) {
if (kDebugMode) rethrow;
}
return false;
}
}