forked from CIT/Vmeda.Online
		
	Merge pull request #1597 from dpalou/MOBILE-2704
MOBILE-2704 siteplugins: Don't show them in bottom tabs
This commit is contained in:
		
						commit
						85a15eb651
					
				@ -56,6 +56,10 @@ export class CoreMainMenuPage implements OnDestroy {
 | 
			
		||||
        this.showTabs = true;
 | 
			
		||||
 | 
			
		||||
        this.subscription = this.menuDelegate.getHandlers().subscribe((handlers) => {
 | 
			
		||||
            // Remove the handlers that should only appear in the More menu.
 | 
			
		||||
            handlers = handlers.filter((handler) => {
 | 
			
		||||
                return !handler.onlyInMore;
 | 
			
		||||
            });
 | 
			
		||||
            handlers = handlers.slice(0, CoreMainMenuProvider.NUM_MAIN_HANDLERS); // Get main handlers.
 | 
			
		||||
 | 
			
		||||
            // Re-build the list of tabs. If a handler is already in the list, use existing object to prevent re-creating the tab.
 | 
			
		||||
 | 
			
		||||
@ -57,7 +57,19 @@ export class CoreMainMenuMorePage implements OnDestroy {
 | 
			
		||||
    ionViewDidLoad(): void {
 | 
			
		||||
        // Load the handlers.
 | 
			
		||||
        this.subscription = this.menuDelegate.getHandlers().subscribe((handlers) => {
 | 
			
		||||
            this.handlers = handlers.slice(CoreMainMenuProvider.NUM_MAIN_HANDLERS); // Remove the main handlers.
 | 
			
		||||
            // Calculate the main handlers to not display them in this view.
 | 
			
		||||
            const mainHandlers = handlers.filter((handler) => {
 | 
			
		||||
                return !handler.onlyInMore;
 | 
			
		||||
            }).slice(0, CoreMainMenuProvider.NUM_MAIN_HANDLERS);
 | 
			
		||||
 | 
			
		||||
            // Get only the handlers that don't appear in the main view.
 | 
			
		||||
            this.handlers = [];
 | 
			
		||||
            handlers.forEach((handler) => {
 | 
			
		||||
                if (mainHandlers.indexOf(handler) == -1) {
 | 
			
		||||
                    this.handlers.push(handler);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            this.handlersLoaded = this.menuDelegate.areHandlersLoaded();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -88,6 +88,12 @@ export interface CoreMainMenuHandlerData {
 | 
			
		||||
     * @type {any}
 | 
			
		||||
     */
 | 
			
		||||
    pageParams?: any;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Whether the handler should only appear in More menu.
 | 
			
		||||
     * @type {boolean}
 | 
			
		||||
     */
 | 
			
		||||
    onlyInMore?: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
@ -25,8 +25,7 @@ export class CoreSitePluginsMainMenuHandler extends CoreSitePluginsBaseHandler i
 | 
			
		||||
            protected initResult: any) {
 | 
			
		||||
        super(name);
 | 
			
		||||
 | 
			
		||||
        // Set 699 as max priority so site plugins are always shown in the More tab (700 is Notifications tab).
 | 
			
		||||
        this.priority = Math.min(handlerSchema.priority, 699);
 | 
			
		||||
        this.priority = handlerSchema.priority;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@ -45,7 +44,8 @@ export class CoreSitePluginsMainMenuHandler extends CoreSitePluginsBaseHandler i
 | 
			
		||||
                component: this.plugin.component,
 | 
			
		||||
                method: this.handlerSchema.method,
 | 
			
		||||
                initResult: this.initResult
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
            onlyInMore: true
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user