From 6a07a9f6938e7f63acb680cae6d13247013f969f Mon Sep 17 00:00:00 2001 From: Ajay Date: Fri, 21 Jan 2022 18:38:04 -0500 Subject: [PATCH] Use new Poi action type fetch method --- config.json.example | 2 +- src/components/SkipNoticeComponent.tsx | 10 ++-- src/components/SponsorTimeEditComponent.tsx | 29 ++++++----- src/content.ts | 24 ++++----- src/popup.ts | 5 +- src/types.ts | 8 +-- src/utils/categoryUtils.ts | 54 +++++++++------------ 7 files changed, 58 insertions(+), 74 deletions(-) diff --git a/config.json.example b/config.json.example index fd6afe22..1912aaee 100644 --- a/config.json.example +++ b/config.json.example @@ -13,7 +13,7 @@ "preview": ["skip", "mute"], "filler": ["skip", "mute"], "music_offtopic": ["skip"], - "poi_highlight": ["skip"] + "poi_highlight": ["poi"] }, "wikiLinks": { "sponsor": "https://wiki.sponsor.ajay.app/w/Sponsor", diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx index 49dac9ab..588405fe 100644 --- a/src/components/SkipNoticeComponent.tsx +++ b/src/components/SkipNoticeComponent.tsx @@ -1,13 +1,13 @@ import * as React from "react"; import * as CompileConfig from "../../config.json"; import Config from "../config" -import { Category, ContentContainer, CategoryActionType, SponsorHideType, SponsorTime, NoticeVisbilityMode, ActionType, SponsorSourceType, SegmentUUID } from "../types"; +import { Category, ContentContainer, SponsorHideType, SponsorTime, NoticeVisbilityMode, ActionType, SponsorSourceType, SegmentUUID } from "../types"; import NoticeComponent from "./NoticeComponent"; import NoticeTextSelectionComponent from "./NoticeTextSectionComponent"; import Utils from "../utils"; const utils = new Utils(); -import { getCategoryActionType, getSkippingText } from "../utils/categoryUtils"; +import { getSkippingText } from "../utils/categoryUtils"; import ThumbsUpSvg from "../svg-icons/thumbs_up_svg"; import ThumbsDownSvg from "../svg-icons/thumbs_down_svg"; @@ -326,7 +326,7 @@ class SkipNoticeComponent extends React.Component 1 - || getCategoryActionType(this.segments[0].category) !== CategoryActionType.POI + || this.segments[0].actionType !== ActionType.Poi || this.props.unskipTime)) { const style: React.CSSProperties = { @@ -547,7 +547,7 @@ class SkipNoticeComponent extends React.Component getCategoryActionType(cat as Category) === CategoryActionType.Skippable))) as Category[]; + const categories = (CompileConfig.categoryList.filter((cat => CompileConfig.categorySupport[cat].includes(ActionType.Skip)))) as Category[]; for (const category of categories) { elements.push(