fix file view display for cached reposts
This commit is contained in:
parent
1d97f9008d
commit
f49a3570e9
2 changed files with 27 additions and 8 deletions
|
@ -342,6 +342,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
((MainActivity) context).onBackPressed();
|
((MainActivity) context).onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean invalidRepost = false;
|
||||||
if (updateRequired) {
|
if (updateRequired) {
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
((MainActivity) context).clearNowPlayingClaim();
|
((MainActivity) context).clearNowPlayingClaim();
|
||||||
|
@ -365,6 +366,20 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
onNewClaim(currentUrl);
|
onNewClaim(currentUrl);
|
||||||
if (Lbry.claimCache.containsKey(key)) {
|
if (Lbry.claimCache.containsKey(key)) {
|
||||||
claim = Lbry.claimCache.get(key);
|
claim = Lbry.claimCache.get(key);
|
||||||
|
if (Claim.TYPE_REPOST.equalsIgnoreCase(claim.getValueType())) {
|
||||||
|
claim = claim.getRepostedClaim();
|
||||||
|
if (claim == null || Helper.isNullOrEmpty(claim.getClaimId())) {
|
||||||
|
// Invalid repost, probably
|
||||||
|
invalidRepost = true;
|
||||||
|
renderNothingAtLocation();
|
||||||
|
} else if (claim.getName().startsWith("@")) {
|
||||||
|
// this is a reposted channel, so launch the channel url
|
||||||
|
if (context instanceof MainActivity) {
|
||||||
|
((MainActivity) context).openChannelUrl(!Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
resolveUrl(currentUrl);
|
resolveUrl(currentUrl);
|
||||||
}
|
}
|
||||||
|
@ -380,7 +395,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
Helper.saveUrlHistory(currentUrl, claim != null ? claim.getTitle() : null, UrlSuggestion.TYPE_FILE);
|
Helper.saveUrlHistory(currentUrl, claim != null ? claim.getTitle() : null, UrlSuggestion.TYPE_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (claim != null) {
|
if (claim != null && !invalidRepost) {
|
||||||
Helper.saveViewHistory(currentUrl, claim);
|
Helper.saveViewHistory(currentUrl, claim);
|
||||||
checkAndLoadRelatedContent();
|
checkAndLoadRelatedContent();
|
||||||
checkAndLoadComments();
|
checkAndLoadComments();
|
||||||
|
|
|
@ -103,16 +103,20 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
|
||||||
TransactionListTask task = new TransactionListTask(currentTransactionPage, TRANSACTION_PAGE_LIMIT, loading, new TransactionListTask.TransactionListHandler() {
|
TransactionListTask task = new TransactionListTask(currentTransactionPage, TRANSACTION_PAGE_LIMIT, loading, new TransactionListTask.TransactionListHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<Transaction> transactions, boolean hasReachedEnd) {
|
public void onSuccess(List<Transaction> transactions, boolean hasReachedEnd) {
|
||||||
|
Context context = getContext();
|
||||||
|
|
||||||
transactionsLoading = false;
|
transactionsLoading = false;
|
||||||
transactionsHaveReachedEnd = hasReachedEnd;
|
transactionsHaveReachedEnd = hasReachedEnd;
|
||||||
if (adapter == null) {
|
if (context != null) {
|
||||||
adapter = new TransactionListAdapter(transactions, getContext());
|
if (adapter == null) {
|
||||||
adapter.setListener(TransactionHistoryFragment.this);
|
adapter = new TransactionListAdapter(transactions, context);
|
||||||
if (transactionList != null) {
|
adapter.setListener(TransactionHistoryFragment.this);
|
||||||
transactionList.setAdapter(adapter);
|
if (transactionList != null) {
|
||||||
|
transactionList.setAdapter(adapter);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
adapter.addTransactions(transactions);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
adapter.addTransactions(transactions);
|
|
||||||
}
|
}
|
||||||
checkNoTransactions();
|
checkNoTransactions();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue