diff --git a/android/jni/com/mapswithme/maps/promo/Promo.cpp b/android/jni/com/mapswithme/maps/promo/Promo.cpp index 2a9332922c..c91705f4d8 100644 --- a/android/jni/com/mapswithme/maps/promo/Promo.cpp +++ b/android/jni/com/mapswithme/maps/promo/Promo.cpp @@ -39,7 +39,7 @@ void PrepareClassRefs(JNIEnv * env) g_galleryConstructor = jni::GetConstructorID(env, g_galleryClass, "([Lcom/mapswithme/maps/promo/PromoCityGallery$Item;" - "Ljava/lang/String;)V"); + "Ljava/lang/String;Ljava/lang/String;)V"); g_itemClass = jni::GetGlobalClassRef(env, "com/mapswithme/maps/promo/PromoCityGallery$Item"); g_itemConstructor = jni::GetConstructorID(env, g_itemClass, @@ -136,8 +136,10 @@ jobject MakeCityGallery(JNIEnv * env, promo::CityGallery const & gallery) jni::TScopedLocalObjectArrayRef items(env, jni::ToJavaArray(env, g_itemClass, gallery.m_items, itemBuilder)); jni::TScopedLocalRef moreUrl(env, jni::ToJavaString(env, gallery.m_moreUrl)); + jni::TScopedLocalRef category(env, jni::ToJavaString(env, gallery.m_category)); - return env->NewObject(g_galleryClass, g_galleryConstructor, items.get(), moreUrl.get()); + return env->NewObject(g_galleryClass, g_galleryConstructor, items.get(), moreUrl.get(), + category.get()); } } diff --git a/android/src/com/mapswithme/maps/promo/PromoCityGallery.java b/android/src/com/mapswithme/maps/promo/PromoCityGallery.java index 7b5403bcd3..e20d84d522 100644 --- a/android/src/com/mapswithme/maps/promo/PromoCityGallery.java +++ b/android/src/com/mapswithme/maps/promo/PromoCityGallery.java @@ -11,11 +11,14 @@ public final class PromoCityGallery private final Item[] mItems; @NonNull private final String mMoreUrl; + @NonNull + private final String mCategory; - PromoCityGallery(@NonNull Item[] items, @NonNull String moreUrl) + PromoCityGallery(@NonNull Item[] items, @NonNull String moreUrl, @NonNull String category) { mItems = items; mMoreUrl = moreUrl; + mCategory = category; } @NonNull @@ -30,6 +33,12 @@ public final class PromoCityGallery return mMoreUrl; } + @NonNull + public String getCategory() + { + return mCategory; + } + public static final class Item { @NonNull diff --git a/partners_api/promo_api.cpp b/partners_api/promo_api.cpp index 9bd036d979..351d5b0239 100644 --- a/partners_api/promo_api.cpp +++ b/partners_api/promo_api.cpp @@ -87,11 +87,9 @@ void ParseCityGallery(std::string const & src, UTM utm, promo::CityGallery & res } auto const meta = json_object_get(root.get(), "meta"); - // Workaround, should be changed to optional field when server will be done. - auto const more = json_object_get(meta, "more"); - if (json_is_string(more)) - FromJSON(more, result.m_moreUrl); + FromJSONObjectOptionalField(meta, "more", result.m_moreUrl); result.m_moreUrl = InjectUTM(url::Join(BOOKMARKS_CATALOG_FRONT_URL, result.m_moreUrl), utm); + FromJSONObjectOptionalField(meta, "category", result.m_category); } std::string ToSignedId(std::string const & id) diff --git a/partners_api/promo_api.hpp b/partners_api/promo_api.hpp index c7e1683ba4..cfb82d2d6f 100644 --- a/partners_api/promo_api.hpp +++ b/partners_api/promo_api.hpp @@ -54,6 +54,7 @@ struct CityGallery } std::string m_moreUrl; + std::string m_category; std::vector m_items; };