mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 18:00:17 +01:00
Merge pull request #5410 from BlueWallet/privacytsx
REF: Privacy from JS to TSX
This commit is contained in:
commit
2f6000c168
@ -1,21 +0,0 @@
|
||||
import { useContext, useEffect } from 'react';
|
||||
import Obscure from 'react-native-obscure';
|
||||
import { BlueStorageContext } from './storage-context';
|
||||
const Privacy = () => {
|
||||
const { isPrivacyBlurEnabled } = useContext(BlueStorageContext);
|
||||
|
||||
useEffect(() => {
|
||||
Privacy.disableBlur();
|
||||
}, [isPrivacyBlurEnabled]);
|
||||
|
||||
Privacy.enableBlur = () => {
|
||||
if (!isPrivacyBlurEnabled) return;
|
||||
Obscure.activateObscure();
|
||||
};
|
||||
|
||||
Privacy.disableBlur = () => {
|
||||
Obscure.deactivateObscure();
|
||||
};
|
||||
return null;
|
||||
};
|
||||
export default Privacy;
|
29
blue_modules/Privacy.android.tsx
Normal file
29
blue_modules/Privacy.android.tsx
Normal file
@ -0,0 +1,29 @@
|
||||
import { useContext, useEffect } from 'react';
|
||||
// @ts-ignore: react-native-obscure is not in the type definition
|
||||
import Obscure from 'react-native-obscure';
|
||||
import { BlueStorageContext } from './storage-context';
|
||||
interface PrivacyComponent extends React.FC {
|
||||
enableBlur: (isPrivacyBlurEnabled: boolean) => void;
|
||||
disableBlur: () => void;
|
||||
}
|
||||
|
||||
const Privacy: PrivacyComponent = () => {
|
||||
const { isPrivacyBlurEnabled } = useContext(BlueStorageContext);
|
||||
|
||||
useEffect(() => {
|
||||
Obscure.deactivateObscure();
|
||||
}, [isPrivacyBlurEnabled]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
Privacy.enableBlur = (isPrivacyBlurEnabled: boolean) => {
|
||||
if (!isPrivacyBlurEnabled) return;
|
||||
Obscure.activateObscure();
|
||||
};
|
||||
|
||||
Privacy.disableBlur = () => {
|
||||
Obscure.deactivateObscure();
|
||||
};
|
||||
|
||||
export default Privacy;
|
@ -1,22 +0,0 @@
|
||||
import { useContext, useEffect } from 'react';
|
||||
import { enabled } from 'react-native-privacy-snapshot';
|
||||
import { BlueStorageContext } from './storage-context';
|
||||
const Privacy = () => {
|
||||
const { isPrivacyBlurEnabled } = useContext(BlueStorageContext);
|
||||
|
||||
useEffect(() => {
|
||||
Privacy.disableBlur();
|
||||
}, [isPrivacyBlurEnabled]);
|
||||
|
||||
Privacy.enableBlur = () => {
|
||||
if (!isPrivacyBlurEnabled) return;
|
||||
enabled(true);
|
||||
};
|
||||
|
||||
Privacy.disableBlur = () => {
|
||||
enabled(false);
|
||||
};
|
||||
return null;
|
||||
};
|
||||
|
||||
export default Privacy;
|
30
blue_modules/Privacy.ios.tsx
Normal file
30
blue_modules/Privacy.ios.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
import { useContext, useEffect } from 'react';
|
||||
// @ts-ignore: react-native-obscure is not in the type definition
|
||||
import { enabled } from 'react-native-privacy-snapshot';
|
||||
import { BlueStorageContext } from './storage-context';
|
||||
|
||||
interface PrivacyComponent extends React.FC {
|
||||
enableBlur: (isPrivacyBlurEnabled: boolean) => void;
|
||||
disableBlur: () => void;
|
||||
}
|
||||
|
||||
const Privacy: PrivacyComponent = () => {
|
||||
const { isPrivacyBlurEnabled } = useContext(BlueStorageContext);
|
||||
|
||||
useEffect(() => {
|
||||
Privacy.disableBlur();
|
||||
}, [isPrivacyBlurEnabled]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
Privacy.enableBlur = (isPrivacyBlurEnabled: boolean) => {
|
||||
if (!isPrivacyBlurEnabled) return;
|
||||
enabled(true);
|
||||
};
|
||||
|
||||
Privacy.disableBlur = () => {
|
||||
enabled(false);
|
||||
};
|
||||
|
||||
export default Privacy;
|
@ -1,5 +0,0 @@
|
||||
export default class Privacy {
|
||||
static enableBlur() {}
|
||||
|
||||
static disableBlur() {}
|
||||
}
|
21
blue_modules/Privacy.tsx
Normal file
21
blue_modules/Privacy.tsx
Normal file
@ -0,0 +1,21 @@
|
||||
import React from 'react';
|
||||
|
||||
interface PrivacyComponent extends React.FC {
|
||||
enableBlur: () => void;
|
||||
disableBlur: () => void;
|
||||
}
|
||||
|
||||
const Privacy: PrivacyComponent = () => {
|
||||
// Define Privacy's behavior
|
||||
return null;
|
||||
};
|
||||
|
||||
Privacy.enableBlur = () => {
|
||||
// Define the enableBlur behavior
|
||||
};
|
||||
|
||||
Privacy.disableBlur = () => {
|
||||
// Define the disableBlur behavior
|
||||
};
|
||||
|
||||
export default Privacy;
|
Loading…
Reference in New Issue
Block a user