Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setUpWatchConnectivity = () => {
watch.getWatchReachability((err, watchIsReachable) => {
this.setState({ watchIsReachable });
});
watch.subscribeToWatchReachability((err, watchIsReachable) => {
if (!err) {
this.setState({ watchIsReachable });
if (watchIsReachable) {
this.sendTokenToWatch();
}
}
});
watch.getWatchState((err, watchState) => {
if (!err && watchState === 'Activated') {
this.sendTokenToWatch();
}
});
watch.subscribeToWatchState((err, watchState) => {
if (!err && watchState === 'Activated') {
this.sendTokenToWatch();
}
});
};