Added error when segments haven't loaded and improved popup message

Resolves #1553
This commit is contained in:
Ajay
2022-10-27 21:46:47 -04:00
parent fea8a9a37e
commit 715bcb6bd3
3 changed files with 21 additions and 1 deletions

View File

@@ -116,6 +116,9 @@
"connectionError": {
"message": "A connection error has occurred. Error code: "
},
"segmentsStillLoading": {
"message": "Segments still loading..."
},
"clearTimes": {
"message": "Clear Segments"
},
@@ -1243,5 +1246,8 @@
},
"exportSegmentsAsURL": {
"message": "Share as URL"
},
"segmentFetchFailureWarning": {
"message": "Warning: The server hasn't responded with segments yet. There might actually be segments on this video already submitted but you just haven't recieved them due to issues with the server."
}
}

View File

@@ -56,6 +56,7 @@ let sponsorVideoID: VideoID = null;
const skipNotices: SkipNotice[] = [];
let activeSkipKeybindElement: ToggleSkippable = null;
let retryFetchTimeout: NodeJS.Timeout = null;
let shownSegmentFailedToFetchWarning = false;
// JSON video info
let videoInfo: VideoInfo = null;
@@ -344,6 +345,8 @@ function resetValues() {
sponsorTimes = [];
existingChaptersImported = false;
sponsorSkipped = [];
lastResponseStatus = 0;
shownSegmentFailedToFetchWarning = false;
sponsorVideoID = null;
videoInfo = null;
@@ -1922,6 +1925,12 @@ function startOrEndTimingNewSegment() {
updateSponsorTimesSubmitting(false);
importExistingChapters(false);
if (lastResponseStatus !== 200 && !shownSegmentFailedToFetchWarning) {
alert(chrome.i18n.getMessage("segmentFetchFailureWarning"));
shownSegmentFailedToFetchWarning = true;
}
}
function getIncompleteSegment(): SponsorTime {

View File

@@ -456,7 +456,12 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("sponsor404");
PageElements.issueReporterImportExport.classList.remove("hidden");
} else {
if (request.status) {
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("connectionError") + request.status;
} else {
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("segmentsStillLoading");
}
PageElements.issueReporterImportExport.classList.remove("hidden");
}
}