Always display rewards driver on Invites page. Rewards drivers minimum display amounts.
This commit is contained in:
parent
6a083c4152
commit
2c98ed2d8d
8 changed files with 22 additions and 14 deletions
|
@ -12,6 +12,7 @@ import io.lbry.browser.MainActivity;
|
|||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.model.WalletBalance;
|
||||
import io.lbry.browser.ui.wallet.RewardsFragment;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -65,7 +66,7 @@ public class BaseFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
public void checkRewardsDriverCard(String rewardDriverText) {
|
||||
public void checkRewardsDriverCard(String rewardDriverText, double minCost) {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
View rewardDriverCard = root.findViewById(R.id.reward_driver_card);
|
||||
|
@ -85,7 +86,9 @@ public class BaseFragment extends Fragment {
|
|||
|
||||
// only apply to fragments that have the card present
|
||||
((TextView) rewardDriverCard.findViewById(R.id.reward_driver_text)).setText(rewardDriverText);
|
||||
boolean showRewardsDriver = Lbry.walletBalance == null || Lbry.walletBalance.getAvailable().doubleValue() <= 0;
|
||||
boolean showRewardsDriver = Lbry.walletBalance == null ||
|
||||
minCost == 0 && Lbry.walletBalance.getAvailable().doubleValue() == 0 |
|
||||
Lbry.walletBalance.getAvailable().doubleValue() < Math.max(minCost, Helper.MIN_DEPOSIT);
|
||||
rewardDriverCard.setVisibility(showRewardsDriver ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -697,7 +697,7 @@ public class ChannelFormFragment extends BaseFragment implements
|
|||
if (ctx != null) {
|
||||
String rewardsDriverText = String.format("%s\n%s",
|
||||
getString(R.string.channel_creation_requires_credits), getString(R.string.tap_here_to_get_some));
|
||||
checkRewardsDriverCard(rewardsDriverText);
|
||||
checkRewardsDriverCard(rewardsDriverText, Helper.MIN_DEPOSIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1428,6 +1428,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
if (metadata instanceof Claim.StreamMetadata) {
|
||||
Claim.StreamMetadata streamMetadata = (Claim.StreamMetadata) metadata;
|
||||
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 {
|
||||
|
@ -1436,10 +1437,13 @@ public class FileViewFragment extends BaseFragment implements
|
|||
return;
|
||||
}
|
||||
|
||||
getView().findViewById(R.id.file_view_main_action_button).setVisibility(View.INVISIBLE);
|
||||
getView().findViewById(R.id.file_view_main_action_loading).setVisibility(View.VISIBLE);
|
||||
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();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
showError(getString(R.string.cannot_view_claim));
|
||||
}
|
||||
|
@ -2161,7 +2165,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
Context ctx = getContext();
|
||||
if (ctx != null && claim != null && !claim.isFree() && claim.getFile() == null) {
|
||||
String rewardsDriverText = getString(R.string.earn_some_credits_to_access);
|
||||
checkRewardsDriverCard(rewardsDriverText);
|
||||
checkRewardsDriverCard(rewardsDriverText, claim.getActualCost(Lbryio.LBCUSDRate).doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1430,7 +1430,7 @@ public class PublishFormFragment extends BaseFragment implements
|
|||
if (ctx != null) {
|
||||
String rewardsDriverText = String.format("%s\n%s",
|
||||
getString(R.string.publishing_requires_credits), getString(R.string.tap_here_to_get_some));
|
||||
checkRewardsDriverCard(rewardsDriverText);
|
||||
checkRewardsDriverCard(rewardsDriverText, Helper.MIN_DEPOSIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -574,9 +574,9 @@ public class InvitesFragment extends BaseFragment implements SdkStatusListener,
|
|||
|
||||
private void checkRewardsDriver() {
|
||||
Context ctx = getContext();
|
||||
if (ctx != null) {
|
||||
String rewardsDriverText = getString(R.string.earn_credits_for_inviting);
|
||||
checkRewardsDriverCard(rewardsDriverText);
|
||||
View root = getView();
|
||||
if (ctx != null && root != null) {
|
||||
Helper.setViewText(root.findViewById(R.id.reward_driver_text), R.string.earn_credits_for_inviting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -604,7 +604,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
|||
Lbryio.totalUnclaimedRewardAmount == 1 ? 1 : 2,
|
||||
Helper.shortCurrencyFormat(Lbryio.totalUnclaimedRewardAmount));
|
||||
}
|
||||
checkRewardsDriverCard(rewardsDriverText);
|
||||
checkRewardsDriverCard(rewardsDriverText, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
<include layout="@layout/card_reward_driver"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp" />
|
||||
android:layout_marginBottom="16dp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<include layout="@layout/card_invites_by_link" />
|
||||
|
||||
|
|
|
@ -496,7 +496,7 @@
|
|||
<string name="invite_email_placeholder">imaginary@friend.com</string>
|
||||
<string name="invite">Invite</string>
|
||||
<string name="invite_history">Invite History</string>
|
||||
<string name="earn_credits_for_inviting">Earn credits for invite a friend, an enemy, a frenemy, or an enefriend. Everyone needs content freedom.</string>
|
||||
<string name="earn_credits_for_inviting">Earn credits for inviting a friend, an enemy, a frenemy, or an enefriend. Everyone needs content freedom.</string>
|
||||
<string name="reward">Reward</string>
|
||||
<string name="claimed">Claimed</string>
|
||||
<string name="claimable">Claimable</string>
|
||||
|
|
Loading…
Reference in a new issue