Remove mock locations from jailbrake detection (#7005) (#7017)

(cherry picked from commit 4aaf08b12a)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2023-01-26 20:32:36 +02:00 committed by GitHub
parent 70119fc026
commit 4764a76c9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View file

@ -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) => {

View file

@ -502,7 +502,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.",