diff --git a/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AccountRecordsDao.java b/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AccountRecordsDao.java index de2c9fb6e..62ae0ef60 100644 --- a/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AccountRecordsDao.java +++ b/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AccountRecordsDao.java @@ -12,9 +12,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; - public class AccountRecordsDao extends DbContentProvider implements AccountRecordsDaoInterface, AccountRecordsSchema { @@ -43,6 +40,18 @@ public long insert(@NonNull long parentId, return super.insert(TABLE_ACCOUNTS, accountContentValues); } + @Override + public long updateParentId(long oldParentId, long newParentId) { + final ContentValues accountContentValues = new ContentValues(1); + accountContentValues.put(COLUMN_ACCOUNTS_PARENT_ID, newParentId); + return super.update( + TABLE_ACCOUNTS, + accountContentValues, + COLUMN_ACCOUNTS_PARENT_ID + "=?", + new String[] { String.valueOf(oldParentId) } + ); + } + @Nullable @Override public AccountRecord query(@NonNull byte[] publicKey) { diff --git a/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AccountRecordsDaoInterface.java b/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AccountRecordsDaoInterface.java index 9564aa2da..98f3430be 100644 --- a/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AccountRecordsDaoInterface.java +++ b/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AccountRecordsDaoInterface.java @@ -15,6 +15,9 @@ long insert(@NonNull long parentId, @NonNull byte[] publicKey, @Nullable String accountLabel, @Nullable Uri accountIcon, @Nullable String[] chains, @Nullable String[] features); + @IntRange(from = 0) + long updateParentId(long oldParentId, long newParentId); + // @Nullable // List query(int parentId); diff --git a/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AuthRepositoryImpl.java b/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AuthRepositoryImpl.java index cb0910234..7facc8e21 100644 --- a/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AuthRepositoryImpl.java +++ b/android/walletlib/src/main/java/com/solana/mobilewalletadapter/walletlib/authorization/AuthRepositoryImpl.java @@ -444,6 +444,7 @@ public synchronized AuthRecord reissue(@NonNull AuthRecord authRecord) { } else { final int id = (int) mAuthorizationsDao.insert(authRecord.identity.getId(), now, authRecord.chain, authRecord.walletUriBaseId, authRecord.scope); + mAccountsDao.updateParentId(authRecord.id, id); reissued = new AuthRecord(id, authRecord.identity, authRecord.accounts, authRecord.chain, authRecord.scope, authRecord.walletUriBase, authRecord.walletUriBaseId, now,