Skip to content

Commit

Permalink
Fix for TokenScript view and refresh of attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesSmartCell committed Dec 26, 2023
1 parent 0c3184a commit c2fdc4e
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ default void handleTokenScriptFunction(String function, List<BigInteger> selecti
default void showWaitSpinner(boolean show) { }

default void handleFunctionDenied(String denialMessage) { }

default void completeFunctionSetup() { }

Check warning on line 32 in app/src/main/java/com/alphawallet/app/entity/StandardFunctionInterface.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/entity/StandardFunctionInterface.java#L32

Added line #L32 was not covered by tests
}
10 changes: 10 additions & 0 deletions app/src/main/java/com/alphawallet/app/entity/TSAttrCallback.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.alphawallet.app.entity;

import com.alphawallet.token.entity.TokenScriptResult;

import java.util.List;

public interface TSAttrCallback
{
void showTSAttributes(List<TokenScriptResult.Attribute> attrs, boolean updateRequired);
}
8 changes: 8 additions & 0 deletions app/src/main/java/com/alphawallet/app/entity/UpdateType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.alphawallet.app.entity;

public enum UpdateType

Check warning on line 3 in app/src/main/java/com/alphawallet/app/entity/UpdateType.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/entity/UpdateType.java#L3

Added line #L3 was not covered by tests
{
USE_CACHE,
UPDATE_IF_REQUIRED,
ALWAYS_UPDATE

Check warning on line 7 in app/src/main/java/com/alphawallet/app/entity/UpdateType.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/entity/UpdateType.java#L5-L7

Added lines #L5 - L7 were not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import android.text.TextUtils;

import com.alphawallet.app.entity.UpdateType;
import com.alphawallet.app.entity.tokens.Token;
import com.alphawallet.app.repository.TokenRepository;
import com.alphawallet.app.util.BalanceUtils;
Expand Down Expand Up @@ -874,7 +875,8 @@ else if (!TextUtils.isEmpty(element.value))
}
else
{
return fetchAttrResult(token, attr, tokenId, definition, attrIf, ViewType.VIEW).blockingGet().text;
return fetchAttrResult(token, attr, tokenId, definition, attrIf,
ViewType.VIEW, UpdateType.ALWAYS_UPDATE).blockingGet().text;

Check warning on line 879 in app/src/main/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunction.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunction.java#L878-L879

Added lines #L878 - L879 were not covered by tests
}

return null;
Expand Down Expand Up @@ -903,7 +905,8 @@ else if (!TextUtils.isEmpty(element.value))
*/

public Single<TokenScriptResult.Attribute> fetchAttrResult(Token token, Attribute attr, BigInteger tokenId,
TokenDefinition td, AttributeInterface attrIf, ViewType itemView)
TokenDefinition td, AttributeInterface attrIf,
ViewType itemView, UpdateType update)
{
if (attr == null)
{
Expand Down Expand Up @@ -941,8 +944,10 @@ else if (attr.function == null) // static attribute from tokenId (eg city mappi
ContractAddress useAddress = new ContractAddress(attr.function); //always use the function attribute's address
long lastTxUpdate = attrIf.getLastTokenUpdate(useAddress.chainId, useAddress.address);
TransactionResult cachedResult = attrIf.getFunctionResult(useAddress, attr, useTokenId); //Needs to allow for multiple tokenIds
boolean shouldUseCache = checkUpdateRequired(attrIf, attr, cachedResult, update,
itemView == ViewType.ITEM_VIEW, lastTxUpdate, useAddress);

if ((itemView == ViewType.ITEM_VIEW || (!attr.isVolatile() && ((attrIf.resolveOptimisedAttr(useAddress, attr, cachedResult) || !cachedResult.needsUpdating(lastTxUpdate)))))) //can we use wallet's known data or cached value?
if (shouldUseCache) //can we use wallet's known data or cached value?
{
return resultFromDatabase(cachedResult, attr);
}
Expand All @@ -958,6 +963,27 @@ else if (attr.function == null) // static attribute from tokenId (eg city mappi
}
}

private boolean checkUpdateRequired(AttributeInterface attrIf, Attribute attr,
TransactionResult cachedResult, UpdateType update,
boolean isItemView, long lastTxUpdate,
ContractAddress useAddress)
{
switch (update)
{
case USE_CACHE -> {
return isItemView || !(cachedResult.resultTime == 0); //only update if no result
}
case UPDATE_IF_REQUIRED -> {
return (isItemView || (!attr.isVolatile() && ((attrIf.resolveOptimisedAttr(useAddress, attr, cachedResult) || !cachedResult.needsUpdating(lastTxUpdate)))));
}
case ALWAYS_UPDATE -> {
return isItemView;

Check warning on line 980 in app/src/main/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunction.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunction.java#L980

Added line #L980 was not covered by tests
}
}

return true;

Check warning on line 984 in app/src/main/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunction.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/entity/tokenscript/TokenscriptFunction.java#L984

Added line #L984 was not covered by tests
}

private Single<TokenScriptResult.Attribute> getEventResult(TransactionResult txResult, Attribute attr, BigInteger tokenId, AttributeInterface attrIf)
{
//fetch the function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.alphawallet.app.entity.FragmentMessenger;
import com.alphawallet.app.entity.QueryResponse;
import com.alphawallet.app.entity.TokenLocator;
import com.alphawallet.app.entity.UpdateType;
import com.alphawallet.app.entity.Wallet;
import com.alphawallet.app.entity.nftassets.NFTAsset;
import com.alphawallet.app.entity.tokens.Attestation;
Expand Down Expand Up @@ -592,7 +593,7 @@ public TokenScriptResult.Attribute fetchAttrResult(ContractAddress origin, Attri
if (originToken == null || td == null) return null;

//produce result
return tokenscriptUtility.fetchAttrResult(originToken, attr, tokenId, td, this, ViewType.VIEW).blockingGet();
return tokenscriptUtility.fetchAttrResult(originToken, attr, tokenId, td, this, ViewType.VIEW, UpdateType.UPDATE_IF_REQUIRED).blockingGet();

Check warning on line 596 in app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java#L596

Added line #L596 was not covered by tests
}

/**
Expand Down Expand Up @@ -2305,7 +2306,8 @@ private List<Attribute> getLocalAttributes(TokenDefinition td, List<String> acti
* @param token
* @return map of unique tokenIds to lists of allowed functions for that ID - note that we allow the function to be displayed if it has a denial message
*/
public Single<Map<BigInteger, List<String>>> fetchFunctionMap(Token token, @NotNull List<BigInteger> tokenIds, ContractType type)
public Single<Map<BigInteger, List<String>>> fetchFunctionMap(Token token, @NotNull List<BigInteger> tokenIds,
ContractType type, UpdateType update)
{
return Single.fromCallable(() -> {
ActionModifier requiredActionModifier = type == ContractType.ATTESTATION ? ActionModifier.ATTESTATION : ActionModifier.NONE;
Expand All @@ -2317,7 +2319,7 @@ public Single<Map<BigInteger, List<String>>> fetchFunctionMap(Token token, @NotN
//first gather all attrs required - do this so if there's multiple actions using the same attribute for a tokenId we aren't fetching the value repeatedly
List<String> requiredAttrNames = getRequiredAttributeNames(actions, td);
Map<BigInteger, Map<String, TokenScriptResult.Attribute>> attrResults // Map of attribute results vs tokenId
= getRequiredAttributeResults(requiredAttrNames, tokenIds, td, token); // Map of all required attribute values vs all the tokenIds
= getRequiredAttributeResults(requiredAttrNames, tokenIds, td, token, update); // Map of all required attribute values vs all the tokenIds

Check warning on line 2322 in app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java#L2322

Added line #L2322 was not covered by tests

for (BigInteger tokenId : tokenIds)
{
Expand Down Expand Up @@ -2388,7 +2390,7 @@ public String checkFunctionDenied(Token token, String actionName, List<BigIntege
{
Attribute attr = td.attributes.get(attrId);
if (attr == null) continue;
TokenScriptResult.Attribute attrResult = tokenscriptUtility.fetchAttrResult(token, attr, tokenId, td, this, ViewType.VIEW).blockingGet();
TokenScriptResult.Attribute attrResult = tokenscriptUtility.fetchAttrResult(token, attr, tokenId, td, this, ViewType.VIEW, UpdateType.ALWAYS_UPDATE).blockingGet();

Check warning on line 2393 in app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java#L2393

Added line #L2393 was not covered by tests
if (attrResult != null) attrs.put(attrId, attrResult);
}

Expand Down Expand Up @@ -2425,7 +2427,8 @@ private Map<String, TokenScriptResult.Attribute> getAttributeResultsForTokenIds(
return results;
}

private Map<BigInteger, Map<String, TokenScriptResult.Attribute>> getRequiredAttributeResults(List<String> requiredAttrNames, List<BigInteger> tokenIds, TokenDefinition td, Token token)
private Map<BigInteger, Map<String, TokenScriptResult.Attribute>> getRequiredAttributeResults(List<String> requiredAttrNames, List<BigInteger> tokenIds,
TokenDefinition td, Token token, UpdateType update)
{
Map<BigInteger, Map<String, TokenScriptResult.Attribute>> resultSet = new HashMap<>();
for (BigInteger tokenId : tokenIds)
Expand All @@ -2435,7 +2438,7 @@ private Map<BigInteger, Map<String, TokenScriptResult.Attribute>> getRequiredAtt
Attribute attr = td.attributes.get(attrName);
if (attr == null) continue;
BigInteger useTokenId = td.useZeroForTokenIdAgnostic(attrName, tokenId);
TokenScriptResult.Attribute attrResult = tokenscriptUtility.fetchAttrResult(token, attr, useTokenId, td, this, ViewType.VIEW).blockingGet();
TokenScriptResult.Attribute attrResult = tokenscriptUtility.fetchAttrResult(token, attr, useTokenId, td, this, ViewType.VIEW, update).blockingGet();

Check warning on line 2441 in app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java#L2441

Added line #L2441 was not covered by tests
if (attrResult != null)
{
Map<String, TokenScriptResult.Attribute> tokenIdMap = resultSet.get(useTokenId);
Expand Down Expand Up @@ -2813,7 +2816,8 @@ public void clearResultMap()
tokenscriptUtility.clearParseMaps();
}

public Observable<TokenScriptResult.Attribute> resolveAttrs(Token token, TokenDefinition td, BigInteger tokenId, List<Attribute> extraAttrs, ViewType itemView)
public Observable<TokenScriptResult.Attribute> resolveAttrs(Token token, TokenDefinition td, BigInteger tokenId,
List<Attribute> extraAttrs, ViewType itemView, UpdateType update)
{
TokenDefinition definition = td != null ? td : getAssetDefinition(token);
ContractAddress cAddr = new ContractAddress(token.tokenInfo.chainId, token.tokenInfo.address);
Expand All @@ -2827,7 +2831,7 @@ public Observable<TokenScriptResult.Attribute> resolveAttrs(Token token, TokenDe
List<Attribute> attrList = new ArrayList<>(definition.attributes.values());
if (extraAttrs != null) attrList.addAll(extraAttrs);

return resolveAttrs(token, tokenId, definition, attrList, itemView);
return resolveAttrs(token, tokenId, definition, attrList, itemView, update);

Check warning on line 2834 in app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java#L2834

Added line #L2834 was not covered by tests
}

public List<TokenScriptResult.Attribute> getAttestationAttrs(Token token, TSAction action, String attnId)
Expand Down Expand Up @@ -2953,15 +2957,15 @@ private List<RealmAttestation> getRealmItemsForUpdate(Realm realm, TokenDefiniti
}

private Observable<TokenScriptResult.Attribute> resolveAttrs(Token token, BigInteger tokenId, TokenDefinition td,
List<Attribute> attrList, ViewType itemView)
List<Attribute> attrList, ViewType itemView, UpdateType update)
{
tokenscriptUtility.buildAttrMap(attrList);
return Observable.fromIterable(attrList)
.flatMap(attr -> tokenscriptUtility.fetchAttrResult(token, attr, tokenId,
td, this, itemView).toObservable());
td, this, itemView, update).toObservable());

Check warning on line 2965 in app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java#L2965

Added line #L2965 was not covered by tests
}

public Observable<TokenScriptResult.Attribute> resolveAttrs(Token token, List<BigInteger> tokenIds, List<Attribute> extraAttrs)
public Observable<TokenScriptResult.Attribute> resolveAttrs(Token token, List<BigInteger> tokenIds, List<Attribute> extraAttrs, UpdateType update)
{
TokenDefinition definition = getAssetDefinition(token);
if (definition == null)
Expand All @@ -2976,7 +2980,7 @@ public Observable<TokenScriptResult.Attribute> resolveAttrs(Token token, List<Bi

//TODO: store transaction fetch time for multiple tokenIds

return resolveAttrs(token, definition, tokenIds.get(0), extraAttrs, ViewType.VIEW);
return resolveAttrs(token, definition, tokenIds.get(0), extraAttrs, ViewType.VIEW, UpdateType.UPDATE_IF_REQUIRED);

Check warning on line 2983 in app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java#L2983

Added line #L2983 was not covered by tests
}

private void resolveTokenIds(Attribute attrType, List<BigInteger> tokenIds)
Expand Down
14 changes: 3 additions & 11 deletions app/src/main/java/com/alphawallet/app/ui/FunctionActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.alphawallet.app.entity.SignAuthenticationCallback;
import com.alphawallet.app.entity.StandardFunctionInterface;
import com.alphawallet.app.entity.TransactionReturn;
import com.alphawallet.app.entity.UpdateType;
import com.alphawallet.app.entity.Wallet;
import com.alphawallet.app.entity.WalletType;
import com.alphawallet.app.entity.nftassets.NFTAsset;
Expand Down Expand Up @@ -219,7 +220,7 @@ private void getAttrs()
//Add attestation attributes
attrs.append(viewModel.addAttestationAttrs(asset, token, action));

viewModel.getAssetDefinitionService().resolveAttrs(token, tokenIds, localAttrs)
viewModel.getAssetDefinitionService().resolveAttrs(token, tokenIds, localAttrs, UpdateType.USE_CACHE)

Check warning on line 223 in app/src/main/java/com/alphawallet/app/ui/FunctionActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/FunctionActivity.java#L223

Added line #L223 was not covered by tests
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::onAttr, this::onError, () -> displayFunction(attrs.toString()))
Expand Down Expand Up @@ -392,7 +393,7 @@ public void calculationCompleted(String value, String result, TokenscriptElement
@Override
public void unresolvedSymbolError(String value)
{
Timber.d("ATTR/FA: Resolve: ERROR: " + value);
Timber.d("ATTR/FA: Resolve: ERROR: %s", value);

Check warning on line 396 in app/src/main/java/com/alphawallet/app/ui/FunctionActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/FunctionActivity.java#L396

Added line #L396 was not covered by tests
tokenScriptError(value, null);
}
};
Expand Down Expand Up @@ -1002,13 +1003,4 @@ private void getValueFromInnerHTML(CalcJsValueCallback callback, String value, T
}
});
}

private void repopulateInputField(String key, String value)
{
tokenView.evaluateJavascript(
"(function() { document.getElementById(\"" + key + "\").innerHTML = \"" + value + "\"; })();",
html -> {
Timber.d("Worked?");
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
Expand All @@ -35,6 +34,7 @@
import com.alphawallet.app.entity.GasEstimate;
import com.alphawallet.app.entity.SignAuthenticationCallback;
import com.alphawallet.app.entity.StandardFunctionInterface;
import com.alphawallet.app.entity.TSAttrCallback;
import com.alphawallet.app.entity.TransactionReturn;
import com.alphawallet.app.entity.Wallet;
import com.alphawallet.app.entity.WalletType;
Expand Down Expand Up @@ -62,7 +62,6 @@
import com.alphawallet.token.entity.TSAction;
import com.alphawallet.token.entity.TicketRange;
import com.alphawallet.token.entity.TokenScriptResult;
import com.alphawallet.token.entity.TokenScriptResult.Attribute;
import com.alphawallet.token.entity.ViewType;
import com.alphawallet.token.entity.XMLDsigDescriptor;
import com.alphawallet.token.tools.TokenDefinition;
Expand All @@ -75,11 +74,7 @@
import java.util.Map;

import dagger.hilt.android.AndroidEntryPoint;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import timber.log.Timber;

@AndroidEntryPoint
public class NFTAssetDetailActivity extends BaseActivity implements StandardFunctionInterface, ActionSheetCallback
Expand Down Expand Up @@ -317,7 +312,7 @@ private void setup()
else
{
viewModel.getAsset(token, tokenId);
viewModel.updateLocalAttributes(token, tokenId);
viewModel.updateLocalAttributes(token, tokenId); //when complete calls displayTokenView

Check warning on line 315 in app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java#L315

Added line #L315 was not covered by tests
}
}

Expand All @@ -334,7 +329,7 @@ private void initViewModel()
viewModel.sig().observe(this, this::onSignature);
viewModel.newScriptFound().observe(this, this::newScriptFound);
viewModel.walletUpdate().observe(this, this::setupFunctionBar);
viewModel.attrFetchComplete().observe(this, this::displayTokenView);
viewModel.attrFetchComplete().observe(this, this::displayTokenView); //local attr fetch

Check warning on line 332 in app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java#L332

Added line #L332 was not covered by tests
}

private void newScriptFound(TokenDefinition td)
Expand Down Expand Up @@ -412,18 +407,17 @@ private void completeAttestationTokenScriptSetup(TSAction action)
}
}

private void completeTokenScriptSetup()
private void completeTokenScriptSetup(String prevResult)
{
final List<Attribute> attrs = new ArrayList<>();

if (viewModel.hasTokenScript(token))
{
viewModel.getAssetDefinitionService().resolveAttrs(token, new ArrayList<>(Collections.singleton(tokenId)), null)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(attrs::add, this::onError, () -> showTSAttributes(attrs))
.isDisposed();
}
viewModel.completeTokenScriptSetup(token, tokenId, prevResult, (attrs, needsUpdate) -> {

Check warning on line 412 in app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java#L412

Added line #L412 was not covered by tests
//should have resolved all the attrs
tsAttributeLayout.bindTSAttributes(attrs);

Check warning on line 414 in app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java#L414

Added line #L414 was not covered by tests
//require refresh of TS View
if (needsUpdate)
{
displayTokenView(viewModel.getAssetDefinitionService().getAssetDefinition(token));

Check warning on line 418 in app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java#L418

Added line #L418 was not covered by tests
}
});

Check warning on line 420 in app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java#L420

Added line #L420 was not covered by tests
}

private void reloadMetadata()
Expand Down Expand Up @@ -503,22 +497,9 @@ private void loadAssetFromMetadata(NFTAsset loadedAsset)
clearRefreshAnimation();

loadFromOpenSeaData(loadedAsset.getOpenSeaAsset());

completeTokenScriptSetup();
}
}

private void showTSAttributes(List<Attribute> attrs)
{
//should have resolved all the attrs
tsAttributeLayout.bindTSAttributes(attrs);
}

private void onError(Throwable throwable)
{
Timber.w(throwable);
}

private void updateTokenImage(NFTAsset asset)
{
if (triggeredReload) tokenImage.clearImage();
Expand Down Expand Up @@ -626,15 +607,15 @@ private void loadFromOpenSeaData(OpenSeaAsset openSeaAsset)
private void setupAttestation(TokenDefinition td)
{
NFTAsset attnAsset = new NFTAsset();
if (token.getInterfaceSpec() != ContractType.ATTESTATION)
if (token == null || token.getInterfaceSpec() != ContractType.ATTESTATION)
{
return;
}
else if (td != null)
{
attnAsset.setupScriptElements(td);
attnAsset.setupScriptAttributes(td, token);
if (!displayTokenView(td))
if (!displayTokenView(td)) //display token for Attribute
{
tokenImage.setupTokenImage(attnAsset);
}
Expand Down Expand Up @@ -796,7 +777,7 @@ private void showIssuer(String issuer)
if (!TextUtils.isEmpty(issuer))
{
((TokenInfoView)findViewById(R.id.key_address)).setCopyableValue(issuer);
((TokenInfoView)findViewById(R.id.key_address)).setVisibility(View.VISIBLE);
findViewById(R.id.key_address).setVisibility(View.VISIBLE);

Check warning on line 780 in app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java#L780

Added line #L780 was not covered by tests
}
}

Expand Down Expand Up @@ -848,6 +829,13 @@ public WalletType getWalletType()
return viewModel.getWallet().type;
}

@Override
public void completeFunctionSetup()
{
//check if TS needs to be refreshed
completeTokenScriptSetup(tokenScriptView.getAttrResults());
}

Check warning on line 837 in app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java#L836-L837

Added lines #L836 - L837 were not covered by tests

/***
* TokenScript view handling
*/
Expand Down
Loading

0 comments on commit c2fdc4e

Please sign in to comment.