From 2afb0ee980a474e6f7d199b7b713a8b7a0cfe1e8 Mon Sep 17 00:00:00 2001 From: hawkbee1 Date: Mon, 9 Oct 2023 20:27:53 +0200 Subject: [PATCH] transform log.i into Sentry.captureMessage --- lib/app/shared/dio_client/dio_client.dart | 5 +- lib/app/shared/dio_client/logging.dart | 6 +- .../helper_functions/helper_functions.dart | 11 +- lib/app/shared/issuer/check_issuer.dart | 7 +- lib/app/shared/local_auth/local_auth_api.dart | 3 +- .../shared/m_web3_client/m_web3_client.dart | 47 ++++---- lib/app/shared/widget/base/markdown_page.dart | 4 +- lib/app/shared/widget/display_terms.dart | 6 +- .../widget/m_webview/view/m_webview_page.dart | 11 +- .../beacon/cubit/beacon_cubit.dart | 11 +- .../repository/connected_dapp_repository.dart | 14 ++- .../cubit/wallet_connect_cubit.dart | 107 +++++++++--------- lib/credentials/cubit/credentials_cubit.dart | 9 +- .../cubit/credentials_helper_function.dart | 34 +++--- .../cubit/import_account_cubit.dart | 5 +- .../verify_age/cubit/camera_cubit.dart | 2 - .../cubit/confirm_connection_cubit.dart | 14 ++- .../cubit/connected_dapps_cubit.dart | 15 +-- .../operation/cubit/operation_cubit.dart | 59 +++++----- .../connection/rights/cubit/rights_cubit.dart | 7 +- .../cubit/sign_payload_cubit.dart | 21 ++-- .../cubit/generate_linkedin_qr_cubit.dart | 3 +- .../view/generate_linkedin_qr_page.dart | 3 +- .../home/tab_bar/nft/cubit/nft_cubit.dart | 11 +- .../confirm_token_transaction_cubit.dart | 4 - .../cubit/send_receive_home_cubit.dart | 4 - .../profile/cubit/profile_cubit.dart | 9 +- .../cubit/qr_code_scan_cubit.dart | 35 +++--- .../self_issued_credential_button_cubit.dart | 13 ++- lib/dashboard/wert/cubit/wert_cubit.dart | 3 +- lib/dashboard/wert/view/wert_page.dart | 15 +-- lib/did/cubit/did_cubit.dart | 5 +- .../cubit/import_wallet_cubit.dart | 7 +- .../cubit/onboarding_gen_phrase_cubit.dart | 5 +- .../cubit/submit_enterprise_user_cubit.dart | 5 +- .../cubit/onboarding_verify_phrase_cubit.dart | 5 +- lib/polygon_id/cubit/polygon_id_cubit.dart | 40 +++---- lib/route/cubit/route_cubit.dart | 3 +- lib/scan/cubit/scan_cubit.dart | 29 +++-- lib/splash/bloclisteners/blocklisteners.dart | 7 +- .../helper_function/is_wallet_created.dart | 7 +- lib/splash/view/splash_page.dart | 15 +-- lib/wallet/cubit/wallet_cubit.dart | 15 +-- 43 files changed, 336 insertions(+), 305 deletions(-) diff --git a/lib/app/shared/dio_client/dio_client.dart b/lib/app/shared/dio_client/dio_client.dart index 13e966299..d8dd62214 100644 --- a/lib/app/shared/dio_client/dio_client.dart +++ b/lib/app/shared/dio_client/dio_client.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'package:altme/app/app.dart'; import 'package:dio/dio.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'logging.dart'; const _defaultConnectTimeout = Duration(minutes: 1); @@ -61,7 +62,7 @@ class DioClient { cancelToken: cancelToken, onReceiveProgress: onReceiveProgress, ); - log.i('Time - ${stopwatch.elapsed}'); + Sentry.captureMessage('Time - ${stopwatch.elapsed}'); return response.data; } on FormatException catch (_) { throw ResponseMessage( @@ -128,7 +129,7 @@ class DioClient { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); - log.i('Time - ${stopwatch.elapsed}'); + Sentry.captureMessage('Time - ${stopwatch.elapsed}'); return response.data; } on FormatException catch (_) { throw ResponseMessage( diff --git a/lib/app/shared/dio_client/logging.dart b/lib/app/shared/dio_client/logging.dart index 92c489b94..cd99dd5ec 100644 --- a/lib/app/shared/dio_client/logging.dart +++ b/lib/app/shared/dio_client/logging.dart @@ -5,7 +5,7 @@ class Logging extends Interceptor { @override void onRequest(RequestOptions options, RequestInterceptorHandler handler) { - log.i('REQUEST[${options.method}] => PATH: ${options.uri}'); + Sentry.captureMessage('REQUEST[${options.method}] => PATH: ${options.uri}'); return super.onRequest(options, handler); } @@ -14,7 +14,7 @@ class Logging extends Interceptor { Response response, ResponseInterceptorHandler handler, ) { - log.i( + Sentry.captureMessage( '''RESPONSE[${response.statusCode}] => PATH: ${response.requestOptions.path} => data: ${jsonEncode(response.data)}''', ); return super.onResponse(response, handler); @@ -22,7 +22,7 @@ class Logging extends Interceptor { @override void onError(DioException err, ErrorInterceptorHandler handler) { - log.e( + Sentry.captureMessage( 'ERROR[${err.response?.statusCode}] TYPE[${err.type}],=> PATH:' ' ${err.requestOptions.path} data: ${err.response?.data}', ); diff --git a/lib/app/shared/helper_functions/helper_functions.dart b/lib/app/shared/helper_functions/helper_functions.dart index 5714cf80a..ee4580e70 100644 --- a/lib/app/shared/helper_functions/helper_functions.dart +++ b/lib/app/shared/helper_functions/helper_functions.dart @@ -23,6 +23,7 @@ import 'package:key_generator/key_generator.dart'; import 'package:oidc4vc/oidc4vc.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; String generateDefaultAccountName( int accountIndex, @@ -112,7 +113,7 @@ Future isConnected() async { connectivityResult == ConnectivityResult.wifi) { return true; } - log.e('No Internet Connection'); + Sentry.captureMessage('No Internet Connection'); return false; } @@ -332,7 +333,9 @@ Map decodePayload({ final payload = jwtDecode.parseJwt(token); data = payload; } catch (e, s) { - log.e('An error occurred while decoding.', error: e, stackTrace: s); + Sentry.captureMessage( + 'An error occurred while decoding.', + ); } return data; } @@ -348,7 +351,9 @@ Map decodeHeader({ final header = jwtDecode.parseJwtHeader(token); data = header; } catch (e, s) { - log.e('An error occurred while decoding.', error: e, stackTrace: s); + Sentry.captureMessage( + 'An error occurred while decoding.', + ); } return data; } diff --git a/lib/app/shared/issuer/check_issuer.dart b/lib/app/shared/issuer/check_issuer.dart index 7b4851735..82d45f809 100644 --- a/lib/app/shared/issuer/check_issuer.dart +++ b/lib/app/shared/issuer/check_issuer.dart @@ -1,5 +1,6 @@ import 'package:altme/app/app.dart'; import 'package:altme/app/shared/issuer/models/organization_info.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; class CheckIssuer { CheckIssuer( @@ -18,7 +19,7 @@ class CheckIssuer { didToTest = getIssuerDid(uriToCheck: uriToCheck); if (checkIssuerServerUrl == Urls.checkIssuerEbsiUrl && !didToTest.startsWith('did:ebsi')) { - log.i('did:ebsi issuer'); + Sentry.captureMessage('did:ebsi issuer'); return Issuer.emptyIssuer(uriToCheck.host); } @@ -27,7 +28,7 @@ class CheckIssuer { } try { - log.i('fetching issuer data'); + Sentry.captureMessage('fetching issuer data'); final dynamic response = await client.get('$checkIssuerServerUrl/$didToTest'); if (checkIssuerServerUrl == Urls.checkIssuerEbsiUrl) { @@ -53,7 +54,7 @@ class CheckIssuer { return Issuer.emptyIssuer(uriToCheck.host); } catch (e) { - log.e('error $e'); + Sentry.captureMessage('error $e'); if (e is NetworkException) { if (e.message == NetworkError.NETWORK_ERROR_NOT_FOUND) { return Issuer.emptyIssuer(uriToCheck.toString()); diff --git a/lib/app/shared/local_auth/local_auth_api.dart b/lib/app/shared/local_auth/local_auth_api.dart index 36b0f83cc..dbfaf9cbc 100644 --- a/lib/app/shared/local_auth/local_auth_api.dart +++ b/lib/app/shared/local_auth/local_auth_api.dart @@ -1,6 +1,7 @@ import 'package:altme/app/app.dart'; import 'package:flutter/services.dart'; import 'package:local_auth/local_auth.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; class LocalAuthApi { factory LocalAuthApi() { @@ -45,7 +46,7 @@ class LocalAuthApi { ), ); } on PlatformException catch (e, s) { - log.e('${e.message} stack: $s'); + Sentry.captureMessage('${e.message} stack: $s'); return false; } } diff --git a/lib/app/shared/m_web3_client/m_web3_client.dart b/lib/app/shared/m_web3_client/m_web3_client.dart index 52dd115ed..635688691 100644 --- a/lib/app/shared/m_web3_client/m_web3_client.dart +++ b/lib/app/shared/m_web3_client/m_web3_client.dart @@ -3,6 +3,7 @@ import 'package:altme/dashboard/dashboard.dart'; import 'package:flutter/services.dart'; import 'package:http/http.dart' as http; import 'package:http/http.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:web3dart/crypto.dart'; import 'package:web3dart/json_rpc.dart'; import 'package:web3dart/web3dart.dart'; @@ -21,7 +22,7 @@ class MWeb3Client { final balance = await ethClient.getBalance(credentials.address); final balanceInUnit = balance.getValueInUnit(EtherUnit.ether); - log.i('ETH balance in unit: $balanceInUnit'); + Sentry.captureMessage('ETH balance in unit: $balanceInUnit'); return balanceInUnit; } @@ -63,7 +64,7 @@ class MWeb3Client { transaction, chainId: chainId, ); - log.i('Transaction sent: $result'); + Sentry.captureMessage('Transaction sent: $result'); } static double formatEthAmount({ @@ -178,7 +179,7 @@ class MWeb3Client { BigInt.from(amountInWei), //amount bytes, //bytes ]; - log.i('ERC1155 bytes : $bytes'); + Sentry.captureMessage('ERC1155 bytes : $bytes'); } // // listen for the Transfer event when it's emitted by the contract above @@ -195,8 +196,8 @@ class MWeb3Client { // final to = decoded[1] as EthereumAddress; // final value = decoded[2] as BigInt; - // log.i('decoded response: $decoded'); - // log.i('$from sent $value ${token.name} to $to'); + // Sentry.captureMessage('decoded response: $decoded'); + // Sentry.captureMessage('$from sent $value ${token.name} to $to'); // }); try { @@ -206,9 +207,9 @@ class MWeb3Client { function: balanceFunction, params: balanceFunctionParams, ); - log.i('We have ${balance.first} ${token.name}'); + Sentry.captureMessage('We have ${balance.first} ${token.name}'); } catch (e, s) { - log.e('error in the token balance e: $e, s: $s'); + Sentry.captureMessage('error in the token balance e: $e, s: $s'); } final txId = await client.sendTransaction( @@ -228,7 +229,7 @@ class MWeb3Client { await client.dispose(); return txId; } catch (e, s) { - log.e('sendToken() error: $e , stack: $s'); + Sentry.captureMessage('sendToken() error: $e , stack: $s'); if (e is RPCError) rethrow; return null; } @@ -241,17 +242,17 @@ class MWeb3Client { required EtherAmount amount, String? data, }) async { - log.i('estimateEthereumFee'); + Sentry.captureMessage('estimateEthereumFee'); late EtherAmount gasPrice = EtherAmount.inWei(BigInt.one); try { final Web3Client web3Client = Web3Client(web3RpcURL, http.Client()); gasPrice = await web3Client.getGasPrice(); - log.i('from: ${sender.hex}'); - log.i('to: ${reciever.hex}'); - log.i('gasPrice: ${gasPrice.getInWei}'); - log.i('value: ${amount.getInWei}'); - log.i('data: $data'); + Sentry.captureMessage('from: ${sender.hex}'); + Sentry.captureMessage('to: ${reciever.hex}'); + Sentry.captureMessage('gasPrice: ${gasPrice.getInWei}'); + Sentry.captureMessage('value: ${amount.getInWei}'); + Sentry.captureMessage('data: $data'); final BigInt maxGas = await web3Client.estimateGas( sender: sender, @@ -260,15 +261,15 @@ class MWeb3Client { gasPrice: gasPrice, data: data != null ? hexToBytes(data) : null, ); - log.i('maxGas - $maxGas'); + Sentry.captureMessage('maxGas - $maxGas'); final fee = maxGas * gasPrice.getInWei; - log.i('maxGas * gasPrice.getInWei = $fee'); + Sentry.captureMessage('maxGas * gasPrice.getInWei = $fee'); return fee; } catch (e, s) { - log.e('e: $e, s: $s'); + Sentry.captureMessage('e: $e, s: $s'); final fee = BigInt.from(21000) * gasPrice.getInWei; - log.i('2100 * gasPrice.getInWei = $fee'); + Sentry.captureMessage('2100 * gasPrice.getInWei = $fee'); return fee; } } @@ -283,7 +284,7 @@ class MWeb3Client { BigInt? gas, String? data, }) async { - log.i('sendEthereumTransaction'); + Sentry.captureMessage('sendEthereumTransaction'); final Web3Client web3Client = Web3Client(web3RpcURL, http.Client()); final int nonce = await web3Client.getTransactionCount(sender); final EtherAmount gasPrice = await web3Client.getGasPrice(); @@ -308,9 +309,9 @@ class MWeb3Client { maxGas: maxGas.toInt(), ); - log.i('nonce: $nonce'); - log.i('maxGas: ${maxGas.toInt()}'); - log.i('chainId: $chainId'); + Sentry.captureMessage('nonce: $nonce'); + Sentry.captureMessage('maxGas: ${maxGas.toInt()}'); + Sentry.captureMessage('chainId: $chainId'); final transactionHash = await web3Client.sendTransaction( credentials, @@ -318,7 +319,7 @@ class MWeb3Client { chainId: chainId, ); - log.i('transactionHash - $transactionHash'); + Sentry.captureMessage('transactionHash - $transactionHash'); return transactionHash; } } diff --git a/lib/app/shared/widget/base/markdown_page.dart b/lib/app/shared/widget/base/markdown_page.dart index c8c7306f2..5e639eec5 100644 --- a/lib/app/shared/widget/base/markdown_page.dart +++ b/lib/app/shared/widget/base/markdown_page.dart @@ -3,6 +3,7 @@ import 'package:altme/theme/theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; class MarkdownPage extends StatelessWidget { MarkdownPage({super.key, required this.title, required this.file}); @@ -46,9 +47,8 @@ class MarkdownPage extends StatelessWidget { } if (snapshot.error != null) { - log.e( + Sentry.captureMessage( 'something went wrong when loading $file', - error: snapshot.error, ); return Container(); } diff --git a/lib/app/shared/widget/display_terms.dart b/lib/app/shared/widget/display_terms.dart index 8cb53e93b..569c015d4 100644 --- a/lib/app/shared/widget/display_terms.dart +++ b/lib/app/shared/widget/display_terms.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; class DisplayTermsOfUseCubit extends Cubit { DisplayTermsOfUseCubit() : super(false); @@ -115,9 +116,8 @@ class _DisplayTermsofUseState extends State { } if (snapshot.error != null) { - log.e( - 'something went wrong when loading privacy file', - error: snapshot.error, + Sentry.captureMessage( + snapshot.error.toString(), ); return const SizedBox.shrink(); } diff --git a/lib/app/shared/widget/m_webview/view/m_webview_page.dart b/lib/app/shared/widget/m_webview/view/m_webview_page.dart index 4d3010f6f..80e426e4c 100644 --- a/lib/app/shared/widget/m_webview/view/m_webview_page.dart +++ b/lib/app/shared/widget/m_webview/view/m_webview_page.dart @@ -3,6 +3,7 @@ import 'dart:typed_data'; import 'package:altme/app/app.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter_android/webview_flutter_android.dart'; import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart'; @@ -83,21 +84,21 @@ class _MWebViewState extends State ..setNavigationDelegate( NavigationDelegate( onProgress: (int progress) { - log.i('WebView is loading (progress : $progress%)'); + Sentry.captureMessage('WebView is loading (progress : $progress%)'); if (progress == 100) { mWebViewCubit.setLoading(isLoading: false); } }, onPageStarted: (String url) { - log.i('Page started loading: $url'); + Sentry.captureMessage('Page started loading: $url'); mWebViewCubit.setLoading(isLoading: true); }, onPageFinished: (String url) { - log.i('Page finished loading: $url'); + Sentry.captureMessage('Page finished loading: $url'); }, onWebResourceError: (WebResourceError error) { mWebViewCubit.setLoading(isLoading: false); - log.i(''' + Sentry.captureMessage(''' Page resource error: code: ${error.errorCode} description: ${error.description} @@ -106,7 +107,7 @@ class _MWebViewState extends State '''); }, onNavigationRequest: (NavigationRequest request) { - log.i('navigate - ${request.url}'); + Sentry.captureMessage('navigate - ${request.url}'); if (widget.onNavigationRequest != null) { return widget.onNavigationRequest!.call(request); } else { diff --git a/lib/connection_bridge/beacon/cubit/beacon_cubit.dart b/lib/connection_bridge/beacon/cubit/beacon_cubit.dart index 571762473..ce289a1ea 100644 --- a/lib/connection_bridge/beacon/cubit/beacon_cubit.dart +++ b/lib/connection_bridge/beacon/cubit/beacon_cubit.dart @@ -5,6 +5,7 @@ import 'package:beacon_flutter/beacon_flutter.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'beacon_cubit.g.dart'; part 'beacon_state.dart'; @@ -19,7 +20,7 @@ class BeaconCubit extends Cubit { Future startBeacon() async { await beacon.startBeacon(walletName: 'Altme'); if (state.isBeaconStarted) return; - log.i('beacon started'); + await Sentry.captureMessage('beacon started'); emit(state.copyWith(isBeaconStarted: true)); Future.delayed(const Duration(seconds: 1), listenToBeacon); } @@ -33,7 +34,7 @@ class BeaconCubit extends Cubit { void listenToBeacon() { try { - log.i('listening to beacon'); + Sentry.captureMessage('listening to beacon'); beacon.getBeaconResponse().listen( (data) { final Map requestJson = @@ -41,8 +42,8 @@ class BeaconCubit extends Cubit { final BeaconRequest beaconRequest = BeaconRequest.fromJson(requestJson); - log.i('beacon response - $requestJson'); - log.i('beaconRequest.type - ${beaconRequest.type}'); + Sentry.captureMessage('beacon response - $requestJson'); + Sentry.captureMessage('beaconRequest.type - ${beaconRequest.type}'); switch (beaconRequest.type) { case RequestType.permission: emit( @@ -82,7 +83,7 @@ class BeaconCubit extends Cubit { }, ); } catch (e) { - log.e('beacon listening error - $e'); + Sentry.captureMessage('beacon listening error - $e'); } } } diff --git a/lib/connection_bridge/repository/connected_dapp_repository.dart b/lib/connection_bridge/repository/connected_dapp_repository.dart index cc55a5252..c34799874 100644 --- a/lib/connection_bridge/repository/connected_dapp_repository.dart +++ b/lib/connection_bridge/repository/connected_dapp_repository.dart @@ -4,6 +4,7 @@ import 'package:altme/app/app.dart'; import 'package:altme/connection_bridge/connection_bridge.dart'; import 'package:beacon_flutter/beacon_flutter.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; class ConnectedDappRepository { ConnectedDappRepository(SecureStorageProvider secureStorageProvider) @@ -14,7 +15,7 @@ class ConnectedDappRepository { final log = getLogger('ConnectedDappRepository'); Future> findAll(/* dynamic filters */) async { - log.i('fetching all '); + Sentry.captureMessage('fetching all '); try { final data = await _secureStorageProvider.getAllValues(); data.removeWhere( @@ -38,7 +39,7 @@ class ConnectedDappRepository { } Future findBeaconDappsByPublicKey(String publicKey) async { - log.i('findByPublicKey'); + Sentry.captureMessage('findByPublicKey'); final String? data = await _secureStorageProvider .get('${SecureStorageKeys.savedDaaps}/$publicKey'); if (data == null) { @@ -50,7 +51,7 @@ class ConnectedDappRepository { } Future deleteAll() async { - log.i('deleting all connected dapps'); + Sentry.captureMessage('deleting all connected dapps'); final data = await _secureStorageProvider.getAllValues(); data.removeWhere( (key, value) => !key.startsWith('${SecureStorageKeys.savedDaaps}/'), @@ -72,7 +73,8 @@ class ConnectedDappRepository { id = savedDappData.sessionData!.pairingTopic; } - log.i('deleteing dapp data - ${SecureStorageKeys.savedDaaps}/$id'); + Sentry.captureMessage( + 'deleteing dapp data - ${SecureStorageKeys.savedDaaps}/$id'); await _secureStorageProvider.delete('${SecureStorageKeys.savedDaaps}/$id'); return true; } @@ -93,7 +95,7 @@ class ConnectedDappRepository { } } - log.i('saving dapp Data'); + Sentry.captureMessage('saving dapp Data'); late String id; if (savedDappData.walletAddress != null) { @@ -110,7 +112,7 @@ class ConnectedDappRepository { } // Future update(SavedDappData savedPeerData) async { - // log.i('updating data'); + // Sentry.captureMessage('updating data'); // await _secureStorageProvider.set( // '${SecureStorageKeys.savedDaaps}/${savedPeerData.peer!.publicKey}', // json.encode(savedPeerData.toJson()), diff --git a/lib/connection_bridge/wallet_connect/cubit/wallet_connect_cubit.dart b/lib/connection_bridge/wallet_connect/cubit/wallet_connect_cubit.dart index 4abb2c721..c5efa5b68 100644 --- a/lib/connection_bridge/wallet_connect/cubit/wallet_connect_cubit.dart +++ b/lib/connection_bridge/wallet_connect/cubit/wallet_connect_cubit.dart @@ -11,6 +11,7 @@ import 'package:equatable/equatable.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart'; import 'package:web3dart/web3dart.dart'; @@ -43,7 +44,7 @@ class WalletConnectCubit extends Cubit { final String? savedCryptoAccount = await secureStorageProvider.get(SecureStorageKeys.cryptoAccount); - log.i('Create the web3wallet'); + Sentry.captureMessage('Create the web3wallet'); await dotenv.load(); final projectId = dotenv.get('WALLET_CONNECT_PROJECT_ID'); _web3Wallet = await Web3Wallet.createInstance( @@ -58,7 +59,7 @@ class WalletConnectCubit extends Cubit { ), ); - log.i('Setup our accounts'); + Sentry.captureMessage('Setup our accounts'); if (savedCryptoAccount != null && savedCryptoAccount.isNotEmpty) { //load all the content of walletAddress @@ -71,7 +72,7 @@ class WalletConnectCubit extends Cubit { .where((e) => e.blockchainType != BlockchainType.tezos) .toList(); - log.i('registering acconts'); + Sentry.captureMessage('registering acconts'); for (final evm in eVMAccounts) { _web3Wallet!.registerAccount( chainId: evm.blockchainType.chain, @@ -80,7 +81,7 @@ class WalletConnectCubit extends Cubit { } } - log.i('Setup our listeners'); + Sentry.captureMessage('Setup our listeners'); _web3Wallet!.core.pairing.onPairingInvalid.subscribe(_onPairingInvalid); _web3Wallet!.core.pairing.onPairingCreate.subscribe(_onPairingCreate); _web3Wallet!.pairings.onSync.subscribe(_onPairingsSync); @@ -95,27 +96,27 @@ class WalletConnectCubit extends Cubit { if (blockchainType == BlockchainType.tezos) { continue; } - log.i(blockchainType); - log.i('registerEventEmitter'); + Sentry.captureMessage(blockchainType.toString()); + Sentry.captureMessage('registerEventEmitter'); registerEventEmitter(blockchainType.chain); - log.i('registerRequestHandler'); + Sentry.captureMessage('registerRequestHandler'); registerRequestHandler(blockchainType.chain); } - log.i('web3wallet init'); + Sentry.captureMessage('web3wallet init'); await _web3Wallet!.init(); - log.i('metadata'); - log.i(_web3Wallet!.metadata); - - log.i('pairings'); - log.i(_web3Wallet!.pairings.getAll()); - log.i('sessions'); - log.i(_web3Wallet!.sessions.getAll()); - log.i('completeRequests'); - log.i(_web3Wallet!.completeRequests.getAll()); + Sentry.captureMessage('metadata'); + Sentry.captureMessage(_web3Wallet!.metadata.toString()); + + Sentry.captureMessage('pairings'); + Sentry.captureMessage(_web3Wallet!.pairings.getAll().toString()); + Sentry.captureMessage('sessions'); + Sentry.captureMessage(_web3Wallet!.sessions.getAll().toString()); + Sentry.captureMessage('completeRequests'); + Sentry.captureMessage(_web3Wallet!.completeRequests.getAll().toString()); } catch (e) { - log.e(e); + Sentry.captureMessage(e.toString()); } } @@ -162,31 +163,31 @@ class WalletConnectCubit extends Cubit { } Future connect(String walletConnectUri) async { - log.i('walletConnectUri - $walletConnectUri'); + Sentry.captureMessage('walletConnectUri - $walletConnectUri'); final Uri uriData = Uri.parse(walletConnectUri); final PairingInfo pairingInfo = await _web3Wallet!.pair( uri: uriData, ); - log.i(pairingInfo); + Sentry.captureMessage(pairingInfo.toString()); } void _onPairingInvalid(PairingInvalidEvent? args) { - log.i('Pairing Invalid Event: $args'); + Sentry.captureMessage('Pairing Invalid Event: $args'); } void _onPairingsSync(StoreSyncEvent? args) { if (args != null) { //pairings.value = _web3Wallet!.pairings.getAll(); - log.i('onPairingsSync'); - log.i(_web3Wallet!.pairings.getAll()); + Sentry.captureMessage('onPairingsSync'); + Sentry.captureMessage(_web3Wallet!.pairings.getAll().toString()); } } void _onSessionProposal(SessionProposalEvent? args) { - log.i('onSessionProposal'); + Sentry.captureMessage('onSessionProposal'); if (args != null) { - log.i('sessionProposalEvent - $args'); + Sentry.captureMessage('sessionProposalEvent - $args'); emit( state.copyWith( status: WalletConnectStatus.permission, @@ -197,8 +198,8 @@ class WalletConnectCubit extends Cubit { } void _onSessionProposalError(SessionProposalErrorEvent? args) { - log.i('onSessionProposalError'); - log.i(args); + Sentry.captureMessage('onSessionProposalError'); + Sentry.captureMessage(args.toString()); final requiredChains = args?.requiredNamespaces['eip155']?.chains; if (requiredChains != null && requiredChains.isNotEmpty) { @@ -243,25 +244,25 @@ class WalletConnectCubit extends Cubit { void _onSessionConnect(SessionConnect? args) { if (args != null) { - log.i(args); + Sentry.captureMessage(args.toString()); //sessions.value.add(args.session); final savedDappData = SavedDappData( sessionData: args.session, ); - log.i(savedDappData.toJson()); + Sentry.captureMessage(savedDappData.toString()); connectedDappRepository.insert(savedDappData); } } void _onPairingCreate(PairingEvent? args) { - log.i('Pairing Create Event: $args'); + Sentry.captureMessage('Pairing Create Event: $args'); } Future _onAuthRequest(AuthRequest? args) async { if (args != null) { - log.i(args); + Sentry.captureMessage(args.toString()); // List chainKeys = GetIt.I().getKeysForChain( // 'eip155:1', // ); @@ -331,7 +332,7 @@ class WalletConnectCubit extends Cubit { double counter = 0; Timer.periodic(const Duration(milliseconds: 500), (timer) async { counter = counter + 0.5; - log.i('counter: $counter'); + Sentry.captureMessage('counter: $counter'); final String currenRouteName = routeCubit.state ?? ''; if (currenRouteName != CONFIRM_CONNECTION_PAGE) { @@ -344,10 +345,10 @@ class WalletConnectCubit extends Cubit { } Future personalSignAction(String topic, dynamic parameters) async { - log.i('received personal sign request: $parameters'); - log.i('topic: $topic'); + Sentry.captureMessage('received personal sign request: $parameters'); + Sentry.captureMessage('topic: $topic'); - log.i('completer initialise'); + Sentry.captureMessage('completer initialise'); completer.add(Completer()); emit( @@ -360,15 +361,15 @@ class WalletConnectCubit extends Cubit { ); final String result = await completer[completer.length - 1]!.future; - log.i('complete - $result'); + Sentry.captureMessage('complete - $result'); completer.removeLast(); return result; } Future ethSign(String topic, dynamic parameters) async { - log.i('received eth sign request: $parameters'); + Sentry.captureMessage('received eth sign request: $parameters'); - log.i('completer initialise'); + Sentry.captureMessage('completer initialise'); completer.add(Completer()); emit( @@ -381,15 +382,15 @@ class WalletConnectCubit extends Cubit { ); final String result = await completer[completer.length - 1]!.future; - log.i('complete - $result'); + Sentry.captureMessage('complete - $result'); completer.removeLast(); return result; } Future ethSignTransaction(String topic, dynamic parameters) async { - log.i('received eth sign transaction request: $parameters'); + Sentry.captureMessage('received eth sign transaction request: $parameters'); - log.i('completer initialise'); + Sentry.captureMessage('completer initialise'); completer.add(Completer()); final transaction = getTransaction(parameters); @@ -405,15 +406,15 @@ class WalletConnectCubit extends Cubit { ); final String result = await completer[completer.length - 1]!.future; - log.i('complete - $result'); + Sentry.captureMessage('complete - $result'); completer.removeLast(); return result; } Future ethSendTransaction(String topic, dynamic parameters) async { - log.i('received eth send transaction request: $parameters'); + Sentry.captureMessage('received eth send transaction request: $parameters'); - log.i('completer initialise'); + Sentry.captureMessage('completer initialise'); completer.add(Completer()); final Transaction transaction = getTransaction(parameters); @@ -429,15 +430,15 @@ class WalletConnectCubit extends Cubit { ); final String result = await completer[completer.length - 1]!.future; - log.i('complete - $result'); + Sentry.captureMessage('complete - $result'); completer.removeLast(); return result; } Future ethSignTypedData(String topic, dynamic parameters) async { - log.i('received eth sign typed data request: $parameters'); + Sentry.captureMessage('received eth sign typed data request: $parameters'); - log.i('completer initialise'); + Sentry.captureMessage('completer initialise'); completer.add(Completer()); emit( @@ -450,15 +451,15 @@ class WalletConnectCubit extends Cubit { ); final String result = await completer[completer.length - 1]!.future; - log.i('complete - $result'); + Sentry.captureMessage('complete - $result'); completer.removeLast(); return result; } Future ethSignTypedDataV4(String topic, dynamic parameters) async { - log.i('received eth sign typed data request: $parameters'); + Sentry.captureMessage('received eth sign typed data request: $parameters'); - log.i('completer initialise'); + Sentry.captureMessage('completer initialise'); completer.add(Completer()); emit( @@ -471,7 +472,7 @@ class WalletConnectCubit extends Cubit { ); final String result = await completer[completer.length - 1]!.future; - log.i('complete - $result'); + Sentry.captureMessage('complete - $result'); completer.removeLast(); return result; } @@ -531,7 +532,7 @@ class WalletConnectCubit extends Cubit { } Future disconnectSession(String topic) async { - log.i('disconnectSession: $topic'); + Sentry.captureMessage('disconnectSession: $topic'); await _web3Wallet!.disconnectSession( topic: topic, reason: Errors.getSdkError(Errors.USER_DISCONNECTED), @@ -539,7 +540,7 @@ class WalletConnectCubit extends Cubit { } Future dispose() async { - log.i('web3wallet dispose'); + Sentry.captureMessage('web3wallet dispose'); _web3Wallet!.core.pairing.onPairingInvalid.unsubscribe(_onPairingInvalid); _web3Wallet!.pairings.onSync.unsubscribe(_onPairingsSync); _web3Wallet!.onSessionProposal.unsubscribe(_onSessionProposal); diff --git a/lib/credentials/cubit/credentials_cubit.dart b/lib/credentials/cubit/credentials_cubit.dart index a7223309f..c073cc7b1 100644 --- a/lib/credentials/cubit/credentials_cubit.dart +++ b/lib/credentials/cubit/credentials_cubit.dart @@ -17,6 +17,7 @@ import 'package:key_generator/key_generator.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uuid/uuid.dart'; part 'credentials_helper_function.dart'; @@ -49,7 +50,8 @@ class CredentialsCubit extends Cubit { final String? ssiKey = await secureStorageProvider.get(SecureStorageKeys.ssiKey); if (ssiKey == null || ssiKey.isEmpty) { - log.i('can not load all credentials beacuse there is no ssi key'); + Sentry.captureMessage( + 'can not load all credentials beacuse there is no ssi key'); return; } emit(state.copyWith(status: CredentialsStatus.loading)); @@ -94,7 +96,8 @@ class CredentialsCubit extends Cubit { dummyCredentials: dummies, ), ); - log.i('credentials loaded from repository - ${savedCredentials.length}'); + Sentry.captureMessage( + 'credentials loaded from repository - ${savedCredentials.length}'); await addRequiredCredentials(ssiKey: ssiKey); } @@ -112,7 +115,7 @@ class CredentialsCubit extends Cubit { didCubit: didCubit, ); if (walletCredential != null) { - log.i('CredentialSubjectType.walletCredential added'); + Sentry.captureMessage('CredentialSubjectType.walletCredential added'); await insertCredential( credential: walletCredential, showMessage: false, diff --git a/lib/credentials/cubit/credentials_helper_function.dart b/lib/credentials/cubit/credentials_helper_function.dart index 1f8030ebe..2891c0dd3 100644 --- a/lib/credentials/cubit/credentials_helper_function.dart +++ b/lib/credentials/cubit/credentials_helper_function.dart @@ -11,7 +11,7 @@ Future generateAssociatedWalletCredential({ }) async { final log = getLogger('CredentialsCubit - generateAssociatedWalletCredential'); - log.i(blockchainType); + Sentry.captureMessage(blockchainType.toString()); try { late String didMethod; @@ -32,14 +32,14 @@ Future generateAssociatedWalletCredential({ ); final issuer = didKitProvider.keyToDID(didMethod, jwkKey); - log.i('didMethod - $didMethod'); - log.i('jwkKey - $jwkKey'); - log.i('didKitProvider.keyToDID - $issuer'); + Sentry.captureMessage('didMethod - $didMethod'); + Sentry.captureMessage('jwkKey - $jwkKey'); + Sentry.captureMessage('didKitProvider.keyToDID - $issuer'); //Issue: https://github.com/spruceid/didkit/issues/329 // final verificationMethod = // await didKitProvider.keyToVerificationMethod(didMethod, jwkKey); - //log.i('didKitProvider.keyToVerificationMethod - $verificationMethod'); + //Sentry.captureMessage('didKitProvider.keyToVerificationMethod - $verificationMethod'); late String verificationMethod; @@ -53,7 +53,7 @@ Future generateAssociatedWalletCredential({ case BlockchainType.binance: verificationMethod = '$issuer#Recovery2020'; } - log.i('hardcoded verificationMethod - $verificationMethod'); + Sentry.captureMessage('hardcoded verificationMethod - $verificationMethod'); final didSsi = didCubit.state.did!; @@ -141,18 +141,18 @@ Future generateAssociatedWalletCredential({ ); } - log.i(jsonEncode(associatedAddressCredential.toJson())); + Sentry.captureMessage(jsonEncode(associatedAddressCredential.toJson())); final String vc = await didKitProvider.issueCredential( jsonEncode(associatedAddressCredential.toJson()), jsonEncode(options), jwkKey, ); - log.i('didKitProvider.issueCredential - $vc'); + Sentry.captureMessage('didKitProvider.issueCredential - $vc'); final result = await didKitProvider.verifyCredential(vc, jsonEncode(verifyOptions)); - log.i('didKitProvider.verifyCredential - $result'); + Sentry.captureMessage('didKitProvider.verifyCredential - $result'); final jsonVerification = jsonDecode(result) as Map; if ((jsonVerification['warnings'] as List).isNotEmpty) { @@ -165,7 +165,8 @@ Future generateAssociatedWalletCredential({ final credentialManifest = blockchainType.credentialManifest; if ((jsonVerification['errors'] as List).isNotEmpty) { - log.e('failed to verify credential, ${jsonVerification['errors']}'); + Sentry.captureMessage( + 'failed to verify credential, ${jsonVerification['errors']}'); if (jsonVerification['errors'][0] != 'No applicable proof') { throw ResponseMessage( message: ResponseString @@ -178,10 +179,8 @@ Future generateAssociatedWalletCredential({ return _createCredential(vc, oldId, credentialManifest); } } catch (e, s) { - log.e( + Sentry.captureMessage( 'something went wrong e: $e, stackTrace: $s', - error: e, - stackTrace: s, ); return null; } @@ -275,7 +274,7 @@ Future generateWalletCredential({ credentialSubjectModel: walletCredentialModel, ); - log.i('walletCredential: ${walletCredential.toJson()}'); + Sentry.captureMessage('walletCredential: ${walletCredential.toJson()}'); final vc = await didKitProvider.issueCredential( jsonEncode(walletCredential.toJson()), @@ -295,7 +294,8 @@ Future generateWalletCredential({ } if ((jsonVerification['errors'] as List).isNotEmpty) { - log.e('failed to verify credential, ${jsonVerification['errors']}'); + Sentry.captureMessage( + 'failed to verify credential, ${jsonVerification['errors']}'); if (jsonVerification['errors'][0] != 'No applicable proof') { throw ResponseMessage( message: ResponseString @@ -308,10 +308,8 @@ Future generateWalletCredential({ return _createCredential(vc, oldId, credentialManifest); } } catch (e, s) { - log.e( + Sentry.captureMessage( 'something went wrong e: $e, stackTrace: $s', - error: e, - stackTrace: s, ); return null; } diff --git a/lib/dashboard/add_account/import_account/cubit/import_account_cubit.dart b/lib/dashboard/add_account/import_account/cubit/import_account_cubit.dart index 84da39343..28d09415d 100644 --- a/lib/dashboard/add_account/import_account/cubit/import_account_cubit.dart +++ b/lib/dashboard/add_account/import_account/cubit/import_account_cubit.dart @@ -10,6 +10,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:key_generator/key_generator.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'import_account_cubit.g.dart'; part 'import_account_state.dart'; @@ -89,10 +90,8 @@ class ImportAccountCubit extends Cubit { await homeCubit.emitHasWallet(); emit(state.success()); } catch (e, s) { - log.e( + Sentry.captureMessage( 'something went wrong when generating a key', - error: e, - stackTrace: s, ); emit( state.error( diff --git a/lib/dashboard/ai_age_verification/verify_age/cubit/camera_cubit.dart b/lib/dashboard/ai_age_verification/verify_age/cubit/camera_cubit.dart index 846b54895..8100bc213 100644 --- a/lib/dashboard/ai_age_verification/verify_age/cubit/camera_cubit.dart +++ b/lib/dashboard/ai_age_verification/verify_age/cubit/camera_cubit.dart @@ -46,8 +46,6 @@ class CameraCubit extends Cubit { emit(state.copyWith(status: CameraStatus.initializeFailed)); logger.e( 'error: $e, stack: $s', - error: e, - stackTrace: s, ); } cameraController = CameraController( diff --git a/lib/dashboard/connection/confirm_connection/cubit/confirm_connection_cubit.dart b/lib/dashboard/connection/confirm_connection/cubit/confirm_connection_cubit.dart index f4dfdc60f..5cd2f1871 100644 --- a/lib/dashboard/connection/confirm_connection/cubit/confirm_connection_cubit.dart +++ b/lib/dashboard/connection/confirm_connection/cubit/confirm_connection_cubit.dart @@ -8,6 +8,7 @@ import 'package:bloc/bloc.dart'; import 'package:dartez/dartez.dart'; import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart'; part 'confirm_connection_cubit.g.dart'; @@ -54,7 +55,7 @@ class ConfirmConnectionCubit extends Cubit { final KeyStoreModel sourceKeystore = getKeysFromSecretKey(secretKey: currentAccount.secretKey); - log.i('Start connecting to beacon'); + Sentry.captureMessage('Start connecting to beacon'); final Map response = await beacon.permissionResponse( id: beaconCubit.state.beaconRequest!.request!.id!, @@ -66,7 +67,7 @@ class ConfirmConnectionCubit extends Cubit { json.decode(response['success'].toString()) as bool; if (success) { - log.i('Connected to beacon'); + Sentry.captureMessage('Connected to beacon'); final savedPeerData = SavedDappData( peer: beaconCubit.state.beaconRequest!.peer, walletAddress: currentAccount.walletAddress, @@ -98,7 +99,7 @@ class ConfirmConnectionCubit extends Cubit { .params.requiredNamespaces['eip155']!.chains!, ]; - log.i(allowedNamespaces); + Sentry.captureMessage(allowedNamespaces.toString()); for (final evm in eVMAccounts) { if (allowedNamespaces.contains(evm.blockchainType.chain)) { @@ -131,7 +132,8 @@ class ConfirmConnectionCubit extends Cubit { ), ); } catch (e, s) { - log.e('error connecting to $connectionBridgeType , e: $e , s: $s'); + Sentry.captureMessage( + 'error connecting to $connectionBridgeType , e: $e , s: $s'); if (e is MessageHandler) { emit(state.error(messageHandler: e)); } else { @@ -153,7 +155,7 @@ class ConfirmConnectionCubit extends Cubit { if (isClosed) return; switch (connectionBridgeType) { case ConnectionBridgeType.beacon: - log.i('beacon connection rejected'); + Sentry.captureMessage('beacon connection rejected'); beacon.permissionResponse( id: beaconCubit.state.beaconRequest!.request!.id!, publicKey: null, @@ -161,7 +163,7 @@ class ConfirmConnectionCubit extends Cubit { ); case ConnectionBridgeType.walletconnect: - log.i('walletconnect connection rejected'); + Sentry.captureMessage('walletconnect connection rejected'); final walletConnectState = walletConnectCubit.state; final SessionProposalEvent? sessionProposalEvent = diff --git a/lib/dashboard/connection/connected_dapps/cubit/connected_dapps_cubit.dart b/lib/dashboard/connection/connected_dapps/cubit/connected_dapps_cubit.dart index 13a6449b5..d44b00da3 100644 --- a/lib/dashboard/connection/connected_dapps/cubit/connected_dapps_cubit.dart +++ b/lib/dashboard/connection/connected_dapps/cubit/connected_dapps_cubit.dart @@ -6,6 +6,7 @@ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'connected_dapps_cubit.g.dart'; part 'connected_dapps_state.dart'; @@ -33,18 +34,18 @@ class ConnectedDappsCubit extends Cubit { Future getXtzData(String walletAddress) async { if (isClosed) return; try { - log.i('fetching xtzData'); + Sentry.captureMessage('fetching xtzData'); emit(state.loading()); final baseUrl = networkCubit.state.network.apiUrl; - log.i('fetching balance'); + Sentry.captureMessage('fetching balance'); final int balance = await client .get('$baseUrl/v1/accounts/$walletAddress/balance') as int; final formattedBalance = balance / 1e6; - log.i('fetching xtz USD price'); + Sentry.captureMessage('fetching xtz USD price'); final xtzUSDPrice = await _getTezosCurrentPriceInUSD() ?? 0; final token = TokenModel( @@ -64,7 +65,7 @@ class ConnectedDappsCubit extends Cubit { state.copyWith(status: AppStatus.idle, xtzModel: token), ); } catch (e) { - log.e('xtzData fetching failure , e: $e'); + Sentry.captureMessage('xtzData fetching failure , e: $e'); if (e is MessageHandler) { emit(state.error(messageHandler: e)); } else { @@ -102,11 +103,11 @@ class ConnectedDappsCubit extends Cubit { try { emit(state.loading()); - log.i('fetching saved peers'); + Sentry.captureMessage('fetching saved peers'); final List savedDapps = await connectedDappRepository.findAll(); - log.i('savedPeerDatas - $savedDapps'); + Sentry.captureMessage('savedPeerDatas - $savedDapps'); final peersListToShow = []; @@ -122,7 +123,7 @@ class ConnectedDappsCubit extends Cubit { emit(state.copyWith(status: AppStatus.idle, savedDapps: peersListToShow)); } catch (e) { - log.e('getPeers failure , e: $e'); + Sentry.captureMessage('getPeers failure , e: $e'); if (e is MessageHandler) { emit(state.error(messageHandler: e)); } else { diff --git a/lib/dashboard/connection/operation/cubit/operation_cubit.dart b/lib/dashboard/connection/operation/cubit/operation_cubit.dart index 116e5425f..d4538b284 100644 --- a/lib/dashboard/connection/operation/cubit/operation_cubit.dart +++ b/lib/dashboard/connection/operation/cubit/operation_cubit.dart @@ -11,6 +11,7 @@ import 'package:equatable/equatable.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:key_generator/key_generator.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:tezart/tezart.dart'; import 'package:web3dart/web3dart.dart'; @@ -70,7 +71,7 @@ class OperationCubit extends Cubit { } } - log.i('dAppName - $dAppName'); + Sentry.captureMessage('dAppName - $dAppName'); emit(state.copyWith(dAppName: dAppName)); @@ -85,7 +86,7 @@ class OperationCubit extends Cubit { final CryptoAccountData? currentAccount = walletCubit.getCryptoAccountData(publicKey); - log.i('currentAccount -$currentAccount'); + Sentry.captureMessage('currentAccount -$currentAccount'); if (currentAccount == null) { throw ResponseMessage( message: ResponseString @@ -98,7 +99,7 @@ class OperationCubit extends Cubit { } } } catch (e) { - log.e('intialisation , e: $e'); + Sentry.captureMessage('intialisation , e: $e'); if (e is MessageHandler) { emit(state.error(messageHandler: e)); } else { @@ -119,23 +120,23 @@ class OperationCubit extends Cubit { try { switch (connectionBridgeType) { case ConnectionBridgeType.beacon: - log.i('fetching xtz USDprice'); + Sentry.captureMessage('fetching xtz USDprice'); final xtzUsdPrice = await _getTezosCurrentPriceInUSD(); emit(state.copyWith(usdRate: xtzUsdPrice)); case ConnectionBridgeType.walletconnect: - log.i('fetching evm USDprice'); + Sentry.captureMessage('fetching evm USDprice'); final symbol = state.cryptoAccountData!.blockchainType.symbol; final response = await dioClient.get(Urls.ethPrice(symbol)) as Map; - log.i('response - $response'); + Sentry.captureMessage('response - $response'); final double usdRate = response['USD'] as double; emit(state.copyWith(usdRate: usdRate)); } await getOtherPrices(connectionBridgeType); } catch (e) { - log.e('getUsdPrice failure , e: $e'); + Sentry.captureMessage('getUsdPrice failure , e: $e'); if (e is MessageHandler) { emit( state.copyWith( @@ -180,7 +181,7 @@ class OperationCubit extends Cubit { if (isClosed) return; try { emit(state.loading()); - log.i('estimateOperationFee'); + Sentry.captureMessage('estimateOperationFee'); late double amount; late double fee; @@ -190,7 +191,7 @@ class OperationCubit extends Cubit { final operationList = await getBeaonOperationList(preCheckBalance: true); await operationList.estimate(); - log.i('after operationList.estimate()'); + Sentry.captureMessage('after operationList.estimate()'); amount = int.parse( beaconCubit .state.beaconRequest!.operationDetails!.first.amount!, @@ -206,7 +207,7 @@ class OperationCubit extends Cubit { amount = MWeb3Client.formatEthAmount(amount: ethAmount.getInWei); final String web3RpcURL = await web3RpcMainnetInfuraURL(); - log.i('web3RpcURL - $web3RpcURL'); + Sentry.captureMessage('web3RpcURL - $web3RpcURL'); final feeData = await MWeb3Client.estimateEthereumFee( web3RpcURL: web3RpcURL, @@ -221,8 +222,8 @@ class OperationCubit extends Cubit { fee = MWeb3Client.formatEthAmount(amount: feeData); } - log.i('amount - $amount'); - log.i('fee - $fee'); + Sentry.captureMessage('amount - $amount'); + Sentry.captureMessage('fee - $fee'); emit( state.copyWith( @@ -232,7 +233,7 @@ class OperationCubit extends Cubit { ), ); } catch (e) { - log.e('cost estimation failure , e: $e'); + Sentry.captureMessage('cost estimation failure , e: $e'); if (e is MessageHandler) { emit( state.copyWith( @@ -242,7 +243,7 @@ class OperationCubit extends Cubit { ); } else if (e is TezartNodeError) { final Map json = e.metadata; - log.e('metadata json: $json'); + Sentry.captureMessage('metadata json: $json'); if (json['reason'] != null) { final reason = json['reason']!; late ResponseString responseString; @@ -311,7 +312,7 @@ class OperationCubit extends Cubit { if (isClosed) return; try { emit(state.loading()); - log.i('sendOperataion'); + Sentry.captureMessage('sendOperataion'); final isInternetAvailable = await isConnected(); if (!isInternetAvailable) { @@ -327,10 +328,10 @@ class OperationCubit extends Cubit { final operationList = await getBeaonOperationList(preCheckBalance: false); await operationList.executeAndMonitor(null); - log.i('after operationList.executeAndMonitor()'); + Sentry.captureMessage('after operationList.executeAndMonitor()'); final transactionHash = operationList.result.id; - log.i('transactionHash - $transactionHash'); + Sentry.captureMessage('transactionHash - $transactionHash'); final Map response = await beacon.operationResponse( id: beaconCubit.state.beaconRequest!.request!.id!, @@ -360,7 +361,7 @@ class OperationCubit extends Cubit { rpcUrl = BinanceNetwork.mainNet().rpcNodeUrl; } - log.i('rpcUrl - $rpcUrl'); + Sentry.captureMessage('rpcUrl - $rpcUrl'); final String transactionHash = await MWeb3Client.sendEthereumTransaction( @@ -381,7 +382,7 @@ class OperationCubit extends Cubit { } if (success) { - log.i('operation success'); + Sentry.captureMessage('operation success'); emit( state.copyWith( status: AppStatus.success, @@ -400,7 +401,7 @@ class OperationCubit extends Cubit { ); } } catch (e) { - log.e('sendOperataion , e: $e'); + Sentry.captureMessage('sendOperataion , e: $e'); if (e is MessageHandler) { emit(state.error(messageHandler: e)); } else if (e is TezartNodeError) { @@ -443,13 +444,13 @@ class OperationCubit extends Cubit { if (isClosed) return; switch (connectionBridgeType) { case ConnectionBridgeType.beacon: - log.i('beacon connection rejected'); + Sentry.captureMessage('beacon connection rejected'); beacon.operationResponse( id: beaconCubit.state.beaconRequest!.request!.id!, transactionHash: null, ); case ConnectionBridgeType.walletconnect: - log.i('walletconnect connection rejected'); + Sentry.captureMessage('walletconnect connection rejected'); walletConnectCubit.completer[walletConnectCubit.completer.length - 1]! .complete('Failed'); } @@ -461,7 +462,7 @@ class OperationCubit extends Cubit { required bool preCheckBalance, }) async { try { - log.i('getOperationList'); + Sentry.captureMessage('getOperationList'); final BeaconRequest beaconRequest = beaconCubit.state.beaconRequest!; @@ -505,11 +506,11 @@ class OperationCubit extends Cubit { if (preCheckBalance) { /// check xtz balance - log.i('checking xtz'); + Sentry.captureMessage('checking xtz'); final int balance = await dioClient.get( '$baseUrl/v1/accounts/${beaconRequest.request!.sourceAddress!}/balance', ) as int; - log.i('total xtz - $balance'); + Sentry.captureMessage('total xtz - $balance'); final formattedBalance = int.parse( balance.toStringAsFixed(6).replaceAll('.', '').replaceAll(',', ''), ); @@ -549,7 +550,7 @@ class OperationCubit extends Cubit { if (!isReveal) { operationList.prependOperation(RevealOperation()); } - log.i( + Sentry.captureMessage( 'publicKey: ${keystore.publicKey} ' 'amount: ${state.amount} ' 'networkFee: ${state.fee} ' @@ -559,11 +560,11 @@ class OperationCubit extends Cubit { return operationList; } catch (e, s) { - log.e('error : $e, s: $s'); + Sentry.captureMessage('error : $e, s: $s'); if (e is MessageHandler) { rethrow; } else if (e is TezartNodeError) { - log.e('e: $e , metadata: ${e.metadata} , s: $s'); + Sentry.captureMessage('e: $e , metadata: ${e.metadata} , s: $s'); rethrow; } else { throw ResponseMessage( @@ -622,7 +623,7 @@ class OperationCubit extends Cubit { } } - log.i('operations - $operations'); + Sentry.captureMessage('operations - $operations'); return operations; } } diff --git a/lib/dashboard/connection/rights/cubit/rights_cubit.dart b/lib/dashboard/connection/rights/cubit/rights_cubit.dart index ff0accc5e..821855a0b 100644 --- a/lib/dashboard/connection/rights/cubit/rights_cubit.dart +++ b/lib/dashboard/connection/rights/cubit/rights_cubit.dart @@ -6,6 +6,7 @@ import 'package:beacon_flutter/beacon_flutter.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'rights_cubit.g.dart'; part 'rights_state.dart'; @@ -26,7 +27,7 @@ class RightsCubit extends Cubit { Future disconnect({required SavedDappData savedDappData}) async { if (isClosed) return; try { - log.i('Started disconnecting'); + Sentry.captureMessage('Started disconnecting'); emit(state.loading()); final isInternetAvailable = await isConnected(); @@ -46,7 +47,7 @@ class RightsCubit extends Cubit { json.decode(response['success'].toString()) as bool; if (success) { - log.i('Disconnect success'); + Sentry.captureMessage('Disconnect success'); await connectedDappRepository.delete(savedDappData); emit( state.copyWith( @@ -77,7 +78,7 @@ class RightsCubit extends Cubit { ); } } catch (e, s) { - log.e('disconnect failure , e: $e, s: $s'); + Sentry.captureMessage('disconnect failure , e: $e, s: $s'); if (e is MessageHandler) { emit(state.error(messageHandler: e)); } else { diff --git a/lib/dashboard/connection/sign_payload/cubit/sign_payload_cubit.dart b/lib/dashboard/connection/sign_payload/cubit/sign_payload_cubit.dart index 1eb68386b..e3b2dd2a7 100644 --- a/lib/dashboard/connection/sign_payload/cubit/sign_payload_cubit.dart +++ b/lib/dashboard/connection/sign_payload/cubit/sign_payload_cubit.dart @@ -15,6 +15,7 @@ import 'package:eth_sig_util/eth_sig_util.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:http/http.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:web3dart/crypto.dart'; import 'package:web3dart/web3dart.dart'; @@ -56,11 +57,11 @@ class SignPayloadCubit extends Cubit { switch (connectionBridgeType) { case ConnectionBridgeType.beacon: - log.i('decoding payload'); + Sentry.captureMessage('decoding payload'); final BeaconRequest beaconRequest = beaconCubit.state.beaconRequest!; final String payload = beaconRequest.request!.payload!; - log.i('payload - $payload'); + Sentry.captureMessage('payload - $payload'); if (payload.startsWith('05')) { encodedPayload = beaconRequest.request!.payload!; signingType = SigningType.micheline; @@ -103,7 +104,7 @@ class SignPayloadCubit extends Cubit { signingType = SigningType.raw; } - log.i('payloadMessage - $payloadMessage'); + Sentry.captureMessage('payloadMessage - $payloadMessage'); String dAppName = ''; switch (connectionBridgeType) { @@ -125,7 +126,7 @@ class SignPayloadCubit extends Cubit { } } - log.i('dAppName - $dAppName'); + Sentry.captureMessage('dAppName - $dAppName'); emit( state.copyWith( @@ -135,7 +136,7 @@ class SignPayloadCubit extends Cubit { ), ); } catch (e) { - log.e('decoding failure , e: $e'); + Sentry.captureMessage('decoding failure , e: $e'); emit( state.error( messageHandler: ResponseMessage( @@ -151,7 +152,7 @@ class SignPayloadCubit extends Cubit { }) async { if (isClosed) return; try { - log.i('Started signing'); + Sentry.captureMessage('Started signing'); emit(state.loading()); final isInternetAvailable = await isConnected(); @@ -223,7 +224,7 @@ class SignPayloadCubit extends Cubit { final CryptoAccountData? currentAccount = walletCubit.getCryptoAccountData(publicKey); - log.i('currentAccount -$currentAccount'); + Sentry.captureMessage('currentAccount -$currentAccount'); if (currentAccount == null) { throw ResponseMessage( message: ResponseString @@ -328,7 +329,7 @@ class SignPayloadCubit extends Cubit { ); } } catch (e) { - log.e('Signing failure , e: $e'); + Sentry.captureMessage('Signing failure , e: $e'); if (e is MessageHandler) { emit(state.error(messageHandler: e)); } else { @@ -350,13 +351,13 @@ class SignPayloadCubit extends Cubit { if (isClosed) return; switch (connectionBridgeType) { case ConnectionBridgeType.beacon: - log.i('beacon Signing rejected'); + Sentry.captureMessage('beacon Signing rejected'); beacon.signPayloadResponse( id: beaconCubit.state.beaconRequest!.request!.id!, signature: null, ); case ConnectionBridgeType.walletconnect: - log.i('walletconnect Signing rejected'); + Sentry.captureMessage('walletconnect Signing rejected'); walletConnectCubit.completer[walletConnectCubit.completer.length - 1]! .complete('Failed'); diff --git a/lib/dashboard/home/tab_bar/credentials/linkedin_credential/generate_linkedin_qr/cubit/generate_linkedin_qr_cubit.dart b/lib/dashboard/home/tab_bar/credentials/linkedin_credential/generate_linkedin_qr/cubit/generate_linkedin_qr_cubit.dart index e38b6366e..2c73cae0c 100644 --- a/lib/dashboard/home/tab_bar/credentials/linkedin_credential/generate_linkedin_qr/cubit/generate_linkedin_qr_cubit.dart +++ b/lib/dashboard/home/tab_bar/credentials/linkedin_credential/generate_linkedin_qr/cubit/generate_linkedin_qr_cubit.dart @@ -10,6 +10,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uuid/uuid.dart'; part 'generate_linkedin_qr_cubit.g.dart'; @@ -61,7 +62,7 @@ class GenerateLinkedInQrCubit extends Cubit { emit(state.copyWith(status: AppStatus.idle, qrValue: presentation)); } catch (e) { - log.e('something went wrong - $e'); + Sentry.captureMessage('something went wrong - $e'); if (e is ResponseMessage) { emit(state.error(messageHandler: e)); } else { diff --git a/lib/dashboard/home/tab_bar/credentials/linkedin_credential/generate_linkedin_qr/view/generate_linkedin_qr_page.dart b/lib/dashboard/home/tab_bar/credentials/linkedin_credential/generate_linkedin_qr/view/generate_linkedin_qr_page.dart index 9567bfbb5..f303905fd 100644 --- a/lib/dashboard/home/tab_bar/credentials/linkedin_credential/generate_linkedin_qr/view/generate_linkedin_qr_page.dart +++ b/lib/dashboard/home/tab_bar/credentials/linkedin_credential/generate_linkedin_qr/view/generate_linkedin_qr_page.dart @@ -9,6 +9,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:pretty_qr_code/pretty_qr_code.dart'; import 'package:screenshot/screenshot.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; class GenerateLinkedinQrPage extends StatelessWidget { const GenerateLinkedinQrPage({ @@ -163,7 +164,7 @@ class _GenerateLinkedinQrViewState extends State { .read() .saveScreenshot(capturedImage!); }).catchError((dynamic onError) { - log.e(onError); + Sentry.captureMessage(onError.toString()); AlertMessage.showStateMessage( context: context, stateMessage: StateMessage.error( diff --git a/lib/dashboard/home/tab_bar/nft/cubit/nft_cubit.dart b/lib/dashboard/home/tab_bar/nft/cubit/nft_cubit.dart index 8e830ec32..107d6b019 100644 --- a/lib/dashboard/home/tab_bar/nft/cubit/nft_cubit.dart +++ b/lib/dashboard/home/tab_bar/nft/cubit/nft_cubit.dart @@ -5,6 +5,7 @@ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'nft_cubit.g.dart'; @@ -41,7 +42,7 @@ class NftCubit extends Cubit { _offsetOfLoadedData = state.offset; if (data.length < state.offset) return; try { - log.i('starting funtion getTezosNftList()'); + Sentry.captureMessage('starting funtion getTezosNftList()'); //final activeIndex = walletCubit.state.currentCryptoIndex; final walletAddress = walletCubit.state.currentAccount!.walletAddress; @@ -80,11 +81,11 @@ class NftCubit extends Cubit { } else { data.addAll(newData); } - log.i('nfts - $data'); + Sentry.captureMessage('nfts - $data'); emit(state.populate(data: data)); } catch (e, s) { if (isClosed) return; - log.e('failed to fetch nfts, e: $e, s: $s'); + Sentry.captureMessage('failed to fetch nfts, e: $e, s: $s'); emit( state.copyWith( status: state.offset == 0 @@ -103,14 +104,14 @@ class NftCubit extends Cubit { } Future fetchFromZero() async { - log.i('refreshing nft page'); + Sentry.captureMessage('refreshing nft page'); _offsetOfLoadedData = -1; emit(state.copyWith(offset: 0)); await getNftList(); } Future fetchMoreTezosNfts() async { - log.i('fetching more nfts'); + Sentry.captureMessage('fetching more nfts'); final offset = state.offset + _limit; emit(state.copyWith(offset: offset)); await getNftList(); diff --git a/lib/dashboard/home/tab_bar/tokens/confirm_token_transaction/cubit/confirm_token_transaction_cubit.dart b/lib/dashboard/home/tab_bar/tokens/confirm_token_transaction/cubit/confirm_token_transaction_cubit.dart index c657d1632..92085624e 100644 --- a/lib/dashboard/home/tab_bar/tokens/confirm_token_transaction/cubit/confirm_token_transaction_cubit.dart +++ b/lib/dashboard/home/tab_bar/tokens/confirm_token_transaction/cubit/confirm_token_transaction_cubit.dart @@ -277,8 +277,6 @@ class ConfirmTokenTransactionCubit extends Cubit { } catch (e, s) { logger.e( 'error after withdrawal execute: e: $e, stack: $s', - error: e, - stackTrace: s, ); emit( state.error( @@ -337,8 +335,6 @@ class ConfirmTokenTransactionCubit extends Cubit { } catch (e, s) { logger.e( 'error after withdrawal execute: e: $e, stack: $s', - error: e, - stackTrace: s, ); if (e is RPCError) { logger.i('rpc error=> e.message: ${e.message} , e.data: ${e.data}'); diff --git a/lib/dashboard/home/tab_bar/tokens/send_receive_home/cubit/send_receive_home_cubit.dart b/lib/dashboard/home/tab_bar/tokens/send_receive_home/cubit/send_receive_home_cubit.dart index 28de298e1..af5383832 100644 --- a/lib/dashboard/home/tab_bar/tokens/send_receive_home/cubit/send_receive_home_cubit.dart +++ b/lib/dashboard/home/tab_bar/tokens/send_receive_home/cubit/send_receive_home_cubit.dart @@ -52,8 +52,6 @@ class SendReceiveHomeCubit extends Cubit { } catch (e, s) { getLogger(runtimeType.toString()).e( 'error in init() e: $e, $s', - error: e, - stackTrace: s, ); if (isClosed) return; emit( @@ -96,8 +94,6 @@ class SendReceiveHomeCubit extends Cubit { } catch (e, s) { getLogger(runtimeType.toString()).e( 'error in getOperations() e: $e, $s', - error: e, - stackTrace: s, ); emit( state.error( diff --git a/lib/dashboard/profile/cubit/profile_cubit.dart b/lib/dashboard/profile/cubit/profile_cubit.dart index 25a441a9e..b53165755 100644 --- a/lib/dashboard/profile/cubit/profile_cubit.dart +++ b/lib/dashboard/profile/cubit/profile_cubit.dart @@ -9,6 +9,7 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'profile_cubit.g.dart'; @@ -151,10 +152,8 @@ class ProfileCubit extends Cubit { ), ); } catch (e, s) { - log.e( + Sentry.captureMessage( 'something went wrong', - error: e, - stackTrace: s, ); emit( state.error( @@ -255,10 +254,8 @@ class ProfileCubit extends Cubit { ), ); } catch (e, s) { - log.e( + Sentry.captureMessage( 'something went wrong', - error: e, - stackTrace: s, ); emit( diff --git a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart index c49cafd54..26df383af 100644 --- a/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart +++ b/lib/dashboard/qr_code/qr_code_scan/cubit/qr_code_scan_cubit.dart @@ -24,6 +24,7 @@ import 'package:json_path/json_path.dart'; import 'package:jwt_decode/jwt_decode.dart'; import 'package:oidc4vc/oidc4vc.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'qr_code_scan_cubit.g.dart'; part 'qr_code_scan_state.dart'; @@ -72,7 +73,7 @@ class QRCodeScanCubit extends Cubit { } Future process({required String? scannedResponse}) async { - log.i('processing scanned qr code - $scannedResponse'); + Sentry.captureMessage('processing scanned qr code - $scannedResponse'); goBack(); await Future.delayed(const Duration(milliseconds: 500)); emit(state.loading(isScan: true)); @@ -114,14 +115,14 @@ class QRCodeScanCubit extends Cubit { await verify(uri: uri); } } on FormatException { - log.i('Format Exception'); + Sentry.captureMessage('Format Exception'); emitError( ResponseMessage( message: ResponseString.RESPONSE_STRING_THIS_QR_CODE_IS_NOT_SUPPORTED, ), ); } catch (e, s) { - log.e('Error -$e, stack: $s'); + Sentry.captureMessage('Error -$e, stack: $s'); if (e is MessageHandler) { emitError(e); } else { @@ -208,7 +209,7 @@ class QRCodeScanCubit extends Cubit { emit(state.acceptHost()); } } catch (e) { - log.e(e); + Sentry.captureMessage(e.toString()); emitError(e); } } @@ -248,9 +249,9 @@ class QRCodeScanCubit extends Cubit { final dynamic response = await client.get(state.uri!.toString()); data = response is String ? jsonDecode(response) : response; - log.i('data - $data'); + Sentry.captureMessage('data - $data'); if (data['credential_manifest'] != null) { - log.i('credential_manifest is not null'); + Sentry.captureMessage('credential_manifest is not null'); final CredentialManifest credentialManifest = CredentialManifest.fromJson( data['credential_manifest'] as Map, @@ -274,7 +275,7 @@ class QRCodeScanCubit extends Cubit { switch (data['type']) { case 'CredentialOffer': - log.i('Credential Offer'); + Sentry.captureMessage('Credential Offer'); emit( state.copyWith( qrScanStatus: QrScanStatus.success, @@ -314,13 +315,13 @@ class QRCodeScanCubit extends Cubit { queryByExampleCubit.setQueryByExampleCubit(query); - log.i(data['query']); + Sentry.captureMessage(data['query'].toString()); if (data['query'].first['type'] == 'DIDAuth') { - log.i('DIDAuth'); + Sentry.captureMessage('DIDAuth'); await scanCubit.askPermissionDIDAuthCHAPI( keyId: SecureStorageKeys.ssiKey, done: (done) { - log.i('done'); + Sentry.captureMessage('done'); }, uri: state.uri!, challenge: data['challenge'] as String, @@ -328,7 +329,7 @@ class QRCodeScanCubit extends Cubit { ); emit(state.copyWith(qrScanStatus: QrScanStatus.idle)); } else if (data['query'].first['type'] == 'QueryByExample') { - log.i('QueryByExample'); + Sentry.captureMessage('QueryByExample'); emit( state.copyWith( qrScanStatus: QrScanStatus.success, @@ -358,7 +359,7 @@ class QRCodeScanCubit extends Cubit { ); } case 'object': - log.i('object'); + Sentry.captureMessage('object'); emit( state.copyWith( qrScanStatus: QrScanStatus.success, @@ -376,7 +377,7 @@ class QRCodeScanCubit extends Cubit { ); } } catch (e) { - log.e( + Sentry.captureMessage( 'An error occurred while connecting to the server. $e', ); emitError(e); @@ -547,7 +548,7 @@ class QRCodeScanCubit extends Cubit { qrScanStatus: QrScanStatus.loading, ), ); - log.i('uri - $newUrl'); + Sentry.captureMessage('uri - $newUrl'); } else { responseType = uri.queryParameters['response_type'] ?? ''; } @@ -699,7 +700,7 @@ class QRCodeScanCubit extends Cubit { } } - log.i('responseType - $responseType'); + Sentry.captureMessage('responseType - $responseType'); if (isIDTokenOnly(responseType.toString())) { /// verifier side (siopv2) @@ -1117,10 +1118,8 @@ class QRCodeScanCubit extends Cubit { final dynamic response = await requestClient.get(url); data = response.toString(); } catch (e, s) { - log.e( + Sentry.captureMessage( 'An error occurred while connecting to the server.', - error: e, - stackTrace: s, ); } return data; diff --git a/lib/dashboard/self_issued_credential_button/cubit/self_issued_credential_button_cubit.dart b/lib/dashboard/self_issued_credential_button/cubit/self_issued_credential_button_cubit.dart index ea74b7340..81438c331 100644 --- a/lib/dashboard/self_issued_credential_button/cubit/self_issued_credential_button_cubit.dart +++ b/lib/dashboard/self_issued_credential_button/cubit/self_issued_credential_button_cubit.dart @@ -13,6 +13,7 @@ import 'package:intl/intl.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uuid/uuid.dart'; part 'self_issued_credential_button_cubit.g.dart'; @@ -84,8 +85,8 @@ class SelfIssuedCredentialCubit extends Cubit { await didKitProvider.verifyCredential(vc, jsonEncode(verifyOptions)); final jsonVerification = jsonDecode(result) as Map; - log.i('vc: $vc'); - log.i('verifyResult: $jsonVerification'); + Sentry.captureMessage('vc: $vc'); + Sentry.captureMessage('verifyResult: $jsonVerification'); if ((jsonVerification['warnings'] as List).isNotEmpty) { log.w( @@ -95,7 +96,9 @@ class SelfIssuedCredentialCubit extends Cubit { } if ((jsonVerification['errors'] as List).isNotEmpty) { - log.e('failed to verify credential', error: jsonVerification['errors']); + Sentry.captureMessage( + 'failed to verify credential', + ); if (jsonVerification['errors'][0] != 'No applicable proof') { throw ResponseMessage( message: ResponseString @@ -109,7 +112,9 @@ class SelfIssuedCredentialCubit extends Cubit { } emit(state.success()); } catch (e, s) { - log.e('something went wrong', error: e, stackTrace: s); + Sentry.captureMessage( + 'something went wrong', + ); if (e is MessageHandler) { emit(state.error(messageHandler: e)); } else { diff --git a/lib/dashboard/wert/cubit/wert_cubit.dart b/lib/dashboard/wert/cubit/wert_cubit.dart index ad324c673..95c845f83 100644 --- a/lib/dashboard/wert/cubit/wert_cubit.dart +++ b/lib/dashboard/wert/cubit/wert_cubit.dart @@ -2,6 +2,7 @@ import 'package:altme/app/app.dart'; import 'package:altme/dashboard/dashboard.dart'; import 'package:altme/wallet/wallet.dart'; import 'package:bloc/bloc.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; class WertCubit extends Cubit { WertCubit({ @@ -55,7 +56,7 @@ class WertCubit extends Cubit { } } - log.i('link: $link'); + Sentry.captureMessage('link: $link'); emit(link); } diff --git a/lib/dashboard/wert/view/wert_page.dart b/lib/dashboard/wert/view/wert_page.dart index d46a4a74b..9c0ca1ef3 100644 --- a/lib/dashboard/wert/view/wert_page.dart +++ b/lib/dashboard/wert/view/wert_page.dart @@ -5,6 +5,7 @@ import 'package:altme/wallet/cubit/wallet_cubit.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart'; // #docregion platform_imports @@ -63,21 +64,21 @@ class _WertViewState extends State { ..setNavigationDelegate( NavigationDelegate( onProgress: (int progress) { - log.i('WebView is loading (progress : $progress%)'); + Sentry.captureMessage('WebView is loading (progress : $progress%)'); if (progress == 100) { LoadingView().hide(); } }, onPageStarted: (String url) { - log.i('Page started loading: $url'); + Sentry.captureMessage('Page started loading: $url'); LoadingView().show(context: context); }, onPageFinished: (String url) { - log.i('Page finished loading: $url'); + Sentry.captureMessage('Page finished loading: $url'); }, onWebResourceError: (WebResourceError error) { LoadingView().hide(); - log.i(''' + Sentry.captureMessage(''' Page resource error: code: ${error.errorCode} description: ${error.description} @@ -86,12 +87,12 @@ class _WertViewState extends State { '''); }, onNavigationRequest: (NavigationRequest request) { - log.i('navigate - ${request.url}'); + Sentry.captureMessage('navigate - ${request.url}'); // if (request.url.startsWith('https://www.youtube.com/')) { - // log.i('blocking navigation to ${request.url}'); + // Sentry.captureMessage('blocking navigation to ${request.url}'); // return NavigationDecision.prevent; // } - // log.i('allowing navigation to ${request.url}'); + // Sentry.captureMessage('allowing navigation to ${request.url}'); return NavigationDecision.navigate; }, ), diff --git a/lib/did/cubit/did_cubit.dart b/lib/did/cubit/did_cubit.dart index 95e899f80..84f53de2e 100644 --- a/lib/did/cubit/did_cubit.dart +++ b/lib/did/cubit/did_cubit.dart @@ -5,6 +5,7 @@ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'did_cubit.g.dart'; @@ -47,7 +48,7 @@ class DIDCubit extends Cubit { verificationMethod: verificationMethod, ), ); - log.i('successfully Set'); + Sentry.captureMessage('successfully Set'); } Future load({ @@ -66,6 +67,6 @@ class DIDCubit extends Cubit { verificationMethod: verificationMethod, ), ); - log.i('successfully Loaded'); + Sentry.captureMessage('successfully Loaded'); } } diff --git a/lib/import_wallet/cubit/import_wallet_cubit.dart b/lib/import_wallet/cubit/import_wallet_cubit.dart index 439798a3f..d6c7497fd 100644 --- a/lib/import_wallet/cubit/import_wallet_cubit.dart +++ b/lib/import_wallet/cubit/import_wallet_cubit.dart @@ -11,6 +11,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:key_generator/key_generator.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'import_wallet_cubit.g.dart'; part 'import_wallet_state.dart'; @@ -58,7 +59,7 @@ class ImportWalletCubit extends Cubit { await Future.delayed(const Duration(milliseconds: 500)); try { - log.i('isFromOnboarding: $isFromOnboarding'); + Sentry.captureMessage('isFromOnboarding: $isFromOnboarding'); if (isFromOnboarding) { /// ssi creation @@ -135,10 +136,8 @@ class ImportWalletCubit extends Cubit { await homeCubit.emitHasWallet(); emit(state.success()); } catch (e, s) { - log.e( + Sentry.captureMessage( 'something went wrong when generating a key', - error: e, - stackTrace: s, ); emit( state.error( diff --git a/lib/onboarding/gen_phrase/cubit/onboarding_gen_phrase_cubit.dart b/lib/onboarding/gen_phrase/cubit/onboarding_gen_phrase_cubit.dart index 39b890d72..c7783944d 100644 --- a/lib/onboarding/gen_phrase/cubit/onboarding_gen_phrase_cubit.dart +++ b/lib/onboarding/gen_phrase/cubit/onboarding_gen_phrase_cubit.dart @@ -10,6 +10,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:key_generator/key_generator.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'onboarding_gen_phrase_cubit.g.dart'; @@ -55,10 +56,8 @@ class OnBoardingGenPhraseCubit extends Cubit { ); emit(state.success()); } catch (e, s) { - log.e( + Sentry.captureMessage( 'something went wrong when generating a key', - error: e, - stackTrace: s, ); emit( state.error( diff --git a/lib/onboarding/submit_enterprise_user/cubit/submit_enterprise_user_cubit.dart b/lib/onboarding/submit_enterprise_user/cubit/submit_enterprise_user_cubit.dart index ba5666613..c951004e3 100644 --- a/lib/onboarding/submit_enterprise_user/cubit/submit_enterprise_user_cubit.dart +++ b/lib/onboarding/submit_enterprise_user/cubit/submit_enterprise_user_cubit.dart @@ -11,6 +11,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:json_path/json_path.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'submit_enterprise_user_cubit.g.dart'; @@ -104,7 +105,9 @@ class SubmitEnterpriseUserCubit extends Cubit { } emit(state.success()); } catch (e, s) { - log.e('error in verifying RSA key :$e}, s: $s', error: e, stackTrace: s); + Sentry.captureMessage( + 'error in verifying RSA key :$e}, s: $s', + ); if (e is MessageHandler) { emit(state.error(messageHandler: e)); } else { diff --git a/lib/onboarding/verify_phrase/cubit/onboarding_verify_phrase_cubit.dart b/lib/onboarding/verify_phrase/cubit/onboarding_verify_phrase_cubit.dart index e464e8677..5c2b71912 100644 --- a/lib/onboarding/verify_phrase/cubit/onboarding_verify_phrase_cubit.dart +++ b/lib/onboarding/verify_phrase/cubit/onboarding_verify_phrase_cubit.dart @@ -12,6 +12,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:key_generator/key_generator.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'onboarding_verify_phrase_cubit.g.dart'; @@ -129,10 +130,8 @@ class OnBoardingVerifyPhraseCubit extends Cubit { ); emit(state.success()); } catch (e, s) { - log.e( + Sentry.captureMessage( 'something went wrong when generating a key', - error: e, - stackTrace: s, ); emit( state.error( diff --git a/lib/polygon_id/cubit/polygon_id_cubit.dart b/lib/polygon_id/cubit/polygon_id_cubit.dart index cc7ec9c4e..b1d71a5a4 100644 --- a/lib/polygon_id/cubit/polygon_id_cubit.dart +++ b/lib/polygon_id/cubit/polygon_id_cubit.dart @@ -13,6 +13,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:polygonid/polygonid.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'polygon_id_cubit.g.dart'; part 'polygon_id_state.dart'; @@ -110,7 +111,7 @@ class PolygonIdCubit extends Cubit { //addIdentity await polygonId.addIdentity(mnemonic: mnemonic!, network: network); - log.i('$network - get Identity'); + Sentry.captureMessage('$network - get Identity'); emit( state.copyWith( status: AppStatus.init, @@ -167,7 +168,7 @@ class PolygonIdCubit extends Cubit { //addIdentity await polygonId.addIdentity(mnemonic: mnemonic!, network: network); - log.i('$network - get Identity'); + Sentry.captureMessage('$network - get Identity'); emit( state.copyWith( status: AppStatus.idle, @@ -191,11 +192,11 @@ class PolygonIdCubit extends Cubit { ), ); - log.i('download circuit'); + Sentry.captureMessage('download circuit'); //download circuit final isCircuitAlreadyDownloaded = await polygonId.isCircuitsDownloaded(); if (isCircuitAlreadyDownloaded) { - log.i('circuit already downloaded'); + Sentry.captureMessage('circuit already downloaded'); await polygonActions(); } else { // show loading with authentication message @@ -215,14 +216,14 @@ class PolygonIdCubit extends Cubit { _subscription = stream.listen((DownloadInfo downloadInfo) async { if (downloadInfo is DownloadInfoOnDone) { unawaited(_subscription?.cancel()); - log.i('download circuit complete'); + Sentry.captureMessage('download circuit complete'); await polygonActions(); } else if (downloadInfo is DownloadInfoOnProgress) { // loading value update final double loadedValue = downloadInfo.downloaded / downloadInfo.contentLength; final roundedValue = double.parse(loadedValue.toStringAsFixed(1)); - log.i(roundedValue); + Sentry.captureMessage(roundedValue.toString()); } else { throw ResponseMessage( message: ResponseString @@ -232,7 +233,7 @@ class PolygonIdCubit extends Cubit { }); } } catch (e) { - log.e(e); + Sentry.captureMessage(e.toString()); if (e is MessageHandler) { emit(state.error(message: StateMessage.error(messageHandler: e))); } else { @@ -266,7 +267,7 @@ class PolygonIdCubit extends Cubit { final body = iden3MessageEntity.body as AuthBodyRequest; if (body.scope!.isNotEmpty) { - log.i('do not consider network for verifier'); + Sentry.captureMessage('do not consider network for verifier'); checkNetwork = false; } } @@ -292,7 +293,7 @@ class PolygonIdCubit extends Cubit { final body = iden3MessageEntity.body as AuthBodyRequest; if (body.scope!.isEmpty) { - log.i('issuer'); + Sentry.captureMessage('issuer'); emit( state.copyWith( status: AppStatus.loading, @@ -300,7 +301,7 @@ class PolygonIdCubit extends Cubit { ), ); } else { - log.i('verifier'); + Sentry.captureMessage('verifier'); emit( state.copyWith( status: AppStatus.loading, @@ -348,7 +349,7 @@ class PolygonIdCubit extends Cubit { throw Exception(); } - log.i('get claims'); + Sentry.captureMessage('get claims'); emit( state.copyWith( status: AppStatus.loading, @@ -358,7 +359,8 @@ class PolygonIdCubit extends Cubit { ), ); } catch (e) { - log.e('can not get the credntials manifest for polygon error: $e'); + Sentry.captureMessage( + 'can not get the credntials manifest for polygon error: $e'); throw ResponseMessage( message: ResponseString .RESPONSE_STRING_SOMETHING_WENT_WRONG_TRY_AGAIN_LATER, @@ -366,7 +368,7 @@ class PolygonIdCubit extends Cubit { } } else if (iden3MessageEntity.messageType == Iden3MessageType.proofContractInvokeRequest) { - log.i('contractFunctionCall'); + Sentry.captureMessage('contractFunctionCall'); emit( state.copyWith( status: AppStatus.loading, @@ -398,15 +400,15 @@ class PolygonIdCubit extends Cubit { network = Parameters.POLYGON_TEST_NETWORK; } - log.i('iden3MessageEntity - $iden3MessageEntity'); + Sentry.captureMessage('iden3MessageEntity - $iden3MessageEntity'); - log.i('polygonId authentication - $network'); + Sentry.captureMessage('polygonId authentication - $network'); final isAuthenticated = await polygonId.authenticate( iden3MessageEntity: iden3MessageEntity, mnemonic: mnemonic!, network: network, ); - log.i('isAuthenticated - $isAuthenticated'); + Sentry.captureMessage('isAuthenticated - $isAuthenticated'); if (isAuthenticated) { emit( @@ -429,7 +431,7 @@ class PolygonIdCubit extends Cubit { ); } } catch (e) { - log.e(e); + Sentry.captureMessage(e.toString()); if (e is MessageHandler) { emit(state.error(message: StateMessage.error(messageHandler: e))); } else { @@ -482,7 +484,7 @@ class PolygonIdCubit extends Cubit { Future addPolygonIdCredentials() async { try { - log.i('add Claims'); + Sentry.captureMessage('add Claims'); emit(state.copyWith(status: AppStatus.loading)); for (int i = 0; i < state.claims!.length; i++) { await addToList( @@ -492,7 +494,7 @@ class PolygonIdCubit extends Cubit { } emit(state.copyWith(status: AppStatus.goBack)); } catch (e) { - log.e(e); + Sentry.captureMessage(e.toString()); if (e is MessageHandler) { emit(state.error(message: StateMessage.error(messageHandler: e))); } else { diff --git a/lib/route/cubit/route_cubit.dart b/lib/route/cubit/route_cubit.dart index 10d934e55..aa066b3b2 100644 --- a/lib/route/cubit/route_cubit.dart +++ b/lib/route/cubit/route_cubit.dart @@ -1,5 +1,6 @@ import 'package:altme/app/app.dart'; import 'package:bloc/bloc.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; class RouteCubit extends Cubit { RouteCubit() : super(''); @@ -8,7 +9,7 @@ class RouteCubit extends Cubit { void setCurrentScreen(String? screenName) { /// track screen of user - log.i('Screen -> $screenName'); + Sentry.captureMessage('Screen -> $screenName'); emit(screenName); } } diff --git a/lib/scan/cubit/scan_cubit.dart b/lib/scan/cubit/scan_cubit.dart index 861727076..f677361eb 100644 --- a/lib/scan/cubit/scan_cubit.dart +++ b/lib/scan/cubit/scan_cubit.dart @@ -15,6 +15,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:oidc4vc/oidc4vc.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uuid/uuid.dart'; part 'scan_cubit.g.dart'; @@ -176,7 +177,7 @@ class ScanCubit extends Cubit { } } - log.i('presentations - $presentations'); + Sentry.captureMessage('presentations - $presentations'); FormData data; if (credentialModel.receivedId == null) { @@ -206,7 +207,7 @@ class ScanCubit extends Cubit { if (credentialModel.jwt == null) { /// not verifying credential for did:ebsi and did:web issuer - log.i('verifying Credential'); + Sentry.captureMessage('verifying Credential'); final vcStr = jsonEncode(jsonCredential); final optStr = jsonEncode({'proofPurpose': 'assertionMethod'}); @@ -215,9 +216,11 @@ class ScanCubit extends Cubit { final verification = await didKitProvider.verifyCredential(vcStr, optStr); - log.i('[wallet/credential-offer/verify/vc] $vcStr'); - log.i('[wallet/credential-offer/verify/options] $optStr'); - log.i('[wallet/credential-offer/verify/result] $verification'); + Sentry.captureMessage('[wallet/credential-offer/verify/vc] $vcStr'); + Sentry.captureMessage( + '[wallet/credential-offer/verify/options] $optStr'); + Sentry.captureMessage( + '[wallet/credential-offer/verify/result] $verification'); final jsonVerification = jsonDecode(verification) as Map; @@ -276,7 +279,7 @@ class ScanCubit extends Cubit { emit(state.copyWith(status: ScanStatus.success)); } } catch (e) { - log.e('something went wrong - $e'); + Sentry.captureMessage('something went wrong - $e'); if (e is NetworkException && e.message == NetworkError.NETWORK_ERROR_PRECONDITION_FAILED) { emitError( @@ -329,7 +332,7 @@ class ScanCubit extends Cubit { key, ); - log.i('presentation $presentation'); + Sentry.captureMessage('presentation $presentation'); final FormData formData = FormData.fromMap({ 'presentation': presentation, @@ -436,7 +439,9 @@ class ScanCubit extends Cubit { throw Exception('DID is not set. It is required to present DIDAuth'); } } catch (e, s) { - log.e('something went wrong', error: e, stackTrace: s); + Sentry.captureMessage( + 'something went wrong', + ); emitError(e); } } @@ -617,7 +622,9 @@ class ScanCubit extends Cubit { ); } } catch (e, s) { - log.e('something went wrong', error: e, stackTrace: s); + Sentry.captureMessage( + 'something went wrong', + ); emitError(e); } } @@ -786,7 +793,7 @@ class ScanCubit extends Cubit { required Issuer issuer, }) async { final log = getLogger('ScanCubit'); - log.i('adding presentation Activity'); + Sentry.captureMessage('adding presentation Activity'); for (final credentialModel in credentialModels) { final Activity activity = Activity( presentation: Presentation( @@ -796,7 +803,7 @@ class ScanCubit extends Cubit { ); credentialModel.activities.add(activity); - log.i('presentation activity added to the credential'); + Sentry.captureMessage('presentation activity added to the credential'); await credentialsCubit.updateCredential( credential: credentialModel, showMessage: false, diff --git a/lib/splash/bloclisteners/blocklisteners.dart b/lib/splash/bloclisteners/blocklisteners.dart index 6febf608a..4118f6e91 100644 --- a/lib/splash/bloclisteners/blocklisteners.dart +++ b/lib/splash/bloclisteners/blocklisteners.dart @@ -19,6 +19,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:polygonid/polygonid.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; final splashBlocListener = BlocListener( listener: (BuildContext context, SplashState state) { @@ -210,7 +211,7 @@ final qrCodeBlocListener = BlocListener( } if (state.status == QrScanStatus.acceptHost) { - log.i('accept host'); + Sentry.captureMessage('accept host'); LoadingView().show(context: context); if (state.uri != null) { final profileCubit = context.read(); @@ -420,7 +421,7 @@ final beaconBlocListener = BlocListener( ); } } catch (e) { - log.e(e); + Sentry.captureMessage(e.toString()); } }, ); @@ -462,7 +463,7 @@ final walletConnectBlocListener = ); } } catch (e) { - log.e(e); + Sentry.captureMessage(e.toString()); } }, ); diff --git a/lib/splash/helper_function/is_wallet_created.dart b/lib/splash/helper_function/is_wallet_created.dart index 2d508070b..a27db53b8 100644 --- a/lib/splash/helper_function/is_wallet_created.dart +++ b/lib/splash/helper_function/is_wallet_created.dart @@ -7,6 +7,7 @@ import 'package:altme/credentials/credentials.dart'; import 'package:altme/did/did.dart'; import 'package:altme/wallet/wallet.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; Future isWalletCreated({ required SecureStorageProvider secureStorageProvider, @@ -16,7 +17,7 @@ Future isWalletCreated({ }) async { final log = getLogger('IsWalletCreated'); - log.i('did initialisation'); + Sentry.captureMessage('did initialisation'); final String? ssiMnemonic = await secureStorageProvider.get(SecureStorageKeys.ssiMnemonic); if (ssiMnemonic == null || ssiMnemonic.isEmpty) { @@ -73,10 +74,10 @@ Future isWalletCreated({ verificationMethod: verificationMethod, ); - log.i('wallet initialisation'); + Sentry.captureMessage('wallet initialisation'); await credentialsCubit.loadAllCredentials(); - log.i('blockchain initialisation'); + Sentry.captureMessage('blockchain initialisation'); await blockchainInitialize( walletCubit: walletCubit, ssiMnemonic: ssiMnemonic, diff --git a/lib/splash/view/splash_page.dart b/lib/splash/view/splash_page.dart index 1023c9b81..830fcaffd 100644 --- a/lib/splash/view/splash_page.dart +++ b/lib/splash/view/splash_page.dart @@ -14,6 +14,7 @@ import 'package:flutter/services.dart' as services; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:jwt_decode/jwt_decode.dart'; import 'package:secure_storage/secure_storage.dart' as secure_storage; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uni_links/uni_links.dart'; bool _initialUriIsHandled = false; @@ -62,12 +63,12 @@ class _SplashViewState extends State { _sub = uriLinkStream.listen( (Uri? uri) async { if (!mounted) return; - log.i('got uri: $uri'); + Sentry.captureMessage('got uri: $uri'); await processIncomingUri(uri, context); }, onError: (Object err) { if (!mounted) return; - log.e('got err: $err'); + Sentry.captureMessage('got err: $err'); }, ); } @@ -189,19 +190,19 @@ class _SplashViewState extends State { try { final uri = await getInitialUri(); if (uri == null) { - log.i('no initial uri'); + Sentry.captureMessage('no initial uri'); } else { - log.i('got initial uri: $uri'); + Sentry.captureMessage('got initial uri: $uri'); if (!mounted) return; - log.i('got uri: $uri'); + Sentry.captureMessage('got uri: $uri'); await processIncomingUri(uri, context); } } on services.PlatformException { // Platform messages may fail but we ignore the exception - log.e('falied to get initial uri'); + Sentry.captureMessage('falied to get initial uri'); } on FormatException catch (err) { if (!mounted) return; - log.e('malformed initial uri: $err'); + Sentry.captureMessage('malformed initial uri: $err'); } } } diff --git a/lib/wallet/cubit/wallet_cubit.dart b/lib/wallet/cubit/wallet_cubit.dart index 1bbfd38a4..4c34fe143 100644 --- a/lib/wallet/cubit/wallet_cubit.dart +++ b/lib/wallet/cubit/wallet_cubit.dart @@ -12,6 +12,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:key_generator/key_generator.dart'; import 'package:secure_storage/secure_storage.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; part 'wallet_cubit.g.dart'; @@ -108,7 +109,7 @@ class WalletCubit extends Cubit { return; } - log.i('creating both $blockchainType accounts'); + Sentry.captureMessage('creating both $blockchainType accounts'); cryptoAccountDataList.add( await _createBlockchainAccount( accountName: accountName, @@ -126,7 +127,7 @@ class WalletCubit extends Cubit { mnemonicOrKey.startsWith('spsk') || mnemonicOrKey.startsWith('p2sk'); - log.i( + Sentry.captureMessage( 'creating ${isTezosSecretKey ? 'tezos' : 'ethereum based'} account', ); @@ -280,7 +281,7 @@ class WalletCubit extends Cubit { int derivePathIndex = 0; final bool isCreated = !isImported; - log.i('isImported - $isImported'); + Sentry.captureMessage('isImported - $isImported'); if (isCreated) { /// Note: while adding derivePathIndex is always increased final String? savedDerivePathIndex = @@ -296,7 +297,7 @@ class WalletCubit extends Cubit { ); } - log.i('derivePathIndex - $derivePathIndex'); + Sentry.captureMessage('derivePathIndex - $derivePathIndex'); /// Note: while importing derivePathIndex is always 0 @@ -345,7 +346,7 @@ class WalletCubit extends Cubit { blockchainType: blockchainType, ); - log.i('$blockchainType created'); + Sentry.captureMessage('$blockchainType created'); /// If we are not using crypto in the wallet we are not generating /// AssociatedAddress credentials. @@ -392,7 +393,7 @@ class WalletCubit extends Cubit { int derivePathIndex = 0; final bool isCreated = !isImported; - log.i('isImported - $isImported'); + Sentry.captureMessage('isImported - $isImported'); if (isCreated) { /// Note: while adding derivePathIndex is always increased final String? savedDerivePathIndex = @@ -403,7 +404,7 @@ class WalletCubit extends Cubit { } } - log.i('derivePathIndex - $derivePathIndex'); + Sentry.captureMessage('derivePathIndex - $derivePathIndex'); /// Note: while importing derivePathIndex is always 0