diff --git a/android/jni/CMakeLists.txt b/android/jni/CMakeLists.txt index 3acef183d2..ee104e6758 100644 --- a/android/jni/CMakeLists.txt +++ b/android/jni/CMakeLists.txt @@ -41,7 +41,6 @@ set( com/mapswithme/maps/bookmarks/data/Bookmark.cpp com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp com/mapswithme/maps/bookmarks/data/BookmarkCategory.cpp - com/mapswithme/maps/cian/Cian.cpp com/mapswithme/maps/discovery/DiscoveryManager.cpp com/mapswithme/maps/discovery/Locals.cpp com/mapswithme/maps/DisplayedCategories.cpp diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index e52a8e6abc..7b54713917 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -599,17 +599,6 @@ void Framework::UploadUGC() m_work.UploadUGC(nullptr /* onCompleteUploading */); } -uint64_t Framework::GetRentNearby(JNIEnv * env, jobject policy, ms::LatLon const & latlon, - cian::Api::RentNearbyCallback const & onSuccess, - cian::Api::ErrorCallback const & onError) -{ - auto const cianApi = m_work.GetCianApi(ToNativeNetworkPolicy(env, policy)); - if (!cianApi) - return 0; - - return cianApi->GetRentNearby(latlon, onSuccess, onError); -} - int Framework::ToDoAfterUpdate() const { return (int) m_work.ToDoAfterUpdate(); diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index f4cd96dc0b..f38a3ed411 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -206,10 +206,6 @@ namespace android void SetUGCUpdate(FeatureID const & fid, ugc::UGCUpdate const & ugc); void UploadUGC(); - uint64_t GetRentNearby(JNIEnv * env, jobject policy, ms::LatLon const & latlon, - cian::Api::RentNearbyCallback const & onSuccess, - cian::Api::ErrorCallback const & onError); - int ToDoAfterUpdate() const; uint64_t GetLocals(JNIEnv * env, jobject policy, double lat, double lon, diff --git a/android/jni/com/mapswithme/maps/cian/Cian.cpp b/android/jni/com/mapswithme/maps/cian/Cian.cpp deleted file mode 100644 index 36b09815c3..0000000000 --- a/android/jni/com/mapswithme/maps/cian/Cian.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "com/mapswithme/maps/Framework.hpp" - -#include "com/mapswithme/core/jni_helper.hpp" -#include "partners_api/cian_api.hpp" - -#include "base/logging.cpp" - -namespace -{ -jclass g_cianClass; -jclass g_rentPlaceClass; -jclass g_rentOfferClass; -jmethodID g_rentPlaceConstructor; -jmethodID g_rentOfferConstructor; -jmethodID g_cianCallback; -jmethodID g_cianSuccessCallback; -jmethodID g_cianErrorCallback; -uint64_t g_requestId; -std::string g_id; - -void PrepareClassRefs(JNIEnv * env) -{ - if (g_cianClass) - return; - - g_cianClass = jni::GetGlobalClassRef(env, "com/mapswithme/maps/cian/Cian"); - g_rentPlaceClass = jni::GetGlobalClassRef(env, "com/mapswithme/maps/cian/RentPlace"); - g_rentOfferClass = jni::GetGlobalClassRef(env, "com/mapswithme/maps/cian/RentOffer"); - - g_rentPlaceConstructor = - jni::GetConstructorID(env, g_rentPlaceClass, - "(DD[Lcom/mapswithme/maps/cian/RentOffer;)V"); - - g_rentOfferConstructor = - jni::GetConstructorID(env, g_rentOfferClass, - "(Ljava/lang/String;IDIILjava/lang/String;Ljava/lang/String;)V"); - - g_cianSuccessCallback = - jni::GetStaticMethodID(env, g_cianClass, "onRentPlacesReceived", - "([Lcom/mapswithme/maps/cian/RentPlace;Ljava/lang/String;)V"); - g_cianErrorCallback = - jni::GetStaticMethodID(env, g_cianClass, "onErrorReceived", - "(I)V"); -} - -void OnRentPlacesReceived(std::vector const & places, uint64_t const requestId) -{ - if (g_requestId != requestId) - return; - - JNIEnv * env = jni::GetEnv(); - - auto const offerBuilder = [](JNIEnv * env, cian::RentOffer const & item) - { - jni::TScopedLocalRef jFlatType(env, jni::ToJavaString(env, item.m_flatType)); - jni::TScopedLocalRef jUrl(env, jni::ToJavaString(env, item.m_url)); - jni::TScopedLocalRef jAddress(env, jni::ToJavaString(env, item.m_address)); - return env->NewObject(g_rentOfferClass, g_rentOfferConstructor, jFlatType.get(), - item.m_roomsCount, item.m_priceRur, item.m_floorNumber, - item.m_floorsCount, jUrl.get(), jAddress.get()); - }; - - auto const placeBuilder = [offerBuilder](JNIEnv * env, cian::RentPlace const & item) - { - return env->NewObject(g_rentPlaceClass, g_rentPlaceConstructor, item.m_latlon.lat, - item.m_latlon.lon, - jni::ToJavaArray(env, g_rentOfferClass, item.m_offers, offerBuilder)); - }; - - jni::TScopedLocalObjectArrayRef jPlaces(env, jni::ToJavaArray(env, g_rentPlaceClass, places, - placeBuilder)); - jni::TScopedLocalRef jId(env, jni::ToJavaString(env, g_id)); - - env->CallStaticVoidMethod(g_cianClass, g_cianSuccessCallback, jPlaces.get(), jId.get()); -} - -void OnErrorReceived(int httpCode, uint64_t const requestId) -{ - if (g_requestId != requestId) - return; - - JNIEnv * env = jni::GetEnv(); - - env->CallStaticVoidMethod(g_cianClass, g_cianErrorCallback, httpCode); -} -} // namespace - -extern "C" { - -JNIEXPORT void JNICALL Java_com_mapswithme_maps_cian_Cian_nativeGetRentNearby( - JNIEnv * env, jclass clazz, jobject policy, jdouble lat, jdouble lon, jstring id) -{ - PrepareClassRefs(env); - - g_id = jni::ToNativeString(env, id); - ms::LatLon const pos(lat, lon); - g_requestId = g_framework->GetRentNearby(env, policy, pos, &OnRentPlacesReceived, - &OnErrorReceived); -} -} // extern "C" diff --git a/android/res/drawable-hdpi/ic_category_cian.png b/android/res/drawable-hdpi/ic_category_cian.png deleted file mode 100644 index 7d21177c02..0000000000 Binary files a/android/res/drawable-hdpi/ic_category_cian.png and /dev/null differ diff --git a/android/res/drawable-hdpi/ic_category_cian_night.png b/android/res/drawable-hdpi/ic_category_cian_night.png deleted file mode 100644 index 335cd5b381..0000000000 Binary files a/android/res/drawable-hdpi/ic_category_cian_night.png and /dev/null differ diff --git a/android/res/drawable-hdpi/ic_category_luggagehero.png b/android/res/drawable-hdpi/ic_category_luggagehero.png new file mode 100644 index 0000000000..7faec9a543 Binary files /dev/null and b/android/res/drawable-hdpi/ic_category_luggagehero.png differ diff --git a/android/res/drawable-hdpi/ic_category_luggagehero_night.png b/android/res/drawable-hdpi/ic_category_luggagehero_night.png new file mode 100644 index 0000000000..1fcd541829 Binary files /dev/null and b/android/res/drawable-hdpi/ic_category_luggagehero_night.png differ diff --git a/android/res/drawable-hdpi/logo_cian_dark.png b/android/res/drawable-hdpi/logo_cian_dark.png deleted file mode 100644 index 33f6ff8e12..0000000000 Binary files a/android/res/drawable-hdpi/logo_cian_dark.png and /dev/null differ diff --git a/android/res/drawable-hdpi/logo_cian_light.png b/android/res/drawable-hdpi/logo_cian_light.png deleted file mode 100644 index e730a8e5b4..0000000000 Binary files a/android/res/drawable-hdpi/logo_cian_light.png and /dev/null differ diff --git a/android/res/drawable-hdpi/logo_luggagehero_dark.png b/android/res/drawable-hdpi/logo_luggagehero_dark.png new file mode 100644 index 0000000000..da81ee7b40 Binary files /dev/null and b/android/res/drawable-hdpi/logo_luggagehero_dark.png differ diff --git a/android/res/drawable-hdpi/logo_luggagehero_light.png b/android/res/drawable-hdpi/logo_luggagehero_light.png new file mode 100644 index 0000000000..da81ee7b40 Binary files /dev/null and b/android/res/drawable-hdpi/logo_luggagehero_light.png differ diff --git a/android/res/drawable-mdpi/ic_category_cian.png b/android/res/drawable-mdpi/ic_category_cian.png deleted file mode 100644 index 2722a9dd66..0000000000 Binary files a/android/res/drawable-mdpi/ic_category_cian.png and /dev/null differ diff --git a/android/res/drawable-mdpi/ic_category_cian_night.png b/android/res/drawable-mdpi/ic_category_cian_night.png deleted file mode 100644 index 6a0810b6e5..0000000000 Binary files a/android/res/drawable-mdpi/ic_category_cian_night.png and /dev/null differ diff --git a/android/res/drawable-mdpi/ic_category_luggagehero.png b/android/res/drawable-mdpi/ic_category_luggagehero.png new file mode 100644 index 0000000000..cfff87af19 Binary files /dev/null and b/android/res/drawable-mdpi/ic_category_luggagehero.png differ diff --git a/android/res/drawable-mdpi/ic_category_luggagehero_night.png b/android/res/drawable-mdpi/ic_category_luggagehero_night.png new file mode 100644 index 0000000000..200c41bd0a Binary files /dev/null and b/android/res/drawable-mdpi/ic_category_luggagehero_night.png differ diff --git a/android/res/drawable-mdpi/logo_cian_dark.png b/android/res/drawable-mdpi/logo_cian_dark.png deleted file mode 100644 index 255eeba113..0000000000 Binary files a/android/res/drawable-mdpi/logo_cian_dark.png and /dev/null differ diff --git a/android/res/drawable-mdpi/logo_cian_light.png b/android/res/drawable-mdpi/logo_cian_light.png deleted file mode 100644 index 80ce846358..0000000000 Binary files a/android/res/drawable-mdpi/logo_cian_light.png and /dev/null differ diff --git a/android/res/drawable-mdpi/logo_luggagehero_dark.png b/android/res/drawable-mdpi/logo_luggagehero_dark.png new file mode 100644 index 0000000000..0a8b18fbb2 Binary files /dev/null and b/android/res/drawable-mdpi/logo_luggagehero_dark.png differ diff --git a/android/res/drawable-mdpi/logo_luggagehero_light.png b/android/res/drawable-mdpi/logo_luggagehero_light.png new file mode 100644 index 0000000000..0a8b18fbb2 Binary files /dev/null and b/android/res/drawable-mdpi/logo_luggagehero_light.png differ diff --git a/android/res/drawable-xhdpi/ic_category_cian.png b/android/res/drawable-xhdpi/ic_category_cian.png deleted file mode 100644 index 5218076d2b..0000000000 Binary files a/android/res/drawable-xhdpi/ic_category_cian.png and /dev/null differ diff --git a/android/res/drawable-xhdpi/ic_category_cian_night.png b/android/res/drawable-xhdpi/ic_category_cian_night.png deleted file mode 100644 index 157d0cce67..0000000000 Binary files a/android/res/drawable-xhdpi/ic_category_cian_night.png and /dev/null differ diff --git a/android/res/drawable-xhdpi/ic_category_luggagehero.png b/android/res/drawable-xhdpi/ic_category_luggagehero.png new file mode 100644 index 0000000000..d4a0bd0505 Binary files /dev/null and b/android/res/drawable-xhdpi/ic_category_luggagehero.png differ diff --git a/android/res/drawable-xhdpi/ic_category_luggagehero_night.png b/android/res/drawable-xhdpi/ic_category_luggagehero_night.png new file mode 100644 index 0000000000..2d5a1e1c11 Binary files /dev/null and b/android/res/drawable-xhdpi/ic_category_luggagehero_night.png differ diff --git a/android/res/drawable-xhdpi/logo_cian_dark.png b/android/res/drawable-xhdpi/logo_cian_dark.png deleted file mode 100644 index f82068ffa3..0000000000 Binary files a/android/res/drawable-xhdpi/logo_cian_dark.png and /dev/null differ diff --git a/android/res/drawable-xhdpi/logo_cian_light.png b/android/res/drawable-xhdpi/logo_cian_light.png deleted file mode 100644 index be6d79d82b..0000000000 Binary files a/android/res/drawable-xhdpi/logo_cian_light.png and /dev/null differ diff --git a/android/res/drawable-xhdpi/logo_luggagehero_dark.png b/android/res/drawable-xhdpi/logo_luggagehero_dark.png new file mode 100644 index 0000000000..199d4533a6 Binary files /dev/null and b/android/res/drawable-xhdpi/logo_luggagehero_dark.png differ diff --git a/android/res/drawable-xhdpi/logo_luggagehero_light.png b/android/res/drawable-xhdpi/logo_luggagehero_light.png new file mode 100644 index 0000000000..199d4533a6 Binary files /dev/null and b/android/res/drawable-xhdpi/logo_luggagehero_light.png differ diff --git a/android/res/drawable-xxhdpi/ic_category_cian.png b/android/res/drawable-xxhdpi/ic_category_cian.png deleted file mode 100644 index 14b5297852..0000000000 Binary files a/android/res/drawable-xxhdpi/ic_category_cian.png and /dev/null differ diff --git a/android/res/drawable-xxhdpi/ic_category_cian_night.png b/android/res/drawable-xxhdpi/ic_category_cian_night.png deleted file mode 100644 index d3013d49b3..0000000000 Binary files a/android/res/drawable-xxhdpi/ic_category_cian_night.png and /dev/null differ diff --git a/android/res/drawable-xxhdpi/ic_category_luggagehero.png b/android/res/drawable-xxhdpi/ic_category_luggagehero.png new file mode 100644 index 0000000000..afd739ec7c Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_category_luggagehero.png differ diff --git a/android/res/drawable-xxhdpi/ic_category_luggagehero_night.png b/android/res/drawable-xxhdpi/ic_category_luggagehero_night.png new file mode 100644 index 0000000000..0d75b3e828 Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_category_luggagehero_night.png differ diff --git a/android/res/drawable-xxhdpi/logo_cian_dark.png b/android/res/drawable-xxhdpi/logo_cian_dark.png deleted file mode 100644 index becbfae1ea..0000000000 Binary files a/android/res/drawable-xxhdpi/logo_cian_dark.png and /dev/null differ diff --git a/android/res/drawable-xxhdpi/logo_cian_light.png b/android/res/drawable-xxhdpi/logo_cian_light.png deleted file mode 100644 index c0fbeefa9c..0000000000 Binary files a/android/res/drawable-xxhdpi/logo_cian_light.png and /dev/null differ diff --git a/android/res/drawable-xxhdpi/logo_luggagehero_dark.png b/android/res/drawable-xxhdpi/logo_luggagehero_dark.png new file mode 100644 index 0000000000..ca6bba8491 Binary files /dev/null and b/android/res/drawable-xxhdpi/logo_luggagehero_dark.png differ diff --git a/android/res/drawable-xxhdpi/logo_luggagehero_light.png b/android/res/drawable-xxhdpi/logo_luggagehero_light.png new file mode 100644 index 0000000000..ca6bba8491 Binary files /dev/null and b/android/res/drawable-xxhdpi/logo_luggagehero_light.png differ diff --git a/android/res/drawable-xxxhdpi/ic_category_cian.png b/android/res/drawable-xxxhdpi/ic_category_cian.png deleted file mode 100644 index b424c28235..0000000000 Binary files a/android/res/drawable-xxxhdpi/ic_category_cian.png and /dev/null differ diff --git a/android/res/drawable-xxxhdpi/ic_category_cian_night.png b/android/res/drawable-xxxhdpi/ic_category_cian_night.png deleted file mode 100644 index ae85fcf5ee..0000000000 Binary files a/android/res/drawable-xxxhdpi/ic_category_cian_night.png and /dev/null differ diff --git a/android/res/drawable-xxxhdpi/ic_category_luggagehero.png b/android/res/drawable-xxxhdpi/ic_category_luggagehero.png new file mode 100644 index 0000000000..c74ee78bda Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_category_luggagehero.png differ diff --git a/android/res/drawable-xxxhdpi/ic_category_luggagehero_night.png b/android/res/drawable-xxxhdpi/ic_category_luggagehero_night.png new file mode 100644 index 0000000000..babb1bc8e0 Binary files /dev/null and b/android/res/drawable-xxxhdpi/ic_category_luggagehero_night.png differ diff --git a/android/res/drawable-xxxhdpi/logo_cian_dark.png b/android/res/drawable-xxxhdpi/logo_cian_dark.png deleted file mode 100644 index e4c2b533ea..0000000000 Binary files a/android/res/drawable-xxxhdpi/logo_cian_dark.png and /dev/null differ diff --git a/android/res/drawable-xxxhdpi/logo_cian_light.png b/android/res/drawable-xxxhdpi/logo_cian_light.png deleted file mode 100644 index e5dd8d385e..0000000000 Binary files a/android/res/drawable-xxxhdpi/logo_cian_light.png and /dev/null differ diff --git a/android/res/drawable-xxxhdpi/logo_luggagehero_dark.png b/android/res/drawable-xxxhdpi/logo_luggagehero_dark.png new file mode 100644 index 0000000000..224895956d Binary files /dev/null and b/android/res/drawable-xxxhdpi/logo_luggagehero_dark.png differ diff --git a/android/res/drawable-xxxhdpi/logo_luggagehero_light.png b/android/res/drawable-xxxhdpi/logo_luggagehero_light.png new file mode 100644 index 0000000000..224895956d Binary files /dev/null and b/android/res/drawable-xxxhdpi/logo_luggagehero_light.png differ diff --git a/android/res/layout/card_loading.xml b/android/res/layout/card_loading.xml index a0857e0066..f4d9756292 100644 --- a/android/res/layout/card_loading.xml +++ b/android/res/layout/card_loading.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="@dimen/cian_product_height" + android:layout_height="@dimen/luggage_product_height" android:orientation="vertical" android:gravity="center_horizontal"> diff --git a/android/res/layout/item_cian_loading.xml b/android/res/layout/item_cian_loading.xml deleted file mode 100644 index 8f21061247..0000000000 --- a/android/res/layout/item_cian_loading.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - diff --git a/android/res/layout/item_cian_more.xml b/android/res/layout/item_cian_more.xml deleted file mode 100644 index 13b721063c..0000000000 --- a/android/res/layout/item_cian_more.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - diff --git a/android/res/layout/item_cian_product.xml b/android/res/layout/item_cian_product.xml deleted file mode 100644 index 2648c9c5a9..0000000000 --- a/android/res/layout/item_cian_product.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - diff --git a/android/res/layout/item_search_category_cian.xml b/android/res/layout/item_search_category_luggage.xml similarity index 96% rename from android/res/layout/item_search_category_cian.xml rename to android/res/layout/item_search_category_luggage.xml index 62bc9bc0b2..ef57d4853f 100644 --- a/android/res/layout/item_search_category_cian.xml +++ b/android/res/layout/item_search_category_luggage.xml @@ -23,5 +23,5 @@ android:layout_gravity="center_vertical" android:layout_marginEnd="@dimen/margin_base" android:layout_marginRight="@dimen/margin_base" - android:src="?cianLogo"/> + android:src="?luggageLogo"/> diff --git a/android/res/layout/item_viator_product.xml b/android/res/layout/item_viator_product.xml index 7be51fdb18..945102a1ab 100644 --- a/android/res/layout/item_viator_product.xml +++ b/android/res/layout/item_viator_product.xml @@ -62,7 +62,7 @@ android:textSize="@dimen/text_size_body_4" tools:visibility="visible"/> 160dp 80dp - - 140dp - 160dp - 44dp + + 140dp + 160dp + 44dp 40dp diff --git a/android/res/values/themes-attrs.xml b/android/res/values/themes-attrs.xml index 8de66e44e2..676aaabc09 100644 --- a/android/res/values/themes-attrs.xml +++ b/android/res/values/themes-attrs.xml @@ -87,7 +87,7 @@ - + diff --git a/android/res/values/themes-base.xml b/android/res/values/themes-base.xml index 5236b9cf9a..692f67e2d6 100644 --- a/android/res/values/themes-base.xml +++ b/android/res/values/themes-base.xml @@ -104,7 +104,7 @@ @drawable/bg_tag @drawable/ic_sponsored_gallery_more - @drawable/logo_cian_light + @drawable/logo_luggagehero_light @drawable/ic_logo_viator_light @drawable/bg_rating_button @@ -223,7 +223,7 @@ @drawable/bg_tag_night @drawable/ic_sponsored_gallery_more_night - @drawable/logo_cian_dark + @drawable/logo_luggagehero_dark @drawable/ic_logo_viator_dark @drawable/bg_rating_button_night diff --git a/android/src/com/mapswithme/maps/cian/Cian.java b/android/src/com/mapswithme/maps/cian/Cian.java deleted file mode 100644 index 33671d2b1c..0000000000 --- a/android/src/com/mapswithme/maps/cian/Cian.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.mapswithme.maps.cian; - -import android.support.annotation.NonNull; - -import com.mapswithme.maps.bookmarks.data.FeatureId; -import com.mapswithme.util.NetworkPolicy; - -import java.lang.ref.WeakReference; -import java.util.HashMap; -import java.util.Map; - -public final class Cian -{ - @NonNull - private static WeakReference sCianListener = new WeakReference<>(null); - @NonNull - private static final Map sProductsCache = new HashMap<>(); - - public static void setCianListener(@NonNull com.mapswithme.maps.cian.Cian.CianListener listener) - { - sCianListener = new WeakReference<>(listener); - } - - private static void onRentPlacesReceived(@NonNull RentPlace[] places, @NonNull String id) - { - sProductsCache.put(FeatureId.fromString(id), places); - com.mapswithme.maps.cian.Cian.CianListener listener = sCianListener.get(); - if (listener != null) - listener.onRentPlacesReceived(places); - } - - private static void onErrorReceived(int httpCode) - { - com.mapswithme.maps.cian.Cian.CianListener listener = sCianListener.get(); - if (listener != null) - listener.onErrorReceived(httpCode); - } - - private Cian() {} - - public static void getRentNearby(@NonNull NetworkPolicy policy,double lat, double lon, - @NonNull FeatureId id) - { - RentPlace[] products = sProductsCache.get(id); - if (products != null && products.length > 0) - onRentPlacesReceived(products, id.toString()); - - nativeGetRentNearby(policy, lat, lon, id.toString()); - } - - public static boolean hasCache(@NonNull FeatureId id) - { - return sProductsCache.containsKey(id); - } - - public interface CianListener - { - void onRentPlacesReceived(@NonNull RentPlace[] places); - void onErrorReceived(int httpCode); - } - - private static native void nativeGetRentNearby(@NonNull NetworkPolicy policy, double lat, - double lon, @NonNull String id); -} diff --git a/android/src/com/mapswithme/maps/cian/RentOffer.java b/android/src/com/mapswithme/maps/cian/RentOffer.java deleted file mode 100644 index c0087cfdb9..0000000000 --- a/android/src/com/mapswithme/maps/cian/RentOffer.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.mapswithme.maps.cian; - -import android.os.Parcel; -import android.os.Parcelable; -import android.support.annotation.NonNull; - -public final class RentOffer implements Parcelable -{ - @NonNull - private final String mFlatType; - private final int mRoomsCount; - private final double mPrice; - private final int mFloorNumber; - private final int mFloorsCount; - @NonNull - private final String mUrl; - @NonNull - private final String mAddress; - - public static final Creator CREATOR = new Creator() - { - @Override - public RentOffer createFromParcel(Parcel in) - { - return new RentOffer(in); - } - - @Override - public RentOffer[] newArray(int size) - { - return new RentOffer[size]; - } - }; - - public RentOffer(@NonNull String flatType, int roomsCount, double price, int floorNumber, - int floorsCount, @NonNull String url, @NonNull String address) - { - mFlatType = flatType; - mRoomsCount = roomsCount; - mPrice = price; - mFloorNumber = floorNumber; - mFloorsCount = floorsCount; - mUrl = url; - mAddress = address; - } - - private RentOffer(Parcel in) - { - mFlatType = in.readString(); - mRoomsCount = in.readInt(); - mPrice = in.readInt(); - mFloorNumber = in.readInt(); - mFloorsCount = in.readInt(); - mUrl = in.readString(); - mAddress = in.readString(); - } - - @Override - public int describeContents() - { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) - { - dest.writeString(mFlatType); - dest.writeInt(mRoomsCount); - dest.writeDouble(mPrice); - dest.writeInt(mFloorNumber); - dest.writeInt(mFloorsCount); - dest.writeString(mUrl); - dest.writeString(mAddress); - } - - @NonNull - public String getFlatType() - { - return mFlatType; - } - - public int getRoomsCount() - { - return mRoomsCount; - } - - public double getPrice() - { - return mPrice; - } - - public int getFloorNumber() - { - return mFloorNumber; - } - - public int getFloorsCount() - { - return mFloorsCount; - } - - @NonNull - public String getUrl() - { - return mUrl; - } - - @NonNull - public String getAddress() - { - return mAddress; - } - - @Override - public boolean equals(Object o) - { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - RentOffer rentOffer = (RentOffer) o; - - if (mRoomsCount != rentOffer.mRoomsCount) return false; - if (Double.compare(rentOffer.mPrice, mPrice) != 0) return false; - if (mFloorNumber != rentOffer.mFloorNumber) return false; - if (mFloorsCount != rentOffer.mFloorsCount) return false; - if (!mFlatType.equals(rentOffer.mFlatType)) return false; - if (!mUrl.equals(rentOffer.mUrl)) return false; - return mAddress.equals(rentOffer.mAddress); - } - - @Override - public int hashCode() - { - int result; - long temp; - result = mFlatType.hashCode(); - result = 31 * result + mRoomsCount; - temp = Double.doubleToLongBits(mPrice); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - result = 31 * result + mFloorNumber; - result = 31 * result + mFloorsCount; - result = 31 * result + mUrl.hashCode(); - result = 31 * result + mAddress.hashCode(); - return result; - } -} diff --git a/android/src/com/mapswithme/maps/cian/RentPlace.java b/android/src/com/mapswithme/maps/cian/RentPlace.java deleted file mode 100644 index 5af8d1bd2e..0000000000 --- a/android/src/com/mapswithme/maps/cian/RentPlace.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.mapswithme.maps.cian; - -import android.os.Parcel; -import android.os.Parcelable; -import android.support.annotation.NonNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class RentPlace implements Parcelable -{ - private final double mLat; - private final double mLon; - @NonNull - private final List mOffers; - - public static final Creator CREATOR = new Creator() - { - @Override - public RentPlace createFromParcel(Parcel in) - { - return new RentPlace(in); - } - - @Override - public RentPlace[] newArray(int size) - { - return new RentPlace[size]; - } - }; - - public RentPlace(double lat, double lon, @NonNull RentOffer[] offers) - { - mLat = lat; - mLon = lon; - mOffers = new ArrayList<>(Arrays.asList(offers)); - } - - private RentPlace(Parcel in) - { - mLat = in.readDouble(); - mLon = in.readDouble(); - mOffers = in.createTypedArrayList(RentOffer.CREATOR); - } - - @Override - public int describeContents() - { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) - { - dest.writeDouble(mLat); - dest.writeDouble(mLon); - dest.writeTypedList(mOffers); - } - - public double getLat() - { - return mLat; - } - - public double getLon() - { - return mLon; - } - - @NonNull - public List getOffers() - { - return mOffers; - } - - @Override - public boolean equals(Object o) - { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - RentPlace rentPlace = (RentPlace) o; - - if (Double.compare(rentPlace.mLat, mLat) != 0) return false; - if (Double.compare(rentPlace.mLon, mLon) != 0) return false; - return mOffers.equals(rentPlace.mOffers); - } - - @Override - public int hashCode() - { - int result; - long temp; - temp = Double.doubleToLongBits(mLat); - result = (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(mLon); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - result = 31 * result + mOffers.hashCode(); - return result; - } -} diff --git a/android/src/com/mapswithme/maps/gallery/Holders.java b/android/src/com/mapswithme/maps/gallery/Holders.java index b50cd82bea..15c384fc73 100644 --- a/android/src/com/mapswithme/maps/gallery/Holders.java +++ b/android/src/com/mapswithme/maps/gallery/Holders.java @@ -24,7 +24,6 @@ import com.mapswithme.util.Utils; import java.util.List; -import static com.mapswithme.maps.gallery.Items.CianItem; import static com.mapswithme.maps.gallery.Items.ViatorItem; public class Holders @@ -97,50 +96,6 @@ public class Holders } } - public static final class CianProductViewHolder extends BaseViewHolder - { - @NonNull - TextView mPrice; - @NonNull - TextView mAddress; - - public CianProductViewHolder(@NonNull View itemView, @NonNull List items, - @NonNull GalleryAdapter adapter) - { - super(itemView, items, adapter); - mPrice = (TextView) itemView.findViewById(R.id.tv__price); - mAddress = (TextView) itemView.findViewById(R.id.tv__address); - } - - @Override - public void bind(@NonNull CianItem item) - { - super.bind(item); - UiUtils.setTextAndHideIfEmpty(mPrice, item.mPrice); - UiUtils.setTextAndHideIfEmpty(mAddress, item.mAddress); - } - } - - public static final class CianMoreItemViewHolder extends BaseViewHolder - { - - public CianMoreItemViewHolder(@NonNull View itemView, @NonNull List items, - @NonNull GalleryAdapter adapter) - { - super(itemView, items, adapter); - } - - @Override - protected void onItemSelected(@NonNull T item, int position) - { - ItemSelectedListener listener = mAdapter.getListener(); - if (listener == null || TextUtils.isEmpty(item.getUrl())) - return; - - listener.onMoreItemSelected(item); - } - } - public static class LocalExpertViewHolder extends BaseViewHolder { @NonNull diff --git a/android/src/com/mapswithme/maps/gallery/Items.java b/android/src/com/mapswithme/maps/gallery/Items.java index ac9453aa66..d067518505 100644 --- a/android/src/com/mapswithme/maps/gallery/Items.java +++ b/android/src/com/mapswithme/maps/gallery/Items.java @@ -52,38 +52,6 @@ public class Items } } - public static class CianItem extends RegularAdapterStrategy.Item - { - @NonNull - final String mPrice; - @NonNull - final String mAddress; - - public CianItem(@NonNull String title, @NonNull String url, @NonNull String price, - @NonNull String address) - { - super(TYPE_PRODUCT, title, url, null); - mPrice = price; - mAddress = address; - } - - CianItem(@Constants.ViewType int type, @NonNull String title, @Nullable String url) - { - super(type, title, url, null); - mPrice = ""; - mAddress = ""; - } - } - - public static class CianMoreItem extends CianItem - { - - public CianMoreItem(@Nullable String url) - { - super(TYPE_MORE, MwmApplication.get().getString(R.string.placepage_more_button), url); - } - } - public static class LocalExpertItem extends RegularAdapterStrategy.Item { @Nullable diff --git a/android/src/com/mapswithme/maps/gallery/impl/CianAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/impl/CianAdapterStrategy.java deleted file mode 100644 index 0c00466120..0000000000 --- a/android/src/com/mapswithme/maps/gallery/impl/CianAdapterStrategy.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.mapswithme.maps.gallery.impl; - -import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.mapswithme.maps.MwmApplication; -import com.mapswithme.maps.R; -import com.mapswithme.maps.cian.RentOffer; -import com.mapswithme.maps.cian.RentPlace; -import com.mapswithme.maps.gallery.GalleryAdapter; -import com.mapswithme.maps.gallery.Holders; -import com.mapswithme.maps.gallery.Items; -import com.mapswithme.maps.gallery.RegularAdapterStrategy; - -import java.util.ArrayList; -import java.util.List; - -class CianAdapterStrategy extends RegularAdapterStrategy -{ - - CianAdapterStrategy(@NonNull RentPlace[] items, @Nullable String moreUrl) - { - super(convertItems(items), new Items.CianMoreItem(moreUrl)); - } - - CianAdapterStrategy(@NonNull List items, - @Nullable Items.CianItem moreItem) - { - super(items, moreItem); - } - - @NonNull - @Override - protected Holders.BaseViewHolder createProductViewHodler - (@NonNull ViewGroup parent, int viewType, @NonNull GalleryAdapter adapter) - { - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_cian_product, parent, - false); - return new Holders.CianProductViewHolder(view, mItems, adapter); - } - - @NonNull - @Override - protected Holders.BaseViewHolder createMoreProductsViewHolder - (@NonNull ViewGroup parent, int viewType, @NonNull GalleryAdapter adapter) - { - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_cian_more, parent, - false); - return new Holders.CianMoreItemViewHolder<>(view, mItems, adapter); - } - - @NonNull - private static List convertItems(@NonNull RentPlace[] items) - { - List viewItems = new ArrayList<>(); - for (RentPlace place : items) - { - if (place.getOffers().isEmpty()) - continue; - - RentOffer product = place.getOffers().get(0); - Context context = MwmApplication.get(); - String title = context.getString(R.string.room, Integer.toString(product.getRoomsCount())); - String price = Integer.toString((int) product.getPrice()) + " " - + context.getString(R.string.rub_month); - viewItems.add(new Items.CianItem(title, product.getUrl(), price, product.getAddress())); - } - return viewItems; - } -} diff --git a/android/src/com/mapswithme/maps/gallery/impl/CianErrorAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/impl/CianErrorAdapterStrategy.java deleted file mode 100644 index 5b3855b123..0000000000 --- a/android/src/com/mapswithme/maps/gallery/impl/CianErrorAdapterStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.mapswithme.maps.gallery.impl; - -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.mapswithme.maps.R; -import com.mapswithme.maps.gallery.ErrorAdapterStrategy; - -class CianErrorAdapterStrategy extends ErrorAdapterStrategy -{ - CianErrorAdapterStrategy(@Nullable String url) - { - super(url); - } - - @Override - protected int getTitle() - { - return R.string.preloader_cian_title; - } - - @Override - protected int getSubtitle() - { - return R.string.preloader_cian_message; - } - - @NonNull - @Override - protected View inflateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) - { - return inflater.inflate(R.layout.item_cian_loading, parent, false); - } - - @Override - protected int getLabelForDetailsView() - { - return R.string.preloader_cian_button; - } -} diff --git a/android/src/com/mapswithme/maps/gallery/impl/CianLoadingAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/impl/CianLoadingAdapterStrategy.java deleted file mode 100644 index 274387183c..0000000000 --- a/android/src/com/mapswithme/maps/gallery/impl/CianLoadingAdapterStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.mapswithme.maps.gallery.impl; - -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.mapswithme.maps.R; -import com.mapswithme.maps.gallery.LoadingAdapterStrategy; - -class CianLoadingAdapterStrategy extends LoadingAdapterStrategy -{ - CianLoadingAdapterStrategy(@Nullable String url) - { - super(url); - } - - @Override - protected int getTitle() - { - return R.string.preloader_cian_title; - } - - @Override - protected int getSubtitle() - { - return R.string.preloader_cian_message; - } - - @NonNull - @Override - protected View inflateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) - { - return inflater.inflate(R.layout.item_cian_loading, parent, false); - } - - @Override - protected int getLabelForDetailsView() - { - return R.string.preloader_cian_button; - } -} diff --git a/android/src/com/mapswithme/maps/gallery/impl/Factory.java b/android/src/com/mapswithme/maps/gallery/impl/Factory.java index d605eb681b..520feb0160 100644 --- a/android/src/com/mapswithme/maps/gallery/impl/Factory.java +++ b/android/src/com/mapswithme/maps/gallery/impl/Factory.java @@ -3,7 +3,6 @@ package com.mapswithme.maps.gallery.impl; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import com.mapswithme.maps.cian.RentPlace; import com.mapswithme.maps.discovery.LocalExpert; import com.mapswithme.maps.gallery.GalleryAdapter; import com.mapswithme.maps.gallery.ItemSelectedListener; @@ -17,7 +16,6 @@ import com.mapswithme.util.statistics.Statistics; import static com.mapswithme.util.statistics.GalleryState.OFFLINE; import static com.mapswithme.util.statistics.GalleryState.ONLINE; -import static com.mapswithme.util.statistics.GalleryType.CIAN; import static com.mapswithme.util.statistics.GalleryType.LOCAL_EXPERTS; import static com.mapswithme.util.statistics.GalleryType.VIATOR; @@ -46,21 +44,6 @@ public class Factory return new GalleryAdapter<>(new ViatorErrorAdapterStrategy(url), listener); } - @NonNull - public static GalleryAdapter createCianLoadingAdapter - (@Nullable String url, @Nullable ItemSelectedListener listener) - { - return new GalleryAdapter<>(new CianLoadingAdapterStrategy(url), listener); - } - - @NonNull - public static GalleryAdapter createCianErrorAdapter(@Nullable String url, - @Nullable ItemSelectedListener - listener) - { - return new GalleryAdapter<>(new CianErrorAdapterStrategy(url), listener); - } - @NonNull public static GalleryAdapter createViatorAdapter(@NonNull ViatorProduct[] products, @Nullable String cityUrl, @@ -72,15 +55,6 @@ public class Factory return new GalleryAdapter<>(new ViatorAdapterStrategy(products, cityUrl), listener); } - @NonNull - public static GalleryAdapter createCianAdapter(@NonNull RentPlace[] products, @NonNull String url, - @Nullable ItemSelectedListener listener, - @NonNull GalleryPlacement placement) - { - trackProductGalleryShownOrError(products, CIAN, ONLINE, placement); - return new GalleryAdapter<>(new CianAdapterStrategy(products, url), listener); - } - @NonNull public static GalleryAdapter createSearchBasedAdapter(@NonNull SearchResult[] results, @Nullable ItemSelectedListener= MIN_QUERY_LENGTH_FOR_AD) @@ -209,7 +209,7 @@ public class SearchFragment extends BaseMwmFragment private final LastPosition mLastPosition = new LastPosition(); private boolean mSearchRunning; - private boolean mCianCategorySelected; + private boolean mLuggageCategorySelected; private String mInitialQuery; @Nullable private String mInitialLocale; @@ -673,15 +673,17 @@ public class SearchFragment extends BaseMwmFragment @Override public void onCategorySelected(String category) { - if (!TextUtils.isEmpty(category) && category.equals("cian ")) + if (!TextUtils.isEmpty(category) && + category.equals(CategoriesAdapter.LUGGAGE_CATEGORY + ' ')) { - mCianCategorySelected = true; + mLuggageCategorySelected = true; mToolbarController.setQuery(category); - Statistics.INSTANCE.trackSponsoredEventByType( - Statistics.EventName.SEARCH_SPONSOR_CATEGORY_SELECTED, Sponsored.TYPE_CIAN); + Statistics.INSTANCE.trackSponsoredEventForCustomProvider( + Statistics.EventName.SEARCH_SPONSOR_CATEGORY_SELECTED, + Statistics.ParamValue.LUGGAGE_HERO); showAllResultsOnMap(); - mCianCategorySelected = false; + mLuggageCategorySelected = false; } else { diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 70cd583965..32b8d501ec 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -49,11 +49,8 @@ import com.mapswithme.maps.api.ParsedMwmRequest; import com.mapswithme.maps.bookmarks.data.Bookmark; import com.mapswithme.maps.bookmarks.data.BookmarkManager; import com.mapswithme.maps.bookmarks.data.DistanceAndAzimut; -import com.mapswithme.maps.bookmarks.data.FeatureId; import com.mapswithme.maps.bookmarks.data.MapObject; import com.mapswithme.maps.bookmarks.data.Metadata; -import com.mapswithme.maps.cian.Cian; -import com.mapswithme.maps.cian.RentPlace; import com.mapswithme.maps.downloader.CountryItem; import com.mapswithme.maps.downloader.DownloaderStatusIcon; import com.mapswithme.maps.downloader.MapManager; @@ -128,8 +125,7 @@ public class PlacePageView extends RelativeLayout BottomPlacePageAnimationController.OnBannerOpenListener, EditBookmarkFragment.EditBookmarkListener, BannerController.BannerListener, - Viator.ViatorListener, - Cian.CianListener + Viator.ViatorListener { private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); private static final String TAG = PlacePageView.class.getSimpleName(); @@ -646,7 +642,6 @@ public class PlacePageView extends RelativeLayout Sponsored.setPriceListener(this); Sponsored.setInfoListener(this); Viator.setViatorListener(this); - Cian.setCianListener(this); } private void initHotelRatingView() @@ -836,22 +831,6 @@ public class PlacePageView extends RelativeLayout updateViatorView(products, mSponsored.getUrl()); } - @Override - public void onRentPlacesReceived(@NonNull RentPlace[] places) - { - if (mSponsored != null) - updateCianView(places, mSponsored.getUrl()); - } - - @Override - public void onErrorReceived(int errorCode) - { - String url = mSponsored != null ? mSponsored.getUrl() : ""; - mRvSponsoredProducts.setAdapter(Factory.createCianErrorAdapter(url, mDefaultGalleryItemListener)); - Statistics.INSTANCE.trackGalleryError(GalleryType.CIAN, GalleryPlacement.PLACEPAGE, - String.valueOf(errorCode)); - } - private void initSponsoredGalleryView() { mSponsoredGalleryView = findViewById(R.id.ll__place_sponsored_gallery); @@ -885,29 +864,12 @@ public class PlacePageView extends RelativeLayout } } - private void updateCianView(@NonNull final RentPlace[] products, @NonNull final String url) - { - if (products.length == 0) - { - mRvSponsoredProducts.setAdapter(Factory.createCianErrorAdapter(url, mDefaultGalleryItemListener)); - Statistics.INSTANCE.trackGalleryError(GalleryType.CIAN, GalleryPlacement.PLACEPAGE, - Statistics.ParamValue.NO_PRODUCTS); - } - else - { - ItemSelectedListener listener - = createSponsoredProductItemListener(GalleryType.CIAN); - mRvSponsoredProducts.setAdapter(Factory.createCianAdapter(products, url, listener, - GalleryPlacement.PLACEPAGE)); - } - } - private void updateGallerySponsoredLogo(@Sponsored.SponsoredType int type) { - if (type != Sponsored.TYPE_VIATOR && type != Sponsored.TYPE_CIAN) + if (type != Sponsored.TYPE_VIATOR) throw new AssertionError("Unsupported type: " + type); - int logoAttr = type == Sponsored.TYPE_CIAN ? R.attr.cianLogo : R.attr.viatorLogo; + int logoAttr = R.attr.viatorLogo; TypedArray array = getActivity().getTheme().obtainStyledAttributes(new int[] {logoAttr}); int attributeResourceId = array.getResourceId(0 /* index */, 0 /* defValue */); Drawable drawable = getResources().getDrawable(attributeResourceId); @@ -917,8 +879,7 @@ public class PlacePageView extends RelativeLayout private void updateGallerySponsoredTitle(@Sponsored.SponsoredType int type) { - mTvSponsoredTitle.setText(type == Sponsored.TYPE_CIAN ? R.string.subtitle_rent - : R.string.place_page_viator_title); + mTvSponsoredTitle.setText(R.string.place_page_viator_title); } private void hideSponsoredGalleryViews() @@ -1240,41 +1201,26 @@ public class PlacePageView extends RelativeLayout } boolean isViator = mSponsored.getType() == Sponsored.TYPE_VIATOR; - boolean isCian = mSponsored.getType() == Sponsored.TYPE_CIAN; - if (!isViator && !isCian) + if (!isViator) return; updateGallerySponsoredLogo(mSponsored.getType()); updateGallerySponsoredTitle(mSponsored.getType()); UiUtils.show(mSponsoredGalleryView); - boolean hasInCache = isCian ? Cian.hasCache(mMapObject.getFeatureId()) - : Viator.hasCache(mSponsored.getId()); + boolean hasInCache = Viator.hasCache(mSponsored.getId()); final String url = !TextUtils.isEmpty(mSponsored.getUrl()) ? mSponsored.getUrl() : mSponsored.getDescriptionUrl(); if (!ConnectionState.isConnected() && !hasInCache) { - if (isCian) - { - updateCianView(new RentPlace[]{}, url); - return; - } - updateViatorView(new ViatorProduct[]{}, url); return; } - if (isViator) - { - mRvSponsoredProducts.setAdapter(Factory.createViatorLoadingAdapter(url, - mDefaultGalleryItemListener)); - Viator.requestViatorProducts(policy, mSponsored.getId(), currencyCode); - return; - } - - mRvSponsoredProducts.setAdapter(Factory.createCianLoadingAdapter(url, mDefaultGalleryItemListener)); - Cian.getRentNearby(policy, mMapObject.getLat(), mMapObject.getLon(), mMapObject.getFeatureId()); + mRvSponsoredProducts.setAdapter(Factory.createViatorLoadingAdapter(url, + mDefaultGalleryItemListener)); + Viator.requestViatorProducts(policy, mSponsored.getId(), currencyCode); } private boolean isNetworkNeeded() @@ -1436,11 +1382,8 @@ public class PlacePageView extends RelativeLayout if (mSponsored.getType() != Sponsored.TYPE_BOOKING) hideHotelViews(); - if (mSponsored.getType() != Sponsored.TYPE_VIATOR - && mSponsored.getType() != Sponsored.TYPE_CIAN) - { + if (mSponsored.getType() != Sponsored.TYPE_VIATOR) hideSponsoredGalleryViews(); - } } refreshMetadataOrHide(mapObject.getMetadata(Metadata.MetadataType.FMD_PHONE_NUMBER), mPhone, mTvPhone); @@ -1921,10 +1864,8 @@ public class PlacePageView extends RelativeLayout if (!TextUtils.isEmpty(url)) { Utils.openUrl(getContext(), url); - GalleryType type = mSponsored.getType() == Sponsored.TYPE_CIAN ? GalleryType.CIAN - : GalleryType.VIATOR; Statistics.INSTANCE.trackGalleryEvent(Statistics.EventName.PP_SPONSOR_LOGO_SELECTED, - type, GalleryPlacement.PLACEPAGE); + GalleryType.VIATOR, GalleryPlacement.PLACEPAGE); } break; } diff --git a/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java b/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java index c4f588e423..63e729cf4e 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java +++ b/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java @@ -26,13 +26,11 @@ public final class Sponsored public static final int TYPE_BOOKING = 1; public static final int TYPE_OPENTABLE = 2; public static final int TYPE_VIATOR = 3; - public static final int TYPE_CIAN = 4; - public static final int TYPE_PARTNER = 5; - public static final int TYPE_HOLIDAY = 6; + public static final int TYPE_PARTNER = 4; + public static final int TYPE_HOLIDAY = 5; @Retention(RetentionPolicy.SOURCE) - @IntDef({ TYPE_NONE, TYPE_BOOKING, TYPE_OPENTABLE, - TYPE_VIATOR, TYPE_CIAN, TYPE_PARTNER, TYPE_HOLIDAY }) + @IntDef({ TYPE_NONE, TYPE_BOOKING, TYPE_OPENTABLE, TYPE_VIATOR, TYPE_PARTNER, TYPE_HOLIDAY }) public @interface SponsoredType {} private static class Price diff --git a/android/src/com/mapswithme/util/statistics/GalleryType.java b/android/src/com/mapswithme/util/statistics/GalleryType.java index 4278accc3c..1dcada88ef 100644 --- a/android/src/com/mapswithme/util/statistics/GalleryType.java +++ b/android/src/com/mapswithme/util/statistics/GalleryType.java @@ -13,15 +13,6 @@ public enum GalleryType return Statistics.ParamValue.VIATOR; } }, - CIAN - { - @NonNull - @Override - public String getProvider() - { - return Statistics.ParamValue.CIAN; - } - }, LOCAL_EXPERTS { @NonNull diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java index 0a3e11d372..db8df63c1f 100644 --- a/android/src/com/mapswithme/util/statistics/Statistics.java +++ b/android/src/com/mapswithme/util/statistics/Statistics.java @@ -95,7 +95,6 @@ import static com.mapswithme.util.statistics.Statistics.EventParam.STATE; import static com.mapswithme.util.statistics.Statistics.EventParam.TYPE; import static com.mapswithme.util.statistics.Statistics.EventParam.VALUE; import static com.mapswithme.util.statistics.Statistics.ParamValue.BOOKING_COM; -import static com.mapswithme.util.statistics.Statistics.ParamValue.CIAN; import static com.mapswithme.util.statistics.Statistics.ParamValue.HOLIDAY; import static com.mapswithme.util.statistics.Statistics.ParamValue.OPENTABLE; import static com.mapswithme.util.statistics.Statistics.ParamValue.SEARCH_BOOKING_COM; @@ -358,7 +357,6 @@ public enum Statistics static final String LOCALS_EXPERTS = "Locals.Maps.Me"; static final String SEARCH_RESTAURANTS = "Search.Restaurants"; static final String SEARCH_ATTRACTIONS = "Search.Attractions"; - static final String CIAN = "Cian.Ru"; static final String HOLIDAY = "Holiday"; public static final String NO_PRODUCTS = "no_products"; static final String ADD = "add"; @@ -367,6 +365,8 @@ public enum Statistics static final String PLACEPAGE_PREVIEW = "placepage_preview"; static final String PLACEPAGE = "placepage"; public static final String FACEBOOK = "facebook"; + + public static final String LUGGAGE_HERO = "LuggageHero"; } // Initialized once in constructor and does not change until the process restarts. @@ -774,7 +774,7 @@ public enum Statistics .add(PLACEMENT, placement.toString()) .add(STATE, state.toString())); - if (type == GalleryType.CIAN && state == GalleryState.ONLINE) + if (state == GalleryState.ONLINE) MyTracker.trackEvent(PP_SPONSORED_SHOWN + "_" + type.getProvider()); } @@ -807,9 +807,9 @@ public enum Statistics .get()); } - public void trackSponsoredEventByType(@NonNull String eventName, @Sponsored.SponsoredType int type) + public void trackSponsoredEventForCustomProvider(@NonNull String eventName, + @NonNull String provider) { - String provider = convertToSponsor(type); trackEvent(eventName, Statistics.params().add(PROVIDER, provider).get()); MyTracker.trackEvent(eventName + "_" + provider); } @@ -834,8 +834,6 @@ public enum Statistics return VIATOR; case Sponsored.TYPE_OPENTABLE: return OPENTABLE; - case Sponsored.TYPE_CIAN: - return CIAN; case Sponsored.TYPE_HOLIDAY: return HOLIDAY; case Sponsored.TYPE_NONE: diff --git a/iphone/Maps/Common/Statistics/StatisticsStrings.h b/iphone/Maps/Common/Statistics/StatisticsStrings.h index 434a059e0d..8cf338d591 100644 --- a/iphone/Maps/Common/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Common/Statistics/StatisticsStrings.h @@ -59,7 +59,6 @@ static NSString * const kStatChangeRoutingMode = @"Change routing mode"; static NSString * const kStatCharging = @"charging"; static NSString * const kStatCheckIn = @"check_in"; static NSString * const kStatCheckOut = @"check_out"; -static NSString * const kStatCian = @"Cian.ru"; static NSString * const kStatClear = @"Clear"; static NSString * const kStatClose = @"Close"; static NSString * const kStatCollapse = @"Collapse"; @@ -162,6 +161,7 @@ static NSString * const kStatLocals = @"Locals"; static NSString * const kStatLocalsProvider = @"Locals.Maps.Me"; static NSString * const kStatLocation = @"Location"; static NSString * const kStatLogout = @"Logout"; +static NSString * const kStatLuggageHero = @"LuggageHero"; static NSString * const kStatMap = @"map"; static NSString * const kStatMapDataSize = @"map_data_size"; static NSString * const kStatMapSearch = @"Map search"; diff --git a/iphone/Maps/Core/Search/MWMSearch.mm b/iphone/Maps/Core/Search/MWMSearch.mm index 2d58a580b8..a6410486d4 100644 --- a/iphone/Maps/Core/Search/MWMSearch.mm +++ b/iphone/Maps/Core/Search/MWMSearch.mm @@ -12,7 +12,7 @@ #include "map/everywhere_search_params.hpp" #include "map/viewport_search_params.hpp" -extern NSString * const kCianCategory; +extern NSString * const kLuggageCategory; namespace { diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/Contents.json b/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/Contents.json deleted file mode 100644 index 50879cdcff..0000000000 --- a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "ic_cian_dark.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "ic_cian_dark@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "ic_cian_dark@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/ic_cian_dark.png b/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/ic_cian_dark.png deleted file mode 100644 index 63d01152bd..0000000000 Binary files a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/ic_cian_dark.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/ic_cian_dark@2x.png b/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/ic_cian_dark@2x.png deleted file mode 100644 index b589465bf3..0000000000 Binary files a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/ic_cian_dark@2x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/ic_cian_dark@3x.png b/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/ic_cian_dark@3x.png deleted file mode 100644 index 81db6262de..0000000000 Binary files a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_dark.imageset/ic_cian_dark@3x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/Contents.json b/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/Contents.json deleted file mode 100644 index a5b9ccc017..0000000000 --- a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "ic_cian_light.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "ic_cian_light@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "ic_cian_light@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/ic_cian_light.png b/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/ic_cian_light.png deleted file mode 100644 index 848e49b35f..0000000000 Binary files a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/ic_cian_light.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/ic_cian_light@2x.png b/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/ic_cian_light@2x.png deleted file mode 100644 index 530c568e6b..0000000000 Binary files a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/ic_cian_light@2x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/ic_cian_light@3x.png b/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/ic_cian_light@3x.png deleted file mode 100644 index aabc58e4ab..0000000000 Binary files a/iphone/Maps/Images.xcassets/Search/Categories/ic_cian_light.imageset/ic_cian_light@3x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_dark.imageset/Contents.json b/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_dark.imageset/Contents.json new file mode 100644 index 0000000000..78c0e59545 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_dark.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_luggagehero_dark.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_dark.imageset/ic_luggagehero_dark.pdf b/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_dark.imageset/ic_luggagehero_dark.pdf new file mode 100644 index 0000000000..06a6d1786d Binary files /dev/null and b/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_dark.imageset/ic_luggagehero_dark.pdf differ diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_light.imageset/Contents.json b/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_light.imageset/Contents.json new file mode 100644 index 0000000000..ac186f8904 --- /dev/null +++ b/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_light.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "ic_luggagehero_light.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_light.imageset/ic_luggagehero_light.pdf b/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_light.imageset/ic_luggagehero_light.pdf new file mode 100644 index 0000000000..90b3cb0593 Binary files /dev/null and b/iphone/Maps/Images.xcassets/Search/Categories/ic_luggagehero_light.imageset/ic_luggagehero_light.pdf differ diff --git a/iphone/Maps/Images.xcassets/logo_cian.imageset/Contents.json b/iphone/Maps/Images.xcassets/logo_cian.imageset/Contents.json deleted file mode 100644 index d43e8b4e7a..0000000000 --- a/iphone/Maps/Images.xcassets/logo_cian.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "logo_cian.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "logo_cian@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "logo_cian@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/logo_cian.imageset/logo_cian.png b/iphone/Maps/Images.xcassets/logo_cian.imageset/logo_cian.png deleted file mode 100644 index 29d4bd2acf..0000000000 Binary files a/iphone/Maps/Images.xcassets/logo_cian.imageset/logo_cian.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/logo_cian.imageset/logo_cian@2x.png b/iphone/Maps/Images.xcassets/logo_cian.imageset/logo_cian@2x.png deleted file mode 100644 index be6d79d82b..0000000000 Binary files a/iphone/Maps/Images.xcassets/logo_cian.imageset/logo_cian@2x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/logo_cian.imageset/logo_cian@3x.png b/iphone/Maps/Images.xcassets/logo_cian.imageset/logo_cian@3x.png deleted file mode 100644 index c0fbeefa9c..0000000000 Binary files a/iphone/Maps/Images.xcassets/logo_cian.imageset/logo_cian@3x.png and /dev/null differ diff --git a/iphone/Maps/Images.xcassets/logo_luggage.imageset/Contents.json b/iphone/Maps/Images.xcassets/logo_luggage.imageset/Contents.json new file mode 100644 index 0000000000..c6bc0d9b6d --- /dev/null +++ b/iphone/Maps/Images.xcassets/logo_luggage.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "logo_luggage.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/logo_luggage.imageset/logo_luggage.pdf b/iphone/Maps/Images.xcassets/logo_luggage.imageset/logo_luggage.pdf new file mode 100644 index 0000000000..bcf6ea0b76 Binary files /dev/null and b/iphone/Maps/Images.xcassets/logo_luggage.imageset/logo_luggage.pdf differ diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 69827f4111..c9fd41ab80 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -142,11 +142,6 @@ 347A4C5E1C4E76C9006BA66E /* liboauthcpp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 340DC82B1C4E72C700EAA2CC /* liboauthcpp.a */; }; 347BFA901F27909200E5531F /* MenuArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347BFA8E1F27909200E5531F /* MenuArea.swift */; }; 347E039A1FAC5F1D00426032 /* UIWindow+InputLanguage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347E03981FAC5F1D00426032 /* UIWindow+InputLanguage.swift */; }; - 347E1A891F1F5DD7002BF7A8 /* CianItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347E1A871F1F5DD7002BF7A8 /* CianItemModel.swift */; }; - 347E1A8E1F1F71F1002BF7A8 /* PPCianCarouselCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347E1A8C1F1F71F1002BF7A8 /* PPCianCarouselCell.swift */; }; - 347E1A921F1F72AD002BF7A8 /* PPCianCarouselCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 347E1A901F1F72AD002BF7A8 /* PPCianCarouselCell.xib */; }; - 347E1A971F1F7404002BF7A8 /* CianElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347E1A941F1F7404002BF7A8 /* CianElement.swift */; }; - 347E1A9A1F1F7404002BF7A8 /* CianElement.xib in Resources */ = {isa = PBXBuildFile; fileRef = 347E1A951F1F7404002BF7A8 /* CianElement.xib */; }; 34845DAF1E1649F6003D55B9 /* DownloaderNoResultsEmbedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34845DAD1E1649F6003D55B9 /* DownloaderNoResultsEmbedViewController.swift */; }; 34845DB31E165E24003D55B9 /* SearchNoResultsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34845DB11E165E24003D55B9 /* SearchNoResultsViewController.swift */; }; 34845DB71E166084003D55B9 /* Common.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34845DB51E166084003D55B9 /* Common.swift */; }; @@ -927,11 +922,6 @@ 347D15C71F82362900E86251 /* GoogleSignIn.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GoogleSignIn.framework; path = GoogleSignIn/GoogleSignIn.framework; sourceTree = ""; }; 347D15C81F82362900E86251 /* GoogleSignInDependencies.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GoogleSignInDependencies.framework; path = GoogleSignIn/GoogleSignInDependencies.framework; sourceTree = ""; }; 347E03981FAC5F1D00426032 /* UIWindow+InputLanguage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIWindow+InputLanguage.swift"; sourceTree = ""; }; - 347E1A871F1F5DD7002BF7A8 /* CianItemModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CianItemModel.swift; sourceTree = ""; }; - 347E1A8C1F1F71F1002BF7A8 /* PPCianCarouselCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PPCianCarouselCell.swift; sourceTree = ""; }; - 347E1A901F1F72AD002BF7A8 /* PPCianCarouselCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PPCianCarouselCell.xib; sourceTree = ""; }; - 347E1A941F1F7404002BF7A8 /* CianElement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CianElement.swift; sourceTree = ""; }; - 347E1A951F1F7404002BF7A8 /* CianElement.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CianElement.xib; sourceTree = ""; }; 34845DAD1E1649F6003D55B9 /* DownloaderNoResultsEmbedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloaderNoResultsEmbedViewController.swift; sourceTree = ""; }; 34845DB11E165E24003D55B9 /* SearchNoResultsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchNoResultsViewController.swift; sourceTree = ""; }; 34845DB51E166084003D55B9 /* Common.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Common.swift; sourceTree = ""; }; @@ -2489,18 +2479,6 @@ path = TextToSpeech; sourceTree = ""; }; - 347E1A861F1F5DD7002BF7A8 /* Cian */ = { - isa = PBXGroup; - children = ( - 347E1A871F1F5DD7002BF7A8 /* CianItemModel.swift */, - 347E1A8C1F1F71F1002BF7A8 /* PPCianCarouselCell.swift */, - 347E1A901F1F72AD002BF7A8 /* PPCianCarouselCell.xib */, - 347E1A941F1F7404002BF7A8 /* CianElement.swift */, - 347E1A951F1F7404002BF7A8 /* CianElement.xib */, - ); - path = Cian; - sourceTree = ""; - }; 3486B5041E27A4B50069C126 /* Notifications */ = { isa = PBXGroup; children = ( @@ -3467,7 +3445,6 @@ F68224981E5B0FE100BC1C18 /* BookingCells */, F6E2FCA91E097B9F0083EBEC /* BookmarkCell */, F6E2FCAF1E097B9F0083EBEC /* ButtonCell */, - 347E1A861F1F5DD7002BF7A8 /* Cian */, 346DB81C1E5C4F6700E3123E /* Gallery */, F6E2FCB31E097B9F0083EBEC /* OpeningHoursCell */, F6E2FCC11E097B9F0083EBEC /* RegularCell */, @@ -4120,7 +4097,6 @@ F6E2FEEE1E097BA00083EBEC /* MWMSearchView.xib in Resources */, 344532511F714FD70059FBCC /* UGCAddReviewController.xib in Resources */, 3490D2E31CE9DD2500D0B838 /* MWMSideButtonsView.xib in Resources */, - 347E1A921F1F72AD002BF7A8 /* PPCianCarouselCell.xib in Resources */, 346DB82B1E5C4F6700E3123E /* GalleryCell.xib in Resources */, F6E2FE2E1E097BA00083EBEC /* MWMStreetEditorEditTableViewCell.xib in Resources */, 349B92711DF0526D007779DD /* MWMToast.xib in Resources */, @@ -4145,7 +4121,6 @@ 6741A94D1BF340DE002C974C /* resources-xxhdpi_clear in Resources */, 6741A9551BF340DE002C974C /* resources-xxhdpi_dark in Resources */, 340E1EF51E2F614400CE49BF /* SearchFilters.storyboard in Resources */, - 347E1A9A1F1F7404002BF7A8 /* CianElement.xib in Resources */, F682249F1E5B105900BC1C18 /* PPHotelDescriptionCell.xib in Resources */, 340E1EF81E2F614400CE49BF /* Settings.storyboard in Resources */, 6741A9421BF340DE002C974C /* sound-strings in Resources */, @@ -4233,7 +4208,6 @@ 343064411E9FDC7300DC7665 /* SearchIndex.swift in Sources */, F6664BFA1E6459CB00E703C2 /* PPFacilityCell.swift in Sources */, 348B926D1FF3B5E100379009 /* UIView+Animation.swift in Sources */, - 347E1A8E1F1F71F1002BF7A8 /* PPCianCarouselCell.swift in Sources */, F6E2FDE91E097BA00083EBEC /* MWMObjectsCategorySelectorController.mm in Sources */, 3472B5EF200F8F7600DC6CD5 /* BackgroundUGCUpload.swift in Sources */, 6741A9A81BF340DE002C974C /* MWMFacebookAlert.mm in Sources */, @@ -4264,7 +4238,6 @@ 340475501E081A4600C92850 /* fabric_logging_ios.mm in Sources */, 34F4073E1E9E1AFF00E57AC0 /* MPNativeAd+MWM.mm in Sources */, F6E2FED01E097BA00083EBEC /* MWMSearchFilterViewController.mm in Sources */, - 347E1A971F1F7404002BF7A8 /* CianElement.swift in Sources */, 34D4FA671E265749003F53EF /* WhatsNewController.swift in Sources */, 34D3B01B1E389D05004100F9 /* MWMButtonCell.mm in Sources */, 3486B5161E27AD3B0069C126 /* Framework.cpp in Sources */, @@ -4347,7 +4320,6 @@ F6558DA21E642CC0002203AE /* MWMFacilitiesController.mm in Sources */, 34AB664A1FC5AA330078E451 /* RouteManageriPadPresentationController.swift in Sources */, 349D1ACF1E2E325B004A2006 /* MWMBottomMenuCollectionViewCell.mm in Sources */, - 347E1A891F1F5DD7002BF7A8 /* CianItemModel.swift in Sources */, F6E2FF451E097BA00083EBEC /* SettingsTableViewLinkCell.swift in Sources */, 34C9BD0A1C6DBCDA000DC38D /* MWMNavigationController.mm in Sources */, 3472B5F3200F906800DC6CD5 /* BackgroundDownloadMapNotification.swift in Sources */, diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h index e4bfa3651e..b728b092bc 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h @@ -12,7 +12,6 @@ @class MWMPlacePageData; @class MWMUGCReviewVM; -@class MWMCianItemModel; struct BookmarkAndCategory; struct FeatureID; @@ -92,8 +91,7 @@ enum class HotelReviewsRow enum class SpecialProject { - Viator, - Cian + Viator }; enum class MetainfoRows @@ -135,12 +133,10 @@ enum class OpeningHours }; using NewSectionsAreReady = void (^)(NSRange const & range, MWMPlacePageData * data, BOOL isSection); -using CianIsReady = void (^)(NSArray * items); } // namespace place_page @class MWMGalleryItemModel; @class MWMViatorItemModel; -@class MWMCianItemModel; @class MWMUGCViewModel; @class MWMUGCReviewModel; @class MWMUGCRatingValueType; @@ -152,7 +148,6 @@ using CianIsReady = void (^)(NSArray * items); @property(copy, nonatomic) MWMVoidBlock refreshPreviewCallback; @property(copy, nonatomic) place_page::NewSectionsAreReady sectionsAreReadyCallback; @property(copy, nonatomic) MWMVoidBlock bannerIsReadyCallback; -@property(copy, nonatomic) place_page::CianIsReady cianIsReadyCallback; @property(nonatomic, readonly) MWMUGCViewModel * ugc; // ready callback will be called from main queue. @@ -202,9 +197,6 @@ using CianIsReady = void (^)(NSArray * items); - (void)fillOnlineViatorSection; - (NSArray *)viatorItems; -// CIAN -- (void)fillOnlineCianSection; - // Route points - (RouteMarkType)routeMarkType; - (size_t)intermediateIndex; @@ -251,7 +243,6 @@ using CianIsReady = void (^)(NSArray * items); - (BOOL)isBooking; - (BOOL)isOpentable; - (BOOL)isViator; -- (BOOL)isCian; - (BOOL)isPartner; - (BOOL)isHolidayObject; - (BOOL)isBookingSearch; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm index f5358dd960..6d941ab07a 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm @@ -50,8 +50,6 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; std::vector m_hotelReviewsRows; booking::HotelInfo m_hotelInfo; - - uint64_t m_cianRequestId; } - (instancetype)initWithPlacePageInfo:(Info const &)info @@ -183,7 +181,7 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; NSAssert(!m_previewRows.empty(), @"Preview row's can't be empty!"); if (network_policy::CanUseNetwork() && ![MWMSettings adForbidden] && m_info.HasBanner() && - ![self isViator] && ![self isCian]) + ![self isViator]) { __weak auto wSelf = self; [[MWMBannersCache cache] @@ -338,68 +336,6 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; }); } -- (void)fillOnlineCianSection -{ - if (![self isCian]) - return; - - [self insertSpecialProjectsSectionWithProject:SpecialProject::Cian]; - - if (Platform::ConnectionStatus() == Platform::EConnectionType::CONNECTION_NONE) - { - self.cianIsReadyCallback(@[]); - return; - } - - network_policy::CallPartnersApi([self](platform::NetworkPolicy const & canUseNetwork) { - auto api = GetFramework().GetCianApi(canUseNetwork); - if (!api) - { - self.cianIsReadyCallback(@[]); - return; - } - auto const latLon = [self latLon]; - - __weak auto wSuccessSelf = self; - __weak auto wErrorSelf = self; - m_cianRequestId = api->GetRentNearby( - latLon, - [wSuccessSelf](std::vector const & places, uint64_t const requestId) { - __strong auto self = wSuccessSelf; - if (!self || self->m_cianRequestId != requestId) - return; - NSMutableArray * items = [@[] mutableCopy]; - for (auto const & p : places) - { - auto const & offers = p.m_offers; - NSCAssert(!offers.empty(), @"Cian misses offers for place."); - if (offers.empty()) - continue; - auto const & firstOffer = offers.front(); - - auto pageURL = [NSURL URLWithString:@(firstOffer.m_url.c_str())]; - if (!pageURL) - continue; - auto item = - [[MWMCianItemModel alloc] initWithRoomsCount:firstOffer.m_roomsCount - priceRur:firstOffer.m_priceRur - pageURL:pageURL - address:@(firstOffer.m_address.c_str())]; - [items addObject:item]; - } - - dispatch_async(dispatch_get_main_queue(), - [self, items] { self.cianIsReadyCallback(items); }); - }, - [wErrorSelf](int code, uint64_t const requestId) { - __strong auto self = wErrorSelf; - if (!self || self->m_cianRequestId != requestId) - return; - dispatch_async(dispatch_get_main_queue(), [self] { self.cianIsReadyCallback(@[]); }); - }); - }); -} - - (float)ratingRawValue { return m_info.GetRatingRawValue(); @@ -845,7 +781,6 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; - (BOOL)isBooking { return m_info.GetSponsoredType() == SponsoredType::Booking; } - (BOOL)isOpentable { return m_info.GetSponsoredType() == SponsoredType::Opentable; } - (BOOL)isViator { return m_info.GetSponsoredType() == SponsoredType::Viator; } -- (BOOL)isCian { return m_info.GetSponsoredType() == SponsoredType::Cian; } - (BOOL)isPartner { return m_info.GetSponsoredType() == SponsoredType::Partner; } - (BOOL)isHolidayObject { return m_info.GetSponsoredType() == SponsoredType::Holiday; } - (BOOL)isBookingSearch { return !m_info.GetBookingSearchUrl().empty(); } diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index fc904ecef3..eba597541d 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -253,8 +253,6 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName) parameters[kStatProvider] = kStatViator; else if (data.isBooking) parameters[kStatProvider] = kStatBooking; - else if (data.isCian) - parameters[kStatProvider] = kStatCian; else if (data.isPartner) parameters[kStatProvider] = data.partnerName; else if (data.isHolidayObject) diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.swift deleted file mode 100644 index cadea2884f..0000000000 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.swift +++ /dev/null @@ -1,179 +0,0 @@ -final class CianElement: UICollectionViewCell { - enum State { - case pending(onButtonAction: () -> Void) - case offer(model: CianItemModel?, onButtonAction: (CianItemModel?) -> Void) - case error(onButtonAction: () -> Void) - } - - @IBOutlet private var contentViews: [UIView]! - - @IBOutlet private weak var pendingView: UIView! - @IBOutlet private weak var offerView: UIView! - @IBOutlet private weak var more: UIButton! - @IBOutlet private weak var price: UILabel! { - didSet { - price.font = UIFont.medium14() - price.textColor = UIColor.linkBlue() - } - } - - @IBOutlet private weak var descr: UILabel! { - didSet { - descr.font = UIFont.medium14() - descr.textColor = UIColor.blackPrimaryText() - } - } - - @IBOutlet private weak var address: UILabel! { - didSet { - address.font = UIFont.regular12() - address.textColor = UIColor.blackSecondaryText() - } - } - - @IBOutlet private weak var details: UIButton! { - didSet { - details.setTitleColor(UIColor.linkBlue(), for: .normal) - details.setBackgroundColor(UIColor.blackOpaque(), for: .normal) - } - } - - private var isLastCell = false { - didSet { - more.isHidden = !isLastCell - price.isHidden = isLastCell - descr.isHidden = isLastCell - address.isHidden = isLastCell - details.isHidden = isLastCell - } - } - - @IBOutlet private weak var pendingSpinnerView: UIImageView! { - didSet { - pendingSpinnerView.tintColor = UIColor.linkBlue() - } - } - - @IBOutlet private weak var pendingTitleTopOffset: NSLayoutConstraint! - @IBOutlet private weak var pendingTitle: UILabel! { - didSet { - pendingTitle.font = UIFont.medium14() - pendingTitle.textColor = UIColor.blackPrimaryText() - pendingTitle.text = L("preloader_cian_title") - } - } - - @IBOutlet private weak var pendingDescription: UILabel! { - didSet { - pendingDescription.font = UIFont.regular12() - pendingDescription.textColor = UIColor.blackSecondaryText() - pendingDescription.text = L("preloader_cian_message") - } - } - - @IBAction func onButtonAction() { - switch state! { - case let .pending(action): action() - case let .offer(model, action): action(model) - case let .error(action): action() - } - } - - var state: State! { - didSet { - setupAppearance() - let visibleView: UIView - let pendingSpinnerViewAlpha: CGFloat - switch state! { - case .pending: - pendingSpinnerViewAlpha = 1 - visibleView = self.pendingView - case .offer: - pendingSpinnerViewAlpha = 1 - visibleView = self.offerView - case .error: - pendingSpinnerViewAlpha = 0 - visibleView = self.pendingView - } - - animateConstraints(animations: { - self.contentViews.forEach { $0.isHidden = false } - switch self.state! { - case .pending: self.configPending() - case let .offer(model, _): self.configOffer(model: model) - case .error: self.configError() - } - self.pendingSpinnerView.alpha = pendingSpinnerViewAlpha - self.contentViews.forEach { $0.alpha = 0 } - visibleView.alpha = 1 - }, completion: { - self.contentViews.forEach { $0.isHidden = true } - visibleView.isHidden = false - }) - } - } - - private var isSpinning = false { - didSet { - let animationKey = "SpinnerAnimation" - if isSpinning { - let animation = CABasicAnimation(keyPath: "transform.rotation.z") - animation.fromValue = NSNumber(value: 0) - animation.toValue = NSNumber(value: 2 * Double.pi) - animation.duration = 0.8 - animation.repeatCount = Float.infinity - pendingSpinnerView.layer.add(animation, forKey: animationKey) - } else { - pendingSpinnerView.layer.removeAnimation(forKey: animationKey) - } - } - } - - private func setupAppearance() { - backgroundColor = UIColor.white() - layer.cornerRadius = 6 - layer.borderWidth = 1 - layer.borderColor = UIColor.blackDividers().cgColor - } - - private func configPending() { - isSpinning = true - details.setTitle(L("preloader_cian_button"), for: .normal) - pendingTitleTopOffset.priority = UILayoutPriority.defaultLow - } - - private func configError() { - isSpinning = false - details.setTitle(L("preloader_cian_button"), for: .normal) - pendingTitleTopOffset.priority = UILayoutPriority.defaultHigh - } - - private func configOffer(model: CianItemModel?) { - isSpinning = false - if let model = model { - isLastCell = false - - let priceFormatter = NumberFormatter() - priceFormatter.usesGroupingSeparator = true - if let priceString = priceFormatter.string(from: NSNumber(value: model.priceRur)) { - price.text = "\(priceString) \(L("rub_month"))" - } else { - price.isHidden = true - } - - let descrFormat = L("room").replacingOccurrences(of: "%s", with: "%@") - descr.text = String(format: descrFormat, arguments: ["\(model.roomsCount)"]) - - address.text = model.address - - details.setTitle(L("details"), for: .normal) - } else { - isLastCell = true - - more.setBackgroundImage(UIColor.isNightMode() ? #imageLiteral(resourceName: "btn_float_more_dark") : #imageLiteral(resourceName: "btn_float_more_light"), for: .normal) - - backgroundColor = UIColor.clear - layer.borderColor = UIColor.clear.cgColor - } - } -} diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.xib b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.xib deleted file mode 100644 index 83c4ba1688..0000000000 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianElement.xib +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianItemModel.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianItemModel.swift deleted file mode 100644 index b8b3af7cfd..0000000000 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/CianItemModel.swift +++ /dev/null @@ -1,14 +0,0 @@ -@objc(MWMCianItemModel) -final class CianItemModel: NSObject { - let roomsCount: UInt - let priceRur: UInt - let pageURL: URL - let address: String - - @objc init(roomsCount: UInt, priceRur: UInt, pageURL: URL, address: String) { - self.roomsCount = roomsCount - self.priceRur = priceRur - self.pageURL = pageURL - self.address = address - } -} diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.swift deleted file mode 100644 index 95405aeca7..0000000000 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.swift +++ /dev/null @@ -1,130 +0,0 @@ -import MyTrackerSDK - -@objc(MWMPPCianCarouselCell) -final class PPCianCarouselCell: MWMTableViewCell { - @IBOutlet private weak var title: UILabel! { - didSet { - title.text = L("subtitle_rent") - title.font = UIFont.bold14() - title.textColor = UIColor.blackSecondaryText() - } - } - - @IBOutlet private weak var more: UIButton! { - didSet { - more.setImage(#imageLiteral(resourceName: "logo_cian"), for: .normal) - more.titleLabel?.font = UIFont.regular17() - more.setTitleColor(UIColor.linkBlue(), for: .normal) - } - } - - @IBOutlet private weak var collectionView: UICollectionView! - @objc var data: [CianItemModel]? { - didSet { - updateCollectionView { [weak self] in - self?.collectionView.reloadSections(IndexSet(integer: 0)) - } - } - } - - fileprivate let kMaximumNumberOfElements = 5 - fileprivate var delegate: MWMPlacePageButtonsProtocol? - - fileprivate var statisticsParameters: [AnyHashable: Any] { return [kStatProvider: kStatCian, - kStatPlacement : kStatPlacePage] } - - @objc func config(delegate d: MWMPlacePageButtonsProtocol?) { - delegate = d - collectionView.contentOffset = .zero - collectionView.delegate = self - collectionView.dataSource = self - collectionView.register(cellClass: CianElement.self) - collectionView.reloadData() - - isSeparatorHidden = true - backgroundColor = UIColor.clear - } - - fileprivate func isLastCell(_ indexPath: IndexPath) -> Bool { - return indexPath.item == collectionView.numberOfItems(inSection: indexPath.section) - 1 - } - - override func didMoveToSuperview() { - super.didMoveToSuperview() - updateCollectionView(nil) - } - - private func updateCollectionView(_ updates: (() -> Void)?) { - guard let sv = superview else { return } - let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout - let screenSize = { sv.size.width - layout.sectionInset.left - layout.sectionInset.right } - let itemHeight: CGFloat = 136 - let itemWidth: CGFloat - if let data = data { - if data.isEmpty { - itemWidth = screenSize() - } else { - itemWidth = 160 - } - } else { - itemWidth = screenSize() - } - layout.itemSize = CGSize(width: itemWidth, height: itemHeight) - collectionView.performBatchUpdates(updates, completion: nil) - } - - @IBAction - fileprivate func onMore() { - MRMyTracker.trackEvent(withName: "Placepage_SponsoredGallery_LogoItem_selected_Cian.Ru") - Statistics.logEvent(kStatPlacepageSponsoredLogoSelected, withParameters: statisticsParameters) - delegate?.openSponsoredURL(nil) - } -} - -extension PPCianCarouselCell: UICollectionViewDelegate, UICollectionViewDataSource { - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCell(withCellClass: CianElement.self, - indexPath: indexPath) as! CianElement - if let data = data { - if data.isEmpty { - cell.state = .error(onButtonAction: { [unowned self] in - Statistics.logEvent(kStatPlacepageSponsoredError, withParameters: self.statisticsParameters) - self.delegate?.openSponsoredURL(nil) - }) - } else { - let model = isLastCell(indexPath) ? nil : data[indexPath.item] - var params = statisticsParameters - params[kStatItem] = indexPath.row + 1 - params[kStatDestination] = kStatExternal - cell.state = .offer(model: model, - onButtonAction: { [unowned self] model in - let isMore = model == nil - MRMyTracker.trackEvent(withName: isMore ? "Placepage_SponsoredGallery_MoreItem_selected_Cian.Ru" : - "Placepage_SponsoredGallery_ProductItem_selected_Cian.Ru") - Statistics.logEvent(isMore ? kStatPlacepageSponsoredMoreSelected : kStatPlacepageSponsoredItemSelected, - withParameters: params) - self.delegate?.openSponsoredURL(model?.pageURL) - }) - } - } else { - cell.state = .pending(onButtonAction: { [unowned self] in - MRMyTracker.trackEvent(withName: "Placepage_SponsoredGallery_MoreItem_selected_Cian.Ru") - Statistics.logEvent(kStatPlacepageSponsoredMoreSelected, withParameters: self.statisticsParameters) - self.delegate?.openSponsoredURL(nil) - }) - } - return cell - } - - func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int { - if let data = data { - if data.isEmpty { - return 1 - } else { - return min(data.count, kMaximumNumberOfElements) + 1 - } - } else { - return 1 - } - } -} diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.xib b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.xib deleted file mode 100644 index 6caaa12e06..0000000000 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/Cian/PPCianCarouselCell.xib +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm index fb9bc09eed..c0522797c7 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm @@ -57,7 +57,6 @@ map const kMetaInfoCells = { @property(weak, nonatomic) MWMPlacePageTaxiCell * taxiCell; @property(weak, nonatomic) MWMPPViatorCarouselCell * viatorCell; -@property(weak, nonatomic) MWMPPCianCarouselCell * cianCell; @property(nonatomic) BOOL buttonsSectionEnabled; @@ -94,7 +93,6 @@ map const kMetaInfoCells = { [tv registerWithCellClass:[MWMPPHotelDescriptionCell class]]; [tv registerWithCellClass:[MWMPPHotelCarouselCell class]]; [tv registerWithCellClass:[MWMPPViatorCarouselCell class]]; - [tv registerWithCellClass:[MWMPPCianCarouselCell class]]; [tv registerWithCellClass:[MWMPPReviewHeaderCell class]]; [tv registerWithCellClass:[MWMPPReviewCell class]]; [tv registerWithCellClass:[MWMPPFacilityCell class]]; @@ -120,7 +118,6 @@ map const kMetaInfoCells = { dispatch_async(dispatch_get_main_queue(), ^{ [data fillOnlineBookingSections]; [data fillOnlineViatorSection]; - [data fillOnlineCianSection]; }); } @@ -418,15 +415,6 @@ map const kMetaInfoCells = { self.viatorCell = c; return c; } - case SpecialProject::Cian: - { - Class cls = [MWMPPCianCarouselCell class]; - auto c = static_cast( - [tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]); - [c configWithDelegate:delegate]; - self.cianCell = c; - return c; - } } } case Sections::HotelPhotos: @@ -624,13 +612,6 @@ map const kMetaInfoCells = { [Statistics logEvent:kStatPlacepageSponsoredShow withParameters:@{kStatProvider: kStatViator, kStatPlacement: kStatPlacePage}]; }); - - checkCell(self.cianCell, ^{ - self.cianCell = nil; - [MRMyTracker trackEventWithName:@"Placepage_SponsoredGallery_shown_Cian.Ru"]; - [Statistics logEvent:kStatPlacepageSponsoredShow - withParameters:@{kStatProvider : kStatCian, kStatPlacement: kStatPlacePage}]; - }); } #pragma mark - MWMOpeningHoursLayoutHelper @@ -730,10 +711,6 @@ map const kMetaInfoCells = { [self.previewLayoutHelper insertRowAtTheEnd]; }; - data.cianIsReadyCallback = ^(NSArray * items) { - self.cianCell.data = items; - }; - [self.actionBar configureWithData:data]; [self.previewLayoutHelper configWithData:data]; auto const & metaInfo = data.metainfoRows; diff --git a/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoriesManager.mm b/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoriesManager.mm index 6ac180d89d..323174de84 100644 --- a/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoriesManager.mm +++ b/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoriesManager.mm @@ -6,7 +6,7 @@ #include "Framework.h" -extern NSString * const kCianCategory = @"cian"; +extern NSString * const kLuggageCategory = @"luggagehero"; @implementation MWMSearchCategoriesManager { @@ -54,10 +54,10 @@ extern NSString * const kCianCategory = @"cian"; forRowAtIndexPath:(NSIndexPath *)indexPath { NSString * string = @(m_categories[indexPath.row].c_str()); - if ([string isEqualToString:kCianCategory]) + if ([string isEqualToString:kLuggageCategory]) { - [MRMyTracker trackEventWithName:@"Search_SponsoredCategory_shown_Cian"]; - [Statistics logEvent:kStatSearchSponsoredShow withParameters:@{kStatProvider : kStatCian}]; + [MRMyTracker trackEventWithName:@"Search_SponsoredCategory_shown_LuggageHero"]; + [Statistics logEvent:kStatSearchSponsoredShow withParameters:@{kStatProvider : kStatLuggageHero}]; } } @@ -70,11 +70,11 @@ extern NSString * const kCianCategory = @"cian"; [delegate searchText:[L(string) stringByAppendingString:@" "] forInputLocale:[[AppInfo sharedInfo] languageId]]; [delegate dismissKeyboard]; - if ([string isEqualToString:kCianCategory]) + if ([string isEqualToString:kLuggageCategory]) { delegate.state = MWMSearchManagerStateMapSearch; - [MRMyTracker trackEventWithName:@"Search_SponsoredCategory_selected_Cian"]; - [Statistics logEvent:kStatSearchSponsoredSelect withParameters:@{kStatProvider : kStatCian}]; + [MRMyTracker trackEventWithName:@"Search_SponsoredCategory_selected_LuggageHero"]; + [Statistics logEvent:kStatSearchSponsoredSelect withParameters:@{kStatProvider : kStatLuggageHero}]; } } diff --git a/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.mm b/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.mm index 31c2a6828a..a3e95fdf56 100644 --- a/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.mm +++ b/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.mm @@ -2,7 +2,7 @@ #import "MWMCommon.h" #import "UIImageView+Coloring.h" -extern NSString * const kCianCategory; +extern NSString * const kLuggageCategory; @interface MWMSearchCategoryCell () @@ -29,11 +29,11 @@ extern NSString * const kCianCategory; UILabel * label = self.label; label.textColor = [UIColor blackPrimaryText]; self.icon.mwm_name = [NSString stringWithFormat:@"ic_%@", category]; - if ([category isEqualToString:kCianCategory]) + if ([category isEqualToString:kLuggageCategory]) { - label.text = L(@"real_estate"); + label.text = L(@"luggage_storage"); self.adIcon.hidden = NO; - self.adIcon.mwm_name = @"logo_cian"; + self.adIcon.image = [UIImage imageNamed:@"logo_luggage"]; } else { diff --git a/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.xib b/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.xib index 2650eeed53..587af8987c 100644 --- a/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.xib +++ b/iphone/Maps/UI/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.xib @@ -1,13 +1,18 @@ - + - + + + + HelveticaNeue + + @@ -45,7 +50,7 @@ - + @@ -79,6 +84,6 @@ - + diff --git a/map/displayed_categories_modifiers.cpp b/map/displayed_categories_modifiers.cpp index ba7b253491..64f1c99764 100644 --- a/map/displayed_categories_modifiers.cpp +++ b/map/displayed_categories_modifiers.cpp @@ -1,19 +1,25 @@ #include "map/displayed_categories_modifiers.hpp" -#include "partners_api/cian_api.hpp" - #include "base/macros.hpp" #include +#include -CianModifier::CianModifier(std::string const & city) : m_city(city) {} +namespace +{ +std::unordered_set const kLuggageHeroesSupportedCities{"London", "New York", + "Copenhagen"}; +} // namespace -void CianModifier::Modify(search::DisplayedCategories::Keys & keys) +LuggageHeroModifier::LuggageHeroModifier(std::string const & city) : m_city(city) {} + +void LuggageHeroModifier::Modify(search::DisplayedCategories::Keys & keys) { static int const kPos = 4; - static std::string const kCategoryName = "cian"; + static std::string const kCategoryName = "luggagehero"; - auto const supported = cian::Api::IsCitySupported(m_city); + auto const supported = + kLuggageHeroesSupportedCities.find(m_city) != kLuggageHeroesSupportedCities.cend(); auto const contains = std::find(keys.cbegin(), keys.cend(), kCategoryName) != keys.cend(); ASSERT_LESS(kPos, keys.size(), ()); diff --git a/map/displayed_categories_modifiers.hpp b/map/displayed_categories_modifiers.hpp index 798b0d2a1a..5e6a3e6ebc 100644 --- a/map/displayed_categories_modifiers.hpp +++ b/map/displayed_categories_modifiers.hpp @@ -2,10 +2,10 @@ #include "search/displayed_categories.hpp" -class CianModifier : public search::CategoriesModifier +class LuggageHeroModifier : public search::CategoriesModifier { public: - explicit CianModifier(std::string const & city); + explicit LuggageHeroModifier(std::string const & city); // CategoriesModifier overrides: void Modify(search::DisplayedCategories::Keys & keys) override; diff --git a/map/framework.cpp b/map/framework.cpp index b9f2d74888..9ac61e2435 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -539,15 +539,6 @@ taxi::Engine * Framework::GetTaxiEngine(platform::NetworkPolicy const & policy) return nullptr; } -cian::Api * Framework::GetCianApi(platform::NetworkPolicy const & policy) -{ - ASSERT(m_cianApi, ()); - if (policy.CanUse()) - return m_cianApi.get(); - - return nullptr; -} - locals::Api * Framework::GetLocalsApi(platform::NetworkPolicy const & policy) { ASSERT(m_localsApi, ()); @@ -892,13 +883,6 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info info.SetBookingSearchUrl(url); LOG(LINFO, (url)); } - else if (cian::Api::IsCitySupported(city) && - ((buildingHolder.Equals({ft}) && !ft.HasName()) || - ftypes::IsPublicTransportStopChecker::Instance()(ft))) - { - info.SetSponsoredType(SponsoredType::Cian); - info.SetSponsoredUrl(cian::Api::GetMainPageUrl()); - } else if (ftypes::SponsoredPartnerChecker::Instance()(ft)) { info.SetSponsoredType(place_page::SponsoredType::Partner); @@ -1484,8 +1468,8 @@ search::DisplayedCategories const & Framework::GetDisplayedCategories() if (auto const position = GetCurrentPosition()) city = m_cityFinder->GetCityName(*position, StringUtf8Multilang::kEnglishCode); - CianModifier cianModifier(city); - m_displayedCategories->Modify(cianModifier); + LuggageHeroModifier modifier(city); + m_displayedCategories->Modify(modifier); return *m_displayedCategories; } @@ -1634,13 +1618,6 @@ void Framework::FillSearchResultsMarks(bool clear, search::Results::ConstIter be continue; } - // TODO: delete me after Cian project is finished. - if (GetSearchAPI().GetSponsoredMode() == SearchAPI::SponsoredMode::Cian) - { - mark->SetMarkType(SearchMarkType::Cian); - continue; - } - if (r.m_metadata.m_isSponsoredHotel) mark->SetMarkType(SearchMarkType::Booking); diff --git a/map/framework.hpp b/map/framework.hpp index 075b1cbb3f..f0dc08610d 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -47,7 +47,6 @@ #include "tracking/reporter.hpp" #include "partners_api/booking_api.hpp" -#include "partners_api/cian_api.hpp" #include "partners_api/locals_api.hpp" #include "partners_api/taxi_engine.hpp" #include "partners_api/viator_api.hpp" @@ -193,7 +192,6 @@ protected: unique_ptr m_bookingApi = make_unique(); unique_ptr m_viatorApi = make_unique(); - unique_ptr m_cianApi = make_unique(); unique_ptr m_localsApi = make_unique(); df::DrapeApi m_drapeApi; @@ -237,7 +235,6 @@ public: booking::Api const * GetBookingApi(platform::NetworkPolicy const & policy) const; viator::Api * GetViatorApi(platform::NetworkPolicy const & policy); taxi::Engine * GetTaxiEngine(platform::NetworkPolicy const & policy); - cian::Api * GetCianApi(platform::NetworkPolicy const & policy); locals::Api * GetLocalsApi(platform::NetworkPolicy const & policy); ugc::Api * GetUGCApi() { return m_ugcApi.get(); } ugc::Api const * GetUGCApi() const { return m_ugcApi.get(); } diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp index 37fd32361c..3ae7f674b1 100644 --- a/map/place_page_info.cpp +++ b/map/place_page_info.cpp @@ -268,9 +268,6 @@ bool Info::HasBanner() const if (!m_adsEngine) return false; - if (m_sponsoredType == SponsoredType::Cian) - return false; - if (IsMyPosition()) return false; diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index b7e11cb96a..d2c9a8155a 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -38,7 +38,6 @@ enum class SponsoredType Booking, Opentable, Viator, - Cian, Partner, Holiday }; diff --git a/map/search_api.cpp b/map/search_api.cpp index 85aea8721b..fe9a7d3c95 100644 --- a/map/search_api.cpp +++ b/map/search_api.cpp @@ -39,13 +39,6 @@ void CancelQuery(weak_ptr & handle) handle.reset(); } -bool IsCianMode(string query) -{ - strings::Trim(query); - strings::AsciiToLower(query); - return query == "cian"; -} - bookmarks::Id MarkIDToBookmarkId(df::MarkID id) { static_assert(is_integral::value, ""); @@ -172,7 +165,6 @@ bool SearchAPI::SearchEverywhere(EverywhereSearchParams const & params) p.m_needAddress = true; p.m_needHighlighting = true; p.m_hotelsFilter = params.m_hotelsFilter; - p.m_cianMode = m_sponsoredMode == SponsoredMode::Cian; p.m_onResults = EverywhereSearchCallback( static_cast(*this), @@ -206,7 +198,6 @@ bool SearchAPI::SearchInViewport(ViewportSearchParams const & params) p.m_needAddress = false; p.m_needHighlighting = false; p.m_hotelsFilter = params.m_hotelsFilter; - p.m_cianMode = m_sponsoredMode == SponsoredMode::Cian; p.m_onStarted = [this, params] { if (params.m_onStarted) @@ -437,9 +428,6 @@ void SearchAPI::UpdateSponsoredMode(string const & query, booking::filter::availability::Params const & params) { m_sponsoredMode = SponsoredMode::None; - // TODO: delete me after Cian project is finished. - if (IsCianMode(query)) - m_sponsoredMode = SponsoredMode::Cian; if (!params.IsEmpty()) m_sponsoredMode = SponsoredMode::Booking; } @@ -449,7 +437,6 @@ string DebugPrint(SearchAPI::SponsoredMode mode) switch (mode) { case SearchAPI::SponsoredMode::None: return "None"; - case SearchAPI::SponsoredMode::Cian: return "Cian"; case SearchAPI::SponsoredMode::Booking: return "Booking"; } } diff --git a/map/search_api.hpp b/map/search_api.hpp index 4936d2a44a..6296cbbfeb 100644 --- a/map/search_api.hpp +++ b/map/search_api.hpp @@ -58,8 +58,6 @@ public: enum class SponsoredMode { None, - // TODO (@y, @m): delete me after Cian project is finished. - Cian, Booking }; diff --git a/map/search_mark.cpp b/map/search_mark.cpp index c9ca9082b0..f0cf0eed2b 100644 --- a/map/search_mark.cpp +++ b/map/search_mark.cpp @@ -14,7 +14,6 @@ std::vector const kSymbols = "search-result", // Default. "search-booking", // Booking. "search-adv", // LocalAds. - "search-cian", // TODO: delete me after Cian project is finished. "non-found-search-result", // NotFound. }; @@ -24,7 +23,6 @@ std::vector const kPreparingSymbols = "search-result", // Default. "search-booking-inactive", // Booking. "search-adv", // LocalAds. - "search-cian", // TODO: delete me after Cian project is finished. "non-found-search-result", // NotFound. }; diff --git a/map/search_mark.hpp b/map/search_mark.hpp index b66d68fc90..90e848a0c6 100644 --- a/map/search_mark.hpp +++ b/map/search_mark.hpp @@ -17,8 +17,6 @@ enum class SearchMarkType Default = 0, Booking, LocalAds, - Cian, // TODO: delete me after Cian project is finished. - NotFound, // Service value used in developer tools. Count }; diff --git a/partners_api/CMakeLists.txt b/partners_api/CMakeLists.txt index a76b739127..d1171690ae 100644 --- a/partners_api/CMakeLists.txt +++ b/partners_api/CMakeLists.txt @@ -13,8 +13,6 @@ set( booking_api.hpp booking_availability_params.cpp booking_availability_params.hpp - cian_api.cpp - cian_api.hpp facebook_ads.cpp facebook_ads.hpp google_ads.cpp diff --git a/partners_api/cian_api.cpp b/partners_api/cian_api.cpp deleted file mode 100644 index 53e29e99ee..0000000000 --- a/partners_api/cian_api.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "partners_api/cian_api.hpp" - -#include "platform/platform.hpp" - -#include "geometry/mercator.hpp" -#include "geometry/rect2d.hpp" - -#include "base/logging.hpp" - -#include -#include - -#include "3party/jansson/myjansson.hpp" - -using namespace partners_api; -using namespace platform; - -namespace -{ -void AddParameterToUrl(std::string & url, std::string const & parameters) -{ - if (url.find("?") != std::string::npos) - url += "&"; - else - url += "?"; - - url += parameters; -} - -// Length of the rect side in meters. -double const kSearchRadius = 500.0; -std::string const kUtmComplement = "utm_source=maps.me&utm_medium=cpc&utm_campaign=map"; - -std::unordered_set const kSupportedCities -{ - "Moscow", - "Saint Petersburg", - "Nizhny Novgorod", - "Samara", - "Kazan", - "Krasnodar", - "Rostov-on-Don", - "Ufa" -}; - -template -void GetNullable(json_t * src, std::string const & fieldName, T & result) -{ - auto const field = json_object_get(src, fieldName.c_str()); - - if (json_is_null(field)) - return; - - FromJSON(field, result); -} - -void MakeResult(std::string const & src, std::vector & result) -{ - my::Json root(src.c_str()); - if (!json_is_object(root.get())) - MYTHROW(my::Json::Exception, ("The answer must contain a json object.")); - - json_t * clusters = json_object_get(root.get(), "clusters"); - - if (clusters == nullptr) - return; - - size_t const clustersSize = json_array_size(clusters); - - for (size_t i = 0; i < clustersSize; ++i) - { - auto cluster = json_array_get(clusters, i); - cian::RentPlace place; - FromJSONObject(cluster, "lat", place.m_latlon.lat); - FromJSONObject(cluster, "lng", place.m_latlon.lon); - FromJSONObject(cluster, "url", place.m_url); - - json_t * offers = json_object_get(cluster, "offers"); - - if (offers == nullptr) - continue; - - size_t const offersSize = json_array_size(offers); - - if (offersSize == 0) - continue; - - for (size_t i = 0; i < offersSize; ++i) - { - auto offer = json_array_get(offers, i); - - cian::RentOffer rentOffer; - - GetNullable(offer, "flatType", rentOffer.m_flatType); - GetNullable(offer, "roomsCount", rentOffer.m_roomsCount); - GetNullable(offer, "priceRur", rentOffer.m_priceRur); - GetNullable(offer, "floorNumber", rentOffer.m_floorNumber); - GetNullable(offer, "floorsCount", rentOffer.m_floorsCount); - GetNullable(offer, "url", rentOffer.m_url); - GetNullable(offer, "address", rentOffer.m_address); - - if (rentOffer.IsValid()) - { - AddParameterToUrl(rentOffer.m_url, kUtmComplement); - place.m_offers.push_back(std::move(rentOffer)); - } - } - - result.push_back(std::move(place)); - } -} -} // namespace - -namespace cian -{ -std::string const kBaseUrl = "https://api.cian.ru/rent-nearby/v1"; - -// static -http::Result RawApi::GetRentNearby(m2::RectD const & rect, - std::string const & baseUrl /* = kBaseUrl */) -{ - std::ostringstream url; - url << std::setprecision(6) << baseUrl << "/get-offers-in-bbox/?bbox=" << rect.minX() << ',' << rect.maxY() << '~' - << rect.maxX() << ',' << rect.minY(); - - return http::RunSimpleRequest(url.str()); -} - -Api::Api(std::string const & baseUrl /* = kBaseUrl */) : m_baseUrl(baseUrl) {} - -uint64_t Api::GetRentNearby(ms::LatLon const & latlon, RentNearbyCallback const & onSuccess, - ErrorCallback const & onError) -{ - auto const reqId = ++m_requestId; - auto const & baseUrl = m_baseUrl; - - // Cian supports inverted lon lat coordinates - auto const mercatorRect = MercatorBounds::MetresToXY(latlon.lat, latlon.lon, kSearchRadius); - auto const rect = MercatorBounds::ToLatLonRect(mercatorRect); - - GetPlatform().RunTask(Platform::Thread::Network, [reqId, rect, onSuccess, onError, baseUrl]() { - std::vector result; - - auto const rawResult = RawApi::GetRentNearby(rect, baseUrl); - if (!rawResult) - { - auto & code = rawResult.m_errorCode; - onError(code, reqId); - return; - } - - try - { - MakeResult(rawResult.m_data, result); - } - catch (my::Json::Exception const & e) - { - LOG(LERROR, (e.Msg())); - result.clear(); - } - onSuccess(result, reqId); - }); - - return reqId; -} - -// static -bool Api::IsCitySupported(std::string const & city) -{ - return kSupportedCities.find(city) != kSupportedCities.cend(); -} - -// static -std::string const & Api::GetMainPageUrl() -{ - static std::string const kMainPageUrl = "https://www.cian.ru/?" + kUtmComplement; - return kMainPageUrl; -} -} // namespace cian diff --git a/partners_api/cian_api.hpp b/partners_api/cian_api.hpp deleted file mode 100644 index e98fd31b2c..0000000000 --- a/partners_api/cian_api.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include "partners_api/utils.hpp" - -#include "geometry/latlon.hpp" -#include "geometry/rect2d.hpp" - -#include "platform/safe_callback.hpp" - -#include "base/worker_thread.hpp" - -#include -#include -#include -#include - -namespace cian -{ -extern std::string const kBaseUrl; - -class RawApi -{ -public: - static partners_api::http::Result GetRentNearby(m2::RectD const & rect, - std::string const & url = kBaseUrl); -}; - -struct RentOffer -{ - std::string m_flatType; - uint8_t m_roomsCount = 0; - double m_priceRur = 0.0; - uint8_t m_floorNumber = 0; - uint8_t m_floorsCount = 0; - std::string m_url; - std::string m_address; - - // No need to use offer when it is not fully filled. - bool IsValid() const - { - return !m_flatType.empty() && m_roomsCount && m_priceRur != 0.0 && m_floorNumber && - m_floorsCount && !m_url.empty() && !m_address.empty(); - } -}; - -struct RentPlace -{ - ms::LatLon m_latlon; - std::string m_url; - std::vector m_offers; -}; - -class Api -{ -public: - - using RentNearbyCallback = - platform::SafeCallback const & places, uint64_t const requestId)>; - - using ErrorCallback = platform::SafeCallback; - - explicit Api(std::string const & baseUrl = kBaseUrl); - - uint64_t GetRentNearby(ms::LatLon const & latlon, RentNearbyCallback const & onSuccess, - ErrorCallback const & onError); - - static bool IsCitySupported(std::string const & city); - static std::string const & GetMainPageUrl(); - -private: - uint64_t m_requestId = 0; - std::string m_baseUrl; -}; -} // namespace cian diff --git a/partners_api/partners_api_tests/CMakeLists.txt b/partners_api/partners_api_tests/CMakeLists.txt index 711191377f..72d83548be 100644 --- a/partners_api/partners_api_tests/CMakeLists.txt +++ b/partners_api/partners_api_tests/CMakeLists.txt @@ -6,7 +6,6 @@ set( SRC ads_engine_tests.cpp booking_tests.cpp - cian_tests.cpp facebook_tests.cpp google_tests.cpp mopub_tests.cpp diff --git a/partners_api/partners_api_tests/cian_tests.cpp b/partners_api/partners_api_tests/cian_tests.cpp deleted file mode 100644 index e4bd69b650..0000000000 --- a/partners_api/partners_api_tests/cian_tests.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "testing/testing.hpp" - -#include "partners_api/partners_api_tests/async_gui_thread.hpp" - -#include "partners_api/cian_api.hpp" - -#include "3party/jansson/myjansson.hpp" - -using namespace partners_api; - -namespace -{ -UNIT_TEST(Cian_GetRentNearbyRaw) -{ - auto const result = cian::RawApi::GetRentNearby({37.402891, 55.656318, 37.840971, 55.859980}); - - TEST(!result.m_data.empty(), ()); - - my::Json root(result.m_data.c_str()); - TEST(json_is_object(root.get()), ()); -} - -UNIT_CLASS_TEST(AsyncGuiThread, Cian_GetRentNearby) -{ - ms::LatLon latlon(55.807385, 37.505554); - uint64_t reqId = 0; - - { - cian::Api api("http://localhost:34568/partners"); - std::vector result; - - reqId = api.GetRentNearby( - latlon, - [&reqId, &result](std::vector const & places, uint64_t const requestId) { - TEST_EQUAL(reqId, requestId, ()); - result = places; - testing::Notify(); - }, - [&reqId](int httpCode, uint64_t const requestId) { - TEST_EQUAL(reqId, requestId, ()); - TEST(false, (httpCode)); - }); - - testing::Wait(); - - TEST(!result.empty(), ()); - for (auto const & r : result) - { - for (auto const & o : r.m_offers) - { - TEST(o.IsValid(), ()); - } - } - } - { - cian::Api api("incorrect url"); - std::vector result; - int httpCode = -1; - - reqId = api.GetRentNearby( - latlon, - [&reqId, &result](std::vector const & places, uint64_t const requestId) { - TEST_EQUAL(reqId, requestId, ()); - TEST(false, (requestId)); - }, - [&reqId, &httpCode](int code, uint64_t const requestId) { - TEST_EQUAL(reqId, requestId, ()); - httpCode = code; - testing::Notify(); - }); - - testing::Wait(); - - TEST_NOT_EQUAL(httpCode, -1, ()); - } -} -} // namespace diff --git a/search/geocoder.cpp b/search/geocoder.cpp index bc8a36d2ed..97751780a6 100644 --- a/search/geocoder.cpp +++ b/search/geocoder.cpp @@ -333,31 +333,6 @@ size_t OrderCountries(m2::RectD const & pivot, vector> & inf auto const sep = stable_partition(infos.begin(), infos.end(), intersects); return distance(infos.begin(), sep); } - -CBV DecimateCianResults(CBV const & cbv) -{ - // With the typical amount of buildings in a relevant - // mwm nearing 200000, the geocoding slows down considerably. - // Leaving only a fraction of them does not seem - // to worsen the percieved result. - size_t const kMaxCianResults = 10000; - minstd_rand rng(0); - auto survivedIds = - ::base::RandomSample(::base::checked_cast(cbv.PopCount()), kMaxCianResults, rng); - sort(survivedIds.begin(), survivedIds.end()); - auto it = survivedIds.begin(); - vector setBits; - setBits.reserve(kMaxCianResults); - size_t observed = 0; - cbv.ForEach([&](uint64_t bit) { - while (it != survivedIds.end() && *it < observed) - ++it; - if (it != survivedIds.end() && *it == observed) - setBits.push_back(bit); - ++observed; - }); - return CBV(coding::CompressedBitVectorBuilder::FromBitPositions(move(setBits))); -} } // namespace // Geocoder::Geocoder ------------------------------------------------------------------------------ @@ -392,7 +367,6 @@ void Geocoder::SetParams(Params const & params) } m_params = params; - m_model.SetCianEnabled(m_params.m_cianMode); m_tokenRequests.clear(); m_prefixTokenRequest.Clear(); @@ -481,7 +455,6 @@ void Geocoder::ClearCaches() void Geocoder::SetParamsForCategorialSearch(Params const & params) { m_params = params; - m_model.SetCianEnabled(m_params.m_cianMode); m_tokenRequests.clear(); m_prefixTokenRequest.Clear(); @@ -621,9 +594,6 @@ void Geocoder::InitBaseContext(BaseContext & ctx) { ctx.m_features[i] = retrieval.RetrieveAddressFeatures(m_tokenRequests[i]); } - - if (m_params.m_cianMode) - ctx.m_features[i] = DecimateCianResults(ctx.m_features[i]); } ctx.m_hotelsFilter = m_hotelsFilter.MakeScopedFilter(*m_context, m_params.m_hotelsFilter); @@ -1338,9 +1308,6 @@ void Geocoder::EmitResult(BaseContext & ctx, MwmSet::MwmId const & mwmId, uint32 if (ctx.m_hotelsFilter && !ctx.m_hotelsFilter->Matches(id)) return; - if (m_params.m_cianMode && type != Model::TYPE_BUILDING) - return; - if (m_params.m_tracer) TraceResult(*m_params.m_tracer, ctx, mwmId, ftId, type, tokenRange); @@ -1394,9 +1361,6 @@ void Geocoder::EmitResult(BaseContext & ctx, City const & city, TokenRange const void Geocoder::MatchUnclassified(BaseContext & ctx, size_t curToken) { - if (m_params.m_cianMode) - return; - ASSERT(ctx.m_layers.empty(), ()); // We need to match all unused tokens to UNCLASSIFIED features, diff --git a/search/geocoder.hpp b/search/geocoder.hpp index 00fcb4629e..26b3f63f65 100644 --- a/search/geocoder.hpp +++ b/search/geocoder.hpp @@ -83,7 +83,6 @@ public: m2::RectD m_pivot; Locales m_categoryLocales; shared_ptr m_hotelsFilter; - bool m_cianMode = false; set m_preferredTypes; shared_ptr m_tracer; }; diff --git a/search/model.cpp b/search/model.cpp index a95fbbae0a..b0c52067cc 100644 --- a/search/model.cpp +++ b/search/model.cpp @@ -76,41 +76,16 @@ public: private: CustomIsBuildingChecker() {} }; - -class IsCianChecker -{ -public: - static IsCianChecker const & Instance() - { - static const IsCianChecker instance; - return instance; - } - - bool operator()(FeatureType const & ft) const - { - feature::TypesHolder th(ft); - return !ft.HasName() && th.Size() == 1 && th.Has(m_type); - } - -private: - IsCianChecker() { m_type = classif().GetTypeByPath({"building"}); } - - uint32_t m_type; -}; } // namespace Model::Type Model::GetType(FeatureType const & feature) const { static auto const & buildingChecker = CustomIsBuildingChecker::Instance(); - static auto const & cianChecker = IsCianChecker::Instance(); static auto const & streetChecker = IsStreetChecker::Instance(); static auto const & localityChecker = IsLocalityChecker::Instance(); static auto const & poiChecker = IsPoiChecker::Instance(); - if (m_cianEnabled && cianChecker(feature)) - return TYPE_BUILDING; - - if (!m_cianEnabled && buildingChecker(feature)) + if (buildingChecker(feature)) return TYPE_BUILDING; if (streetChecker(feature)) diff --git a/search/model.hpp b/search/model.hpp index 97b317a2b3..aab9ba5a1e 100644 --- a/search/model.hpp +++ b/search/model.hpp @@ -54,11 +54,6 @@ public: } Type GetType(FeatureType const & feature) const; - - void SetCianEnabled(bool enabled) { m_cianEnabled = enabled; } - -private: - bool m_cianEnabled = false; }; string DebugPrint(Model::Type type); diff --git a/search/processor.cpp b/search/processor.cpp index f6a457a41b..88c1fd7ec7 100644 --- a/search/processor.cpp +++ b/search/processor.cpp @@ -511,7 +511,6 @@ void Processor::InitGeocoder(Geocoder::Params & geocoderParams, SearchParams con geocoderParams.m_pivot = GetPivotRect(viewportSearch); geocoderParams.m_categoryLocales = GetCategoryLocales(); geocoderParams.m_hotelsFilter = searchParams.m_hotelsFilter; - geocoderParams.m_cianMode = searchParams.m_cianMode; geocoderParams.m_preferredTypes = m_preferredTypes; geocoderParams.m_tracer = searchParams.m_tracer; diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp index 2f9bb09470..f4202e5b50 100644 --- a/search/search_integration_tests/processor_test.cpp +++ b/search/search_integration_tests/processor_test.cpp @@ -1108,44 +1108,6 @@ UNIT_CLASS_TEST(ProcessorTest, TestWeirdTypes) } } -UNIT_CLASS_TEST(ProcessorTest, Cian) -{ - string const countryName = "Wonderland"; - TestCity cianCity(m2::PointD(0, 0), "Cian", "en", 100 /* rank */); - TestBuilding plainBuilding(m2::PointD(0, 0), "Plain building", "1", "en"); - TestBuilding garage(m2::PointD(0.001, 0.001), "Garage", "2", "en"); - garage.AddType({"building", "garage"}); - TestBuilding nonameBuilding(m2::PointD(0.002, 0.002), "", "3", "en"); - - auto worldId = BuildWorld([&](TestMwmBuilder & builder) { builder.Add(cianCity); }); - - auto countryId = BuildCountry(countryName, [&](TestMwmBuilder & builder) { - builder.Add(plainBuilding); - builder.Add(garage); - builder.Add(nonameBuilding); - }); - - SearchParams params; - params.m_query = "cian"; - params.m_inputLocale = "en"; - params.m_viewport = m2::RectD(m2::PointD(-1.0, -1.0), m2::PointD(1.0, 1.0)); - params.m_mode = Mode::Everywhere; - params.m_suggestsEnabled = false; - - params.m_cianMode = false; - { - TRules rules = {ExactMatch(worldId, cianCity), ExactMatch(countryId, plainBuilding), - ExactMatch(countryId, garage), ExactMatch(countryId, nonameBuilding)}; - TEST(ResultsMatch(params, rules), ()); - } - - params.m_cianMode = true; - { - TRules rules = {ExactMatch(countryId, nonameBuilding)}; - TEST(ResultsMatch(params, rules), ()); - } -} - UNIT_CLASS_TEST(ProcessorTest, CityBoundaryLoad) { TestCity city(vector({m2::PointD(0, 0), m2::PointD(0.5, 0), m2::PointD(0.5, 0.5), diff --git a/search/search_params.hpp b/search/search_params.hpp index 393db8d347..e7e7c31573 100644 --- a/search/search_params.hpp +++ b/search/search_params.hpp @@ -59,8 +59,6 @@ struct SearchParams std::shared_ptr m_hotelsFilter; - bool m_cianMode = false; - std::shared_ptr m_tracer; }; diff --git a/search/types_skipper.hpp b/search/types_skipper.hpp index 935423f72c..3a234d1792 100644 --- a/search/types_skipper.hpp +++ b/search/types_skipper.hpp @@ -2,8 +2,6 @@ #include "search/model.hpp" -#include "indexer/ftypes_matcher.hpp" - #include "base/buffer_vector.hpp" namespace search @@ -23,20 +21,6 @@ public: bool IsCountryOrState(feature::TypesHolder const & types) const; private: - class DontSkipIfEmptyName - { - public: - bool IsMatched(uint32_t type) const - { - // This is needed for Cian support. - auto const & buildingChecker = ftypes::IsBuildingChecker::Instance(); - return m_poiChecker.IsMatched(type) || buildingChecker.IsMatched(type); - } - - private: - TwoLevelPOIChecker m_poiChecker; - }; - using TCont = buffer_vector; static bool HasType(TCont const & v, uint32_t t); @@ -47,7 +31,7 @@ private: // m_skipIfEmptyName and m_dontSkipIfEmptyName are used in the case 2 described above. TCont m_skipIfEmptyName[2]; - DontSkipIfEmptyName m_dontSkipIfEmptyName; + TwoLevelPOIChecker m_dontSkipIfEmptyName; uint32_t m_country, m_state; }; diff --git a/xcode/partners_api/partners_api.xcodeproj/project.pbxproj b/xcode/partners_api/partners_api.xcodeproj/project.pbxproj index cad640474a..5d83b003d4 100644 --- a/xcode/partners_api/partners_api.xcodeproj/project.pbxproj +++ b/xcode/partners_api/partners_api.xcodeproj/project.pbxproj @@ -34,9 +34,6 @@ 3D47B29B1F054C89000828D2 /* taxi_countries.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D47B2971F054C89000828D2 /* taxi_countries.cpp */; }; 3D47B29C1F054C89000828D2 /* taxi_countries.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D47B2981F054C89000828D2 /* taxi_countries.hpp */; }; 3D47B29D1F054C89000828D2 /* taxi_places.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D47B2991F054C89000828D2 /* taxi_places.hpp */; }; - 3D47B2AC1F14BE89000828D2 /* cian_api.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D47B2AA1F14BE89000828D2 /* cian_api.cpp */; }; - 3D47B2AD1F14BE89000828D2 /* cian_api.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D47B2AB1F14BE89000828D2 /* cian_api.hpp */; }; - 3D47B2AF1F14BE94000828D2 /* cian_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D47B2AE1F14BE94000828D2 /* cian_tests.cpp */; }; 3D47B2B11F14FA14000828D2 /* utils.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D47B2B01F14FA14000828D2 /* utils.hpp */; }; 3D4E997C1FB439260025B48C /* booking_availability_params.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D4E997A1FB439260025B48C /* booking_availability_params.hpp */; }; 3D4E997D1FB439260025B48C /* booking_availability_params.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D4E997B1FB439260025B48C /* booking_availability_params.cpp */; }; @@ -106,9 +103,6 @@ 3D47B2971F054C89000828D2 /* taxi_countries.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = taxi_countries.cpp; sourceTree = ""; }; 3D47B2981F054C89000828D2 /* taxi_countries.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = taxi_countries.hpp; sourceTree = ""; }; 3D47B2991F054C89000828D2 /* taxi_places.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = taxi_places.hpp; sourceTree = ""; }; - 3D47B2AA1F14BE89000828D2 /* cian_api.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cian_api.cpp; sourceTree = ""; }; - 3D47B2AB1F14BE89000828D2 /* cian_api.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cian_api.hpp; sourceTree = ""; }; - 3D47B2AE1F14BE94000828D2 /* cian_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cian_tests.cpp; sourceTree = ""; }; 3D47B2B01F14FA14000828D2 /* utils.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = utils.hpp; sourceTree = ""; }; 3D4E997A1FB439260025B48C /* booking_availability_params.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = booking_availability_params.hpp; sourceTree = ""; }; 3D4E997B1FB439260025B48C /* booking_availability_params.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = booking_availability_params.cpp; sourceTree = ""; }; @@ -214,8 +208,6 @@ BB1956E41F543D7B003ECE6C /* locals_api.cpp */, BB1956E51F543D7C003ECE6C /* locals_api.hpp */, 3D47B2B01F14FA14000828D2 /* utils.hpp */, - 3D47B2AA1F14BE89000828D2 /* cian_api.cpp */, - 3D47B2AB1F14BE89000828D2 /* cian_api.hpp */, 3D47B2961F054C89000828D2 /* taxi_base.cpp */, 3D47B2971F054C89000828D2 /* taxi_countries.cpp */, 3D47B2981F054C89000828D2 /* taxi_countries.hpp */, @@ -256,7 +248,6 @@ isa = PBXGroup; children = ( 3D7815751F3A14910068B6AC /* async_gui_thread.hpp */, - 3D47B2AE1F14BE94000828D2 /* cian_tests.cpp */, 3D47B2801F00F94D000828D2 /* mopub_tests.cpp */, 3DFEBF871EF82C1300317D5C /* viator_tests.cpp */, 3DFEBFA01EFBFC2300317D5C /* taxi_engine_tests.cpp */, @@ -322,7 +313,6 @@ 3DFEBF861EF82BEA00317D5C /* viator_api.hpp in Headers */, 346E889C1E9D087400D4CE9B /* rb_ads.hpp in Headers */, 3DFEBF9A1EFBFC1500317D5C /* taxi_base.hpp in Headers */, - 3D47B2AD1F14BE89000828D2 /* cian_api.hpp in Headers */, 346E889A1E9D087400D4CE9B /* banner.hpp in Headers */, 3DFEBF9F1EFBFC1500317D5C /* yandex_api.hpp in Headers */, 3DFEBF9D1EFBFC1500317D5C /* taxi_provider.hpp in Headers */, @@ -438,7 +428,6 @@ 3DFEBF9B1EFBFC1500317D5C /* taxi_engine.cpp in Sources */, 346E889B1E9D087400D4CE9B /* rb_ads.cpp in Sources */, 3DBC1C541E4B14920016897F /* facebook_ads.cpp in Sources */, - 3D47B2AF1F14BE94000828D2 /* cian_tests.cpp in Sources */, 3D452AF31EE6D20D009EAB9B /* google_ads.cpp in Sources */, 346E88981E9D087400D4CE9B /* ads_engine.cpp in Sources */, 3D47B29B1F054C89000828D2 /* taxi_countries.cpp in Sources */, @@ -448,7 +437,6 @@ F6B536401DA520E40067EEA5 /* booking_api.cpp in Sources */, 3D47B29A1F054C89000828D2 /* taxi_base.cpp in Sources */, 3DFEBF9E1EFBFC1500317D5C /* yandex_api.cpp in Sources */, - 3D47B2AC1F14BE89000828D2 /* cian_api.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };