MOBILE-2768 policy: Decouple policy service from initial bundle

main
Dani Palou 2024-03-04 10:24:52 +01:00
parent b33b8b07fc
commit 62a04239cb
3 changed files with 11 additions and 4 deletions

View File

@ -57,7 +57,6 @@ import {
IDENTITY_PROVIDER_FEATURE_NAME_PREFIX, IDENTITY_PROVIDER_FEATURE_NAME_PREFIX,
} from '../constants'; } from '../constants';
import { LazyRoutesModule } from '@/app/app-routing.module'; import { LazyRoutesModule } from '@/app/app-routing.module';
import { CorePolicy } from '@features/policy/services/policy';
/** /**
* Helper provider that provides some common features regarding authentication. * Helper provider that provides some common features regarding authentication.
@ -91,6 +90,8 @@ export class CoreLoginHelperProvider {
* @deprecated since 4.4. Use CorePolicy.acceptMandatoryPolicies instead. * @deprecated since 4.4. Use CorePolicy.acceptMandatoryPolicies instead.
*/ */
async acceptSitePolicy(siteId?: string): Promise<void> { async acceptSitePolicy(siteId?: string): Promise<void> {
const { CorePolicy } = await import('@features/policy/services/policy');
return CorePolicy.acceptMandatorySitePolicies(siteId); return CorePolicy.acceptMandatorySitePolicies(siteId);
} }
@ -285,6 +286,8 @@ export class CoreLoginHelperProvider {
* @deprecated since 4.4. Use CorePolicy.getSitePoliciesURL instead. * @deprecated since 4.4. Use CorePolicy.getSitePoliciesURL instead.
*/ */
async getSitePolicy(siteId?: string): Promise<string> { async getSitePolicy(siteId?: string): Promise<string> {
const { CorePolicy } = await import('@features/policy/services/policy');
return CorePolicy.getSitePoliciesURL(siteId); return CorePolicy.getSitePoliciesURL(siteId);
} }
@ -1040,7 +1043,9 @@ export class CoreLoginHelperProvider {
* @returns void * @returns void
* @deprecated since 4.4. Use CorePolicy.goToAcceptSitePolicies instead. * @deprecated since 4.4. Use CorePolicy.goToAcceptSitePolicies instead.
*/ */
sitePolicyNotAgreed(siteId?: string): void { async sitePolicyNotAgreed(siteId?: string): Promise<void> {
const { CorePolicy } = await import('@features/policy/services/policy');
return CorePolicy.goToAcceptSitePolicies(siteId); return CorePolicy.goToAcceptSitePolicies(siteId);
} }

View File

@ -18,7 +18,6 @@ import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { CorePolicy } from '../policy';
import { ACCEPTANCES_PAGE_NAME, POLICY_PAGE_NAME } from '@features/policy/constants'; import { ACCEPTANCES_PAGE_NAME, POLICY_PAGE_NAME } from '@features/policy/constants';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
@ -55,6 +54,8 @@ export class CorePolicyAcceptancesLinkHandlerService extends CoreContentLinksHan
return false; return false;
} }
const { CorePolicy } = await import('@features/policy/services/policy');
return CorePolicy.isManageAcceptancesAvailable(siteId); return CorePolicy.isManageAcceptancesAvailable(siteId);
} }

View File

@ -19,7 +19,6 @@ import {
CoreUserProfileHandler, CoreUserProfileHandler,
CoreUserProfileHandlerData, CoreUserProfileHandlerData,
} from '@features/user/services/user-delegate'; } from '@features/user/services/user-delegate';
import { CorePolicy } from '../policy';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
@ -40,6 +39,8 @@ export class CorePolicyUserHandlerService implements CoreUserProfileHandler {
* @inheritdoc * @inheritdoc
*/ */
async isEnabled(): Promise<boolean> { async isEnabled(): Promise<boolean> {
const { CorePolicy } = await import('@features/policy/services/policy');
const wsAvailable = await CorePolicy.isManageAcceptancesAvailable(); const wsAvailable = await CorePolicy.isManageAcceptancesAvailable();
if (!wsAvailable) { if (!wsAvailable) {
return false; return false;