show the device-update-message only once, not on every account switch (#3069)

* show the device-update-message only once, not on every account switch

* instead of not adding device messages twice, always add and mark the chat as being noticed

* remove unused variable
This commit is contained in:
bjoern 2024-05-19 20:55:43 +02:00 committed by GitHub
parent 15db6e5d91
commit 1884f9bc4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -127,6 +127,14 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
+ "For more changes worth testing see https://delta.chat/changelog");
//}
dcContext.addDeviceMsg(deviceMsgId, msg);
if (Prefs.getStringPreference(this, Prefs.LAST_DEVICE_MSG_ID, "").equals(deviceMsgId)) {
int deviceChatId = dcContext.getChatIdByContactId(DcContact.DC_CONTACT_ID_DEVICE);
if (deviceChatId != 0) {
dcContext.marknoticedChat(deviceChatId);
}
}
Prefs.setStringPreference(this, Prefs.LAST_DEVICE_MSG_ID, deviceMsgId);
}
} catch(Exception e) {
e.printStackTrace();

View file

@ -64,6 +64,8 @@ public class Prefs {
public static final String ALWAYS_LOAD_REMOTE_CONTENT = "pref_always_load_remote_content";
public static final boolean ALWAYS_LOAD_REMOTE_CONTENT_DEFAULT = false;
public static final String LAST_DEVICE_MSG_ID = "pref_last_device_msg_id";
public enum VibrateState {
DEFAULT(0), ENABLED(1), DISABLED(2);
private final int id;