Closed rajasone closed 5 years ago
Hi, could you please resolve the merge issues - you know best about your changes 😉 Thanks!
I change the whole logic, since with the previous logic there was a flaw. The last date was taken from the latest news in the database. First the value was always updates, since the Fragment was subscribed via a LiveData to it. So: latestNewsDate -> update -> latestNewsDate gets also updated and loses its old state.
What we actually need to know is, when the last update from the server was done AND also not by the Work Manager Task. We have a value called lastAutomaticNewsUpdateLocalDate
in the Share Preferences which holds this information. So I know get it at the beginning and use it in the Adapter.
Please review my changes, I didn't really test it with real data yet...
@spipau I think there is something missing because it is not showing badge at all (please don't get me wrong I felt I am really pushing you on this issue sorry :smile:) I think there are few use cases for this feature,
I think passing the Date of most recent news is not enough for our need because passing Date to constructor will only help if News are getting download on startup by default, let's say user have the old list of news and user press the refresh button to update list, we are not updating recyclerview mostRecentNewsPublishDateTime
field which cause a problem while identifying new news.
I see, I think we have a complete different vision of the feature 😄 - that's why we always talk in two different directions... (and it's very good that you push this here, thanks for that!)
So here is my understanding on how it should work: The user has a list of news in the database. Two scenarios:
Regarding:
User open app for the first time and there is no news exist(all news should show badge)
I thought that too at the beginning and I almost implemented it. But then I decided not to, because we would mark "old" news as new. Check some of the dates more down the list, they are not new at all. And that's why I would not show the NEW badge on the first download.
@spipau thanks for the explanation , I think we both are agree with the first 2 use cases of this feature, I have a bit different definition/understanding of the New
and may be I am completely wrong just want to share my thought :smile: My understanding regarding New
is let's say I was in Vienna and my parents renovate
my room and placed new furniture, LED, Playstation etc.
and when I came back home I saw those things for the first time
so, all these things which I saw for the first time they were new to me even though they were placed there an year ago
. In that perspective I think we should show badge to all news when user download them for the very first time. For user all of the news are new because user is going to view them for the first time even though few news are year old.
Please excuse my lame example I showed off many things :rofl: and please let me know what you think.
@rajasone haha, I like your example and it's not lame at all 😄 I understand what you mean, but I don't think that this edge case is so important that we extra put in some logic to show at the first app start a the NEW badge. I scanned quickly through the code and couldn't find a quick and nice solution. If this is important to you and you find a good and simple solution, then please feel free to implement this extra feature. If not, then I can live with the fact, that the user sees this one time not the NEW badge 😉
@spipau sounds good to me, we may ignore this edge case for now, thanks for your explanation :smile: