add MoonPay 'Buy LBC' button #937

Merged
akinwale merged 3 commits from moonpay into master 2020-06-13 17:14:06 +02:00
Showing only changes of commit 47b58fc9a6 - Show all commits

View file

@ -70,7 +70,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
private static final String MOONPAY_KEY = "c2tfbGl2ZV9ueVJqVXNDbE5pcnVSdnlCMkJLWW5JcFA5VnA3dWU="; private static final String MOONPAY_KEY = "c2tfbGl2ZV9ueVJqVXNDbE5pcnVSdnlCMkJLWW5JcFA5VnA3dWU=";
private static final String MOONPAY_URL_FORMAT = private static final String MOONPAY_URL_FORMAT =
"https://buy.moonpay.io?apiKey=pk_live_xNFffrN5NWKy6fu0ggbV8VQIwRieRzy&currencyCode=LBC&walletAddress=%s"; "https://buy.moonpay.io?apiKey=pk_live_xNFffrN5NWKy6fu0ggbV8VQIwRieRzy&colorCode=%%232F9176&currencyCode=LBC&showWalletAddressForm=true&walletAddress=%s&externalCustomerId=%s";
private View layoutAccountRecommended; private View layoutAccountRecommended;
private View layoutSdkInitializing; private View layoutSdkInitializing;
@ -517,7 +517,9 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
return; return;
} }
String url = String.format(MOONPAY_URL_FORMAT, receiveAddress); long userId = Lbryio.currentUser != null ? Lbryio.currentUser.getId() : 0;
String url = String.format(MOONPAY_URL_FORMAT, receiveAddress,
URLEncoder.encode(String.format("android-%d", userId), StandardCharsets.UTF_8.name()));
String email = Lbryio.getSignedInEmail(); String email = Lbryio.getSignedInEmail();
if (!Helper.isNullOrEmpty(email)) { if (!Helper.isNullOrEmpty(email)) {
url = String.format("%s&email=%s", url, URLEncoder.encode(email, StandardCharsets.UTF_8.name())); url = String.format("%s&email=%s", url, URLEncoder.encode(email, StandardCharsets.UTF_8.name()));