Skip to content

Commit

Permalink
[android] Added usage ads removal ids from private
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzatsepin authored and Sergey Yershov committed Sep 24, 2018
1 parent 39f3500 commit d1a1484
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
18 changes: 18 additions & 0 deletions android/jni/com/mapswithme/maps/PrivateVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
6 changes: 6 additions & 0 deletions android/src/com/mapswithme/maps/PrivateVariables.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
8 changes: 6 additions & 2 deletions android/src/com/mapswithme/maps/purchase/PurchaseFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.support.annotation.NonNull;

import com.android.billingclient.api.BillingClient;
import com.mapswithme.maps.PrivateVariables;

public class PurchaseFactory
{
Expand All @@ -17,7 +18,10 @@ public static PurchaseController<AdsRemovalPurchaseCallback> createPurchaseContr
BillingManager<PlayStoreBillingCallback> billingManager
= new PlayStoreBillingManager(BillingClient.SkuType.SUBS);
PurchaseValidator<AdsRemovalValidationCallback> 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);
}
}

0 comments on commit d1a1484

Please sign in to comment.