diff --git a/DashSyncCurrentCommit b/DashSyncCurrentCommit index a23053640..9adcaa75a 100644 --- a/DashSyncCurrentCommit +++ b/DashSyncCurrentCommit @@ -1 +1 @@ -08f34489b64061aa549735dd79a19bfb266f5e31 +11837d26130f55c25f763109878920920b039b34 diff --git a/DashWallet/Sources/Models/DWEnvironment.m b/DashWallet/Sources/Models/DWEnvironment.m index 7ffc90c0b..8268295f6 100644 --- a/DashWallet/Sources/Models/DWEnvironment.m +++ b/DashWallet/Sources/Models/DWEnvironment.m @@ -17,6 +17,8 @@ #import "DWEnvironment.h" +#import "DWGlobalOptions.h" + #define CURRENT_CHAIN_TYPE_KEY @"CURRENT_CHAIN_TYPE_KEY" NSNotificationName const DWCurrentNetworkDidChangeNotification = @"DWCurrentNetworkDidChangeNotification"; @@ -88,7 +90,10 @@ - (DSWallet *)currentWallet { } - (DSAccount *)currentAccount { - return [[self.currentWallet accounts] firstObject]; + NSDictionary *accounts = self.currentWallet.orderedAccounts; + NSInteger accountIndex = [DWGlobalOptions sharedInstance].currentAccountIndex; + DSAccount *account = accounts[@(accountIndex)]; + return account; } - (NSArray *)allWallets { @@ -187,7 +192,10 @@ - (void)switchToNetwork:(DSChainType)chainType withIdentifier:(NSString *)identi protocolVersion:70216 minProtocolVersion:70216 sporkAddress:@"yQuAu9YAMt4yEiXBeDp3q5bKpo7jsC2eEj" - sporkPrivateKey:@"cVk6u16fT1Pwd9MugowSt7VmNzN8ozE4wJjfJGC97Hf43oxRMjar"]; + sporkPrivateKey:@"cVk6u16fT1Pwd9MugowSt7VmNzN8ozE4wJjfJGC97Hf43oxRMjar" + instantSendLockQuorumType:DSLLMQType_5_60 + chainLockQuorumType:DSLLMQType_5_60 + platformQuorumType:DSLLMQType_5_60]; [destinationChain setDevnetNetworkName:@"Evonet"]; } break; diff --git a/DashWallet/Sources/Models/DWGlobalOptions.h b/DashWallet/Sources/Models/DWGlobalOptions.h index 69be0ee4e..cbecf319f 100644 --- a/DashWallet/Sources/Models/DWGlobalOptions.h +++ b/DashWallet/Sources/Models/DWGlobalOptions.h @@ -52,6 +52,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign, getter=isResyncingWallet) BOOL resyncingWallet; +@property (nonatomic, assign) NSInteger currentAccountIndex; + // Non-dynamic - (BOOL)lockScreenDisabled; diff --git a/DashWallet/Sources/Models/DWGlobalOptions.m b/DashWallet/Sources/Models/DWGlobalOptions.m index 77e0699d0..f041ebcf7 100644 --- a/DashWallet/Sources/Models/DWGlobalOptions.m +++ b/DashWallet/Sources/Models/DWGlobalOptions.m @@ -42,6 +42,7 @@ @implementation DWGlobalOptions @dynamic dashpayRegistrationCompleted; @dynamic mostRecentViewedNotificationDate; @dynamic resyncingWallet; +@dynamic currentAccountIndex; #pragma mark - Init @@ -51,6 +52,7 @@ - (instancetype)init { DW_KEYPATH(self, localNotificationsEnabled) : @YES, DW_KEYPATH(self, autoLockAppInterval) : @60, // 1 min DW_KEYPATH(self, shouldDisplayOnboarding) : @YES, + DW_KEYPATH(self, currentAccountIndex) : @0, }; self = [super initWithUserDefaults:nil defaults:defaults]; @@ -119,6 +121,7 @@ - (void)restoreToDefaults { self.dashpayRegistrationCompleted = NO; self.mostRecentViewedNotificationDate = nil; self.resyncingWallet = NO; + self.currentAccountIndex = 0; } @end diff --git a/DashWallet/Sources/UI/Home/Models/DWHomeModel.m b/DashWallet/Sources/UI/Home/Models/DWHomeModel.m index 4129e708e..b5131699d 100644 --- a/DashWallet/Sources/UI/Home/Models/DWHomeModel.m +++ b/DashWallet/Sources/UI/Home/Models/DWHomeModel.m @@ -293,6 +293,9 @@ - (void)forceStartSyncingActivity { DWSyncModel *syncModel = (DWSyncModel *)self.syncModel; NSAssert([syncModel isKindOfClass:DWSyncModel.class], @"Internal inconsistency"); [syncModel forceStartSyncingActivity]; + + [self updateBalance]; + [self reloadTxDataSource]; } - (void)walletDidWipe { @@ -467,7 +470,8 @@ - (void)reloadTxDataSource { return [(NSNumber *)obj1 compare:obj2]; } }]; - NSArray *transactions = [wallet.allTransactions sortedArrayUsingDescriptors:@[ sortDescriptor ]]; + DSAccount *account = [DWEnvironment sharedInstance].currentAccount; + NSArray *transactions = [account.allTransactions sortedArrayUsingDescriptors:@[ sortDescriptor ]]; BOOL shouldAnimate = YES; DSTransaction *prevTransaction = self.dataSource.items.firstObject; diff --git a/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuModel.h b/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuModel.h index c880304ce..210e11ab8 100644 --- a/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuModel.h +++ b/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuModel.h @@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN @property (readonly, copy, nonatomic) NSString *networkName; @property (readonly, copy, nonatomic) NSString *localCurrencyCode; +@property (assign, nonatomic) NSInteger accountIndex; + @property (assign, nonatomic) BOOL notificationsEnabled; + (void)switchToMainnetWithCompletion:(void (^)(BOOL success))completion; diff --git a/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuModel.m b/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuModel.m index cbda1c775..e2ed72bb2 100644 --- a/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuModel.m +++ b/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuModel.m @@ -32,6 +32,19 @@ - (NSString *)localCurrencyCode { return [DSPriceManager sharedInstance].localCurrencyCode; } +- (NSInteger)accountIndex { + return [DWGlobalOptions sharedInstance].currentAccountIndex; +} + +- (void)setAccountIndex:(NSInteger)accountIndex { + BOOL hasChanged = [DWGlobalOptions sharedInstance].currentAccountIndex != accountIndex; + [DWGlobalOptions sharedInstance].currentAccountIndex = accountIndex; + if (hasChanged) { + [[NSNotificationCenter defaultCenter] postNotificationName:DWCurrentNetworkDidChangeNotification + object:nil]; + } +} + - (BOOL)notificationsEnabled { return [DWGlobalOptions sharedInstance].localNotificationsEnabled; } diff --git a/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuViewController.m b/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuViewController.m index b1426b924..d75bb0fe9 100644 --- a/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuViewController.m +++ b/DashWallet/Sources/UI/Menu/Settings/DWSettingsMenuViewController.m @@ -20,6 +20,7 @@ #import #import "DWAboutViewController.h" +#import "DWEnvironment.h" #import "DWFormTableViewController.h" #import "DWLocalCurrencyViewController.h" #import "DWSettingsMenuModel.h" @@ -33,6 +34,7 @@ @interface DWSettingsMenuViewController ()