From 9a6d6049a4891bc5132207df70d54bfae6f5747e Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 29 Mar 2021 21:15:16 +0300 Subject: [PATCH] fixes after merge --- .../plus/liveupdates/LiveUpdatesFragment.java | 36 +++++++++++++++++++ .../settings/fragments/SubscriptionsCard.java | 3 +- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index 2058c6e31b..6e3c951f6c 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -50,6 +50,7 @@ import net.osmand.plus.base.BaseOsmAndDialogFragment; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.inapp.InAppPurchaseHelper; +import net.osmand.plus.inapp.InAppPurchases.InAppSubscription; import net.osmand.plus.liveupdates.LiveUpdatesClearBottomSheet.RefreshLiveUpdates; import net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay; import net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency; @@ -696,6 +697,41 @@ public class LiveUpdatesFragment extends BaseOsmAndDialogFragment implements OnL } } + public static String getSupportRegionName(OsmandApplication app, InAppPurchaseHelper purchaseHelper) { + OsmandSettings settings = app.getSettings(); + String countryName = settings.BILLING_USER_COUNTRY.get(); + if (purchaseHelper != null) { + List subscriptions = purchaseHelper.getLiveUpdates().getVisibleSubscriptions(); + boolean donationSupported = false; + for (InAppSubscription s : subscriptions) { + if (s.isDonationSupported()) { + donationSupported = true; + break; + } + } + if (donationSupported) { + if (Algorithms.isEmpty(countryName)) { + if (OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER.equals(settings.BILLING_USER_COUNTRY_DOWNLOAD_NAME.get())) { + countryName = app.getString(R.string.osmand_team); + } else { + countryName = app.getString(R.string.shared_string_world); + } + } + } else { + countryName = app.getString(R.string.osmand_team); + } + } else { + countryName = app.getString(R.string.osmand_team); + } + return countryName; + } + + public static String getSupportRegionHeader(OsmandApplication app, String supportRegion) { + return supportRegion.equals(app.getString(R.string.osmand_team)) ? + app.getString(R.string.default_buttons_support) : + app.getString(R.string.osm_live_support_region); + } + @ColorRes public static int getDefaultIconColorId(boolean nightMode) { return nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light; diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/SubscriptionsCard.java b/OsmAnd/src/net/osmand/plus/settings/fragments/SubscriptionsCard.java index 100bab00df..300b5b55dd 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/SubscriptionsCard.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/SubscriptionsCard.java @@ -14,7 +14,6 @@ import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.inapp.InAppPurchaseHelper; import net.osmand.plus.liveupdates.CountrySelectionFragment; import net.osmand.plus.liveupdates.LiveUpdatesFragment; -import net.osmand.plus.liveupdates.LiveUpdatesFragmentNew; import net.osmand.plus.liveupdates.OsmLiveActivity; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.settings.backend.OsmandSettings; @@ -71,7 +70,7 @@ public class SubscriptionsCard extends BaseCard { liveUpdatesContainer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - LiveUpdatesFragmentNew.showInstance(mapActivity.getSupportFragmentManager(), target); + LiveUpdatesFragment.showInstance(mapActivity.getSupportFragmentManager(), target); } });