Skip to content

OkHttpJsonApi#getMediaList migrated to retrofit #3054

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

Conversation

ilgazer
Copy link
Contributor

@ilgazer ilgazer commented Jul 5, 2019

This PR migrates OkHttpJsonApi#getMediaList to 2 different functions, MediaClient#getMediaListFromSearch and MEdiaClient#getMediaListFromCategory.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ A review job has been created and sent to the PullRequest network.


@ilgazer you can click here to see the review status or cancel the code review job.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

1 Message
The description of this pull request is blank. Adding a high-level summary will help our reviewers provide better feedback.

Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

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

Could you please add tests to make sure this change works as expected?

@codecov-io
Copy link

codecov-io commented Jul 5, 2019

Codecov Report

Merging #3054 into backend-overhaul will increase coverage by 0.23%.
The diff coverage is 43.47%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           backend-overhaul   #3054      +/-   ##
===================================================
+ Coverage              4.71%   4.94%   +0.23%     
===================================================
  Files                   261     260       -1     
  Lines                 12195   12153      -42     
  Branches               1043    1038       -5     
===================================================
+ Hits                    575     601      +26     
+ Misses                11581   11507      -74     
- Partials                 39      45       +6
Impacted Files Coverage Δ
...fr/free/nrw/commons/mwapi/OkHttpJsonApiClient.java 0% <ø> (-1.06%) ⬇️
.../java/fr/free/nrw/commons/di/NetworkingModule.java 0% <ø> (ø) ⬆️
...w/commons/category/CategoryImagesListFragment.java 0% <0%> (ø) ⬆️
...rw/commons/explore/images/SearchImageFragment.java 0% <0%> (ø) ⬆️
...in/java/fr/free/nrw/commons/media/MediaClient.java 72.41% <55.55%> (-27.59%) ⬇️
app/src/main/java/fr/free/nrw/commons/Media.java 17.94% <0%> (+11.53%) ⬆️

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 52284b8...b2d0b10. Read the comment docs.

Copy link
Member

@maskaravivek maskaravivek left a comment

Choose a reason for hiding this comment

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

The PR looks great. Thanks for helping us with the migration. :)

@@ -25,6 +25,6 @@ public CategoryImageController(OkHttpJsonApiClient okHttpJsonApiClient) {
* @return
*/
public Single<List<Media>> getCategoryImages(String categoryName) {
return okHttpJsonApiClient.getMediaList("category", categoryName);
return null;// okHttpJsonApiClient.getMediaList("category", categoryName);
Copy link
Member

Choose a reason for hiding this comment

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

@ilgazer Can you update this. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :)

@ilgazer
Copy link
Contributor Author

ilgazer commented Jul 6, 2019 via email

Copy link
Member

@maskaravivek maskaravivek left a comment

Choose a reason for hiding this comment

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

Works perfectly for me. There's just 1 issue.

  • search for something for eg, "mango"
  • search the categories tab
  • select a category from this tab
  • media is not found.

The issue is that the category passed is not suffixed with "Category:".

But i believe the issue is not related to this PR. So we can fix it separately.

@maskaravivek maskaravivek merged commit 91cfc7b into commons-app:backend-overhaul Jul 6, 2019
maskaravivek pushed a commit to maskaravivek/apps-android-commons that referenced this pull request Jul 6, 2019
* Migrated OkHttpJsonApi#getMediaList partially to MediaClient#getCategoryImages

* Migrated rest of OkHttpJsonApi#getMediaList functionality to MediaClient#getCategoryImages

* Removed unused code and tests

* Fixed small bug

* Added tests

* Removed unused CategoryImageController
@ilgazer
Copy link
Contributor Author

ilgazer commented Jul 6, 2019

The issue is that the category passed is not suffixed with "Category:".

Maybe we should set a standart on whether we should pass around page names with namespace or not throughout the app.

@ilgazer ilgazer deleted the backend-overhaul-retrofit-media branch July 6, 2019 15:05
maskaravivek pushed a commit to maskaravivek/apps-android-commons that referenced this pull request Jul 7, 2019
* Migrated OkHttpJsonApi#getMediaList partially to MediaClient#getCategoryImages

* Migrated rest of OkHttpJsonApi#getMediaList functionality to MediaClient#getCategoryImages

* Removed unused code and tests

* Fixed small bug

* Added tests

* Removed unused CategoryImageController
maskaravivek pushed a commit to maskaravivek/apps-android-commons that referenced this pull request Jul 7, 2019
* Migrated OkHttpJsonApi#getMediaList partially to MediaClient#getCategoryImages

* Migrated rest of OkHttpJsonApi#getMediaList functionality to MediaClient#getCategoryImages

* Removed unused code and tests

* Fixed small bug

* Added tests

* Removed unused CategoryImageController
maskaravivek pushed a commit to maskaravivek/apps-android-commons that referenced this pull request Jul 10, 2019
* Migrated OkHttpJsonApi#getMediaList partially to MediaClient#getCategoryImages

* Migrated rest of OkHttpJsonApi#getMediaList functionality to MediaClient#getCategoryImages

* Removed unused code and tests

* Fixed small bug

* Added tests

* Removed unused CategoryImageController
maskaravivek pushed a commit that referenced this pull request Jul 15, 2019
…Client (#3056)

* With media client APIs migrated to retrofit (#2998)

* With media client APIs migrated to retrofit

* Add test cases and java docs

* Fix test

* Fix build

* Fix build and other minor issues

* Fix tests

* Categories related client API's migrated to retrofit (#3053)

* Commit 1

* searchCategories migrated to retrofit

* SearchCategoriesFragment migrated to new API

* Removed unused code

* Created tests

* implemented searching by prefix
fixed SearchCategoryFragment behaviour where the same categories would be added to the list instead of new ones.

* added tests

* Migrated searchTitles to searchCategories, function behaviour seems identical

* With media client APIs migrated to retrofit (#2998)

* With media client APIs migrated to retrofit

* Add test cases and java docs

* Fix test

* Fix build

* Fix build and other minor issues

* Fix tests

* Categories related client API's migrated to retrofit (#3053)

* Commit 1

* searchCategories migrated to retrofit

* SearchCategoriesFragment migrated to new API

* Removed unused code

* Created tests

* implemented searching by prefix
fixed SearchCategoryFragment behaviour where the same categories would be added to the list instead of new ones.

* added tests

* Migrated searchTitles to searchCategories, function behaviour seems identical

* OkHttpJsonApi#getMediaList migrated to retrofit (#3054)

* Migrated OkHttpJsonApi#getMediaList partially to MediaClient#getCategoryImages

* Migrated rest of OkHttpJsonApi#getMediaList functionality to MediaClient#getCategoryImages

* Removed unused code and tests

* Fixed small bug

* Added tests

* Removed unused CategoryImageController

* getSubCategoryList and getParentCategoryList migrated to retrofit (#3055)

* Migrated getSubCategoryList to retrofit

* Migrated getParentCategoryList to retrofit

* Removed obsolete functions

* Added tests

* Fixed small bugs

* Migrated OkHttpJsonApiClient#getMedia and getPictureOfTheDay to MediaClient

* Removed obsolete functions and added tests

* Fixed merge errors

* With media client APIs migrated to retrofit (#2998)

* With media client APIs migrated to retrofit

* Add test cases and java docs

* Fix test

* Fix build

* Fix build and other minor issues

* Fix tests

* Categories related client API's migrated to retrofit (#3053)

* Commit 1

* searchCategories migrated to retrofit

* SearchCategoriesFragment migrated to new API

* Removed unused code

* Created tests

* implemented searching by prefix
fixed SearchCategoryFragment behaviour where the same categories would be added to the list instead of new ones.

* added tests

* Migrated searchTitles to searchCategories, function behaviour seems identical

* OkHttpJsonApi#getMediaList migrated to retrofit (#3054)

* Migrated OkHttpJsonApi#getMediaList partially to MediaClient#getCategoryImages

* Migrated rest of OkHttpJsonApi#getMediaList functionality to MediaClient#getCategoryImages

* Removed unused code and tests

* Fixed small bug

* Added tests

* Removed unused CategoryImageController

* getSubCategoryList and getParentCategoryList migrated to retrofit (#3055)

* Migrated getSubCategoryList to retrofit

* Migrated getParentCategoryList to retrofit

* Removed obsolete functions

* Added tests

* Fixed small bugs

* Consume login client from data client library (#2894)

Fix actions for review client

Use data client library for notifications

With delete helper migrated to data client

With wikidata edits

With notifications and modifications migrated to data client

With upload migrated to retrofit

Delete unused code

Reuse thank interface from the library
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.

3 participants