mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 02:33:40 +00:00
Don't show error messages before restoration
This commit is contained in:
parent
82fb950956
commit
ad5b2eceb7
@ -1072,36 +1072,38 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
@NonNull Optional<Long> smsMessageId)
|
@NonNull Optional<Long> smsMessageId)
|
||||||
{
|
{
|
||||||
SmsDatabase smsDatabase = DatabaseFactory.getSmsDatabase(context);
|
SmsDatabase smsDatabase = DatabaseFactory.getSmsDatabase(context);
|
||||||
|
if (SessionMetaProtocol.shouldErrorMessageShow(context, timestamp)) {
|
||||||
|
if (!smsMessageId.isPresent()) {
|
||||||
|
Optional<InsertResult> insertResult = insertPlaceholder(sender, senderDevice, timestamp);
|
||||||
|
|
||||||
if (!smsMessageId.isPresent()) {
|
if (insertResult.isPresent()) {
|
||||||
Optional<InsertResult> insertResult = insertPlaceholder(sender, senderDevice, timestamp);
|
smsDatabase.markAsDecryptFailed(insertResult.get().getMessageId());
|
||||||
|
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||||
if (insertResult.isPresent()) {
|
}
|
||||||
smsDatabase.markAsDecryptFailed(insertResult.get().getMessageId());
|
} else {
|
||||||
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
smsDatabase.markAsDecryptFailed(smsMessageId.get());
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
smsDatabase.markAsDecryptFailed(smsMessageId.get());
|
|
||||||
}
|
}
|
||||||
SessionManagementProtocol.triggerSessionRestorationUI(context, sender);
|
SessionManagementProtocol.triggerSessionRestorationUI(context, sender, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleNoSessionMessage(@NonNull String sender, int senderDevice, long timestamp,
|
private void handleNoSessionMessage(@NonNull String sender, int senderDevice, long timestamp,
|
||||||
@NonNull Optional<Long> smsMessageId)
|
@NonNull Optional<Long> smsMessageId)
|
||||||
{
|
{
|
||||||
SmsDatabase smsDatabase = DatabaseFactory.getSmsDatabase(context);
|
SmsDatabase smsDatabase = DatabaseFactory.getSmsDatabase(context);
|
||||||
|
if (SessionMetaProtocol.shouldErrorMessageShow(context, timestamp)) {
|
||||||
|
if (!smsMessageId.isPresent()) {
|
||||||
|
Optional<InsertResult> insertResult = insertPlaceholder(sender, senderDevice, timestamp);
|
||||||
|
|
||||||
if (!smsMessageId.isPresent()) {
|
if (insertResult.isPresent()) {
|
||||||
Optional<InsertResult> insertResult = insertPlaceholder(sender, senderDevice, timestamp);
|
smsDatabase.markAsNoSession(insertResult.get().getMessageId());
|
||||||
|
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||||
if (insertResult.isPresent()) {
|
}
|
||||||
smsDatabase.markAsNoSession(insertResult.get().getMessageId());
|
} else {
|
||||||
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
smsDatabase.markAsNoSession(smsMessageId.get());
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
smsDatabase.markAsNoSession(smsMessageId.get());
|
|
||||||
}
|
}
|
||||||
SessionManagementProtocol.triggerSessionRestorationUI(context, sender);
|
SessionManagementProtocol.triggerSessionRestorationUI(context, sender, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleLegacyMessage(@NonNull String sender, int senderDevice, long timestamp,
|
private void handleLegacyMessage(@NonNull String sender, int senderDevice, long timestamp,
|
||||||
|
@ -30,6 +30,12 @@ object SessionMetaProtocol {
|
|||||||
return shouldIgnoreMessage
|
return shouldIgnoreMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun shouldErrorMessageShow(context: Context, timestamp: Long): Boolean {
|
||||||
|
val restorationTimestamp = TextSecurePreferences.getRestorationTime(context)
|
||||||
|
return timestamp > restorationTimestamp
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun handleProfileUpdateIfNeeded(context: Context, content: SignalServiceContent) {
|
fun handleProfileUpdateIfNeeded(context: Context, content: SignalServiceContent) {
|
||||||
val rawDisplayName = content.senderDisplayName.orNull() ?: return
|
val rawDisplayName = content.senderDisplayName.orNull() ?: return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user