mirror of https://github.com/M66B/FairEmail.git
Updated seen on resuming unified inbox
This commit is contained in:
parent
1a24e016a1
commit
00ebeccb81
|
@ -87,8 +87,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||||
|
|
||||||
private static final int ATTACHMENT_BUFFER_SIZE = 8192; // bytes
|
private static final int ATTACHMENT_BUFFER_SIZE = 8192; // bytes
|
||||||
|
|
||||||
static final int REQUEST_VIEW = 1;
|
static final int REQUEST_SERVICE = 1;
|
||||||
static final int REQUEST_UNSEEN = 2;
|
static final int REQUEST_UNSEEN = 2;
|
||||||
|
static final int REQUEST_ERROR = 3;
|
||||||
|
|
||||||
static final int REQUEST_ATTACHMENT = 1;
|
static final int REQUEST_ATTACHMENT = 1;
|
||||||
|
|
||||||
|
@ -456,37 +457,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||||
if ("notification".equals(action)) {
|
if ("notification".equals(action)) {
|
||||||
intent.setAction(null);
|
intent.setAction(null);
|
||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
|
|
||||||
newMessages = true;
|
newMessages = true;
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putLong("time", new Date().getTime());
|
|
||||||
|
|
||||||
new SimpleTask<Void>() {
|
|
||||||
@Override
|
|
||||||
protected Void onLoad(Context context, Bundle args) {
|
|
||||||
long time = args.getLong("time");
|
|
||||||
|
|
||||||
DB db = DB.getInstance(context);
|
|
||||||
try {
|
|
||||||
db.beginTransaction();
|
|
||||||
|
|
||||||
for (EntityAccount account : db.account().getAccounts(true))
|
|
||||||
db.account().setAccountSeenUntil(account.id, time);
|
|
||||||
|
|
||||||
db.setTransactionSuccessful();
|
|
||||||
} finally {
|
|
||||||
db.endTransaction();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
|
||||||
Helper.unexpectedError(ActivityView.this, ex);
|
|
||||||
}
|
|
||||||
}.load(this, args);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -511,6 +511,37 @@ public class FragmentMessages extends FragmentEx {
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
grpSupport.setVisibility(Helper.isPro(getContext()) ? View.GONE : View.VISIBLE);
|
grpSupport.setVisibility(Helper.isPro(getContext()) ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
|
if (viewType == AdapterMessage.ViewType.UNIFIED) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putLong("time", new Date().getTime());
|
||||||
|
|
||||||
|
new SimpleTask<Void>() {
|
||||||
|
@Override
|
||||||
|
protected Void onLoad(Context context, Bundle args) {
|
||||||
|
long time = args.getLong("time");
|
||||||
|
|
||||||
|
DB db = DB.getInstance(context);
|
||||||
|
try {
|
||||||
|
db.beginTransaction();
|
||||||
|
|
||||||
|
for (EntityAccount account : db.account().getAccounts(true))
|
||||||
|
db.account().setAccountSeenUntil(account.id, time);
|
||||||
|
|
||||||
|
db.setTransactionSuccessful();
|
||||||
|
} finally {
|
||||||
|
db.endTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
|
Helper.unexpectedError(getContext(), ex);
|
||||||
|
}
|
||||||
|
}.load(this, args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -315,7 +315,7 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
Intent intent = new Intent(this, ActivityView.class);
|
Intent intent = new Intent(this, ActivityView.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
PendingIntent pi = PendingIntent.getActivity(
|
PendingIntent pi = PendingIntent.getActivity(
|
||||||
this, ActivityView.REQUEST_VIEW, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
this, ActivityView.REQUEST_SERVICE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
// Build notification
|
// Build notification
|
||||||
Notification.Builder builder;
|
Notification.Builder builder;
|
||||||
|
@ -477,7 +477,7 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
Intent intent = new Intent(this, ActivityView.class);
|
Intent intent = new Intent(this, ActivityView.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
PendingIntent pi = PendingIntent.getActivity(
|
PendingIntent pi = PendingIntent.getActivity(
|
||||||
this, ActivityView.REQUEST_VIEW, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
this, ActivityView.REQUEST_ERROR, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
// Build notification
|
// Build notification
|
||||||
Notification.Builder builder;
|
Notification.Builder builder;
|
||||||
|
|
Loading…
Reference in New Issue