* Upgrade to RN 0.48.1 * Update deps to be exact * Fix tests * Remove unneeded code from setup and add socketcluster dep * Fix drawer pan issue * Fix bridge issues on iOS * Upgrade to RN 0.48.3 * Search to use RN SectionList
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
import {NativeModules, DeviceEventEmitter} from 'react-native';
|
|
import LocalAuth from 'react-native-local-auth';
|
|
import JailMonkey from 'jail-monkey';
|
|
|
|
const {BlurAppScreen, MattermostManaged} = NativeModules;
|
|
|
|
const listeners = [];
|
|
|
|
export default {
|
|
addEventListener: (name, callback) => {
|
|
const listener = DeviceEventEmitter.addListener(name, (config) => {
|
|
if (callback && typeof callback === 'function') {
|
|
callback(config);
|
|
}
|
|
});
|
|
|
|
listeners.push(listener);
|
|
},
|
|
clearListeners: () => {
|
|
listeners.forEach((listener) => {
|
|
listener.remove();
|
|
});
|
|
},
|
|
authenticate: LocalAuth.authenticate,
|
|
blurAppScreen: BlurAppScreen.enabled,
|
|
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: MattermostManaged.quitApp
|
|
};
|