|
|
@ -691,19 +691,23 @@ public class NotificationsFragment extends SFragment implements |
|
|
|
private void saveNewestNotificationId(List<Notification> notifications) { |
|
|
|
private void saveNewestNotificationId(List<Notification> notifications) { |
|
|
|
|
|
|
|
|
|
|
|
AccountEntity account = accountManager.getActiveAccount(); |
|
|
|
AccountEntity account = accountManager.getActiveAccount(); |
|
|
|
BigInteger lastNoti = new BigInteger(account.getLastNotificationId()); |
|
|
|
if(account != null) { |
|
|
|
|
|
|
|
BigInteger lastNoti = new BigInteger(account.getLastNotificationId()); |
|
|
|
|
|
|
|
|
|
|
|
for (Notification noti : notifications) { |
|
|
|
for (Notification noti : notifications) { |
|
|
|
BigInteger a = new BigInteger(noti.getId()); |
|
|
|
BigInteger a = new BigInteger(noti.getId()); |
|
|
|
if (isBiggerThan(a, lastNoti)) { |
|
|
|
if (isBiggerThan(a, lastNoti)) { |
|
|
|
lastNoti = a; |
|
|
|
lastNoti = a; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Log.d(TAG, "saving newest noti id: " + lastNoti); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
account.setLastNotificationId(lastNoti.toString()); |
|
|
|
String lastNotificationId = lastNoti.toString(); |
|
|
|
accountManager.saveAccount(account); |
|
|
|
if(!account.getLastNotificationId().equals(lastNotificationId)) { |
|
|
|
|
|
|
|
Log.d(TAG, "saving newest noti id: " + lastNotificationId); |
|
|
|
|
|
|
|
account.setLastNotificationId(lastNotificationId); |
|
|
|
|
|
|
|
accountManager.saveAccount(account); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isBiggerThan(BigInteger newId, BigInteger lastShownNotificationId) { |
|
|
|
private boolean isBiggerThan(BigInteger newId, BigInteger lastShownNotificationId) { |
|
|
|