MM-17589 Update "passcode required" help text (#3137)

* MM-17589 Update passcode required help text in share extension

* MM-17589 Update passcode required help text in app
This commit is contained in:
Harrison Healey 2019-08-23 12:12:22 -04:00 committed by GitHub
parent d2464b16c4
commit 91a7cb499c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 3 deletions

View file

@ -134,7 +134,7 @@ class EMMProvider {
};
showNotSecuredAlert = (translations) => {
return new Promise((resolve) => {
return new Promise(async (resolve) => {
const options = [];
if (Platform.OS === 'android') {
@ -152,9 +152,22 @@ class EMMProvider {
style: 'cancel',
});
let message;
if (Platform.OS === 'ios') {
const {supportsFaceId} = await mattermostManaged.supportsFaceId();
if (supportsFaceId) {
message = translations[t('mobile.managed.not_secured.ios')];
} else {
message = translations[t('mobile.managed.not_secured.ios.touchId')];
}
} else {
message = translations[t('mobile.managed.not_secured.android')];
}
Alert.alert(
translations[t('mobile.managed.blocked_by')].replace('{vendor}', this.vendor),
Platform.OS === 'ios' ? translations[t('mobile.managed.not_secured.ios')] : translations[t('mobile.managed.not_secured.android')],
message,
options,
{cancelable: false, onDismiss: resolve},
);

View file

@ -66,5 +66,6 @@ export default {
return JailMonkey.trustFall();
},
supportsFaceId: async () => false,
quitApp: MattermostManaged.quitApp,
};

View file

@ -68,5 +68,6 @@ export default {
return JailMonkey.trustFall();
},
supportsFaceId: MattermostManaged.supportsFaceId,
quitApp: MattermostManaged.quitApp,
};

View file

@ -279,6 +279,7 @@
"mobile.managed.jailbreak": "Jailbroken devices are not trusted by {vendor}, please exit the app.",
"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.",
"mobile.managed.secured_by": "Secured by {vendor}",
"mobile.managed.settings": "Go to settings",
"mobile.markdown.code.copy_code": "Copy Code",

View file

@ -7,6 +7,7 @@
//
#import "MattermostManaged.h"
#import <LocalAuthentication/LocalAuthentication.h>
#import <UploadAttachments/MMMConstants.h>
@implementation MattermostManaged {
@ -167,4 +168,17 @@ RCT_EXPORT_METHOD(quitApp)
exit(0);
}
RCT_EXPORT_METHOD(supportsFaceId:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
LAContext *context = [[LAContext alloc] init];
NSError *error;
// context.biometryType is initialized when canEvaluatePolicy, regardless of the error or return value
[context canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:&error];
resolve(@{
@"supportsFaceId": @(context.biometryType == LABiometryTypeFaceID && @available(iOS 11.0, *))
});
}
@end

View file

@ -47,9 +47,16 @@ class ShareViewController: SLComposeServiceViewController {
var error: NSError?
if !context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) {
if let error = error, error.code == kLAErrorPasscodeNotSet {
var message = "This device must be secured with a passcode to use Mattermost.\n\nGo to Settings > Touch ID & Passcode."
if #available(iOS 11.0, *) {
if (context.biometryType == LABiometryType.faceID) {
message = "This device must be secured with a passcode to use Mattermost.\n\nGo to Settings > Face ID & Passcode."
}
}
self.showErrorMessage(
title: "",
message: "This device must be secured with a passcode to use Mattermost.\n\nGo to Settings > Face ID & Passcode.",
message: message,
VC: self
)
} else {