diff --git a/build.gradle b/build.gradle index f88246e35d..66a778410b 100644 --- a/build.gradle +++ b/build.gradle @@ -185,8 +185,8 @@ dependencies { implementation "com.opencsv:opencsv:4.6" } -def canonicalVersionCode = 69 -def canonicalVersionName = "1.4.2" +def canonicalVersionCode = 70 +def canonicalVersionName = "1.4.3" def postFixSize = 10 def abiPostFix = ['armeabi-v7a' : 1, diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index 05b162e14f..a615bcadc5 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -1220,211 +1220,179 @@ - + گروه‌های خصوصی + گروه‌های باز diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index b63a1c12c7..9beb68eea1 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -123,7 +123,7 @@ Ajouter une pièce jointe Sélectionner les renseignements du contact Rédiger un message - Désolé, une erreur de mise en place de votre pièce jointe est survenue. + Une erreur est survenue lors du chargement de la pièce jointe. Le destinataire n’est pas une adresse texto ou courriel valide ! Le message est vide ! Membres du groupe @@ -145,7 +145,7 @@ Vous pourrez de nouveau recevoir les messages et appels de ce contact. Les membres actuels pourront vous ajouter au groupe de nouveau. Débloquer - La pièce jointe dépasse la limite de taille pour le type de message que vous envoyé. + La pièce jointe dépasse la limite de taille autorisée. L’appareil photo n’est pas disponible Impossible d’enregistrer l’audio ! Il n’y a aucune appli pour gérer ce lien sur votre appareil. diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index 8b2486eb01..1a10b5e98a 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -433,7 +433,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity }); sessionRestoreBannerView.setOnRestore(() -> { - SessionManagementProtocol.startSessionReset(this, recipient, threadId); + SessionManagementProtocol.startSessionReset(this, recipient.getAddress().serialize()); updateSessionRestoreBanner(); return Unit.INSTANCE; }); diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 52bfb5541f..993fb49d96 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -98,6 +98,7 @@ import org.thoughtcrime.securesms.util.Hex; import org.thoughtcrime.securesms.util.IdentityUtil; import org.thoughtcrime.securesms.util.MediaUtil; import org.thoughtcrime.securesms.util.TextSecurePreferences; +import org.whispersystems.libsignal.InvalidMessageException; import org.whispersystems.libsignal.loki.SessionResetProtocol; import org.whispersystems.libsignal.state.SignalProtocolStore; import org.whispersystems.libsignal.util.guava.Optional; @@ -354,14 +355,14 @@ public class PushDecryptJob extends BaseJob implements InjectableType { } catch (ProtocolInvalidMessageException e) { Log.w(TAG, e); if (!isPushNotification) { // This can be triggered if a PN encrypted with an old session comes in after the user performed a session reset - handleCorruptMessage(e.getSender(), e.getSenderDevice(), envelope.getTimestamp(), smsMessageId); + handleCorruptMessage(e.getSender(), e.getSenderDevice(), envelope.getTimestamp(), smsMessageId, e); } } catch (ProtocolInvalidKeyIdException | ProtocolInvalidKeyException | ProtocolUntrustedIdentityException e) { Log.w(TAG, e); - handleCorruptMessage(e.getSender(), e.getSenderDevice(), envelope.getTimestamp(), smsMessageId); + handleCorruptMessage(e.getSender(), e.getSenderDevice(), envelope.getTimestamp(), smsMessageId, e); } catch (StorageFailedException e) { Log.w(TAG, e); - handleCorruptMessage(e.getSender(), e.getSenderDevice(), envelope.getTimestamp(), smsMessageId); + handleCorruptMessage(e.getSender(), e.getSenderDevice(), envelope.getTimestamp(), smsMessageId, e); } catch (ProtocolNoSessionException e) { Log.w(TAG, e); handleNoSessionMessage(e.getSender(), e.getSenderDevice(), envelope.getTimestamp(), smsMessageId); @@ -1069,7 +1070,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType { } private void handleCorruptMessage(@NonNull String sender, int senderDevice, long timestamp, - @NonNull Optional smsMessageId) + @NonNull Optional smsMessageId, @NonNull Throwable e) { SmsDatabase smsDatabase = DatabaseFactory.getSmsDatabase(context); @@ -1083,6 +1084,22 @@ public class PushDecryptJob extends BaseJob implements InjectableType { } else { smsDatabase.markAsDecryptFailed(smsMessageId.get()); } + + // FIXME: This is a temporary patch for bad mac issues. At least with this people will be able to message again. We have to figure out the root cause of the issue though. + if (e.getCause() != null) { + Throwable e2 = e.getCause(); + if (e2.getCause() != null) { + Throwable e3 = e2.getCause(); + if (e3 instanceof InvalidMessageException) { + String message = e3.getMessage(); + if (message != null && message.startsWith("Bad Mac!")) { + SessionManagementProtocol.startSessionReset(context, sender); + return; // Don't trigger the session restoration UI + } + } + } + } + SessionManagementProtocol.triggerSessionRestorationUI(context, sender); } diff --git a/src/org/thoughtcrime/securesms/loki/protocol/SessionManagementProtocol.kt b/src/org/thoughtcrime/securesms/loki/protocol/SessionManagementProtocol.kt index fe9e07344c..c0143a3042 100644 --- a/src/org/thoughtcrime/securesms/loki/protocol/SessionManagementProtocol.kt +++ b/src/org/thoughtcrime/securesms/loki/protocol/SessionManagementProtocol.kt @@ -1,6 +1,7 @@ package org.thoughtcrime.securesms.loki.protocol import android.content.Context +import android.os.AsyncTask import android.util.Log import org.thoughtcrime.securesms.ApplicationContext import org.thoughtcrime.securesms.crypto.IdentityKeyUtil @@ -23,15 +24,18 @@ import java.util.* object SessionManagementProtocol { @JvmStatic - fun startSessionReset(context: Context, recipient: Recipient, threadID: Long) { + fun startSessionReset(context: Context, publicKey: String) { + val recipient = recipient(context, publicKey) if (recipient.isGroupRecipient) { return } val lokiThreadDB = DatabaseFactory.getLokiThreadDatabase(context) - val smsDB = DatabaseFactory.getSmsDatabase(context) + if (lokiThreadDB.getSessionResetStatus(publicKey) != SessionResetStatus.NONE) { return } + val threadID = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipient) val devices = lokiThreadDB.getSessionRestoreDevices(threadID) for (device in devices) { val endSessionMessage = OutgoingEndSessionMessage(OutgoingTextMessage(recipient, "TERMINATE", 0, -1)) MessageSender.send(context, endSessionMessage, threadID, false, null) } + val smsDB = DatabaseFactory.getSmsDatabase(context) val infoMessage = OutgoingTextMessage(recipient, "", 0, 0) val infoMessageID = smsDB.insertMessageOutbox(threadID, infoMessage, false, System.currentTimeMillis(), null) if (infoMessageID > -1) {