From 4aaf08b12a2a5d4cd0022159a96e7cb429f734f5 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Tue, 24 Jan 2023 08:42:52 +0200 Subject: [PATCH] Remove mock locations from jailbrake detection (#7005) --- app/init/managed_app.ts | 11 +++++++---- assets/base/i18n/en.json | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/init/managed_app.ts b/app/init/managed_app.ts index 234a5f783d..912d45f11d 100644 --- a/app/init/managed_app.ts +++ b/app/init/managed_app.ts @@ -78,7 +78,7 @@ class ManagedApp { const jailbreakProtection = config!.jailbreakProtection === 'true'; if (jailbreakProtection && !this.isTrustedDevice()) { - this.alertDeviceIsUntrusted(); + this.alertDeviceIsNotTrusted(); return; } @@ -88,14 +88,17 @@ class ManagedApp { } }; - alertDeviceIsUntrusted = () => { + alertDeviceIsNotTrusted = () => { // We use the default device locale as this is an app wide setting // and does not require any server data const locale = DEFAULT_LOCALE; const translations = getTranslations(locale); Alert.alert( translations[t('mobile.managed.blocked_by')].replace('{vendor}', this.vendor), - translations[t('mobile.managed.jailbreak')].replace('{vendor}', this.vendor), + translations[t('mobile.managed.jailbreak')]. + replace('{vendor}', this.vendor). + replace('{reason}', JailMonkey.jailBrokenMessage() || translations[t('mobile.managed.jailbreak_no_reason')]). + replace('{debug}', JSON.stringify(JailMonkey.androidRootedDetectionMethods || translations[t('mobile.managed.jailbreak_no_debug_info')])), [{ text: translations[t('mobile.managed.exit')], style: 'destructive', @@ -139,7 +142,7 @@ class ManagedApp { }; isTrustedDevice = () => { - return __DEV__ || JailMonkey.trustFall(); + return __DEV__ || !JailMonkey.isJailBroken(); }; onAppStateChange = async (appState: AppStateStatus) => { diff --git a/assets/base/i18n/en.json b/assets/base/i18n/en.json index 1412f15cc7..f7ee276f50 100644 --- a/assets/base/i18n/en.json +++ b/assets/base/i18n/en.json @@ -527,7 +527,9 @@ "mobile.login_options.sso_continue": "Continue with", "mobile.managed.blocked_by": "Blocked by {vendor}", "mobile.managed.exit": "Exit", - "mobile.managed.jailbreak": "Jailbroken devices are not trusted by {vendor}, please exit the app.", + "mobile.managed.jailbreak": "Jailbroken devices are not trusted by {vendor}.\n\nReason {reason}\n\n\n\nDebug info: {debug}\n\nPlease exit the app.", + "mobile.managed.jailbreak_no_debug_info": "Not available", + "mobile.managed.jailbreak_no_reason": "Not available", "mobile.managed.not_secured.android": "This device must be secured with a screen lock to use Mattermost.", "mobile.managed.not_secured.ios": "This device must be secured with a passcode to use Mattermost.\n\nGo to Settings > Face ID & Passcode.", "mobile.managed.not_secured.ios.touchId": "This device must be secured with a passcode to use Mattermost.\n\nGo to Settings > Touch ID & Passcode.",