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

View File

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

View File

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