From d1a1484ea26b6adbce64d149f906bfac7c40050e Mon Sep 17 00:00:00 2001 From: Alexander Zatsepin Date: Fri, 21 Sep 2018 20:12:56 +0300 Subject: [PATCH] [android] Added usage ads removal ids from private --- .../com/mapswithme/maps/PrivateVariables.cpp | 18 ++++++++++++++++++ .../com/mapswithme/maps/PrivateVariables.java | 6 ++++++ .../maps/purchase/PurchaseFactory.java | 8 ++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/android/jni/com/mapswithme/maps/PrivateVariables.cpp b/android/jni/com/mapswithme/maps/PrivateVariables.cpp index d78f27134cf9a..72e00ee3b9558 100644 --- a/android/jni/com/mapswithme/maps/PrivateVariables.cpp +++ b/android/jni/com/mapswithme/maps/PrivateVariables.cpp @@ -69,4 +69,22 @@ extern "C" { return env->NewStringUTF(ADS_REMOVAL_VENDOR); } + + JNIEXPORT jstring JNICALL + Java_com_mapswithme_maps_PrivateVariables_adsRemovalYearlyProductId(JNIEnv *env, jclass clazz) + { + return env->NewStringUTF(ADS_REMOVAL_YEARLY_PRODUCT_ID); + } + + JNIEXPORT jstring JNICALL + Java_com_mapswithme_maps_PrivateVariables_adsRemovalMonthlyProductId(JNIEnv *env, jclass clazz) + { + return env->NewStringUTF(ADS_REMOVAL_MONTHLY_PRODUCT_ID); + } + + JNIEXPORT jstring JNICALL + Java_com_mapswithme_maps_PrivateVariables_adsRemovalWeeklyProductId(JNIEnv *env, jclass clazz) + { + return env->NewStringUTF(ADS_REMOVAL_WEEKLY_PRODUCT_ID); + } } diff --git a/android/src/com/mapswithme/maps/PrivateVariables.java b/android/src/com/mapswithme/maps/PrivateVariables.java index 36b8533f975c1..634ef2088ba0a 100644 --- a/android/src/com/mapswithme/maps/PrivateVariables.java +++ b/android/src/com/mapswithme/maps/PrivateVariables.java @@ -25,6 +25,12 @@ public class PrivateVariables public static native String adsRemovalServerId(); @NonNull public static native String adsRemovalVendor(); + @NonNull + public static native String adsRemovalYearlyProductId(); + @NonNull + public static native String adsRemovalMonthlyProductId(); + @NonNull + public static native String adsRemovalWeeklyProductId(); /** * @return interval in seconds */ diff --git a/android/src/com/mapswithme/maps/purchase/PurchaseFactory.java b/android/src/com/mapswithme/maps/purchase/PurchaseFactory.java index d4bd4a5bb67cc..713cbdfe7aaac 100644 --- a/android/src/com/mapswithme/maps/purchase/PurchaseFactory.java +++ b/android/src/com/mapswithme/maps/purchase/PurchaseFactory.java @@ -3,6 +3,7 @@ import android.support.annotation.NonNull; import com.android.billingclient.api.BillingClient; +import com.mapswithme.maps.PrivateVariables; public class PurchaseFactory { @@ -17,7 +18,10 @@ public static PurchaseController createPurchaseContr BillingManager billingManager = new PlayStoreBillingManager(BillingClient.SkuType.SUBS); PurchaseValidator validator = new AdsRemovalPurchaseValidator(); - return new AdsRemovalPurchaseController(validator, billingManager, "ads.removal.yearly.test", - "ads.removal.monthly.test", "ads.removal.weekly.test"); + String yearlyProduct = PrivateVariables.adsRemovalYearlyProductId(); + String monthlyProduct = PrivateVariables.adsRemovalMonthlyProductId(); + String weeklyProduct = PrivateVariables.adsRemovalWeeklyProductId(); + return new AdsRemovalPurchaseController(validator, billingManager, yearlyProduct, + monthlyProduct, weeklyProduct); } }