Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61263dd59d | ||
|
|
2707e135c6 | ||
|
|
f9de0d7937 | ||
|
|
f03d58d648 | ||
|
|
f49a3570e9 | ||
|
|
1d97f9008d |
No files matched your search
+2
-2
@@ -16,8 +16,8 @@ android {
|
||||
applicationId "io.lbry.browser"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1509
|
||||
versionName "0.15.9"
|
||||
versionCode 1510
|
||||
versionName "0.15.10"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -837,10 +837,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
listener.onEnterPIPMode();
|
||||
}
|
||||
|
||||
View pipPlayerContainer = findViewById(R.id.pip_player_container);
|
||||
PlayerView pipPlayer = findViewById(R.id.pip_player);
|
||||
pipPlayer.setVisibility(View.VISIBLE);
|
||||
pipPlayer.setPlayer(appPlayer);
|
||||
pipPlayer.setUseController(false);
|
||||
pipPlayerContainer.setVisibility(View.VISIBLE);
|
||||
playerReassigned = true;
|
||||
}
|
||||
private void renderFullMode() {
|
||||
@@ -871,9 +872,10 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
listener.onExitPIPMode();
|
||||
}
|
||||
|
||||
View pipPlayerContainer = findViewById(R.id.pip_player_container);
|
||||
PlayerView pipPlayer = findViewById(R.id.pip_player);
|
||||
pipPlayer.setVisibility(View.INVISIBLE);
|
||||
pipPlayer.setPlayer(null);
|
||||
pipPlayerContainer.setVisibility(View.INVISIBLE);
|
||||
playerReassigned = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,19 @@ import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class PurchaseListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
private String claimId;
|
||||
private int page;
|
||||
private int pageSize;
|
||||
private ClaimSearchResultHandler handler;
|
||||
private View progressView;
|
||||
private Exception error;
|
||||
|
||||
public PurchaseListTask(String claimId, View progressView, ClaimSearchResultHandler handler) {
|
||||
this.claimId = claimId;
|
||||
this.progressView = progressView;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public PurchaseListTask(int page, int pageSize, View progressView, ClaimSearchResultHandler handler) {
|
||||
this.page = page;
|
||||
this.pageSize = pageSize;
|
||||
@@ -38,8 +45,15 @@ public class PurchaseListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
List<Claim> claims = null;
|
||||
try {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
options.put("page", page);
|
||||
options.put("page_size", pageSize);
|
||||
if (!Helper.isNullOrEmpty(claimId)) {
|
||||
options.put("claim_id", claimId);
|
||||
}
|
||||
if (page > 0) {
|
||||
options.put("page", page);
|
||||
}
|
||||
if (pageSize > 0) {
|
||||
options.put("page_size", pageSize);
|
||||
}
|
||||
options.put("resolve", true);
|
||||
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_PURCHASE_LIST, options);
|
||||
@@ -47,9 +61,10 @@ public class PurchaseListTask extends AsyncTask<Void, Void, List<Claim>> {
|
||||
claims = new ArrayList<>();
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
Claim claim = Claim.fromJSONObject(items.getJSONObject(i).getJSONObject("claim"));
|
||||
claims.add(claim);
|
||||
|
||||
Lbry.addClaimToCache(claim);
|
||||
if (!Helper.isNullOrEmpty(claim.getClaimId())) {
|
||||
claims.add(claim);
|
||||
Lbry.addClaimToCache(claim);
|
||||
}
|
||||
}
|
||||
} catch (ApiCallException | JSONException | ClassCastException ex) {
|
||||
error = ex;
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -19,7 +18,6 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -553,6 +551,12 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
|
||||
afterPostComment();
|
||||
checkNoComments();
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putDouble("amount", amount.doubleValue());
|
||||
bundle.putString("claim_id", claim != null ? claim.getClaimId() : null);
|
||||
bundle.putString("claim_name", claim != null ? claim.getName() : null);
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_COMMENT_CREATE, bundle);
|
||||
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(R.string.comment_posted);
|
||||
|
||||
@@ -131,6 +131,7 @@ import io.lbry.browser.tasks.claim.AbandonStreamTask;
|
||||
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
||||
import io.lbry.browser.tasks.claim.ClaimListTask;
|
||||
import io.lbry.browser.tasks.claim.ClaimSearchResultHandler;
|
||||
import io.lbry.browser.tasks.claim.PurchaseListTask;
|
||||
import io.lbry.browser.tasks.claim.ResolveTask;
|
||||
import io.lbry.browser.tasks.file.DeleteFileTask;
|
||||
import io.lbry.browser.tasks.file.FileListTask;
|
||||
@@ -342,6 +343,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
((MainActivity) context).onBackPressed();
|
||||
}
|
||||
|
||||
boolean invalidRepost = false;
|
||||
if (updateRequired) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).clearNowPlayingClaim();
|
||||
@@ -365,6 +367,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 +396,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();
|
||||
@@ -1609,29 +1625,65 @@ public class FileViewFragment extends BaseFragment implements
|
||||
// Check if the claim is free
|
||||
Claim.GenericMetadata metadata = claim.getValue();
|
||||
if (metadata instanceof Claim.StreamMetadata) {
|
||||
Claim.StreamMetadata streamMetadata = (Claim.StreamMetadata) metadata;
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
root.findViewById(R.id.file_view_main_action_button).setVisibility(View.INVISIBLE);
|
||||
root.findViewById(R.id.file_view_main_action_loading).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (claim.getFile() == null && !claim.isFree()) {
|
||||
// TODO: also check ownership from purchase_list
|
||||
// not free (and the user does not own the claim yet), perform a purchase
|
||||
confirmPurchaseUrl();
|
||||
} else {
|
||||
if (!claim.isPlayable() && !Lbry.SDK_READY) {
|
||||
if (!Lbry.SDK_READY) {
|
||||
Snackbar.make(getView().findViewById(R.id.file_view_global_layout), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
restoreMainActionButton();
|
||||
return;
|
||||
}
|
||||
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
root.findViewById(R.id.file_view_main_action_button).setVisibility(View.INVISIBLE);
|
||||
root.findViewById(R.id.file_view_main_action_loading).setVisibility(View.VISIBLE);
|
||||
handleMainActionForClaim();
|
||||
checkAndConfirmPurchaseUrl();
|
||||
} else {
|
||||
if (!claim.isPlayable() && !Lbry.SDK_READY) {
|
||||
Snackbar.make(getView().findViewById(R.id.file_view_global_layout), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
restoreMainActionButton();
|
||||
return;
|
||||
}
|
||||
|
||||
handleMainActionForClaim();
|
||||
}
|
||||
} else {
|
||||
showError(getString(R.string.cannot_view_claim));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndConfirmPurchaseUrl() {
|
||||
if (claim != null) {
|
||||
PurchaseListTask task = new PurchaseListTask(claim.getClaimId(), null, new ClaimSearchResultHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims, boolean hasReachedEnd) {
|
||||
boolean purchased = false;
|
||||
if (claims.size() == 1) {
|
||||
Claim purchasedClaim = claims.get(0);
|
||||
if (claim.getClaimId().equalsIgnoreCase(purchasedClaim.getClaimId())) {
|
||||
// already purchased
|
||||
purchased = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (purchased) {
|
||||
handleMainActionForClaim();
|
||||
} else {
|
||||
restoreMainActionButton();
|
||||
confirmPurchaseUrl();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
// pass
|
||||
restoreMainActionButton();
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
private void confirmPurchaseUrl() {
|
||||
if (claim != null) {
|
||||
Fee fee = ((Claim.StreamMetadata) claim.getValue()).getFee();
|
||||
@@ -2872,6 +2924,12 @@ public class FileViewFragment extends BaseFragment implements
|
||||
afterPostComment();
|
||||
checkNoComments();
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putDouble("amount", amount.doubleValue());
|
||||
bundle.putString("claim_id", claim != null ? claim.getClaimId() : null);
|
||||
bundle.putString("claim_name", claim != null ? claim.getName() : null);
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_COMMENT_CREATE, bundle);
|
||||
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(R.string.comment_posted);
|
||||
|
||||
@@ -103,16 +103,20 @@ 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 (adapter == null) {
|
||||
adapter = new TransactionListAdapter(transactions, getContext());
|
||||
adapter.setListener(TransactionHistoryFragment.this);
|
||||
if (transactionList != null) {
|
||||
transactionList.setAdapter(adapter);
|
||||
if (context != null) {
|
||||
if (adapter == null) {
|
||||
adapter = new TransactionListAdapter(transactions, context);
|
||||
adapter.setListener(TransactionHistoryFragment.this);
|
||||
if (transactionList != null) {
|
||||
transactionList.setAdapter(adapter);
|
||||
}
|
||||
} else {
|
||||
adapter.addTransactions(transactions);
|
||||
}
|
||||
} else {
|
||||
adapter.addTransactions(transactions);
|
||||
}
|
||||
checkNoTransactions();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public class LbryAnalytics {
|
||||
|
||||
public static final String EVENT_APP_ERROR = "app_error";
|
||||
public static final String EVENT_APP_LAUNCH = "app_launch";
|
||||
public static final String EVENT_COMMENT_CREATE = "comment_create";
|
||||
public static final String EVENT_EMAIL_ADDED = "email_added";
|
||||
public static final String EVENT_EMAIL_VERIFIED = "email_verified";
|
||||
public static final String EVENT_FIRST_RUN_COMPLETED = "first_run_completed";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/post_as"
|
||||
android:text="@string/comment_as"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="14sp"
|
||||
android:textFontWeight="300" />
|
||||
|
||||
@@ -128,12 +128,18 @@
|
||||
</RelativeLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/pip_player"
|
||||
<RelativeLayout
|
||||
android:id="@+id/pip_player_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/black"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="invisible" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
<com.google.android.exoplayer2.ui.PlayerView
|
||||
android:id="@+id/pip_player"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -82,7 +82,7 @@
|
||||
<string name="content_deleted">The content was successfully deleted from the blockchain.</string>
|
||||
<string name="content_failed_delete">The content could not be deleted at this time. Please try again later.</string>
|
||||
<string name="comment">Comment</string>
|
||||
<string name="post_as">Post as</string>
|
||||
<string name="comment_as">Comment as</string>
|
||||
<string name="please_enter_comment">Please enter a comment to post.</string>
|
||||
<string name="please_select_channel">Please select a channel to post your comment as.</string>
|
||||
<string name="post_comment">Post comment with tip?</string>
|
||||
|
||||
Reference in new issue
Block a user