This commit is contained in:
M 2020-09-28 22:02:30 +03:00
parent e3678d2cf9
commit e08e10bc35
7 changed files with 59 additions and 14 deletions

View file

@ -354,7 +354,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -493,7 +493,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -526,7 +526,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (

View file

@ -19,6 +19,10 @@ abstract class TransactionHistoryBase<TransactionType extends TransactionInfo> {
try {
_isUpdating = true;
final _transactions = await fetchTransactions();
transactions.keys
.toSet()
.difference(_transactions.keys.toSet())
.forEach((k) => transactions.remove(k));
_transactions.forEach((key, value) => transactions[key] = value);
_isUpdating = false;
} catch (e) {

View file

@ -191,7 +191,12 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
@override
Future<void> rescan({int height}) async {
monero_wallet.setRefreshFromBlockHeight(height: height);
monero_wallet.rescanBlockchainAsync();
await startSync();
_askForUpdateBalance();
await _askForUpdateTransactionHistory();
await save();
}
void _setListeners() {
@ -247,9 +252,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
}
Future<void> _askForUpdateTransactionHistory() async {
print('start');
await transactionHistory.update();
print('end');
}
int _getFullBalance() =>
@ -270,6 +273,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
if (walletInfo.isRecovery) {
_askForUpdateTransactionHistory();
_askForUpdateBalance();
}
final currentHeight = getCurrentHeight();

View file

@ -236,7 +236,8 @@ class Router {
case Routes.login:
return CupertinoPageRoute<void>(
builder: (context) => getIt.get<AuthPage>(instanceName: 'login'));
builder: (context) => getIt.get<AuthPage>(instanceName: 'login'),
fullscreenDialog: true);
case Routes.accountCreation:
return CupertinoPageRoute<String>(

View file

@ -65,7 +65,7 @@ class RootState extends State<Root> with WidgetsBindingObserver {
});
}
return widget.child;
return WillPopScope(onWillPop: () async => false, child: widget.child);
}
void _reset() {

View file

@ -425,8 +425,10 @@ class SendPage extends BasePage {
EdgeInsets.only(left: 24, right: 24, bottom: 24),
bottomSection: Observer(builder: (_) {
return LoadingPrimaryButton(
onPressed: () {
if (_formKey.currentState.validate()) {}
onPressed: () async {
if (_formKey.currentState.validate()) {
await sendViewModel.createTransaction();
}
},
text: S.of(context).send,
color: Theme.of(context).accentTextTheme.body2.color,
@ -445,6 +447,18 @@ class SendPage extends BasePage {
return;
}
_cryptoAmountController.addListener(() {
final amount = _cryptoAmountController.text;
if (sendViewModel.sendAll && amount != S.current.all) {
sendViewModel.sendAll = false;
}
if (amount != sendViewModel.cryptoAmount) {
sendViewModel.setCryptoAmount(amount);
}
});
reaction((_) => sendViewModel.sendAll, (bool all) {
if (all) {
_cryptoAmountController.text = S.current.all;

View file

@ -47,6 +47,28 @@ abstract class SettingsStoreBase with Store {
this.nodes = ObservableMap<WalletType, Node>.of(nodes);
_sharedPreferences = sharedPreferences;
reaction(
(_) => fiatCurrency,
(FiatCurrency fiatCurrency) => sharedPreferences.setString(
PreferencesKey.currentFiatCurrencyKey, fiatCurrency.serialize()));
reaction(
(_) => transactionPriority,
(TransactionPriority priority) => sharedPreferences.setInt(
PreferencesKey.currentTransactionPriorityKey,
priority.serialize()));
reaction(
(_) => shouldSaveRecipientAddress,
(bool shouldSaveRecipientAddress) => sharedPreferences.setBool(
PreferencesKey.shouldSaveRecipientAddressKey,
shouldSaveRecipientAddress));
reaction(
(_) => isDarkTheme,
(bool isDarkTheme) => sharedPreferences.setBool(
PreferencesKey.currentDarkTheme, isDarkTheme));
reaction(
(_) => allowBiometricalAuthentication,
(bool biometricalAuthentication) => sharedPreferences.setBool(
@ -61,9 +83,10 @@ abstract class SettingsStoreBase with Store {
reaction((_) => currentNode,
(Node node) => _saveCurrentNode(node, WalletType.monero));
reaction((_) => languageCode,
(String languageCode) => sharedPreferences.setString(
PreferencesKey.currentLanguageCode, languageCode));
reaction(
(_) => languageCode,
(String languageCode) => sharedPreferences.setString(
PreferencesKey.currentLanguageCode, languageCode));
}
static const defaultPinLength = 4;
@ -165,8 +188,7 @@ abstract class SettingsStoreBase with Store {
initialDarkTheme: savedDarkTheme,
actionlistDisplayMode: actionListDisplayMode,
initialPinLength: pinLength,
initialLanguageCode: savedLanguageCode
);
initialLanguageCode: savedLanguageCode);
}
Future<void> _saveCurrentNode(Node node, WalletType walletType) async {