From 686c978a2f5f57a909dc6e76029a0c225e2e3ec4 Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Fri, 9 Jun 2023 00:54:32 -0500 Subject: [PATCH] Simplify HideSkipPromptAt code --- .../Controllers/SkipIntroController.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs index a595c2f..837f73c 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs @@ -88,15 +88,11 @@ public ActionResult> GetSkippableSegments([FromR var config = Plugin.Instance!.Configuration; segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment); - segment.HideSkipPromptAt = segment.IntroStart + config.HidePromptAdjustment; + segment.HideSkipPromptAt = Math.Min( + segment.IntroStart + config.HidePromptAdjustment, + segment.IntroEnd); segment.IntroEnd -= config.SecondsOfIntroToPlay; - // Don't show prompt after the segment has ended - if (segment.HideSkipPromptAt > segment.IntroEnd) - { - segment.HideSkipPromptAt = segment.IntroEnd; - } - return segment; } catch (KeyNotFoundException)