MOBILE-4543 chore: Remove unnecessary variable type change on hash

main
Pau Ferrer Ocaña 2024-03-22 10:57:17 +01:00
parent c243be806a
commit 0d56f802f2
20 changed files with 22 additions and 22 deletions

View File

@ -138,7 +138,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
subfolder: folder,
};
const hash = <string> Md5.hashAsciiStr(folder.filepath);
const hash = Md5.hashAsciiStr(folder.filepath);
CoreNavigator.navigateToSitePath(
`${AddonModFolderModuleHandlerService.PAGE_NAME}/${this.courseId}/${this.module.id}/${hash}`,

View File

@ -638,7 +638,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
* @returns Promise.
*/
protected async openPageOrSubwiki(options: AddonModWikiOpenPageOptions): Promise<void> {
const hash = <string> Md5.hashAsciiStr(JSON.stringify({
const hash = Md5.hashAsciiStr(JSON.stringify({
...options,
timestamp: Date.now(),
}));

View File

@ -59,7 +59,7 @@ export class AddonModWikiPageOrMapLinkHandlerService extends CoreContentLinksHan
{ siteId, readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
);
const hash = <string> Md5.hashAsciiStr(JSON.stringify({
const hash = Md5.hashAsciiStr(JSON.stringify({
pageId: page.id,
pageTitle: page.title,
subwikiId: page.subwikiid,

View File

@ -267,7 +267,7 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy {
params.filename = '';
}
const hash = <string> Md5.hashAsciiStr(JSON.stringify(params));
const hash = Md5.hashAsciiStr(JSON.stringify(params));
CoreNavigator.navigate(`../${hash}`, { params });
}

View File

@ -1010,7 +1010,7 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected getCacheId(method: string, data: any): string {
return <string> Md5.hashAsciiStr(method + ':' + CoreUtils.sortAndStringify(data));
return Md5.hashAsciiStr(method + ':' + CoreUtils.sortAndStringify(data));
}
/**

View File

@ -214,7 +214,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
*/
async getCourseUpdates(modules: CoreCourseModuleData[], courseId: number): Promise<CourseUpdates> {
// Check if there's already a getCourseUpdates in progress.
const id = <string> Md5.hashAsciiStr(courseId + '#' + JSON.stringify(modules));
const id = Md5.hashAsciiStr(courseId + '#' + JSON.stringify(modules));
const siteId = CoreSites.getCurrentSiteId();
if (this.courseUpdatesPromises[siteId] && this.courseUpdatesPromises[siteId][id] !== undefined) {

View File

@ -140,7 +140,7 @@ export class CoreH5PCore {
toHash.sort((a, b) => a.localeCompare(b));
// Calculate hash.
return <string> Md5.hashAsciiStr(toHash.join(''));
return Md5.hashAsciiStr(toHash.join(''));
}
/**

View File

@ -1104,14 +1104,14 @@ export class CoreLoginHelperProvider {
// Validate the signature.
// We need to check both http and https.
let signature = <string> Md5.hashAsciiStr(launchSiteURL + passport);
let signature = Md5.hashAsciiStr(launchSiteURL + passport);
if (signature != params[0]) {
if (launchSiteURL.indexOf('https://') != -1) {
launchSiteURL = launchSiteURL.replace('https://', 'http://');
} else {
launchSiteURL = launchSiteURL.replace('http://', 'https://');
}
signature = <string> Md5.hashAsciiStr(launchSiteURL + passport);
signature = Md5.hashAsciiStr(launchSiteURL + passport);
}
if (signature == params[0]) {

View File

@ -123,7 +123,7 @@ export class CoreSharedFilesListComponent implements OnInit, OnDestroy {
return;
}
const hash = <string> Md5.hashAsciiStr(path);
const hash = Md5.hashAsciiStr(path);
CoreNavigator.navigate(`../${hash}`, {
params: {

View File

@ -151,7 +151,7 @@ export class CoreSharedFilesProvider {
* @returns File ID.
*/
protected getFileId(entry: FileEntry): string {
return <string> Md5.hashAsciiStr(entry.name);
return Md5.hashAsciiStr(entry.name);
}
/**

View File

@ -87,7 +87,7 @@ export class CoreSitePluginsCourseOptionHandler extends CoreSitePluginsBaseHandl
const args = {
courseid: course.id,
};
const hash = <string> Md5.hashAsciiStr(JSON.stringify(args));
const hash = Md5.hashAsciiStr(JSON.stringify(args));
return {
title: this.title,

View File

@ -98,7 +98,7 @@ export class CoreSitePluginsUserProfileHandler extends CoreSitePluginsBaseHandle
courseid: contextId,
userid: user.id,
};
const hash = <string> Md5.hashAsciiStr(JSON.stringify(args));
const hash = Md5.hashAsciiStr(JSON.stringify(args));
CoreNavigator.navigateToSitePath(
`siteplugins/content/${this.plugin.component}/${this.handlerSchema.method}/${hash}`,

View File

@ -58,7 +58,7 @@ export class CoreSitePluginsOnlyTitleBlockComponent extends CoreBlockBaseCompone
contextlevel: this.contextLevel,
instanceid: this.instanceId,
};
const hash = <string> Md5.hashAsciiStr(JSON.stringify(args));
const hash = Md5.hashAsciiStr(JSON.stringify(args));
CoreNavigator.navigateToSitePath(
`siteplugins/content/${handler.plugin.component}/${handler.handlerSchema.method}/${hash}`,

View File

@ -181,7 +181,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
component = component || this.component;
method = method || this.method;
const hash = <string> Md5.hashAsciiStr(JSON.stringify(args));
const hash = Md5.hashAsciiStr(JSON.stringify(args));
CoreNavigator.navigateToSitePath(`siteplugins/content/${component}/${method}/${hash}`, {
params: {

View File

@ -99,7 +99,7 @@ export class CoreSitePluginsCallWSNewContentDirective extends CoreSitePluginsCal
} else {
const component = this.component || this.parentContent?.component;
const method = this.method || this.parentContent?.method;
const hash = <string> Md5.hashAsciiStr(JSON.stringify(args));
const hash = Md5.hashAsciiStr(JSON.stringify(args));
CoreNavigator.navigateToSitePath(`siteplugins/content/${component}/${method}/${hash}`, {
params: {

View File

@ -98,7 +98,7 @@ export class CoreSitePluginsNewContentDirective implements OnInit {
} else {
const component = this.component || this.parentContent?.component;
const method = this.method || this.parentContent?.method;
const hash = <string> Md5.hashAsciiStr(JSON.stringify(args));
const hash = Md5.hashAsciiStr(JSON.stringify(args));
CoreNavigator.navigateToSitePath(`siteplugins/content/${component}/${method}/${hash}`, {
params: {

View File

@ -218,7 +218,7 @@ export class CoreStylesService {
contents = (await handler.getStyle(siteId, config)).trim();
}
const hash = <string>Md5.hashAsciiStr(contents);
const hash = Md5.hashAsciiStr(contents);
// Update the styles only if they have changed.
if (this.stylesEls[siteId][handler.name] === hash) {

View File

@ -1303,7 +1303,7 @@ export class CoreFilepoolProvider {
* @returns File download ID.
*/
protected getFileDownloadId(fileUrl: string, filePath: string): string {
return <string> Md5.hashAsciiStr(fileUrl + '###' + filePath);
return Md5.hashAsciiStr(fileUrl + '###' + filePath);
}
/**
@ -1867,7 +1867,7 @@ export class CoreFilepoolProvider {
* @returns Package ID.
*/
getPackageId(component: string, componentId?: string | number): string {
return <string> Md5.hashAsciiStr(component + '#' + this.fixComponentId(componentId));
return Md5.hashAsciiStr(component + '#' + this.fixComponentId(componentId));
}
/**

View File

@ -721,7 +721,7 @@ export class CoreSitesProvider {
* @returns Site ID.
*/
createSiteID(siteUrl: string, username: string): string {
return <string> Md5.hashAsciiStr(siteUrl + username);
return Md5.hashAsciiStr(siteUrl + username);
}
/**

View File

@ -1456,7 +1456,7 @@ export class CoreDomUtilsProvider {
const listenCloseEvents = closeOnNavigate ?? true; // Default to true.
// TODO: Improve this if we need two modals with same component open at the same time.
const modalId = <string> Md5.hashAsciiStr(options.component?.toString() || '');
const modalId = Md5.hashAsciiStr(options.component?.toString() || '');
const modal = this.displayedModals[modalId]
? this.displayedModals[modalId]