From e10afa843e5c152892aaef3aa62273d85c9bdd44 Mon Sep 17 00:00:00 2001 From: Konstantin Pastbin Date: Wed, 4 Dec 2024 01:31:01 +0300 Subject: [PATCH] =?UTF-8?q?Revert=20"[android]=20Remove=20a=20referral=20c?= =?UTF-8?q?ode=20from=20=E2=80=9CPhotos,=20reviews,=20booking=E2=80=9D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ee7e87fa1e3a991401bb077fa7331938aa7916c3. Signed-off-by: Konstantin Pastbin --- android/app/src/main/cpp/app/organicmaps/Framework.cpp | 5 ++--- android/app/src/main/java/app/organicmaps/Framework.java | 3 +-- .../app/src/main/java/app/organicmaps/MwmActivity.java | 2 +- .../java/app/organicmaps/bookmarks/data/MapObject.java | 4 +--- .../app/src/main/java/app/organicmaps/util/Config.java | 5 ----- indexer/kayak.cpp | 9 ++++----- indexer/kayak.hpp | 4 ++-- 7 files changed, 11 insertions(+), 21 deletions(-) diff --git a/android/app/src/main/cpp/app/organicmaps/Framework.cpp b/android/app/src/main/cpp/app/organicmaps/Framework.cpp index 1aab2645a2..d749e7a390 100644 --- a/android/app/src/main/cpp/app/organicmaps/Framework.cpp +++ b/android/app/src/main/cpp/app/organicmaps/Framework.cpp @@ -1984,13 +1984,12 @@ Java_app_organicmaps_Framework_nativeMemoryWarning(JNIEnv *, jclass) JNIEXPORT jstring JNICALL Java_app_organicmaps_Framework_nativeGetKayakHotelLink(JNIEnv * env, jclass, jstring countryIsoCode, jstring uri, - jlong firstDaySec, jlong lastDaySec, jboolean isReferral) + jlong firstDaySec, jlong lastDaySec) { string const url = osm::GetKayakHotelURLFromURI(jni::ToNativeString(env, countryIsoCode), jni::ToNativeString(env, uri), static_cast(firstDaySec), - static_cast(lastDaySec), - isReferral); + static_cast(lastDaySec)); return url.empty() ? nullptr : jni::ToJavaString(env, url); } diff --git a/android/app/src/main/java/app/organicmaps/Framework.java b/android/app/src/main/java/app/organicmaps/Framework.java index 24cdac37ab..63d70abde3 100644 --- a/android/app/src/main/java/app/organicmaps/Framework.java +++ b/android/app/src/main/java/app/organicmaps/Framework.java @@ -456,10 +456,9 @@ public class Framework * @param uri `$HOTEL_NAME,-c$CITY_ID-h$HOTEL_ID` URI. * @param firstDaySec the epoch seconds of the first day of planned stay. * @param lastDaySec the epoch seconds of the last day of planned stay. - * @param isReferral enable referral code to help the project. * @return a URL to Kayak's hotel page. */ @Nullable public static native String nativeGetKayakHotelLink(@NonNull String countryIsoCode, @NonNull String uri, - long firstDaySec, long lastDaySec, boolean isReferral); + long firstDaySec, long lastDaySec); } diff --git a/android/app/src/main/java/app/organicmaps/MwmActivity.java b/android/app/src/main/java/app/organicmaps/MwmActivity.java index f8d60e581f..c5baf60699 100644 --- a/android/app/src/main/java/app/organicmaps/MwmActivity.java +++ b/android/app/src/main/java/app/organicmaps/MwmActivity.java @@ -1726,7 +1726,7 @@ public class MwmActivity extends BaseMwmFragmentActivity public void openKayakLink(@NonNull String url) { - if (Config.isKayakDisclaimerAccepted() || !Config.isKayakReferralAllowed()) + if (Config.isKayakDisclaimerAccepted()) { Utils.openUrl(this, url); return; diff --git a/android/app/src/main/java/app/organicmaps/bookmarks/data/MapObject.java b/android/app/src/main/java/app/organicmaps/bookmarks/data/MapObject.java index 750c9bb263..869674fb74 100644 --- a/android/app/src/main/java/app/organicmaps/bookmarks/data/MapObject.java +++ b/android/app/src/main/java/app/organicmaps/bookmarks/data/MapObject.java @@ -13,7 +13,6 @@ import androidx.core.os.ParcelCompat; import app.organicmaps.Framework; import app.organicmaps.routing.RoutePointInfo; import app.organicmaps.search.Popularity; -import app.organicmaps.util.Config; import app.organicmaps.util.Utils; import app.organicmaps.widget.placepage.PlacePageData; @@ -292,8 +291,7 @@ public class MapObject implements PlacePageData final Instant firstDay = Instant.now(); final long firstDaySec = firstDay.getEpochSecond(); final long lastDaySec = firstDay.plus(1, ChronoUnit.DAYS).getEpochSecond(); - final boolean isReferral = Config.isKayakReferralAllowed(); - final String res = Framework.nativeGetKayakHotelLink(Utils.getCountryCode(), uri, firstDaySec, lastDaySec, isReferral); + final String res = Framework.nativeGetKayakHotelLink(Utils.getCountryCode(), uri, firstDaySec, lastDaySec); return res == null ? "" : res; } diff --git a/android/app/src/main/java/app/organicmaps/util/Config.java b/android/app/src/main/java/app/organicmaps/util/Config.java index b5634cae8f..132b3c6051 100644 --- a/android/app/src/main/java/app/organicmaps/util/Config.java +++ b/android/app/src/main/java/app/organicmaps/util/Config.java @@ -229,11 +229,6 @@ public final class Config setBool(KEY_MISC_KAYAK_ACCEPTED); } - public static boolean isKayakReferralAllowed() - { - return !isFdroid(); - } - public static boolean isLocationRequested() { return getBool(KEY_MISC_LOCATION_REQUESTED); diff --git a/indexer/kayak.cpp b/indexer/kayak.cpp index 3d1a598fc4..d8a26f2bc6 100644 --- a/indexer/kayak.cpp +++ b/indexer/kayak.cpp @@ -88,7 +88,7 @@ const map KAYAK_DOMAINS = { string GetKayakHotelURL(const string & countryIsoCode, uint64_t kayakHotelId, const string & kayakHotelName, uint64_t kayakCityId, - time_t firstDay, time_t lastDay, bool isReferral) + time_t firstDay, time_t lastDay) { // https://www.kayak.com.tr/hotels/Elexus-Hotel-Resort--Spa--Casino,Kyrenia-c7163-h2651619-details/2023-10-03/2023-10-04/1adults @@ -97,8 +97,7 @@ string GetKayakHotelURL(const string & countryIsoCode, uint64_t kayakHotelId, url << "https://"; auto const it = KAYAK_DOMAINS.find(countryIsoCode); url << ((it == KAYAK_DOMAINS.end()) ? KAYAK_DOMAINS.find("US")->second : it->second); - if (isReferral) - url << "/in?" << "a=" << KAYAK_AFFILIATE << "&url="; + url << "/in?" << "a=" << KAYAK_AFFILIATE << "&url="; url << "/hotels/"; url << url::Slug(kayakHotelName) << ","; url << "-c" << kayakCityId << "-h" << kayakHotelId << "-details"; @@ -115,7 +114,7 @@ string GetKayakHotelURL(const string & countryIsoCode, uint64_t kayakHotelId, } string GetKayakHotelURLFromURI(const string & countryIsoCode, const string & uri, - time_t firstDay, time_t lastDay, bool isReferral) + time_t firstDay, time_t lastDay) { // Elexus Hotel Resort & Spa & Casino,-c7163-h1696321580 @@ -134,7 +133,7 @@ string GetKayakHotelURLFromURI(const string & countryIsoCode, const string & uri !to_uint64(uri.substr(c + 3, h - c - 3).c_str(), kayakCityId)) return {}; - return GetKayakHotelURL(countryIsoCode, kayakHotelId, kayakHotelName, kayakCityId, firstDay, lastDay, isReferral); + return GetKayakHotelURL(countryIsoCode, kayakHotelId, kayakHotelName, kayakCityId, firstDay, lastDay); } } // namespace osm diff --git a/indexer/kayak.hpp b/indexer/kayak.hpp index 760a01d84b..a329c26a1b 100644 --- a/indexer/kayak.hpp +++ b/indexer/kayak.hpp @@ -8,8 +8,8 @@ namespace osm { std::string GetKayakHotelURL(const std::string & countryIsoCode, uint64_t kayakHotelId, const std::string & kayakHotelName, uint64_t kayakCityId, - time_t firstDay, time_t lastDay, bool isReferral = true); + time_t firstDay, time_t lastDay); std::string GetKayakHotelURLFromURI(const std::string & countryIsoCode, const std::string & uri, - time_t firstDay, time_t lastDay, bool isReferral = true); + time_t firstDay, time_t lastDay); } // namespace osm