Skip to content

Commit

Permalink
do not show tips before when already cancel skip
Browse files Browse the repository at this point in the history
  • Loading branch information
NieR4ever committed Aug 6, 2024
1 parent f9fc8ac commit f6b8402
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ private class EpisodeViewModelImpl(
.distinctUntilChanged()
.debounce(1000)
.collectLatest { enabled ->
//未启用 或 第一集时返回
if (!enabled || episodeSelectorState.currentIndex == 0) return@collectLatest

// 设置启用
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class PlayerFloatingTipsState {
}

fun autoSkipOpEd(pos: Long, max: Long?, chapters: List<Chapter>, onSeek: (Long) -> Unit) {

if (max == null) return
// 已经点击过取消跳过 OP 或 ED时本集不再出现提示
if (max == null || !skipOpEd) return

chapters.forEach {
val matched = when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,13 @@ class PlayerFloatingTipsStateTest {
}
assertEquals(0L, time)
}

@Test
fun `do not show tips before op 5s when already cancel skip`() {
val state = PlayerFloatingTipsState()
state.cancelSkipOpEd()
state.autoSkipOpEd(5_000L, _24minute, chapters) {
}
assertEquals(false, state.leftBottomTipsVisible)
}
}

0 comments on commit f6b8402

Please sign in to comment.