cake_wallet/lib/core/sync_status_title.dart
Matthew Fosse 37b822b7f5
Mweb enhancements (#1715)
* node peer enhancement, delay mweb address generation, increase logging

* prevent unnecessary sync status changes if we can't connect to the ltc node

* handle potential errors

* set nodeUri to null for testing

* [skip ci] redo good changes

* [skip ci] draft

* [skip ci] minor

* [skip ci] cleanup

* [skip ci] minor

* [skip ci] minor

* [skip ci] localization

* [skip ci] save

* [skip ci] wip

* use proxy layer

* ui

* minor changes
Add ToDos for later

* fixes

* [skip ci] minor

* [skip ci] minor

* [skip ci] ui

* handle case where there are no addresses with txcount > 0

* comment out pegin button

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-10-05 03:30:52 +03:00

67 lines
1.7 KiB
Dart

import 'package:cake_wallet/generated/i18n.dart';
import 'package:cw_core/sync_status.dart';
String syncStatusTitle(SyncStatus syncStatus) {
if (syncStatus is SyncingSyncStatus) {
return syncStatus.blocksLeft == 1
? S.current.block_remaining
: S.current.Blocks_remaining('${syncStatus.blocksLeft}');
}
if (syncStatus is SyncedTipSyncStatus) {
return S.current.silent_payments_scanned_tip(syncStatus.tip.toString());
}
if (syncStatus is SyncedSyncStatus) {
return S.current.sync_status_syncronized;
}
if (syncStatus is FailedSyncStatus) {
if (syncStatus.error != null) {
return syncStatus.error!;
}
return S.current.sync_status_failed_connect;
}
if (syncStatus is NotConnectedSyncStatus) {
return S.current.sync_status_not_connected;
}
if (syncStatus is AttemptingSyncStatus) {
return S.current.sync_status_attempting_sync;
}
if (syncStatus is ConnectingSyncStatus) {
return S.current.sync_status_connecting;
}
if (syncStatus is ConnectedSyncStatus) {
return S.current.sync_status_connected;
}
if (syncStatus is LostConnectionSyncStatus) {
return S.current.sync_status_failed_connect;
}
if (syncStatus is UnsupportedSyncStatus) {
return S.current.sync_status_unsupported;
}
if (syncStatus is TimedOutSyncStatus) {
return S.current.sync_status_timed_out;
}
if (syncStatus is SyncronizingSyncStatus) {
return S.current.sync_status_syncronizing;
}
if (syncStatus is StartingScanSyncStatus) {
return S.current.sync_status_starting_scan(syncStatus.beginHeight.toString());
}
if (syncStatus is AttemptingScanSyncStatus) {
return S.current.sync_status_attempting_scan;
}
return '';
}