MOBILE-4543 chore: Remove unnecessary variable type change on hash
parent
c243be806a
commit
0d56f802f2
|
@ -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}`,
|
||||
|
|
|
@ -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(),
|
||||
}));
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(''));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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]) {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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}`,
|
||||
|
|
|
@ -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}`,
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue