Open mrudultora opened 3 years ago
@nicolas-raoul @misaochan Your views?
Sometimes I open the webpage on purpose, for instance because I want to add a talk page comment or use another feature not available yet in the app. But I guess most users do not do that.
I think that's an interesting enhancement to experiment with.
@nicolas-raoul You added the enhancement label, so I will wait for 5 PRs to get merged. Then, I will start working on it. Thanks !
Hi @mrudultora , interesting suggestion. Before you start working on this (after 5 PRs), could you elaborate on how you plan to implement this?
@misaochan I just figured it out, but I am really confused. We are working with indices (position of item) everywhere. Like when we are in ExploreListRootFragment then on clicking a image, it's position is transferred to MediaDetailPagerFragment. But, when the URL is clicked I just have the name/title of the file. If this is the case, I guess this cannot be done. We must have something unique in the url other than just name ;-)
For example, let's take the example of youtube. All the shared urls contains the unique video id which is used during the GET request. So, the video id can be taken from the url by using if (intent.getData != null)
but in ours case, I just have file name.
I just checked and probably we don't make GET request with file name.
If I am wrong somewhere, please guide me. Thanks !
@mrudultora I am sure MediaDetailPagerFragment is given more than a position, it must be given an identifier. You can use the Wikimedia API to get such an identifier from a filename.
@nicolas-raoul I will try to look ;-) Btw, would you please give me some more info 😅.
Sure :-)
I think you need to implement your own MediaDetailPagerFragment.MediaDetailProvider
where getTotalMediaCount()
returns 1
and getMediaAtPosition(0)
returns a Media
which you can fill using your URL and possibly other fields retrieved using the Commons API.
There are several implementations that you can look at for inspiration, for instance app/src/main/java/fr/free/nrw/commons/category/CategoryDetailsActivity.java
.
@nicolas-raoul I tried using https://commons.wikimedia.beta.wmflabs.org/w/api.php?action=wbgetentities&props=labels&format=json&languagefallback=1&sites=commonswiki this api as it takes languages and file name as parameter, and checked the response in Postman. It gives status as ok but output is not appropriate. Also, checked some other combinations but the output is not as expected. I am adding the output as received from GET request.
{ "entities": { "-1": { "site": "commonswiki", "title": "File talk:Paul Cézanne - The Pigeon Tower at Bellevue - 1936.19 - Cleveland Museum of Art", "missing": "" } }, "success": 1 }
Summary:
When we share url of a image and then try to click on that url, the browser opens with that link. But, if the user is having app installed we should open that particular image in app as first choice rather than in browser. Many apps nowadays has such feature.
Would you like to work on the issue? Yes, I would like to implement this feature.