Small renaming

This commit is contained in:
cepprice 2021-03-05 20:41:40 +05:00
parent 83bd81eea7
commit 82f2138c07
2 changed files with 16 additions and 16 deletions

View file

@ -200,7 +200,7 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper {
BillingManager billingManager = getBillingManager();
if (billingManager != null) {
storeUserInfo(billingManager);
setupUserInfo(billingManager);
billingManager.initiatePurchaseFlow(activity, skuDetails);
} else {
throw new IllegalStateException("BillingManager disposed");
@ -228,7 +228,7 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper {
}
BillingManager billingManager = getBillingManager();
if (billingManager != null) {
storeUserInfo(billingManager);
setupUserInfo(billingManager);
billingManager.initiatePurchaseFlow(activity, skuDetails);
} else {
throw new IllegalStateException("BillingManager disposed");
@ -568,7 +568,7 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper {
if (AndroidUtils.isActivityNotDestroyed(a) && skuDetails != null) {
BillingManager billingManager = getBillingManager();
if (billingManager != null) {
storeUserInfo(billingManager);
setupUserInfo(billingManager);
billingManager.initiatePurchaseFlow(a, skuDetails);
} else {
throw new IllegalStateException("BillingManager disposed");
@ -620,10 +620,10 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper {
onPurchaseDone(getPurchaseInfo(purchase));
}
private void storeUserInfo(BillingManager billingManager) {
private void setupUserInfo(BillingManager billingManager) {
OsmandSettings settings = ctx.getSettings();
billingManager.setUserId(settings.BILLING_USER_ID.get());
billingManager.setUserToken(settings.BILLING_USER_TOKEN.get());
billingManager.setObfuscatedAccountId(settings.BILLING_USER_ID.get());
billingManager.setObfuscatedProfileId(settings.BILLING_USER_TOKEN.get());
}
@Override

View file

@ -58,8 +58,8 @@ public class BillingManager implements PurchasesUpdatedListener {
// Public key for verifying signature, in base64 encoding
private String mSignatureBase64;
private String mUserId;
private String mUserToken;
private String mObfuscatedAccountId;
private String mObfuscatedProfileId;
private final BillingUpdatesListener mBillingUpdatesListener;
private final List<Purchase> mPurchases = new ArrayList<>();
@ -149,11 +149,11 @@ public class BillingManager implements PurchasesUpdatedListener {
LOG.debug("Launching in-app purchase flow. Replace old SKU? " + (oldSku != null && purchaseToken != null));
BillingFlowParams.Builder paramsBuilder = BillingFlowParams.newBuilder()
.setSkuDetails(skuDetails);
if (!TextUtils.isEmpty(mUserId)) {
paramsBuilder.setObfuscatedAccountId(mUserId);
if (!TextUtils.isEmpty(mObfuscatedAccountId)) {
paramsBuilder.setObfuscatedAccountId(mObfuscatedAccountId);
}
if (!TextUtils.isEmpty(mUserToken)) {
paramsBuilder.setObfuscatedProfileId(mUserToken);
if (!TextUtils.isEmpty(mObfuscatedProfileId)) {
paramsBuilder.setObfuscatedProfileId(mObfuscatedProfileId);
}
if (oldSku != null && purchaseToken != null) {
paramsBuilder.setOldSku(oldSku, purchaseToken);
@ -405,12 +405,12 @@ public class BillingManager implements PurchasesUpdatedListener {
});
}
public void setUserId(String userId) {
mUserId = userId;
public void setObfuscatedAccountId(String obfuscatedAccountId) {
mObfuscatedAccountId = obfuscatedAccountId;
}
public void setUserToken(String userToken) {
mUserToken = userToken;
public void setObfuscatedProfileId(String obfuscatedProfileId) {
mObfuscatedProfileId = obfuscatedProfileId;
}
private void executeServiceRequest(Runnable runnable) {