mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Fixes.
This commit is contained in:
@@ -39,10 +39,12 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
subaddressList.update(accountIndex: account.id);
|
||||
subaddress = subaddressList.subaddresses.first;
|
||||
address = subaddress.address;
|
||||
_lastAutosaveTimestamp = 0;
|
||||
});
|
||||
_cachedRefreshHeight = 0;
|
||||
}
|
||||
|
||||
static const int _autoAfterSyncSaceInterval = 60000;
|
||||
|
||||
@override
|
||||
final MoneroTransactionHistory transactionHistory;
|
||||
|
||||
@@ -81,7 +83,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
String _filename;
|
||||
SyncListener _listener;
|
||||
ReactionDisposer _onAccountChangeReaction;
|
||||
int _cachedRefreshHeight;
|
||||
int _lastAutosaveTimestamp;
|
||||
|
||||
Future<void> init() async {
|
||||
await accountList.update();
|
||||
@@ -95,7 +97,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
address = subaddress.address;
|
||||
_setListeners();
|
||||
await transactionHistory.update();
|
||||
print('walletInfo.isRecovery ${walletInfo.isRecovery}');
|
||||
|
||||
if (walletInfo.isRecovery) {
|
||||
monero_wallet.setRecoveringFromSeed(isRecovery: walletInfo.isRecovery);
|
||||
|
||||
@@ -156,6 +158,8 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
try {
|
||||
syncStatus = StartingSyncStatus();
|
||||
monero_wallet.startRefresh();
|
||||
_setListeners();
|
||||
_listener?.start();
|
||||
} catch (e) {
|
||||
syncStatus = FailedSyncStatus();
|
||||
print(e);
|
||||
@@ -234,7 +238,6 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
void _setListeners() {
|
||||
_listener?.stop();
|
||||
_listener = monero_wallet.setListeners(_onNewBlock);
|
||||
_listener.start();
|
||||
}
|
||||
|
||||
void _setInitialHeight() {
|
||||
@@ -292,18 +295,15 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
int _getUnlockedBalance() =>
|
||||
monero_wallet.getUnlockedBalance(accountIndex: account.id);
|
||||
|
||||
int _lastAutosaveTimestamp = 0;
|
||||
final int _autosaveInterval = 60000;
|
||||
|
||||
Future<void> _autoSave() async {
|
||||
Future<void> _afterSyncSave() async {
|
||||
final nowTimestamp = DateTime.now().millisecondsSinceEpoch;
|
||||
final sum = _lastAutosaveTimestamp + _autosaveInterval;
|
||||
final sum = _lastAutosaveTimestamp + _autoAfterSyncSaceInterval;
|
||||
|
||||
if (_lastAutosaveTimestamp != 0 && sum < nowTimestamp) {
|
||||
return;
|
||||
}
|
||||
|
||||
_lastAutosaveTimestamp = nowTimestamp + _autosaveInterval;
|
||||
_lastAutosaveTimestamp = nowTimestamp + _autoAfterSyncSaceInterval;
|
||||
await save();
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
|
||||
if (blocksLeft < moneroBlockSize) {
|
||||
syncStatus = SyncedSyncStatus();
|
||||
await _autoSave();
|
||||
await _afterSyncSave();
|
||||
} else {
|
||||
syncStatus = SyncingSyncStatus(blocksLeft, ptc);
|
||||
}
|
||||
|
||||
@@ -73,12 +73,14 @@ class ValidableAnnotatedEditableText extends EditableText {
|
||||
final TextStyle invalidStyle;
|
||||
|
||||
@override
|
||||
ValidableAnnotatedEditableTextState createState() => ValidableAnnotatedEditableTextState();
|
||||
ValidableAnnotatedEditableTextState createState() =>
|
||||
ValidableAnnotatedEditableTextState();
|
||||
}
|
||||
|
||||
class ValidableAnnotatedEditableTextState extends EditableTextState {
|
||||
@override
|
||||
ValidableAnnotatedEditableText get widget => super.widget as ValidableAnnotatedEditableText;
|
||||
ValidableAnnotatedEditableText get widget =>
|
||||
super.widget as ValidableAnnotatedEditableText;
|
||||
|
||||
List<Annotation> getRanges() {
|
||||
final result = List<Annotation>();
|
||||
@@ -154,17 +156,13 @@ class ValidableAnnotatedEditableTextState extends EditableTextState {
|
||||
final text = textEditingValue.text;
|
||||
final ranges = getRanges().toSet();
|
||||
|
||||
print('text $text');
|
||||
|
||||
if (ranges.isNotEmpty) {
|
||||
return TextSpan(
|
||||
style: widget.style,
|
||||
children: ranges.map((item) {
|
||||
final _text = item.range.textInside(text);
|
||||
print(
|
||||
'_text $_text; range ${item.range.start} : ${item.range.end}');
|
||||
return TextSpan(style: item.style, text: _text);
|
||||
}).toList());
|
||||
children: ranges
|
||||
.map((item) => TextSpan(
|
||||
style: item.style, text: item.range.textInside(text)))
|
||||
.toList());
|
||||
}
|
||||
|
||||
return TextSpan(style: widget.style, text: text);
|
||||
|
||||
Reference in New Issue
Block a user