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,
|
subfolder: folder,
|
||||||
};
|
};
|
||||||
|
|
||||||
const hash = <string> Md5.hashAsciiStr(folder.filepath);
|
const hash = Md5.hashAsciiStr(folder.filepath);
|
||||||
|
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigateToSitePath(
|
||||||
`${AddonModFolderModuleHandlerService.PAGE_NAME}/${this.courseId}/${this.module.id}/${hash}`,
|
`${AddonModFolderModuleHandlerService.PAGE_NAME}/${this.courseId}/${this.module.id}/${hash}`,
|
||||||
|
|
|
@ -638,7 +638,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
||||||
* @returns Promise.
|
* @returns Promise.
|
||||||
*/
|
*/
|
||||||
protected async openPageOrSubwiki(options: AddonModWikiOpenPageOptions): Promise<void> {
|
protected async openPageOrSubwiki(options: AddonModWikiOpenPageOptions): Promise<void> {
|
||||||
const hash = <string> Md5.hashAsciiStr(JSON.stringify({
|
const hash = Md5.hashAsciiStr(JSON.stringify({
|
||||||
...options,
|
...options,
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -59,7 +59,7 @@ export class AddonModWikiPageOrMapLinkHandlerService extends CoreContentLinksHan
|
||||||
{ siteId, readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
|
{ siteId, readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
|
||||||
);
|
);
|
||||||
|
|
||||||
const hash = <string> Md5.hashAsciiStr(JSON.stringify({
|
const hash = Md5.hashAsciiStr(JSON.stringify({
|
||||||
pageId: page.id,
|
pageId: page.id,
|
||||||
pageTitle: page.title,
|
pageTitle: page.title,
|
||||||
subwikiId: page.subwikiid,
|
subwikiId: page.subwikiid,
|
||||||
|
|
|
@ -267,7 +267,7 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy {
|
||||||
params.filename = '';
|
params.filename = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const hash = <string> Md5.hashAsciiStr(JSON.stringify(params));
|
const hash = Md5.hashAsciiStr(JSON.stringify(params));
|
||||||
|
|
||||||
CoreNavigator.navigate(`../${hash}`, { params });
|
CoreNavigator.navigate(`../${hash}`, { params });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1010,7 +1010,7 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
protected getCacheId(method: string, data: any): string {
|
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> {
|
async getCourseUpdates(modules: CoreCourseModuleData[], courseId: number): Promise<CourseUpdates> {
|
||||||
// Check if there's already a getCourseUpdates in progress.
|
// 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();
|
const siteId = CoreSites.getCurrentSiteId();
|
||||||
|
|
||||||
if (this.courseUpdatesPromises[siteId] && this.courseUpdatesPromises[siteId][id] !== undefined) {
|
if (this.courseUpdatesPromises[siteId] && this.courseUpdatesPromises[siteId][id] !== undefined) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ export class CoreH5PCore {
|
||||||
toHash.sort((a, b) => a.localeCompare(b));
|
toHash.sort((a, b) => a.localeCompare(b));
|
||||||
|
|
||||||
// Calculate hash.
|
// Calculate hash.
|
||||||
return <string> Md5.hashAsciiStr(toHash.join(''));
|
return Md5.hashAsciiStr(toHash.join(''));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1104,14 +1104,14 @@ export class CoreLoginHelperProvider {
|
||||||
|
|
||||||
// Validate the signature.
|
// Validate the signature.
|
||||||
// We need to check both http and https.
|
// 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 (signature != params[0]) {
|
||||||
if (launchSiteURL.indexOf('https://') != -1) {
|
if (launchSiteURL.indexOf('https://') != -1) {
|
||||||
launchSiteURL = launchSiteURL.replace('https://', 'http://');
|
launchSiteURL = launchSiteURL.replace('https://', 'http://');
|
||||||
} else {
|
} else {
|
||||||
launchSiteURL = launchSiteURL.replace('http://', 'https://');
|
launchSiteURL = launchSiteURL.replace('http://', 'https://');
|
||||||
}
|
}
|
||||||
signature = <string> Md5.hashAsciiStr(launchSiteURL + passport);
|
signature = Md5.hashAsciiStr(launchSiteURL + passport);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signature == params[0]) {
|
if (signature == params[0]) {
|
||||||
|
|
|
@ -123,7 +123,7 @@ export class CoreSharedFilesListComponent implements OnInit, OnDestroy {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hash = <string> Md5.hashAsciiStr(path);
|
const hash = Md5.hashAsciiStr(path);
|
||||||
|
|
||||||
CoreNavigator.navigate(`../${hash}`, {
|
CoreNavigator.navigate(`../${hash}`, {
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -151,7 +151,7 @@ export class CoreSharedFilesProvider {
|
||||||
* @returns File ID.
|
* @returns File ID.
|
||||||
*/
|
*/
|
||||||
protected getFileId(entry: FileEntry): string {
|
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 = {
|
const args = {
|
||||||
courseid: course.id,
|
courseid: course.id,
|
||||||
};
|
};
|
||||||
const hash = <string> Md5.hashAsciiStr(JSON.stringify(args));
|
const hash = Md5.hashAsciiStr(JSON.stringify(args));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: this.title,
|
title: this.title,
|
||||||
|
|
|
@ -98,7 +98,7 @@ export class CoreSitePluginsUserProfileHandler extends CoreSitePluginsBaseHandle
|
||||||
courseid: contextId,
|
courseid: contextId,
|
||||||
userid: user.id,
|
userid: user.id,
|
||||||
};
|
};
|
||||||
const hash = <string> Md5.hashAsciiStr(JSON.stringify(args));
|
const hash = Md5.hashAsciiStr(JSON.stringify(args));
|
||||||
|
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigateToSitePath(
|
||||||
`siteplugins/content/${this.plugin.component}/${this.handlerSchema.method}/${hash}`,
|
`siteplugins/content/${this.plugin.component}/${this.handlerSchema.method}/${hash}`,
|
||||||
|
|
|
@ -58,7 +58,7 @@ export class CoreSitePluginsOnlyTitleBlockComponent extends CoreBlockBaseCompone
|
||||||
contextlevel: this.contextLevel,
|
contextlevel: this.contextLevel,
|
||||||
instanceid: this.instanceId,
|
instanceid: this.instanceId,
|
||||||
};
|
};
|
||||||
const hash = <string> Md5.hashAsciiStr(JSON.stringify(args));
|
const hash = Md5.hashAsciiStr(JSON.stringify(args));
|
||||||
|
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigateToSitePath(
|
||||||
`siteplugins/content/${handler.plugin.component}/${handler.handlerSchema.method}/${hash}`,
|
`siteplugins/content/${handler.plugin.component}/${handler.handlerSchema.method}/${hash}`,
|
||||||
|
|
|
@ -181,7 +181,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
||||||
|
|
||||||
component = component || this.component;
|
component = component || this.component;
|
||||||
method = method || this.method;
|
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}`, {
|
CoreNavigator.navigateToSitePath(`siteplugins/content/${component}/${method}/${hash}`, {
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -99,7 +99,7 @@ export class CoreSitePluginsCallWSNewContentDirective extends CoreSitePluginsCal
|
||||||
} else {
|
} else {
|
||||||
const component = this.component || this.parentContent?.component;
|
const component = this.component || this.parentContent?.component;
|
||||||
const method = this.method || this.parentContent?.method;
|
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}`, {
|
CoreNavigator.navigateToSitePath(`siteplugins/content/${component}/${method}/${hash}`, {
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -98,7 +98,7 @@ export class CoreSitePluginsNewContentDirective implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
const component = this.component || this.parentContent?.component;
|
const component = this.component || this.parentContent?.component;
|
||||||
const method = this.method || this.parentContent?.method;
|
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}`, {
|
CoreNavigator.navigateToSitePath(`siteplugins/content/${component}/${method}/${hash}`, {
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -218,7 +218,7 @@ export class CoreStylesService {
|
||||||
contents = (await handler.getStyle(siteId, config)).trim();
|
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.
|
// Update the styles only if they have changed.
|
||||||
if (this.stylesEls[siteId][handler.name] === hash) {
|
if (this.stylesEls[siteId][handler.name] === hash) {
|
||||||
|
|
|
@ -1303,7 +1303,7 @@ export class CoreFilepoolProvider {
|
||||||
* @returns File download ID.
|
* @returns File download ID.
|
||||||
*/
|
*/
|
||||||
protected getFileDownloadId(fileUrl: string, filePath: string): string {
|
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.
|
* @returns Package ID.
|
||||||
*/
|
*/
|
||||||
getPackageId(component: string, componentId?: string | number): string {
|
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.
|
* @returns Site ID.
|
||||||
*/
|
*/
|
||||||
createSiteID(siteUrl: string, username: string): string {
|
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.
|
const listenCloseEvents = closeOnNavigate ?? true; // Default to true.
|
||||||
|
|
||||||
// TODO: Improve this if we need two modals with same component open at the same time.
|
// 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]
|
const modal = this.displayedModals[modalId]
|
||||||
? this.displayedModals[modalId]
|
? this.displayedModals[modalId]
|
||||||
|
|
Loading…
Reference in New Issue