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:
parent
d2464b16c4
commit
91a7cb499c
6 changed files with 40 additions and 3 deletions
|
|
@ -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},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -66,5 +66,6 @@ export default {
|
|||
|
||||
return JailMonkey.trustFall();
|
||||
},
|
||||
supportsFaceId: async () => false,
|
||||
quitApp: MattermostManaged.quitApp,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -68,5 +68,6 @@ export default {
|
|||
|
||||
return JailMonkey.trustFall();
|
||||
},
|
||||
supportsFaceId: MattermostManaged.supportsFaceId,
|
||||
quitApp: MattermostManaged.quitApp,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue