mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
potential electrum fixes + mweb logs display only last 10000 characters
This commit is contained in:
parent
7874675edd
commit
87cca2db54
3 changed files with 35 additions and 0 deletions
|
@ -132,6 +132,7 @@ class ElectrumClient {
|
|||
if (host == socket?.address.host || socket == null) {
|
||||
_setConnectionStatus(ConnectionStatus.disconnected);
|
||||
socket?.destroy();
|
||||
socket = null;
|
||||
}
|
||||
} catch (e) {
|
||||
print("onDone: $e");
|
||||
|
|
|
@ -26,6 +26,29 @@ class MwebLogsPage extends BasePage {
|
|||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
|
||||
Expanded(
|
||||
child: FutureBuilder<String>(
|
||||
future: mwebSettingsViewModelBase.getAbbreviatedLogs(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) {
|
||||
return Center(child: Text('No logs found'));
|
||||
} else {
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
snapshot.data!,
|
||||
style: TextStyle(fontFamily: 'Monospace'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
child: Observer(
|
||||
builder: (_) => LoadingPrimaryButton(
|
||||
|
|
|
@ -46,6 +46,17 @@ abstract class MwebSettingsViewModelBase with Store {
|
|||
await logsFile.copy(filePath);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Future<void> removeLogsLocally(String filePath) async {
|
||||
final logsFile = File(filePath);
|
||||
if (logsFile.existsSync()) {
|
||||
|
|
Loading…
Reference in a new issue