MOBILE-4616 bbb: Move bbb constants to a file

main
Pau Ferrer Ocaña 2024-07-11 22:39:31 +02:00
parent 346e3d8d57
commit 06fec4e6cf
6 changed files with 34 additions and 19 deletions

View File

@ -35,4 +35,4 @@ const routes: Routes = [
AddonModBBBIndexPage, AddonModBBBIndexPage,
], ],
}) })
export class AddonModBBBLazyModule {} export default class AddonModBBBLazyModule {}

View File

@ -19,12 +19,13 @@ import { CoreCourseModuleDelegate } from '@features/course/services/module-deleg
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { AddonModBBBIndexLinkHandler } from './services/handlers/index-link'; import { AddonModBBBIndexLinkHandler } from './services/handlers/index-link';
import { AddonModBBBListLinkHandler } from './services/handlers/list-link'; import { AddonModBBBListLinkHandler } from './services/handlers/list-link';
import { AddonModBBBModuleHandler, ADDON_MOD_BBB_MAIN_MENU_PAGE_NAME } from './services/handlers/module'; import { AddonModBBBModuleHandler } from './services/handlers/module';
import { ADDON_MOD_BBB_PAGE_NAME } from './constants';
const routes: Routes = [ const routes: Routes = [
{ {
path: ADDON_MOD_BBB_MAIN_MENU_PAGE_NAME, path: ADDON_MOD_BBB_PAGE_NAME,
loadChildren: () => import('./bigbluebuttonbn-lazy.module').then(m => m.AddonModBBBLazyModule), loadChildren: () => import('./bigbluebuttonbn-lazy.module'),
}, },
]; ];

View File

@ -30,8 +30,8 @@ import {
AddonModBBBData, AddonModBBBData,
AddonModBBBMeetingInfo, AddonModBBBMeetingInfo,
AddonModBBBRecordingPlaybackTypes, AddonModBBBRecordingPlaybackTypes,
AddonModBBBService,
} from '../../services/bigbluebuttonbn'; } from '../../services/bigbluebuttonbn';
import { ADDON_MOD_BBB_COMPONENT } from '../../constants';
/** /**
* Component that displays a Big Blue Button activity. * Component that displays a Big Blue Button activity.
@ -43,7 +43,7 @@ import {
}) })
export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityComponent implements OnInit { export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityComponent implements OnInit {
component = AddonModBBBService.COMPONENT; component = ADDON_MOD_BBB_COMPONENT;
pluginName = 'bigbluebuttonbn'; pluginName = 'bigbluebuttonbn';
bbb?: AddonModBBBData; bbb?: AddonModBBBData;
groupInfo?: CoreGroupInfo; groupInfo?: CoreGroupInfo;

View File

@ -0,0 +1,16 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export const ADDON_MOD_BBB_COMPONENT = 'mmaModBigBlueButtonBN';
export const ADDON_MOD_BBB_PAGE_NAME = 'mod_bigbluebuttonbn';

View File

@ -24,8 +24,7 @@ import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils'; import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws'; import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons'; import { makeSingleton, Translate } from '@singletons';
import { ADDON_MOD_BBB_COMPONENT } from '../constants';
const ROOT_CACHE_KEY = 'AddonModBBB:';
/** /**
* Service that provides some features for Big Blue Button activity. * Service that provides some features for Big Blue Button activity.
@ -33,7 +32,7 @@ const ROOT_CACHE_KEY = 'AddonModBBB:';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class AddonModBBBService { export class AddonModBBBService {
static readonly COMPONENT = 'mmaModBigBlueButtonBN'; protected static readonly ROOT_CACHE_KEY = 'AddonModBBB:';
/** /**
* End a meeting. * End a meeting.
@ -75,7 +74,7 @@ export class AddonModBBBService {
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getBBBsCacheKey(courseId), cacheKey: this.getBBBsCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY, updateFrequency: CoreSite.FREQUENCY_RARELY,
component: AddonModBBBService.COMPONENT, component: ADDON_MOD_BBB_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -100,7 +99,7 @@ export class AddonModBBBService {
* @returns Cache key. * @returns Cache key.
*/ */
protected getBBBsCacheKey(courseId: number): string { protected getBBBsCacheKey(courseId: number): string {
return ROOT_CACHE_KEY + 'bbb:' + courseId; return AddonModBBBService.ROOT_CACHE_KEY + 'bbb:' + courseId;
} }
/** /**
@ -166,7 +165,7 @@ export class AddonModBBBService {
cacheKey: this.getMeetingInfoCacheKey(id, groupId), cacheKey: this.getMeetingInfoCacheKey(id, groupId),
getCacheUsingCacheKey: true, getCacheUsingCacheKey: true,
uniqueCacheKey: true, uniqueCacheKey: true,
component: AddonModBBBService.COMPONENT, component: ADDON_MOD_BBB_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -205,7 +204,7 @@ export class AddonModBBBService {
* @returns Cache key prefix. * @returns Cache key prefix.
*/ */
protected getMeetingInfoCacheKeyPrefix(id: number): string { protected getMeetingInfoCacheKeyPrefix(id: number): string {
return ROOT_CACHE_KEY + 'meetingInfo:' + id + ':'; return AddonModBBBService.ROOT_CACHE_KEY + 'meetingInfo:' + id + ':';
} }
/** /**
@ -229,7 +228,7 @@ export class AddonModBBBService {
}; };
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getRecordingsCacheKey(id, groupId), cacheKey: this.getRecordingsCacheKey(id, groupId),
component: AddonModBBBService.COMPONENT, component: ADDON_MOD_BBB_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -270,7 +269,7 @@ export class AddonModBBBService {
* @returns Cache key prefix. * @returns Cache key prefix.
*/ */
protected getRecordingsCacheKeyPrefix(id: number): string { protected getRecordingsCacheKeyPrefix(id: number): string {
return ROOT_CACHE_KEY + 'recordings:' + id + ':'; return AddonModBBBService.ROOT_CACHE_KEY + 'recordings:' + id + ':';
} }
/** /**
@ -288,7 +287,7 @@ export class AddonModBBBService {
await CoreCourseLogHelper.log( await CoreCourseLogHelper.log(
'mod_bigbluebuttonbn_view_bigbluebuttonbn', 'mod_bigbluebuttonbn_view_bigbluebuttonbn',
params, params,
AddonModBBBService.COMPONENT, ADDON_MOD_BBB_COMPONENT,
id, id,
siteId, siteId,
); );

View File

@ -22,8 +22,7 @@ import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { AddonModBBBIndexComponent } from '../../components/index'; import { AddonModBBBIndexComponent } from '../../components/index';
import { AddonModBBB } from '../bigbluebuttonbn'; import { AddonModBBB } from '../bigbluebuttonbn';
import { ADDON_MOD_BBB_PAGE_NAME } from '../../constants';
export const ADDON_MOD_BBB_MAIN_MENU_PAGE_NAME = 'mod_bigbluebuttonbn';
/** /**
* Handler to support Big Blue Button activities. * Handler to support Big Blue Button activities.
@ -33,7 +32,7 @@ export class AddonModBBBModuleHandlerService extends CoreModuleHandlerBase imple
name = 'AddonModBBB'; name = 'AddonModBBB';
modName = 'bigbluebuttonbn'; modName = 'bigbluebuttonbn';
protected pageName = ADDON_MOD_BBB_MAIN_MENU_PAGE_NAME; protected pageName = ADDON_MOD_BBB_PAGE_NAME;
protected sitePluginHandler?: CoreSitePluginsModuleHandler; protected sitePluginHandler?: CoreSitePluginsModuleHandler;
supportedFeatures = { supportedFeatures = {