mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-18 13:21:02 +00:00
Fixed warnings, simplification
This commit is contained in:
parent
d44d0d6230
commit
4c1db52b01
1 changed files with 234 additions and 236 deletions
|
@ -561,7 +561,6 @@ class Core {
|
|||
}
|
||||
|
||||
ifolder.expunge();
|
||||
|
||||
} else {
|
||||
// Mark source read
|
||||
if (autoread)
|
||||
|
@ -1241,7 +1240,6 @@ class Core {
|
|||
IMAPFolder ifolder, IMAPMessage imessage,
|
||||
boolean browsed,
|
||||
List<EntityRule> rules) throws MessagingException, IOException {
|
||||
synchronized (folder) {
|
||||
long uid = ifolder.getUID(imessage);
|
||||
|
||||
if (imessage.isExpunged()) {
|
||||
|
@ -1508,7 +1506,6 @@ class Core {
|
|||
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
private static EntityIdentity matchIdentity(Context context, EntityFolder folder, EntityMessage message) {
|
||||
DB db = DB.getInstance(context);
|
||||
|
@ -1743,6 +1740,8 @@ class Core {
|
|||
Log.i("Notify messages=" + messages.size());
|
||||
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (nm == null)
|
||||
return;
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean badge = prefs.getBoolean("badge", true);
|
||||
|
@ -1844,7 +1843,8 @@ class Core {
|
|||
List<Notification> notifications = new ArrayList<>();
|
||||
// https://developer.android.com/training/notify-user/group
|
||||
|
||||
if (messages == null || messages.size() == 0)
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (messages == null || messages.size() == 0 || nm == null)
|
||||
return notifications;
|
||||
|
||||
boolean pro = Helper.isPro(context);
|
||||
|
@ -1860,8 +1860,6 @@ class Core {
|
|||
boolean notify_flag = prefs.getBoolean("notify_flag", false) && pro;
|
||||
boolean notify_seen = prefs.getBoolean("notify_seen", true);
|
||||
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
// Get contact info
|
||||
Map<TupleMessageEx, ContactInfo> messageContact = new HashMap<>();
|
||||
for (TupleMessageEx message : messages)
|
||||
|
@ -2138,12 +2136,14 @@ class Core {
|
|||
|
||||
EntityLog.log(context, title + " " + Helper.formatThrowable(ex));
|
||||
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (nm == null)
|
||||
return;
|
||||
|
||||
if (ex instanceof AuthenticationFailedException || // Also: Too many simultaneous connections
|
||||
ex instanceof AlertException ||
|
||||
ex instanceof SendFailedException) {
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
ex instanceof SendFailedException)
|
||||
nm.notify(tag, 1, getNotificationError(context, title, ex).build());
|
||||
}
|
||||
|
||||
// connection failure: Too many simultaneous connections
|
||||
|
||||
|
@ -2160,11 +2160,9 @@ class Core {
|
|||
!(ex instanceof MessagingException && ex.getCause() instanceof SocketException) &&
|
||||
!(ex instanceof MessagingException && ex.getCause() instanceof SocketTimeoutException) &&
|
||||
!(ex instanceof MessagingException && ex.getCause() instanceof SSLException) &&
|
||||
!(ex instanceof MessagingException && "connection failure".equals(ex.getMessage()))) {
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
!(ex instanceof MessagingException && "connection failure".equals(ex.getMessage())))
|
||||
nm.notify(tag, 1, getNotificationError(context, title, ex).build());
|
||||
}
|
||||
}
|
||||
|
||||
static NotificationCompat.Builder getNotificationError(Context context, String title, Throwable ex) {
|
||||
return getNotificationError(context, "error", title, ex, true);
|
||||
|
|
Loading…
Reference in a new issue