Skip to content

Nearby tab accessible without GPS #4771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 5, 2022

Conversation

Ayan-10
Copy link
Contributor

@Ayan-10 Ayan-10 commented Jan 27, 2022

Description (required)

Fixes #3732(comment)

What changes did you make and why?

Made Nearby tab accessible without GPS.

  • Now nearby will show tower bridge by default.
  • Search area button is also available
  • location pins are also visible.

Tests performed (required)

Tested latest master ProdDebug on Realme GT master with API level 30.

@codecov
Copy link

codecov bot commented Jan 27, 2022

Codecov Report

Merging #4771 (a85897c) into master (587ff3b) will decrease coverage by 0.02%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #4771      +/-   ##
============================================
- Coverage     42.17%   42.15%   -0.03%     
+ Complexity     1888     1886       -2     
============================================
  Files           364      364              
  Lines         15735    15783      +48     
  Branches       1361     1367       +6     
============================================
+ Hits           6637     6654      +17     
- Misses         8610     8637      +27     
- Partials        488      492       +4     
Impacted Files Coverage Δ
...commons/nearby/fragments/NearbyParentFragment.java 4.00% <66.66%> (+2.91%) ⬆️
...in/java/fr/free/nrw/commons/data/DBOpenHelper.java 0.00% <0.00%> (-40.91%) ⬇️
.../nrw/commons/category/CategoryContentProvider.java 10.71% <0.00%> (-16.08%) ⬇️
...w/commons/upload/categories/BaseDelegateAdapter.kt 35.29% <0.00%> (-11.77%) ⬇️
...upload/mediaDetails/UploadMediaDetailFragment.java 72.05% <0.00%> (-4.03%) ⬇️
...mons/upload/mediaDetails/UploadMediaPresenter.java 44.29% <0.00%> (-3.80%) ⬇️
...va/fr/free/nrw/commons/category/CategoriesModel.kt 47.05% <0.00%> (-1.97%) ⬇️
.../free/nrw/commons/repository/UploadRepository.java 22.41% <0.00%> (-1.73%) ⬇️
...ns/upload/categories/UploadCategoriesFragment.java 86.95% <0.00%> (-1.45%) ⬇️
...commons/LocationPicker/LocationPickerActivity.java 0.00% <0.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 587ff3b...a85897c. Read the comment docs.

@madhurgupta10
Copy link
Collaborator

@Ayan-10 could you add tests for the new lines? Also please rebase to the latest master, we have updated the CI for faster builds

@Ayan-10
Copy link
Contributor Author

Ayan-10 commented Feb 3, 2022

@madhurgupta10 There is no test class for NearbyParentFragment in the code. So I created the test class and added tests for newly added lines in this PR.


@Test
@Throws(Exception::class)
fun `Start map without gps test when last location known`() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ayan-10 can you also add mock verification for all mocked objects to both of your tests, for example

verify(mapView).onStart()

you can also check for number of calls like

verify(mapView, times(1)).onStart()

@Ayan-10 Ayan-10 requested a review from madhurgupta10 February 4, 2022 13:49
Copy link
Collaborator

@madhurgupta10 madhurgupta10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit test changes look good to me :)

* Starts the map without GPS
* By default it points to 51.50550,-0.07520 this coordinates
*/
private void startMapWithoutGPS() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two methods look very similar, To avoid repetition, I think it is better to combine them into a single method and pass the appropriate arguments.

image

@Ayan-10 Ayan-10 requested a review from madhurgupta10 February 5, 2022 15:06
@madhurgupta10 madhurgupta10 merged commit 0e47553 into commons-app:master Feb 5, 2022
@madhurgupta10
Copy link
Collaborator

@Ayan-10 Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nearby Tab Accessible Without Location Permission
2 participants