use name deviceMsgLabel as it is a label and no id

came over that while targeting https://github.com/deltachat/deltachat-ios/pull/2204
and was shortly confused about what is going on there :)

(the name saved to database is not changed, however,
to avoid popping up the message again in case we do an update without a new device messase)
This commit is contained in:
B. Petersen 2024-06-09 18:17:01 +02:00 committed by bjoern
parent ce93edf1a3
commit 1083e19356
2 changed files with 6 additions and 6 deletions

View file

@ -104,8 +104,8 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
// it is not needed to keep all past update messages, however, when deleted, also the strings should be deleted. // it is not needed to keep all past update messages, however, when deleted, also the strings should be deleted.
try { try {
DcContext dcContext = DcHelper.getContext(this); DcContext dcContext = DcHelper.getContext(this);
final String deviceMsgId = "update_1_46_0l_android"; final String deviceMsgLabel = "update_1_46_0l_android";
if (!dcContext.wasDeviceMsgEverAdded(deviceMsgId)) { if (!dcContext.wasDeviceMsgEverAdded(deviceMsgLabel)) {
DcMsg msg = null; DcMsg msg = null;
if (!getIntent().getBooleanExtra(FROM_WELCOME, false)) { if (!getIntent().getBooleanExtra(FROM_WELCOME, false)) {
msg = new DcMsg(dcContext, DcMsg.DC_MSG_TEXT); msg = new DcMsg(dcContext, DcMsg.DC_MSG_TEXT);
@ -117,15 +117,15 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
msg.setText(getString(R.string.update_1_46_android, "https://get.delta.chat/#changelogs")); msg.setText(getString(R.string.update_1_46_android, "https://get.delta.chat/#changelogs"));
} }
dcContext.addDeviceMsg(deviceMsgId, msg); dcContext.addDeviceMsg(deviceMsgLabel, msg);
if (Prefs.getStringPreference(this, Prefs.LAST_DEVICE_MSG_ID, "").equals(deviceMsgId)) { if (Prefs.getStringPreference(this, Prefs.LAST_DEVICE_MSG_LABEL, "").equals(deviceMsgLabel)) {
int deviceChatId = dcContext.getChatIdByContactId(DcContact.DC_CONTACT_ID_DEVICE); int deviceChatId = dcContext.getChatIdByContactId(DcContact.DC_CONTACT_ID_DEVICE);
if (deviceChatId != 0) { if (deviceChatId != 0) {
dcContext.marknoticedChat(deviceChatId); dcContext.marknoticedChat(deviceChatId);
} }
} }
Prefs.setStringPreference(this, Prefs.LAST_DEVICE_MSG_ID, deviceMsgId); Prefs.setStringPreference(this, Prefs.LAST_DEVICE_MSG_LABEL, deviceMsgLabel);
} }
} catch(Exception e) { } catch(Exception e) {
e.printStackTrace(); e.printStackTrace();

View file

@ -65,7 +65,7 @@ public class Prefs {
public static final String ALWAYS_LOAD_REMOTE_CONTENT = "pref_always_load_remote_content"; 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 boolean ALWAYS_LOAD_REMOTE_CONTENT_DEFAULT = false;
public static final String LAST_DEVICE_MSG_ID = "pref_last_device_msg_id"; public static final String LAST_DEVICE_MSG_LABEL = "pref_last_device_msg_id";
public enum VibrateState { public enum VibrateState {
DEFAULT(0), ENABLED(1), DISABLED(2); DEFAULT(0), ENABLED(1), DISABLED(2);