2021-01-27 13:51:51 +00:00
|
|
|
import 'package:cake_wallet/entities/transaction_priority.dart';
|
2021-02-01 18:12:37 +00:00
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
2021-01-27 13:51:51 +00:00
|
|
|
|
|
|
|
class BitcoinTransactionPriority extends TransactionPriority {
|
2021-02-12 22:38:34 +00:00
|
|
|
const BitcoinTransactionPriority({String title, int raw})
|
2021-01-27 13:51:51 +00:00
|
|
|
: super(title: title, raw: raw);
|
|
|
|
|
2021-02-12 22:38:34 +00:00
|
|
|
static const List<BitcoinTransactionPriority> all = [fast, medium, slow];
|
2021-02-01 18:12:37 +00:00
|
|
|
static const BitcoinTransactionPriority slow =
|
2021-02-12 22:38:34 +00:00
|
|
|
BitcoinTransactionPriority(title: 'Slow', raw: 0);
|
2021-02-01 18:12:37 +00:00
|
|
|
static const BitcoinTransactionPriority medium =
|
2021-02-12 22:38:34 +00:00
|
|
|
BitcoinTransactionPriority(title: 'Medium', raw: 1);
|
2021-02-01 18:12:37 +00:00
|
|
|
static const BitcoinTransactionPriority fast =
|
2021-02-12 22:38:34 +00:00
|
|
|
BitcoinTransactionPriority(title: 'Fast', raw: 2);
|
2021-01-27 13:51:51 +00:00
|
|
|
|
|
|
|
static BitcoinTransactionPriority deserialize({int raw}) {
|
|
|
|
switch (raw) {
|
|
|
|
case 0:
|
|
|
|
return slow;
|
2021-02-12 22:38:34 +00:00
|
|
|
case 1:
|
2021-01-27 13:51:51 +00:00
|
|
|
return medium;
|
2021-02-12 22:38:34 +00:00
|
|
|
case 2:
|
2021-01-27 13:51:51 +00:00
|
|
|
return fast;
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2021-02-01 18:12:37 +00:00
|
|
|
String toString() {
|
|
|
|
var label = '';
|
|
|
|
|
|
|
|
switch (this) {
|
|
|
|
case BitcoinTransactionPriority.slow:
|
|
|
|
label = S.current.transaction_priority_slow;
|
|
|
|
break;
|
|
|
|
case BitcoinTransactionPriority.medium:
|
|
|
|
label = S.current.transaction_priority_medium;
|
|
|
|
break;
|
|
|
|
case BitcoinTransactionPriority.fast:
|
|
|
|
label = S.current.transaction_priority_fast;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-02-12 22:38:34 +00:00
|
|
|
return label;
|
2021-02-01 18:12:37 +00:00
|
|
|
}
|
2021-01-27 13:51:51 +00:00
|
|
|
}
|