diff --git a/OsmAnd/src/net/osmand/plus/inapp/InAppHelper.java b/OsmAnd/src/net/osmand/plus/inapp/InAppHelper.java index 9237a22a1c..0b489fd85c 100644 --- a/OsmAnd/src/net/osmand/plus/inapp/InAppHelper.java +++ b/OsmAnd/src/net/osmand/plus/inapp/InAppHelper.java @@ -41,14 +41,9 @@ public class InAppHelper { private static boolean mSubscribedToLiveUpdates = false; private static String mLiveUpdatesPrice; - public static final String SKU_LIVE_UPDATES = "osm_live_subscription_1"; - - // Static test - //public static final String SKU_LIVE_UPDATES = "android.test.purchased"; - //public static final String SKU_LIVE_UPDATES = "android.test.canceled"; - //public static final String SKU_LIVE_UPDATES = "android.test.refunded"; - //public static final String SKU_LIVE_UPDATES = "android.test.item_unavailable"; - + private static final String SKU_LIVE_UPDATES_FULL = "osm_live_subscription_2"; + private static final String SKU_LIVE_UPDATES_FREE = "osm_free_live_subscription_2"; + private static String SKU_LIVE_UPDATES; // (arbitrary) request code for the purchase flow private static final int RC_REQUEST = 10001; @@ -80,9 +75,20 @@ public class InAppHelper { return mLiveUpdatesPrice; } + public static String getSkuLiveUpdates() { + return SKU_LIVE_UPDATES; + } + public InAppHelper(OsmandApplication ctx, InAppCallbacks callbacks) { this.ctx = ctx; this.callbacks = callbacks; + if (SKU_LIVE_UPDATES == null) { + if (Version.isFreeVersion(ctx)) { + SKU_LIVE_UPDATES = SKU_LIVE_UPDATES_FREE; + } else { + SKU_LIVE_UPDATES = SKU_LIVE_UPDATES_FULL; + } + } } public void start(final boolean stopAfterResult) { @@ -110,7 +116,7 @@ public class InAppHelper { mHelper = new IabHelper(ctx, base64EncodedPublicKey); // enable debug logging (for a production application, you should set this to false). - mHelper.enableDebugLogging(true); + mHelper.enableDebugLogging(false); // Start setup. This is asynchronous and the specified listener // will be called once setup completes. @@ -401,7 +407,7 @@ public class InAppHelper { } private String sendRequest(String url, Map parameters, String userOperation) { - Log.d(TAG, "Sending request " + url); //$NON-NLS-1$ + Log.d(TAG, "Sending request " + url); HttpURLConnection connection = null; try { connection = NetworkUtils.getHttpURLConnection(url); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index 81f561ad28..eb9d47de7f 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -78,7 +78,6 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment { Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_live_updates, container, false); listView = (ExpandableListView) view.findViewById(android.R.id.list); -// View header = inflater.inflate(R.layout.live_updates_header, listView, false); View bottomShadowView = inflater.inflate(R.layout.shadow_bottom, listView, false); listView.addFooterView(bottomShadowView); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/SubscriptionFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/SubscriptionFragment.java index 03201a876e..fe895a1e4a 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/SubscriptionFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/SubscriptionFragment.java @@ -172,7 +172,7 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In @Override public void onItemPurchased(String sku) { - if (InAppHelper.SKU_LIVE_UPDATES.equals(sku)) { + if (InAppHelper.getSkuLiveUpdates().equals(sku)) { Fragment parentFragment = getParentFragment(); if (parentFragment instanceof LiveUpdatesFragment) { ((LiveUpdatesFragment) parentFragment).updateSubscriptionBanner(); @@ -190,6 +190,7 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In dlg = new ProgressDialog(getActivity()); dlg.setTitle(""); dlg.setMessage(getString(R.string.wait_current_task_finished)); + dlg.setCancelable(false); dlg.show(); }