From 4c550729ca10ac6e12a2670b04fb62a15ebffe8b Mon Sep 17 00:00:00 2001 From: Alfonso Salces Date: Thu, 1 Aug 2024 12:37:20 +0200 Subject: [PATCH] MOBILE-4581 utils: Add lang to openInBrowser urls --- src/core/services/utils/utils.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core/services/utils/utils.ts b/src/core/services/utils/utils.ts index 9a18d59a7..74e8a83bd 100644 --- a/src/core/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -18,7 +18,7 @@ import { FileEntry } from '@awesome-cordova-plugins/file/ngx'; import { Subscription } from 'rxjs'; import { CoreEvents } from '@singletons/events'; import { CoreFile } from '@services/file'; -import { CoreLang } from '@services/lang'; +import { CoreLang, CoreLangFormat } from '@services/lang'; import { CoreWS } from '@services/ws'; import { CoreModals } from '@services/modals'; import { CoreMimetypeUtils } from '@services/utils/mimetype'; @@ -1179,12 +1179,14 @@ export class CoreUtilsProvider { } } - CoreAnalytics.logEvent({ - type: CoreAnalyticsEventType.OPEN_LINK, - link: originaUrl, - }); - - window.open(url, '_system'); + const site = CoreSites.getCurrentSite(); + CoreAnalytics.logEvent({ type: CoreAnalyticsEventType.OPEN_LINK, link: originaUrl }); + window.open( + site?.containsUrl(url) + ? CoreUrl.addParamsToUrl(url, { lang: await CoreLang.getCurrentLanguage(CoreLangFormat.LMS) }) + : url, + '_system', + ); } /**