mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-20 14:05:27 +01:00
OPS: analytics fix
This commit is contained in:
parent
aebbc11fe9
commit
deea3a087a
8 changed files with 15 additions and 7 deletions
2
App.js
2
App.js
|
@ -13,6 +13,7 @@ import { Chain } from './models/bitcoinUnits';
|
|||
import QuickActions from 'react-native-quick-actions';
|
||||
import * as Sentry from '@sentry/react-native';
|
||||
import OnAppLaunch from './class/onAppLaunch';
|
||||
const A = require('./analytics');
|
||||
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
Sentry.init({
|
||||
|
@ -110,6 +111,7 @@ export default class App extends React.Component {
|
|||
_handleAppStateChange = async nextAppState => {
|
||||
if (BlueApp.getWallets().length > 0) {
|
||||
if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
|
||||
A(A.ENUM.APP_UNSUSPENDED);
|
||||
const clipboard = await Clipboard.getString();
|
||||
const isAddressFromStoredWallet = BlueApp.getWallets().some(wallet =>
|
||||
wallet.chain === Chain.ONCHAIN ? wallet.weOwnAddress(clipboard) : wallet.isInvoiceGeneratedByWallet(clipboard),
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* eslint react/prop-types: 0 */
|
||||
/** @type {AppStorage} */
|
||||
import React, { Component, useEffect, useState } from 'react';
|
||||
import Ionicons from 'react-native-vector-icons/Ionicons';
|
||||
import PropTypes from 'prop-types';
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
import amplitude from 'amplitude-js';
|
||||
import Analytics from 'appcenter-analytics';
|
||||
import { getVersion } from 'react-native-device-info';
|
||||
import { Platform } from 'react-native';
|
||||
|
||||
amplitude.getInstance().init('8b7cf19e8eea3cdcf16340f5fbf16330', null, {
|
||||
useNativeDeviceInfo: true,
|
||||
platform: Platform.OS,
|
||||
});
|
||||
amplitude.getInstance().setVersionName(getVersion());
|
||||
|
||||
let A = async event => {
|
||||
amplitude.getInstance().logEvent(event, {});
|
||||
|
@ -17,8 +21,10 @@ let A = async event => {
|
|||
A.ENUM = {
|
||||
INIT: 'INIT',
|
||||
GOT_NONZERO_BALANCE: 'GOT_NONZERO_BALANCE',
|
||||
GOT_ZERO_BALANCE: 'GOT_ZERO_BALANCE',
|
||||
CREATED_WALLET: 'CREATED_WALLET',
|
||||
CREATED_LIGHTNING_WALLET: 'CREATED_LIGHTNING_WALLET',
|
||||
APP_UNSUSPENDED: 'APP_UNSUSPENDED',
|
||||
};
|
||||
|
||||
module.exports = A;
|
||||
|
|
|
@ -455,7 +455,7 @@ export class AppStorage {
|
|||
getBalance() {
|
||||
let finalBalance = 0;
|
||||
for (let wal of this.wallets) {
|
||||
finalBalance += wal.balance;
|
||||
finalBalance += wal.getBalance();
|
||||
}
|
||||
return finalBalance;
|
||||
}
|
||||
|
|
1
index.js
1
index.js
|
@ -9,7 +9,6 @@ import App from './App';
|
|||
import LottieView from 'lottie-react-native';
|
||||
import UnlockWith from './UnlockWith.js';
|
||||
|
||||
/** @type {AppStorage} */
|
||||
const A = require('./analytics');
|
||||
|
||||
if (!Error.captureStackTrace) {
|
||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -1923,9 +1923,9 @@
|
|||
}
|
||||
},
|
||||
"amplitude-js": {
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/amplitude-js/-/amplitude-js-5.6.0.tgz",
|
||||
"integrity": "sha512-XGaM0sTvMOrVYqfHhkKEikjQ/SzhEGbupxYopcrzEpEuNLenSOIBMyB0JycBcFI1hTWR4rGJ2TDRqIeRMmUZvg==",
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://registry.npmjs.org/amplitude-js/-/amplitude-js-5.7.0.tgz",
|
||||
"integrity": "sha512-nKE5oJhfuGTxUlJje4XJ7hpRmCTkM1G4sKRvk9vFxo/SsgHZ2qofd9a5Bvk/OKO2N4P9RMyLRa0byJ9j6NIAeg==",
|
||||
"requires": {
|
||||
"@amplitude/ua-parser-js": "0.7.20",
|
||||
"blueimp-md5": "^2.10.0",
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
"@react-native-community/slider": "2.0.0-rc.1",
|
||||
"@remobile/react-native-qrcode-local-image": "git+https://github.com/BlueWallet/react-native-qrcode-local-image.git",
|
||||
"@sentry/react-native": "1.0.9",
|
||||
"amplitude-js": "5.6.0",
|
||||
"amplitude-js": "5.7.0",
|
||||
"appcenter": "2.6.0",
|
||||
"appcenter-analytics": "2.6.0",
|
||||
"appcenter-crashes": "2.6.0",
|
||||
|
|
|
@ -111,6 +111,8 @@ export default class WalletsList extends Component {
|
|||
console.log('wallets/list redrawScreen()');
|
||||
if (BlueApp.getBalance() !== 0) {
|
||||
A(A.ENUM.GOT_NONZERO_BALANCE);
|
||||
} else {
|
||||
A(A.ENUM.GOT_ZERO_BALANCE);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
|
|
Loading…
Add table
Reference in a new issue