mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-16 15:16:15 +08:00
skip segments with keyboard
Closes #1379 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user