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();
|
||||
}
|
||||
|
||||
boolean invalidRepost = false;
|
||||
if (updateRequired) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).clearNowPlayingClaim();
|
||||
|
@ -365,6 +366,20 @@ public class FileViewFragment extends BaseFragment implements
|
|||
onNewClaim(currentUrl);
|
||||
if (Lbry.claimCache.containsKey(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 {
|
||||
resolveUrl(currentUrl);
|
||||
}
|
||||
|
@ -380,7 +395,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
Helper.saveUrlHistory(currentUrl, claim != null ? claim.getTitle() : null, UrlSuggestion.TYPE_FILE);
|
||||
}
|
||||
|
||||
if (claim != null) {
|
||||
if (claim != null && !invalidRepost) {
|
||||
Helper.saveViewHistory(currentUrl, claim);
|
||||
checkAndLoadRelatedContent();
|
||||
checkAndLoadComments();
|
||||
|
|
|
@ -103,10 +103,13 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
|
|||
TransactionListTask task = new TransactionListTask(currentTransactionPage, TRANSACTION_PAGE_LIMIT, loading, new TransactionListTask.TransactionListHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Transaction> transactions, boolean hasReachedEnd) {
|
||||
Context context = getContext();
|
||||
|
||||
transactionsLoading = false;
|
||||
transactionsHaveReachedEnd = hasReachedEnd;
|
||||
if (context != null) {
|
||||
if (adapter == null) {
|
||||
adapter = new TransactionListAdapter(transactions, getContext());
|
||||
adapter = new TransactionListAdapter(transactions, context);
|
||||
adapter.setListener(TransactionHistoryFragment.this);
|
||||
if (transactionList != null) {
|
||||
transactionList.setAdapter(adapter);
|
||||
|
@ -114,6 +117,7 @@ public class TransactionHistoryFragment extends BaseFragment implements Transact
|
|||
} else {
|
||||
adapter.addTransactions(transactions);
|
||||
}
|
||||
}
|
||||
checkNoTransactions();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue