|
|
@ -133,7 +133,7 @@ public class ActivityBilling extends ActivityBase implements PurchasingListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
@NonNull
|
|
|
|
static String getSkuPro() {
|
|
|
|
static String getSkuPro(Context context) {
|
|
|
|
return BuildConfig.APPLICATION_ID.replace(".debug", "") + ".pro";
|
|
|
|
return BuildConfig.APPLICATION_ID.replace(".debug", "") + ".pro";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -202,7 +202,7 @@ public class ActivityBilling extends ActivityBase implements PurchasingListener,
|
|
|
|
private void onPurchase(Intent intent) {
|
|
|
|
private void onPurchase(Intent intent) {
|
|
|
|
if (Helper.isAmazonInstall() || isTesting(this))
|
|
|
|
if (Helper.isAmazonInstall() || isTesting(this))
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String skuPro = getSkuPro();
|
|
|
|
String skuPro = getSkuPro(this);
|
|
|
|
Log.i("IAB purchase SKU=" + skuPro);
|
|
|
|
Log.i("IAB purchase SKU=" + skuPro);
|
|
|
|
RequestId requestId = PurchasingService.purchase(skuPro);
|
|
|
|
RequestId requestId = PurchasingService.purchase(skuPro);
|
|
|
|
Log.i("IAB request=" + requestId);
|
|
|
|
Log.i("IAB request=" + requestId);
|
|
|
@ -238,7 +238,7 @@ public class ActivityBilling extends ActivityBase implements PurchasingListener,
|
|
|
|
PurchasingService.getUserData();
|
|
|
|
PurchasingService.getUserData();
|
|
|
|
PurchasingService.getPurchaseUpdates(true); // TODO: reset?
|
|
|
|
PurchasingService.getPurchaseUpdates(true); // TODO: reset?
|
|
|
|
Set<String> skus = new HashSet<>();
|
|
|
|
Set<String> skus = new HashSet<>();
|
|
|
|
skus.add(getSkuPro());
|
|
|
|
skus.add(getSkuPro(this));
|
|
|
|
PurchasingService.getProductData(skus);
|
|
|
|
PurchasingService.getProductData(skus);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -291,7 +291,7 @@ public class ActivityBilling extends ActivityBase implements PurchasingListener,
|
|
|
|
for (String key : products.keySet()) {
|
|
|
|
for (String key : products.keySet()) {
|
|
|
|
Product product = products.get(key);
|
|
|
|
Product product = products.get(key);
|
|
|
|
Log.i("IAB product=" + product.toString().replace('\n', '|'));
|
|
|
|
Log.i("IAB product=" + product.toString().replace('\n', '|'));
|
|
|
|
if (getSkuPro().equals(product.getSku()))
|
|
|
|
if (getSkuPro(this).equals(product.getSku()))
|
|
|
|
for (IBillingListener listener : listeners)
|
|
|
|
for (IBillingListener listener : listeners)
|
|
|
|
listener.onSkuDetails(product.getSku(), product.getPrice());
|
|
|
|
listener.onSkuDetails(product.getSku(), product.getPrice());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -322,7 +322,7 @@ public class ActivityBilling extends ActivityBase implements PurchasingListener,
|
|
|
|
Log.i("IAB receipt=" + receipt.toString().replace('\n', '|') +
|
|
|
|
Log.i("IAB receipt=" + receipt.toString().replace('\n', '|') +
|
|
|
|
" canceled=" + receipt.isCanceled() + "/" + receipt.getCancelDate());
|
|
|
|
" canceled=" + receipt.isCanceled() + "/" + receipt.getCancelDate());
|
|
|
|
|
|
|
|
|
|
|
|
if (getSkuPro().equals(receipt.getSku())) {
|
|
|
|
if (getSkuPro(this).equals(receipt.getSku())) {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
|
|
if (receipt.isCanceled()) {
|
|
|
|
if (receipt.isCanceled()) {
|
|
|
|
prefs.edit().remove("pro").apply();
|
|
|
|
prefs.edit().remove("pro").apply();
|
|
|
|