mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 18:00:17 +01:00
25 lines
643 B
JavaScript
25 lines
643 B
JavaScript
import { Platform } from 'react-native';
|
|
|
|
const BlueApp = require('../BlueApp');
|
|
|
|
export default class HandoffSettings {
|
|
static STORAGEKEY = 'HandOff';
|
|
|
|
static async isHandoffUseEnabled() {
|
|
if (Platform.OS !== 'ios') {
|
|
return false;
|
|
}
|
|
try {
|
|
const enabledHandoff = await BlueApp.getItem(HandoffSettings.STORAGEKEY);
|
|
return !!enabledHandoff;
|
|
} catch (_e) {
|
|
await BlueApp.setItem(HandoffSettings.STORAGEKEY, '');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static async setHandoffUseEnabled(value) {
|
|
await BlueApp.setItem(HandoffSettings.STORAGEKEY, value === true && Platform.OS === 'ios' ? '1' : '');
|
|
}
|
|
}
|