Nearby: Fix race condition and lag when loading pin details, faster overlay management (#6047)

* temporary fixes part one

* temporary fixes part two

* temporary fixes part three

* temporary fixes part four

* temporary fixes part five

* reformatting

* remove code no longer in use

* Migrate NearbyParentFragmentPresenter to Kotlin

* Partially replace temporary experimental fixes

* Replace temporary experimental fixes part 2

* Replace temporary experimental fixes part 3

* Replace temporary fixes completely

* Fix caching and loading places in Nearby list

* Add place bookmarking logic, Remove all old code

* Nearby Presenter: Close channel properly

* Nearby pins now load starting from the center

Fixes #6049

* Add comments and javadoc for Nearby Presenter

* Fix warnings, Fix formatting, Add javadoc

* Pass unit tests
This commit is contained in:
Tanmay Gupta 2024-12-20 18:00:53 +05:30 committed by GitHub
parent 70b4f78a5d
commit c891c2b0df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 676 additions and 679 deletions

View file

@ -31,6 +31,12 @@ class NearbyParentFragmentPresenterTest {
@Mock
internal lateinit var bookmarkLocationsDao: BookmarkLocationsDao
@Mock
internal lateinit var placesRepository: PlacesRepository
@Mock
internal lateinit var nearbyController: NearbyController
@Mock
internal lateinit var latestLocation: LatLng
@ -52,7 +58,8 @@ class NearbyParentFragmentPresenterTest {
@Throws(Exception::class)
fun setUp() {
MockitoAnnotations.openMocks(this)
nearbyPresenter = NearbyParentFragmentPresenter(bookmarkLocationsDao)
nearbyPresenter =
NearbyParentFragmentPresenter(bookmarkLocationsDao, placesRepository, nearbyController)
nearbyPresenter.attachView(nearbyParentFragmentView)
}
@ -322,7 +329,7 @@ class NearbyParentFragmentPresenterTest {
@Test
fun testSetActionListeners() {
nearbyPresenter.setActionListeners(any())
nearbyPresenter.setActionListeners(null)
verify(nearbyParentFragmentView).setFABPlusAction(any())
verify(nearbyParentFragmentView).setFABRecenterAction(any())
}
@ -454,11 +461,11 @@ class NearbyParentFragmentPresenterTest {
nearbyPlacesInfo.boundaryCoordinates = arrayOf()
nearbyPlacesInfo.currentLatLng = latestLocation
nearbyPlacesInfo.searchLatLng = latestLocation
nearbyPlacesInfo.placeList = null
nearbyPlacesInfo.placeList = emptyList<Place>()
whenever(bookmarkLocationsDao.allBookmarksLocations).thenReturn(Collections.emptyList())
nearbyPresenter.updateMapMarkers(nearbyPlacesInfo.placeList, latestLocation, true)
Mockito.verify(nearbyParentFragmentView).updateMapMarkers(any())
nearbyPresenter.updateMapMarkers(nearbyPlacesInfo.placeList, latestLocation, null)
Mockito.verify(nearbyParentFragmentView).setFilterState()
Mockito.verify(nearbyParentFragmentView).setProgressBarVisibility(false)
Mockito.verify(nearbyParentFragmentView).updateListFragment(nearbyPlacesInfo.placeList)
}