sp debugging (#2426)

* feat(sp): debug logging feature

* fix(sp): Receiver

* feat(sp): handle and log failures and early returns

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
rafael_xmr
2025-08-06 16:26:19 +03:00
committed by GitHub
co-authored by Omar Hatem
parent c0ad8e2f70
commit 4dc5be7640
36 changed files with 385 additions and 113 deletions
@@ -1,7 +1,10 @@
import 'dart:io';
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:mobx/mobx.dart';
import 'package:path_provider/path_provider.dart';
part 'silent_payments_settings_view_model.g.dart';
@@ -30,4 +33,16 @@ abstract class SilentPaymentsSettingsViewModelBase with Store {
bitcoin!.setIsAlwaysScanningSP(_wallet, value);
if (value) bitcoin!.setScanningActive(_wallet, true);
}
Future<String> getAbbreviatedLogs() async {
final appSupportPath = (await getApplicationSupportDirectory()).path;
final logsFile = File("$appSupportPath/logs/debug.log");
if (!logsFile.existsSync()) {
return "";
}
final logs = logsFile.readAsStringSync();
// return last 10000 characters:
return logs.substring(logs.length > 10000 ? logs.length - 10000 : 0);
}
}