commons-app / apps-android-commons

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons
https://commons-app.github.io/
Apache License 2.0
1.03k stars 1.24k forks source link

Bookmark Wikidata item #3700

Closed nicolas-raoul closed 2 years ago

nicolas-raoul commented 4 years ago

Currently, only pictures and locations can be bookmarked. It would be useful if Wikidata items could be bookmarked too. For instance if every month I go to the harbour and takes pictures of all kinds of warships, it would be useful to have a bookmark on item warship so that I can easily access it and browse its subclasses to find the best items each of my pictures depict.

neslihanturan commented 4 years ago

thanks @nicolas-raoul , Is this one different from #1499 ?

nicolas-raoul commented 4 years ago

It is similar, but for now we can only bookmark Wikidata items that have a geolocation. Most Wikidata items do not have a geolocation.

Ayan-10 commented 3 years ago

@nicolas-raoul So you are expecting a new tab on Favorites where users can see their bookmarked Wikidata. And also able to bookmark the items? Am I right?

nicolas-raoul commented 3 years ago

Yes, thanks! Mocks in red:

Place to create a new Item bookmark, in any item at Explore>Search>Items: adb

Place to show Item bookmarks: adb

Ayan-10 commented 3 years ago

@nicolas-raoul I am almost done with implementation. But I got stuck a little. I am getting a build failiure with this error. Here it says that. BookmarkItemsController cannot be provided without an @Inject constructor or an @Provides-annotated method. This type supports members injection but cannot be implicitly provided. But I in BookmarkItemsController I implemented @Inject constructor. But app does not recognize it. Also, I found out that in the sidebar of the BookmarkItemsController there is no inject icon. So I think injection does not happen there. Not only these class Dao class also behaving same.

2021-07-19_LI

I tried to fix it by looking at other similar classes. But still, It's not happening. I am not much familiar with dependency injection. So can you please help me with this? I am not getting where am I doing wrong.

Thanks.

Error

e: C:\Users\Ayan\Desktop\apps-android-commons\app\src\main\java\fr\free\nrw\commons\di\CommonsApplicationComponent.java:48: error: [Dagger/MissingBinding] fr.free.nrw.commons.bookmarks.items.BookmarkItemsController cannot be provided without an @Inject constructor or an @Provides-annotated method. This type supports members injection but cannot be implicitly provided.
public interface CommonsApplicationComponent extends AndroidInjector<ApplicationlessInjection> {
       ^
      fr.free.nrw.commons.bookmarks.items.BookmarkItemsController is injected at
          fr.free.nrw.commons.bookmarks.items.BookmarkItemsFragment.controller
      fr.free.nrw.commons.bookmarks.items.BookmarkItemsFragment is injected at
          dagger.android.AndroidInjector.inject(T) [fr.free.nrw.commons.di.CommonsApplicationComponent ? fr.free.nrw.commons.di.FragmentBuilderModule_BindBookmarkItemListFragment.BookmarkItemsFragmentSubcomponent]
nicolas-raoul commented 3 years ago

Have you fully compared with how bookmarked locations are implemented?

Ayan-10 commented 3 years ago

@nicolas-raoul Yes, I fully compared with BookmarkLocations and BookmarkPictures. But it's not working.

On Mon, 19 Jul 2021, 1:42 p.m. Nicolas Raoul, @.***> wrote:

Have you fully compared with how bookmarked locations are implemented?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/commons-app/apps-android-commons/issues/3700#issuecomment-882341329, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ7HSBLNNXOMXYB7KPB64PDTYPM5LANCNFSM4MOZADYA .

Ayan-10 commented 3 years ago

@nicolas-raoul Should I make PR? So that you can check where is the problem. I am done with the implementation. But because of that build failure, I can't test it. And also, again I rechecked the classes there is no difference between BookmarkLocations and BookmarkPictures still it's failing.

nicolas-raoul commented 3 years ago

You can create a PR and put [WIP] in the title. Thanks!

Ayan-10 commented 3 years ago

@nicolas-raoul I build the whole functionality with Kotlin. Now I recreated the same thing with java and those inject icons are coming in the sidebar so I think injection is happening. Can you tell me is there any problem to do injection in Kotlin classes?

Ayan-10 commented 3 years ago

@nicolas-raoul Can you please put your thoughts on the above comment so that I can proceed further?

Thanks.

nicolas-raoul commented 3 years ago

Hi Ayan, Apologies I unfortunately won't have time to go through the code any time soon as I am super-busy on mentoring and on other projects, but I hope some other volunteer or passer-by will be able to help!

Ayan-10 commented 3 years ago

@nicolas-raoul I solved all of the issues. The PR is ready for review. Please review it at your convenience.

Thanks for giving the response and time.