Skip to content

Commit

Permalink
Fix unsubmitted segments not saving
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Jan 6, 2024
1 parent a3c43c8 commit 778d823
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion maze-utils
Submodule maze-utils updated 1 files
+1 −1 src/config.ts
2 changes: 1 addition & 1 deletion src/components/SkipNoticeComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
const segmentTimes = Config.local.unsubmittedSegments[sponsorVideoID] || [];
segmentTimes.push(sponsorTimesSubmitting);
Config.local.unsubmittedSegments[sponsorVideoID] = segmentTimes;
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");

this.props.contentContainer().sponsorTimesSubmitting.push(sponsorTimesSubmitting);
this.props.contentContainer().updatePreviewBar();
Expand Down
4 changes: 2 additions & 2 deletions src/components/SponsorTimeEditComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
sponsorTimesSubmitting[this.props.index].description = description;

Config.local.unsubmittedSegments[this.props.contentContainer().sponsorVideoID] = sponsorTimesSubmitting;
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");

this.props.contentContainer().updatePreviewBar();

Expand Down Expand Up @@ -694,7 +694,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
} else {
delete Config.local.unsubmittedSegments[this.props.contentContainer().sponsorVideoID];
}
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");

this.props.contentContainer().updatePreviewBar();

Expand Down
2 changes: 1 addition & 1 deletion src/components/SubmissionNoticeComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
sponsorTimesSubmitting = sponsorTimesSubmitting.sort((a, b) => a.segment[0] - b.segment[0]);

Config.local.unsubmittedSegments[this.props.contentContainer().sponsorVideoID] = sponsorTimesSubmitting;
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");

this.forceUpdate();
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/options/CategorySkipOptionsComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class CategorySkipOptionsComponent extends React.Component<CategorySkipOptionsPr
});
}

Config.forceSyncUpdate("categorySelections");
Config.forceLocalUpdate("categorySelections");
}

getCategorySkipOptions(): JSX.Element[] {
Expand Down
2 changes: 1 addition & 1 deletion src/components/options/UnsubmittedVideoListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class UnsubmittedVideoListItem extends React.Component<UnsubmittedVideosListItem
clearSegments(): void {
if (confirm(chrome.i18n.getMessage("clearThis"))) {
delete Config.local.unsubmittedSegments[this.props.videoID];
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo

if (addedSegments) {
Config.local.unsubmittedSegments[getVideoID()] = sponsorTimesSubmitting;
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");

updateEditButtonsOnPlayer();
updateSponsorTimesSubmitting(false);
Expand Down Expand Up @@ -1926,7 +1926,7 @@ function startOrEndTimingNewSegment() {

// Save the newly created segment
Config.local.unsubmittedSegments[getVideoID()] = sponsorTimesSubmitting;
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");

// Make sure they know if someone has already submitted something it while they were watching
sponsorsLookup();
Expand Down Expand Up @@ -1964,7 +1964,7 @@ function cancelCreatingSegment() {
sponsorTimesSubmitting = [];
delete Config.local.unsubmittedSegments[getVideoID()];
}
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");
}

updateEditButtonsOnPlayer();
Expand Down Expand Up @@ -2113,7 +2113,7 @@ function clearSponsorTimes() {

//clear the sponsor times
delete Config.local.unsubmittedSegments[currentVideoID];
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");

//clear sponsor times submitting
sponsorTimesSubmitting = [];
Expand Down Expand Up @@ -2277,7 +2277,7 @@ async function sendSubmitMessage() {

//update sponsorTimes
Config.local.unsubmittedSegments[getVideoID()] = sponsorTimesSubmitting;
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");

// Check to see if any of the submissions are below the minimum duration set
if (Config.config.minDuration > 0) {
Expand Down Expand Up @@ -2305,7 +2305,7 @@ async function sendSubmitMessage() {

// Remove segments from storage since they've already been submitted
delete Config.local.unsubmittedSegments[getVideoID()];
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");

const newSegments = sponsorTimesSubmitting;
try {
Expand Down Expand Up @@ -2611,7 +2611,7 @@ function checkForPreloadedSegment() {

if (pushed) {
Config.local.unsubmittedSegments[getVideoID()] = sponsorTimesSubmitting;
Config.forceSyncUpdate("unsubmittedSegments");
Config.forceLocalUpdate("unsubmittedSegments");
}
}

Expand Down

0 comments on commit 778d823

Please sign in to comment.