2020-01-04 19:31:52 +00:00
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
|
|
|
|
abstract class SyncStatus {
|
|
|
|
const SyncStatus();
|
|
|
|
|
|
|
|
double progress();
|
|
|
|
|
|
|
|
String title();
|
|
|
|
}
|
|
|
|
|
|
|
|
class SyncingSyncStatus extends SyncStatus {
|
2020-06-01 18:13:56 +00:00
|
|
|
SyncingSyncStatus(this.blocksLeft, this.ptc);
|
2020-01-08 12:26:34 +00:00
|
|
|
|
2020-06-01 18:13:56 +00:00
|
|
|
final double ptc;
|
|
|
|
final int blocksLeft;
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-06-01 18:13:56 +00:00
|
|
|
double progress() => ptc;
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-11-11 09:49:46 +00:00
|
|
|
String title() => S.current.Blocks_remaining('$blocksLeft');
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
@override
|
2020-06-01 18:13:56 +00:00
|
|
|
String toString() => '$blocksLeft';
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class SyncedSyncStatus extends SyncStatus {
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
double progress() => 1.0;
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
String title() => S.current.sync_status_syncronized;
|
|
|
|
}
|
|
|
|
|
|
|
|
class NotConnectedSyncStatus extends SyncStatus {
|
|
|
|
const NotConnectedSyncStatus();
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
double progress() => 0.0;
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
String title() => S.current.sync_status_not_connected;
|
|
|
|
}
|
|
|
|
|
|
|
|
class StartingSyncStatus extends SyncStatus {
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
double progress() => 0.0;
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
String title() => S.current.sync_status_starting_sync;
|
|
|
|
}
|
|
|
|
|
|
|
|
class FailedSyncStatus extends SyncStatus {
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
double progress() => 1.0;
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
String title() => S.current.sync_status_failed_connect;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ConnectingSyncStatus extends SyncStatus {
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
double progress() => 0.0;
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
String title() => S.current.sync_status_connecting;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ConnectedSyncStatus extends SyncStatus {
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
double progress() => 0.0;
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
@override
|
2020-01-04 19:31:52 +00:00
|
|
|
String title() => S.current.sync_status_connected;
|
2020-01-08 12:26:34 +00:00
|
|
|
}
|
2020-08-29 10:19:27 +00:00
|
|
|
|
|
|
|
class LostConnectionSyncStatus extends SyncStatus {
|
|
|
|
@override
|
|
|
|
double progress() => 1.0;
|
|
|
|
|
|
|
|
@override
|
|
|
|
String title() => S.current.sync_status_failed_connect;
|
|
|
|
}
|