MOBILE-3932 resource: Fix some non-null assertions warnings

main
Dani Palou 2022-01-24 12:27:12 +01:00
parent 29e2119143
commit 080e370136
3 changed files with 10 additions and 13 deletions

View File

@ -204,7 +204,7 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp
// Chapter loaded, log view.
await CoreUtils.ignoreErrors(AddonModBook.logView(
this.module.instance!,
this.module.instance,
logChapterId ? chapterId : undefined,
this.module.name,
));

View File

@ -1252,7 +1252,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
// Treat warnings, adding the not supported modules.
response.warnings?.forEach((warning) => {
if (warning.warningcode == 'missingcallback') {
result[warning.itemid!] = false;
result[warning.itemid || -1] = false;
}
});
@ -1304,10 +1304,10 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
this.statusCache.invalidate(packageId);
this.statusCache.setValue(packageId, 'status', status);
if (sectionId) {
if (courseId && sectionId) {
const data: CoreEventSectionStatusChangedData = {
sectionId,
courseId: courseId!,
courseId: courseId,
};
CoreEvents.trigger(CoreEvents.SECTION_STATUS_CHANGED, data, CoreSites.getCurrentSiteId());
}

View File

@ -307,7 +307,7 @@ export class CoreMimetypeUtilsProvider {
let position;
if (split.length > 1) {
candidate = split.pop()!.toLowerCase();
candidate = split[split.length - 1].toLowerCase();
// Remove params if any.
position = candidate.indexOf('?');
if (position > -1) {
@ -554,17 +554,14 @@ export class CoreMimetypeUtilsProvider {
}
extension = this.cleanExtension(extension);
const extensionGroups = this.extToMime[extension] && this.extToMime[extension].groups;
let found = false;
if (groups?.length && this.extToMime[extension]?.groups) {
for (let i = 0; i < this.extToMime[extension].groups!.length; i++) {
const group = this.extToMime[extension].groups![i];
if (groups.indexOf(group) != -1) {
return true;
}
}
if (groups.length && extensionGroups) {
found = extensionGroups.some((group => groups.includes(group)));
}
return false;
return found;
}
/**