[ios][android] place page reopening on map downloading is fixed for ios + compability changes for android.

This commit is contained in:
Arsentiy Milchakov 2019-08-27 14:31:46 +03:00 committed by Aleksey Belousov
parent 519f0205b2
commit 512354750b
7 changed files with 30 additions and 9 deletions

View file

@ -1017,19 +1017,20 @@ Java_com_mapswithme_maps_Framework_nativeSetMapObjectListener(JNIEnv * env, jcla
"(Lcom/mapswithme/maps/bookmarks/data/MapObject;)V");
// void onDismiss(boolean switchFullScreenMode);
jmethodID const dismissId = jni::GetMethodID(env, g_mapObjectListener, "onDismiss", "(Z)V");
frm()->SetPlacePageListenners([activatedId](place_page::Info const & info)
auto const fillPlacePage = [activatedId](place_page::Info const & info)
{
JNIEnv * env = jni::GetEnv();
g_framework->SetPlacePageInfo(info);
jni::TScopedLocalRef mapObject(env, usermark_helper::CreateMapObject(env, info));
env->CallVoidMethod(g_mapObjectListener, activatedId, mapObject.get());
}, [dismissId](bool switchFullScreenMode)
};
auto const closePlacePage = [dismissId](bool switchFullScreenMode)
{
JNIEnv * env = jni::GetEnv();
g_framework->SetPlacePageInfo({});
env->CallVoidMethod(g_mapObjectListener, dismissId, switchFullScreenMode);
},
{} /* onUpdate */);
};
frm()->SetPlacePageListenners(fillPlacePage, closePlacePage, fillPlacePage);
}
JNIEXPORT void JNICALL

View file

@ -44,6 +44,7 @@ class Info;
- (void)dismissPlacePage;
- (void)showPlacePage:(place_page::Info const &)info;
- (void)updatePlacePage:(place_page::Info const &)info;
- (void)showPlacePageReview:(place_page::Info const &)info;
- (void)addPlace:(BOOL)isBusiness hasPoint:(BOOL)hasPoint point:(m2::PointD const &)point;

View file

@ -130,6 +130,10 @@ extern NSString * const kAlohalyticsTapEventKey;
});
}
- (void)updatePlacePage:(place_page::Info const &)info {
[self.placePageManager update:info];
}
- (void)showPlacePageReview:(place_page::Info const &)info
{
network_policy::CallPartnersApi([self, info](auto const & /* canUseNetwork */) {

View file

@ -136,6 +136,10 @@ NSString * const kHotelFacilitiesSegue = @"Map2FacilitiesSegue";
[self.controlsManager showPlacePage:info];
}
- (void)onMapObjectUpdated:(place_page::Info const &)info {
[self.controlsManager updatePlacePage:info];
}
- (void)checkMaskedPointer:(UITouch *)touch withEvent:(df::TouchEvent &)e
{
int64_t id = reinterpret_cast<int64_t>(touch);
@ -392,10 +396,9 @@ NSString * const kHotelFacilitiesSegue = @"Map2FacilitiesSegue";
self.listeners = [NSHashTable<id<MWMLocationModeListener>> weakObjectsHashTable];
Framework & f = GetFramework();
// TODO: Review and improve this code.
f.SetPlacePageListenners(
[self](place_page::Info const & info) { [self onMapObjectSelected:info]; },
[self](bool switchFullScreen) { [self onMapObjectDeselected:switchFullScreen]; },
{} /* onUpdate */);
f.SetPlacePageListenners([self](place_page::Info const &info) { [self onMapObjectSelected:info]; },
[self](bool switchFullScreen) { [self onMapObjectDeselected:switchFullScreen]; },
[self](place_page::Info const &info) { [self onMapObjectUpdated:info]; });
// TODO: Review and improve this code.
f.SetMyPositionModeListener([self](location::EMyPositionMode mode, bool routingActive) {
// TODO: Two global listeners are subscribed to the same event from the core.

View file

@ -129,6 +129,16 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type, place_page:
[self processCountryEvent:[self.data countryId]];
}
- (void)update:(place_page::Info const &)info {
if (!self.layout || !self.data)
return;
self.data = [[MWMPlacePageData alloc] initWithPlacePageInfo:info];
[self.data fillSections];
[self setupSpeedAndDistance];
[self.layout checkCellsVisible];
}
- (BOOL)isPPShown {
return self.data != nil;
}

View file

@ -50,6 +50,7 @@ struct HotelFacility;
@protocol MWMPlacePageProtocol<MWMActionBarProtocol, MWMPlacePageButtonsProtocol, MWMFeatureHolder, MWMBookingInfoHolder>
- (void)show:(place_page::Info const &)info;
- (void)update:(place_page::Info const &)info;
- (void)showReview:(place_page::Info const &)info;
- (BOOL)isPPShown;
- (void)dismiss;

View file

@ -2456,7 +2456,8 @@ void Framework::UpdatePlacePageInfoForCurrentSelection()
SetPlacePageLocation(info);
ActivateMapSelection(false, obj, info);
if (m_onPlacePageUpdate)
m_onPlacePageUpdate(info);
}
void Framework::InvalidateUserMarks()