Files
mattermost-mobile/app/mattermost_managed/mattermost-managed.android.js
enahum cd5fb71681 Appconfig support for iOS and Android (#856)
* AppConfig support for iOS

* AppConfig support for Android

* Fix typo

* Java feedback review
2017-08-18 12:19:00 -04:00

37 lines
1.1 KiB
JavaScript

// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {BackHandler, NativeModules, DeviceEventEmitter} from 'react-native';
import LocalAuth from 'react-native-local-auth';
import JailMonkey from 'jail-monkey';
const {MattermostManaged} = NativeModules;
export default {
addEventListener: (name, callback) => {
DeviceEventEmitter.addListener(name, (config) => {
if (callback && typeof callback === 'function') {
callback(config);
}
});
},
authenticate: LocalAuth.authenticate,
blurAppScreen: MattermostManaged.blurAppScreen,
getConfig: MattermostManaged.getConfig,
isDeviceSecure: async () => {
try {
return await LocalAuth.isDeviceSecure();
} catch (err) {
return false;
}
},
isTrustedDevice: () => {
if (__DEV__) { //eslint-disable-line no-undef
return true;
}
return JailMonkey.trustFall();
},
quitApp: BackHandler.exitApp
};