Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
Simplify HideSkipPromptAt code
Browse files Browse the repository at this point in the history
  • Loading branch information
ConfusedPolarBear committed Jun 9, 2023
1 parent b2f3168 commit 686c978
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,11 @@ public ActionResult<Dictionary<AnalysisMode, Intro>> 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)
Expand Down

0 comments on commit 686c978

Please sign in to comment.