From 4714e2c5e1c734b3fba38033967d046badcc888b Mon Sep 17 00:00:00 2001 From: Overtorment Date: Tue, 18 May 2021 12:54:18 +0100 Subject: [PATCH] REF: sentry unique id --- App.js | 7 ------- blue_modules/analytics.js | 9 ++++++++- screen/settings/about.js | 24 ++++++++++++++++++------ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/App.js b/App.js index c7b52b801..4c8f510e8 100644 --- a/App.js +++ b/App.js @@ -21,7 +21,6 @@ import * as NavigationService from './NavigationService'; import { BlueTextCentered, BlueButton, SecondButton } from './BlueComponents'; import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; import { Chain } from './models/bitcoinUnits'; -import * as Sentry from '@sentry/react-native'; import OnAppLaunch from './class/on-app-launch'; import DeeplinkSchemaMatch from './class/deeplink-schema-match'; import loc from './loc'; @@ -41,12 +40,6 @@ const A = require('./blue_modules/analytics'); const eventEmitter = new NativeEventEmitter(NativeModules.EventEmitter); -if (process.env.NODE_ENV !== 'development') { - Sentry.init({ - dsn: 'https://23377936131848ca8003448a893cb622@sentry.io/1295736', - }); -} - const ClipboardContentType = Object.freeze({ BITCOIN: 'BITCOIN', LIGHTNING: 'LIGHTNING', diff --git a/blue_modules/analytics.js b/blue_modules/analytics.js index 9a8fd3417..08502da57 100644 --- a/blue_modules/analytics.js +++ b/blue_modules/analytics.js @@ -1,9 +1,16 @@ import * as Sentry from '@sentry/react-native'; import amplitude from 'amplitude-js'; -import { getVersion, getSystemName } from 'react-native-device-info'; +import { getVersion, getSystemName, getUniqueId } from 'react-native-device-info'; import { Platform } from 'react-native'; const BlueApp = require('../BlueApp'); +if (process.env.NODE_ENV !== 'development') { + Sentry.init({ + dsn: 'https://23377936131848ca8003448a893cb622@sentry.io/1295736', + }); + Sentry.setUser({ id: getUniqueId() }); +} + amplitude.getInstance().init('8b7cf19e8eea3cdcf16340f5fbf16330', null, { useNativeDeviceInfo: true, platform: getSystemName().toLocaleLowerCase().includes('mac') ? getSystemName() : Platform.OS, diff --git a/screen/settings/about.js b/screen/settings/about.js index a8e485ee8..f3c9adf5f 100644 --- a/screen/settings/about.js +++ b/screen/settings/about.js @@ -1,13 +1,15 @@ import React from 'react'; -import { TouchableOpacity, ScrollView, Linking, Image, View, Text, StyleSheet, useWindowDimensions, Platform } from 'react-native'; +import { TouchableOpacity, ScrollView, Linking, Image, View, Text, StyleSheet, useWindowDimensions } from 'react-native'; import { useNavigation, useTheme } from '@react-navigation/native'; import { Icon } from 'react-native-elements'; import { getApplicationName, getVersion, getBundleId, getBuildNumber, getUniqueId } from 'react-native-device-info'; import Rate, { AndroidMarket } from 'react-native-rate'; -import { BlueButton, BlueCard, BlueListItem, BlueSpacing20, BlueTextCentered, BlueCopyToClipboardButton } from '../../BlueComponents'; +import { BlueButton, BlueCard, BlueListItem, BlueSpacing20, BlueTextCentered } from '../../BlueComponents'; import navigationStyle from '../../components/navigationStyle'; import loc from '../../loc'; +import Clipboard from '@react-native-clipboard/clipboard'; +import * as Sentry from '@sentry/react-native'; const About = () => { const { navigate } = useNavigation(); @@ -18,6 +20,11 @@ const About = () => { justifyContent: 'center', alignItems: 'center', }, + copyToClipboardText: { + fontSize: 13, + fontWeight: '400', + color: '#68bbe1', + }, center: { justifyContent: 'center', alignItems: 'center', @@ -203,10 +210,15 @@ const About = () => { Unique ID: {getUniqueId()} - + { + const stringToCopy = 'user.id:' + getUniqueId(); + Sentry.captureMessage('copied unique id'); + Clipboard.setString(stringToCopy); + }} + > + {loc.transactions.details_copy} +