From 39b91a8886f96233229a915c7c84fcb2756b72f4 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 19 May 2020 19:38:30 +0100 Subject: [PATCH] Fix displayed amounts. Send Firebase token with install_new. --- .../java/io/lbry/browser/model/Claim.java | 5 +-- .../ui/publish/PublishFormFragment.java | 31 +++++++++++++++++++ .../java/io/lbry/browser/utils/Lbryio.java | 7 ++++- .../main/res/layout/fragment_publish_form.xml | 16 ++++++++++ 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java create mode 100644 app/src/main/res/layout/fragment_publish_form.xml diff --git a/app/src/main/java/io/lbry/browser/model/Claim.java b/app/src/main/java/io/lbry/browser/model/Claim.java index 83698f9..615c292 100644 --- a/app/src/main/java/io/lbry/browser/model/Claim.java +++ b/app/src/main/java/io/lbry/browser/model/Claim.java @@ -121,7 +121,7 @@ public class Claim { return new BigDecimal(String.valueOf(amount / usdRate)); } - return new BigDecimal(String.valueOf(amount)).divide(new BigDecimal(100000000)); // deweys + return new BigDecimal(String.valueOf(amount)); // deweys } return new BigDecimal(0); @@ -363,7 +363,8 @@ public class Claim { Fee fee = null; if (feeAmount > 0) { fee = new Fee(); - fee.setAmount(String.valueOf(feeAmount)); + fee.setAmount(String.valueOf(new BigDecimal(String.valueOf(feeAmount)).divide(new BigDecimal(100000000)))); + fee.setCurrency("LBC"); } ((StreamMetadata) metadata).setFee(fee); diff --git a/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java b/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java new file mode 100644 index 0000000..9fe3be4 --- /dev/null +++ b/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java @@ -0,0 +1,31 @@ +package io.lbry.browser.ui.publish; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; + +import io.lbry.browser.R; +import io.lbry.browser.ui.BaseFragment; + +public class PublishFormFragment extends BaseFragment { + + public View onCreateView(@NonNull LayoutInflater inflater, + ViewGroup container, Bundle savedInstanceState) { + View root = inflater.inflate(R.layout.fragment_publishes, container, false); + + return root; + } + + @Override + public boolean shouldHideGlobalPlayer() { + return true; + } + + @Override + public boolean shouldSuspendGlobalPlayer() { + return true; + } +} diff --git a/app/src/main/java/io/lbry/browser/utils/Lbryio.java b/app/src/main/java/io/lbry/browser/utils/Lbryio.java index 85ed74e..02e9b07 100644 --- a/app/src/main/java/io/lbry/browser/utils/Lbryio.java +++ b/app/src/main/java/io/lbry/browser/utils/Lbryio.java @@ -212,7 +212,12 @@ public final class Lbryio { } Map options = new HashMap<>(); - //options.put("firebase_token", null); + if (context instanceof MainActivity) { + String firebaseToken = ((MainActivity) context).getFirebaseMessagingToken(); + if (!Helper.isNullOrEmpty(firebaseToken)) { + options.put("firebase_token", firebaseToken); + } + } options.put("app_version", appVersion); options.put("app_id", Lbry.INSTALLATION_ID); options.put("node_id", ""); diff --git a/app/src/main/res/layout/fragment_publish_form.xml b/app/src/main/res/layout/fragment_publish_form.xml new file mode 100644 index 0000000..3cfa5e0 --- /dev/null +++ b/app/src/main/res/layout/fragment_publish_form.xml @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file