Skip to content

Commit aa396de

Browse files
authored
optimize
1 parent 503b219 commit aa396de

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AuthRepositoryImpl.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -402,20 +402,11 @@ public AuthRecord issue(@NonNull String name,
402402
// Finally, try and look up the accounts
403403
final List<AccountRecord> accountRecords = new ArrayList<>();
404404
for (AuthorizedAccount account: accounts) {
405-
406-
final AccountRecord accountRecordQueried = mAccountsDao.query(authRecordId, account.publicKey);
407-
408-
final int accountId;
409-
final AccountRecord accountRecord;
410-
// If no matching account record exists, create one
411-
if (accountRecordQueried == null) {
412-
accountId = (int) mAccountsDao.insert(authRecordId, account.publicKey,
405+
// create an account record for each account in this auth record
406+
final int accountId = (int) mAccountsDao.insert(authRecordId, account.publicKey,
413407
account.accountLabel, account.accountIcon, account.chains, account.features);
414-
accountRecord = new AccountRecord(accountId, authRecordId, account.publicKey,
408+
final AccountRecord accountRecord = new AccountRecord(accountId, authRecordId, account.publicKey,
415409
account.accountLabel, account.accountIcon, account.chains, account.features);
416-
} else {
417-
accountRecord = accountRecordQueried;
418-
}
419410
accountRecords.add(accountRecord);
420411
}
421412

0 commit comments

Comments
 (0)