mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Save latest time user notification activity viewed
This commit is contained in:
parent
714b22b733
commit
a2be516bc5
3 changed files with 7 additions and 4 deletions
|
|
@ -16,6 +16,7 @@ import android.widget.RelativeLayout;
|
||||||
|
|
||||||
import com.pedrogomez.renderers.RVRendererAdapter;
|
import com.pedrogomez.renderers.RVRendererAdapter;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -87,6 +88,11 @@ public class NotificationActivity extends NavigationBaseActivity {
|
||||||
private void addNotifications() {
|
private void addNotifications() {
|
||||||
Timber.d("Add notifications");
|
Timber.d("Add notifications");
|
||||||
|
|
||||||
|
// Store when add notification is called last
|
||||||
|
long currentDate = Calendar.getInstance().getTime().getTime();
|
||||||
|
getSharedPreferences("prefs", MODE_PRIVATE).edit().putLong("last_read_notification_date", currentDate).apply();
|
||||||
|
Timber.d("Set last notification read date to current date:"+ currentDate);
|
||||||
|
|
||||||
if(mNotificationWorkerFragment == null){
|
if(mNotificationWorkerFragment == null){
|
||||||
Observable.fromCallable(() -> {
|
Observable.fromCallable(() -> {
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package fr.free.nrw.commons.notification;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ public class UnreadNotificationsCheckAsync extends AsyncTask<Void, Void, List<No
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// This case is not possible ever?
|
// This case is not possible ever?
|
||||||
Log.d("deneme","You read all notifications");
|
|
||||||
Timber.d("You read all notifications of your at"+lastReadNotificationDateStored +"++curr date is:"+currentDate);
|
Timber.d("You read all notifications of your at"+lastReadNotificationDateStored +"++curr date is:"+currentDate);
|
||||||
}
|
}
|
||||||
return unreadNotifications;
|
return unreadNotifications;
|
||||||
|
|
@ -73,8 +72,7 @@ public class UnreadNotificationsCheckAsync extends AsyncTask<Void, Void, List<No
|
||||||
if (context.get().getWindow().getDecorView().isShown() && !context.get().isFinishing()) {
|
if (context.get().getWindow().getDecorView().isShown() && !context.get().isFinishing()) {
|
||||||
// Check if fragment is not null and visible
|
// Check if fragment is not null and visible
|
||||||
if (context.get().isContributionsFragmentVisible && context.get().contributionsActivityPagerAdapter.contributionsFragment != null) {
|
if (context.get().isContributionsFragmentVisible && context.get().contributionsActivityPagerAdapter.contributionsFragment != null) {
|
||||||
//Log.d("deneme3","context.get().contributionsFragment"+((NewContributionsFragment)context.get().contributionsFragment).toString());
|
(context.get().contributionsActivityPagerAdapter.contributionsFragment).updateNotificationsNotification(unreadNotification);
|
||||||
((ContributionsFragment)context.get().contributionsActivityPagerAdapter.contributionsFragment).updateNotificationsNotification(unreadNotification);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue