react-native-unit-components
Version:
Unit React Native components
31 lines (30 loc) • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useSnapshotProtection = void 0;
var _reactNative = require("react-native");
var _UNSnapshotProtectionHelper = _interopRequireDefault(require("../nativeModulesHelpers/UNSanpshotProtectionHelper/UNSnapshotProtectionHelper"));
var _UnitSdkManager = require("../unitSdkManager/UnitSdkManager");
var _securitySettings = require("../types/shared/securitySettings");
var _react = require("react");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const useSnapshotProtection = () => {
/**
* This hook provides snapshot protection specifically for Android.
* For iOS, a native service is utilized instead.
*/
(0, _react.useEffect)(() => {
if (!_UnitSdkManager.UnitSDK.isInitialized()) {
return;
}
if (_UnitSdkManager.UnitSDK.getSecuritySettings().snapshotProtectionStrategy == _securitySettings.UNSnapshotProtectionStrategy.None) {
return;
}
if (_reactNative.Platform.OS == 'android') {
_UNSnapshotProtectionHelper.default.setAndroidSecurity();
}
}, []);
};
exports.useSnapshotProtection = useSnapshotProtection;
//# sourceMappingURL=useSnapshotProtection.js.map