Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
Funkatronics authored Oct 28, 2024
1 parent 503b219 commit aa396de
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,20 +402,11 @@ public AuthRecord issue(@NonNull String name,
// Finally, try and look up the accounts
final List<AccountRecord> accountRecords = new ArrayList<>();
for (AuthorizedAccount account: accounts) {

final AccountRecord accountRecordQueried = mAccountsDao.query(authRecordId, account.publicKey);

final int accountId;
final AccountRecord accountRecord;
// If no matching account record exists, create one
if (accountRecordQueried == null) {
accountId = (int) mAccountsDao.insert(authRecordId, account.publicKey,
// create an account record for each account in this auth record
final int accountId = (int) mAccountsDao.insert(authRecordId, account.publicKey,
account.accountLabel, account.accountIcon, account.chains, account.features);
accountRecord = new AccountRecord(accountId, authRecordId, account.publicKey,
final AccountRecord accountRecord = new AccountRecord(accountId, authRecordId, account.publicKey,
account.accountLabel, account.accountIcon, account.chains, account.features);
} else {
accountRecord = accountRecordQueried;
}
accountRecords.add(accountRecord);
}

Expand Down

0 comments on commit aa396de

Please sign in to comment.