MOBILE-3523 core: Fix handlers order if one hasn't priority

main
Dani Palou 2020-10-05 11:42:21 +02:00
parent 8d95636690
commit 94b215816e
12 changed files with 12 additions and 11 deletions

View File

@ -191,7 +191,7 @@ export class CoreContentLinksDelegate {
// Add them to the list. // Add them to the list.
linkActions.push({ linkActions.push({
priority: handler.priority, priority: handler.priority || 0,
actions: actions actions: actions
}); });
} }

View File

@ -405,7 +405,7 @@ export class CoreCourseOptionsDelegate extends CoreDelegate {
promises.push(Promise.resolve(getFunction.call(handler, injector, course)).then((data) => { promises.push(Promise.resolve(getFunction.call(handler, injector, course)).then((data) => {
handlersToDisplay.push({ handlersToDisplay.push({
data: data, data: data,
priority: handler.priority, priority: handler.priority || 0,
prefetch: handler.prefetch && handler.prefetch.bind(handler), prefetch: handler.prefetch && handler.prefetch.bind(handler),
name: handler.name name: handler.name
}); });

View File

@ -177,7 +177,7 @@ export class CoreFileUploaderDelegate extends CoreDelegate {
} }
const data: CoreFileUploaderHandlerDataToReturn = handler.getData(); const data: CoreFileUploaderHandlerDataToReturn = handler.getData();
data.priority = handler.priority; data.priority = handler.priority || 0;
data.mimetypes = supportedMimetypes; data.mimetypes = supportedMimetypes;
handlers.push(data); handlers.push(data);
} }

View File

@ -162,7 +162,7 @@ export class CoreMainMenuDelegate extends CoreDelegate {
handlersData.push({ handlersData.push({
name: name, name: name,
data: data, data: data,
priority: handler.priority priority: handler.priority || 0,
}); });
} }

View File

@ -177,6 +177,7 @@ export class CorePushNotificationsDelegate {
this.logger.log(`Registered addon '${handler.name}'`); this.logger.log(`Registered addon '${handler.name}'`);
this.clickHandlers[handler.name] = handler; this.clickHandlers[handler.name] = handler;
handler.priority = handler.priority || 0;
return true; return true;
} }

View File

@ -108,7 +108,7 @@ export class CoreSettingsDelegate extends CoreDelegate {
handlersData.push({ handlersData.push({
data: data, data: data,
priority: handler.priority priority: handler.priority || 0,
}); });
} }

View File

@ -35,7 +35,7 @@ export class CoreSitePluginsCourseOptionHandler extends CoreSitePluginsBaseHandl
protected utils: CoreUtilsProvider) { protected utils: CoreUtilsProvider) {
super(name); super(name);
this.priority = handlerSchema.priority; this.priority = handlerSchema.priority || 0;
this.isMenuHandler = !!handlerSchema.ismenuhandler; this.isMenuHandler = !!handlerSchema.ismenuhandler;
} }

View File

@ -25,7 +25,7 @@ export class CoreSitePluginsMainMenuHandler extends CoreSitePluginsBaseHandler i
protected initResult: any) { protected initResult: any) {
super(name); super(name);
this.priority = handlerSchema.priority; this.priority = handlerSchema.priority || 0;
} }
/** /**

View File

@ -32,7 +32,7 @@ export class CoreSitePluginsMessageOutputHandler extends CoreSitePluginsBaseHand
*/ */
getDisplayData(): AddonMessageOutputHandlerData { getDisplayData(): AddonMessageOutputHandlerData {
return { return {
priority: this.handlerSchema.priority, priority: this.handlerSchema.priority || 0,
label: this.title, label: this.title,
icon: this.handlerSchema.displaydata.icon, icon: this.handlerSchema.displaydata.icon,
page: 'CoreSitePluginsPluginPage', page: 'CoreSitePluginsPluginPage',

View File

@ -25,7 +25,7 @@ export class CoreSitePluginsSettingsHandler extends CoreSitePluginsBaseHandler i
protected initResult: any) { protected initResult: any) {
super(name); super(name);
this.priority = handlerSchema.priority; this.priority = handlerSchema.priority || 0;
} }
/** /**

View File

@ -43,7 +43,7 @@ export class CoreSitePluginsUserProfileHandler extends CoreSitePluginsBaseHandle
protected utils: CoreUtilsProvider) { protected utils: CoreUtilsProvider) {
super(name); super(name);
this.priority = handlerSchema.priority; this.priority = handlerSchema.priority || 0;
// Only support TYPE_COMMUNICATION and TYPE_NEW_PAGE. // Only support TYPE_COMMUNICATION and TYPE_NEW_PAGE.
this.type = handlerSchema.type != CoreUserDelegate.TYPE_COMMUNICATION ? this.type = handlerSchema.type != CoreUserDelegate.TYPE_COMMUNICATION ?

View File

@ -260,7 +260,7 @@ export class CoreUserDelegate extends CoreDelegate {
userData.handlers.push({ userData.handlers.push({
name: name, name: name,
data: handler.getDisplayData(user, courseId), data: handler.getDisplayData(user, courseId),
priority: handler.priority, priority: handler.priority || 0,
type: handler.type || CoreUserDelegate.TYPE_NEW_PAGE type: handler.type || CoreUserDelegate.TYPE_NEW_PAGE
}); });
} }