BlueWallet/blue_modules/analytics.js

45 lines
1,015 B
JavaScript
Raw Normal View History

2021-08-20 17:26:46 +01:00
import { getUniqueId } from 'react-native-device-info';
import Bugsnag from '@bugsnag/react-native';
const BlueApp = require('../BlueApp');
2021-08-20 17:26:46 +01:00
let userHasOptedOut = false;
2021-05-18 12:54:18 +01:00
if (process.env.NODE_ENV !== 'development') {
2021-08-20 17:26:46 +01:00
Bugsnag.start({
collectUserIp: false,
user: {
id: getUniqueId(),
},
onError: function (event) {
return !userHasOptedOut;
},
});
2021-05-18 12:54:18 +01:00
}
BlueApp.isDoNotTrackEnabled().then(value => {
2021-08-20 17:26:46 +01:00
if (value) userHasOptedOut = true;
});
const A = async event => {};
A.ENUM = {
INIT: 'INIT',
GOT_NONZERO_BALANCE: 'GOT_NONZERO_BALANCE',
2019-11-28 23:16:04 +00:00
GOT_ZERO_BALANCE: 'GOT_ZERO_BALANCE',
CREATED_WALLET: 'CREATED_WALLET',
CREATED_LIGHTNING_WALLET: 'CREATED_LIGHTNING_WALLET',
2019-11-28 23:16:04 +00:00
APP_UNSUSPENDED: 'APP_UNSUSPENDED',
NAVIGATED_TO_WALLETS_HODLHODL: 'NAVIGATED_TO_WALLETS_HODLHODL',
};
A.setOptOut = value => {
2021-08-20 17:26:46 +01:00
if (value) userHasOptedOut = true;
};
2021-09-13 14:08:49 +01:00
A.logError = errorString => {
console.error(errorString);
Bugsnag.notify(new Error(String(errorString)));
};
module.exports = A;