Skip to content

Commit

Permalink
Fix NFT Detail race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesSmartCell committed Sep 18, 2023
1 parent 7d3d5bc commit 0772f1c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2817,6 +2817,11 @@ public Map<String, TSAction> getAttestationFunctionMap(Token att)
// Trawl through all attestations in this wallet database and update their collectionId pointer if required
public String updateAttestations(TokenDefinition td)
{
if (td.getAttestation() == null)
{
return "0";
}

byte[] preHash = td.getAttestation().getCollectionIdPreHash();
String scriptCollectionId = Numeric.toHexString(Hash.keccak256(preHash));
Wallet wallet = new Wallet(tokensService.getCurrentAddress());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public class NFTAssetDetailActivity extends BaseActivity implements StandardFunc
private ActivityResultLauncher<Intent> getGasSettings;
private boolean triggeredReload;
private long chainId;
private Disposable disposable;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
Expand Down Expand Up @@ -176,10 +175,6 @@ protected void onDestroy()
viewModel.onDestroy();
super.onDestroy();
tokenImage.onDestroy();
if (disposable != null && !disposable.isDisposed())
{
disposable.dispose();
}
}

@Override
Expand Down Expand Up @@ -332,7 +327,7 @@ private void newScriptFound(Boolean status)

setTitle(token.getTokenName(viewModel.getAssetDefinitionService(), 1));

//now re-load the verbs
//now re-load the verbs if already called. If wallet is null this won't complete
setupFunctionBar(viewModel.getWallet());

setupAttestation();
Expand Down Expand Up @@ -367,8 +362,7 @@ private void startScriptDownload(Boolean status)

private void setupFunctionBar(Wallet wallet)
{
if (token == null) return;
if (BuildConfig.DEBUG || wallet.type != WalletType.WATCH)
if (token != null && wallet != null && (BuildConfig.DEBUG || wallet.type != WalletType.WATCH))
{
FunctionButtonBar functionBar = findViewById(R.id.layoutButtons);
functionBar.setupFunctions(this, viewModel.getAssetDefinitionService(), token, null, Collections.singletonList(tokenId));
Expand Down

0 comments on commit 0772f1c

Please sign in to comment.