MOBILE-4498 blog: Use advanced features to check if blog is enabled

main
Pau Ferrer Ocaña 2024-02-28 16:07:39 +01:00
parent 41f005d65a
commit 65ed0d2b1c
2 changed files with 16 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import { CoreBlockHandlerData } from '@features/block/services/block-delegate';
import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler';
import { AddonBlockBlogMenuComponent } from '../components/blogmenu/blogmenu';
import { makeSingleton } from '@singletons';
import { AddonBlog } from '@addons/blog/services/blog';
/**
* Block handler.
@ -28,6 +29,13 @@ export class AddonBlockBlogMenuHandlerService extends CoreBlockBaseHandler {
name = 'AddonBlockBlogMenu';
blockName = 'blog_menu';
/**
* @inheritdoc
*/
async isEnabled(): Promise<boolean> {
return await AddonBlog.isPluginEnabled();
}
/**
* Returns the data needed to render the block.
*

View File

@ -18,6 +18,7 @@ import { CoreBlockHandlerData } from '@features/block/services/block-delegate';
import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler';
import { AddonBlockBlogRecentComponent } from '../components/blogrecent/blogrecent';
import { makeSingleton } from '@singletons';
import { AddonBlog } from '@addons/blog/services/blog';
/**
* Block handler.
@ -28,6 +29,13 @@ export class AddonBlockBlogRecentHandlerService extends CoreBlockBaseHandler {
name = 'AddonBlockBlogRecent';
blockName = 'blog_recent';
/**
* @inheritdoc
*/
async isEnabled(): Promise<boolean> {
return await AddonBlog.isPluginEnabled();
}
/**
* Returns the data needed to render the block.
*