CW 781 replace all print statements with printV (#1733)

* replace all print statements with printV

* restore backup error message

* missing print statements, error fixes

* Update cw_core/lib/utils/print_verbose.dart [skip ci]

* Update cw_core/lib/utils/print_verbose.dart [skip ci]

* CW-846: Correctly display balance (#1848)

* Correctly display balance even with frozen coins

* remove package= from AndroidMainfest.xml

* update namespace

* print -> printV

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
cyan
2024-12-09 20:23:59 +02:00
committed by GitHub
co-authored by Omar Hatem
parent c74194abf4
commit c78662fbfe
124 changed files with 578 additions and 343 deletions
+7 -6
View File
@@ -8,6 +8,7 @@ import 'package:cake_wallet/utils/feature_flag.dart';
import 'package:cake_wallet/view_model/settings/sync_mode.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:flutter/foundation.dart';
@@ -83,8 +84,8 @@ void callbackDispatcher() {
return Future.value(true);
} catch (error, stackTrace) {
print(error);
print(stackTrace);
printV(error);
printV(stackTrace);
return Future.error(error);
}
});
@@ -149,8 +150,8 @@ class BackgroundTasks {
constraints: constraints,
);
} catch (error, stackTrace) {
print(error);
print(stackTrace);
printV(error);
printV(stackTrace);
}
}
@@ -158,8 +159,8 @@ class BackgroundTasks {
try {
Workmanager().cancelByUniqueName(moneroSyncTaskKey);
} catch (error, stackTrace) {
print(error);
print(stackTrace);
printV(error);
printV(stackTrace);
}
}
}
+3 -2
View File
@@ -1,3 +1,4 @@
import 'package:cw_core/utils/print_verbose.dart';
import 'package:flutter/services.dart';
import 'package:flutter_local_authentication/flutter_local_authentication.dart';
@@ -9,7 +10,7 @@ class BiometricAuth {
final authenticated = await _flutterLocalAuthenticationPlugin.authenticate();
return authenticated;
} catch (e) {
print(e);
printV(e);
}
return false;
}
@@ -20,7 +21,7 @@ class BiometricAuth {
canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate();
await _flutterLocalAuthenticationPlugin.setTouchIDAuthenticationAllowableReuseDuration(0);
} catch (error) {
print("Exception checking support. $error");
printV("Exception checking support. $error");
canAuthenticate = false;
}
+4 -3
View File
@@ -7,6 +7,7 @@ import 'package:cake_wallet/entities/fiat_api_mode.dart';
import 'package:cw_core/pathForWallet.dart';
import 'package:cake_wallet/entities/secret_store_key.dart';
import 'package:cw_core/root_dir.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:hive/hive.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:cake_wallet/entities/preferences_key.dart';
@@ -296,7 +297,7 @@ Future<void> defaultSettingsMigration(
await sharedPreferences.setInt(
PreferencesKey.currentDefaultSettingsMigrationVersion, version);
} catch (e) {
print('Migration error: ${e.toString()}');
printV('Migration error: ${e.toString()}');
}
});
@@ -714,7 +715,7 @@ Future<void> insecureStorageMigration({
await secureStorage.write(
key: SecureKey.lastAuthTimeMilliseconds, value: lastAuthTimeMilliseconds.toString());
} catch (e) {
print("Error migrating shared preferences to secure storage!: $e");
printV("Error migrating shared preferences to secure storage!: $e");
// this actually shouldn't be that big of a problem since we don't delete the old keys in this update
// and we read and write to the new locations when loading storage, the migration is just for extra safety
}
@@ -870,7 +871,7 @@ Future<void> addAddressesForMoneroWallets(Box<WalletInfo> walletInfoSource) asyn
info.address = addressText;
await info.save();
} catch (e) {
print(e.toString());
printV(e.toString());
}
});
}
+2 -1
View File
@@ -1,5 +1,6 @@
import 'package:cake_wallet/ethereum/ethereum.dart';
import 'package:cake_wallet/polygon/polygon.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:ens_dart/ens_dart.dart';
@@ -45,7 +46,7 @@ class EnsRecord {
final addr = await ens.withName(name).getAddress();
return addr.hex;
} catch (e) {
print(e);
printV(e);
return "";
}
}
+6 -5
View File
@@ -2,6 +2,7 @@ import 'dart:io';
import 'dart:convert';
import 'package:cake_wallet/core/secure_storage.dart';
import 'package:collection/collection.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
@@ -171,7 +172,7 @@ Future<void> ios_migrate_wallet_passwords() async {
await keyService.saveWalletPassword(walletName: name, password: password!);
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
});
@@ -326,7 +327,7 @@ Future<void> ios_migrate_wallet_info(Box<WalletInfo> walletsInfoSource) async {
return walletInfo;
}
} catch (e) {
print(e.toString());
printV(e.toString());
return null;
}
})
@@ -336,7 +337,7 @@ Future<void> ios_migrate_wallet_info(Box<WalletInfo> walletsInfoSource) async {
await walletsInfoSource.addAll(infoRecords);
await prefs.setBool('ios_migration_wallet_info_completed', true);
} catch (e) {
print(e.toString());
printV(e.toString());
}
}
@@ -403,7 +404,7 @@ Future<void> ios_migrate_trades_list(Box<Trade> tradeSource) async {
await tradeSource.addAll(trades);
await prefs.setBool('ios_migration_trade_list_completed', true);
} catch (e) {
print(e.toString());
printV(e.toString());
}
}
@@ -437,6 +438,6 @@ Future<void> ios_migrate_address_book(Box<Contact> contactSource) async {
await contactSource.addAll(contacts);
await prefs.setBool('ios_migration_address_book_completed', true);
} catch (e) {
print(e.toString());
printV(e.toString());
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
import 'package:basic_utils/basic_utils.dart';
import 'package:cw_core/utils/print_verbose.dart';
class OpenaliasRecord {
OpenaliasRecord({
@@ -27,7 +28,7 @@ class OpenaliasRecord {
return txtRecord;
} catch (e) {
print("${e.toString()}");
printV("${e.toString()}");
return null;
}
}
+2 -1
View File
@@ -11,6 +11,7 @@ import 'package:cake_wallet/nostr/nostr_api.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/twitter/twitter_api.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/entities/fio_address_provider.dart';
@@ -283,7 +284,7 @@ class AddressResolver {
}
}
} catch (e) {
print(e.toString());
printV(e.toString());
}
return ParsedAddress(addresses: [text]);
+2 -1
View File
@@ -5,6 +5,7 @@ import 'package:cake_wallet/main.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:fast_scanner/fast_scanner.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
@@ -61,7 +62,7 @@ class _BarcodeScannerSimpleState extends State<BarcodeScannerSimple> {
);
},
);
print(e);
printV(e);
}
}
+2 -1
View File
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:cw_core/utils/print_verbose.dart';
import 'package:http/http.dart' as http;
Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async {
@@ -20,7 +21,7 @@ Future<String> fetchUnstoppableDomainAddress(String domain, String ticker) async
return records[key] as String? ?? '';
} catch (e) {
print('Unstoppable domain error: ${e.toString()}');
printV('Unstoppable domain error: ${e.toString()}');
address = '';
}