From 067422823e8bf9eb4cc0684c6946230f910ddd15 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 18 Mar 2021 10:43:56 +0200 Subject: [PATCH] Add src-amazon (cherry picked from commit 2910df88e1a03bb4d96c3f364e38a9669eeebf7e) --- OsmAnd/AndroidManifest-amazon.xml | 27 ++++++++ OsmAnd/build.gradle | 6 +- .../plus/inapp/InAppPurchaseHelperImpl.java | 69 +++++++++++++++++++ .../osmand/plus/inapp/InAppPurchasesImpl.java | 41 +++++++++++ 4 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 OsmAnd/AndroidManifest-amazon.xml create mode 100644 OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java create mode 100644 OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java diff --git a/OsmAnd/AndroidManifest-amazon.xml b/OsmAnd/AndroidManifest-amazon.xml new file mode 100644 index 0000000000..93e028dd17 --- /dev/null +++ b/OsmAnd/AndroidManifest-amazon.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index 3b512b1090..f757952560 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"] - manifest.srcFile "AndroidManifest-gplayFree.xml" + java.srcDirs = ["src-nogms", "src-amazon"] + manifest.srcFile "AndroidManifest-amazon.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..c67c90308f --- /dev/null +++ b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java @@ -0,0 +1,41 @@ +package net.osmand.plus.inapp; + +import net.osmand.plus.OsmandApplication; + +public class InAppPurchasesImpl extends InAppPurchases { + + private static final InAppSubscription[] LIVE_UPDATES_FREE = new InAppSubscription[] {}; + + public InAppPurchasesImpl(OsmandApplication ctx) { + super(ctx); + inAppPurchases = new InAppPurchase[] {}; + liveUpdates = new LiveUpdatesInAppPurchasesFree(); + } + + @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 LiveUpdatesInAppPurchasesFree extends InAppSubscriptionList { + + public LiveUpdatesInAppPurchasesFree() { + super(LIVE_UPDATES_FREE); + } + } +} \ No newline at end of file