diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index ad12988def..46192a3144 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -84,11 +84,11 @@ android { manifest.srcFile "AndroidManifest-nightlyFree.xml" } amazonFree { - java.srcDirs = ["src-nogms", "src-google"] + java.srcDirs = ["src-nogms", "src-amazon"] manifest.srcFile "AndroidManifest-gplayFree.xml" } amazonFull { - java.srcDirs = ["src-nogms", "src-google"] + java.srcDirs = ["src-nogms", "src-amazon"] } huawei { java.srcDirs = ["src-nogms", "src-huawei"] diff --git a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java new file mode 100644 index 0000000000..f59569ecc2 --- /dev/null +++ b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java @@ -0,0 +1,69 @@ +package net.osmand.plus.inapp; + +import android.app.Activity; +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import net.osmand.plus.OsmandApplication; + +import java.lang.ref.WeakReference; + +public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { + + public InAppPurchaseHelperImpl(OsmandApplication ctx) { + super(ctx); + purchases = new InAppPurchasesImpl(ctx); + } + + @Override + public void isInAppPurchaseSupported(@NonNull Activity activity, @Nullable InAppPurchaseInitCallback callback) { + + } + + @Override + protected void execImpl(@NonNull InAppPurchaseTaskType taskType, @NonNull InAppCommand command) { + + } + + @Override + public void purchaseFullVersion(@NonNull Activity activity) throws UnsupportedOperationException { + + } + + @Override + public void purchaseDepthContours(@NonNull Activity activity) throws UnsupportedOperationException { + + } + + @Override + public void purchaseContourLines(@NonNull Activity activity) throws UnsupportedOperationException { + + } + + @Override + public void manageSubscription(@NonNull Context ctx, @Nullable String sku) { + + } + + @Override + protected InAppCommand getPurchaseLiveUpdatesCommand(WeakReference activity, String sku, String userInfo) throws UnsupportedOperationException { + return null; + } + + @Override + protected InAppCommand getRequestInventoryCommand() throws UnsupportedOperationException { + return null; + } + + @Override + protected boolean isBillingManagerExists() { + return false; + } + + @Override + protected void destroyBillingManager() { + + } +} \ No newline at end of file diff --git a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java new file mode 100644 index 0000000000..00bbea9693 --- /dev/null +++ b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java @@ -0,0 +1,39 @@ +package net.osmand.plus.inapp; + +import net.osmand.plus.OsmandApplication; + +public class InAppPurchasesImpl extends InAppPurchases { + + public InAppPurchasesImpl(OsmandApplication ctx) { + super(ctx); + inAppPurchases = new InAppPurchase[] {}; + liveUpdates = new EmptyLiveUpdatesList(); + } + + @Override + public boolean isFullVersion(String sku) { + return false; + } + + @Override + public boolean isDepthContours(String sku) { + return false; + } + + @Override + public boolean isContourLines(String sku) { + return false; + } + + @Override + public boolean isLiveUpdates(String sku) { + return false; + } + + private static class EmptyLiveUpdatesList extends InAppSubscriptionList { + + public EmptyLiveUpdatesList() { + super(new InAppSubscription[] {}); + } + } +} \ No newline at end of file diff --git a/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java b/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java index 7a16429bd5..3fc73e6f1d 100644 --- a/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java +++ b/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java @@ -31,7 +31,6 @@ import net.osmand.plus.inapp.InAppPurchases.InAppSubscription; import net.osmand.plus.inapp.InAppPurchases.InAppSubscriptionIntroductoryInfo; import net.osmand.plus.inapp.InAppPurchasesImpl.InAppPurchaseLiveUpdatesOldSubscription; import net.osmand.plus.settings.backend.OsmandSettings; -import net.osmand.plus.settings.backend.OsmandPreference; import net.osmand.util.Algorithms; import java.lang.ref.WeakReference; @@ -268,7 +267,7 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { InAppSubscription s = (InAppSubscription) inAppPurchase; try { s.setIntroductoryInfo(new InAppSubscriptionIntroductoryInfo(s, introductoryPrice, - introductoryPriceAmountMicros, introductoryPricePeriod, String.valueOf(introductoryPriceCycles))); + introductoryPriceAmountMicros, introductoryPricePeriod, introductoryPriceCycles)); } catch (ParseException e) { LOG.error(e); } @@ -542,20 +541,12 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { } } } - OsmandPreference subscriptionCancelledTime = ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_TIME; if (!subscribedToLiveUpdates && ctx.getSettings().LIVE_UPDATES_PURCHASED.get()) { - if (subscriptionCancelledTime.get() == 0) { - subscriptionCancelledTime.set(System.currentTimeMillis()); - ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_FIRST_DLG_SHOWN.set(false); - ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_SECOND_DLG_SHOWN.set(false); - } else if (System.currentTimeMillis() - subscriptionCancelledTime.get() > SUBSCRIPTION_HOLDING_TIME_MSEC) { - ctx.getSettings().LIVE_UPDATES_PURCHASED.set(false); - if (!isDepthContoursPurchased(ctx)) { - ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false); - } + ctx.getSettings().LIVE_UPDATES_PURCHASED.set(false); + if (!isDepthContoursPurchased(ctx)) { + ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false); } } else if (subscribedToLiveUpdates) { - subscriptionCancelledTime.set(0L); ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true); }