浏览代码

Version 6.1.3-1087

Threema 1 月之前
父节点
当前提交
20c4f65f99

+ 2 - 2
app/build.gradle.kts

@@ -47,7 +47,7 @@ if (gradle.startParameter.taskRequests.toString().contains("Hms")) {
 /**
  * Only use the scheme "<major>.<minor>.<patch>" for the appVersion
  */
-val appVersion = "6.1.2"
+val appVersion = "6.1.3"
 
 /**
  * betaSuffix with leading dash (e.g. `-beta1`).
@@ -56,7 +56,7 @@ val appVersion = "6.1.2"
  */
 val betaSuffix = ""
 
-val defaultVersionCode = 1086
+val defaultVersionCode = 1087
 
 /**
  * Map with keystore paths (if found).

+ 1 - 2
app/src/libre/play/release-notes/de/default.txt

@@ -1,2 +1 @@
-- Anpassung der Farbgebung in der App, um die Lesbarkeit von Texten zu verbessern
-- Verschiedene Fehlerbehebungen und Verbesserungen
+- Behebung eines Fehlers bei der Zuordnung von 👍/👎-Emoji-Reaktionen zu den früheren «zustimmen»/«ablehnen»-Reaktionen

+ 1 - 2
app/src/libre/play/release-notes/en-US/default.txt

@@ -1,2 +1 @@
-- Adjusted the color scheme in the app to improve the readability of texts
-- Minor Bugfixes and improvements
+- Fixed a bug with the mapping of 👍/👎 emoji reactions to the legacy “agree”/“disagree” reactions

+ 17 - 7
app/src/main/java/ch/threema/app/messagereceiver/ContactMessageReceiver.java

@@ -37,7 +37,6 @@ import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import ch.threema.app.AppConstants;
 import ch.threema.app.R;
-import ch.threema.app.ThreemaApplication;
 import ch.threema.app.emojis.EmojiUtil;
 import ch.threema.app.managers.ServiceManager;
 import ch.threema.app.multidevice.MultiDeviceManager;
@@ -61,7 +60,6 @@ import ch.threema.app.tasks.OutgoingVoipCallHangupMessageTask;
 import ch.threema.app.tasks.OutgoingVoipCallOfferMessageTask;
 import ch.threema.app.tasks.OutgoingVoipCallRingingMessageTask;
 import ch.threema.app.tasks.OutgoingVoipICECandidateMessageTask;
-import ch.threema.app.utils.ConfigUtils;
 import ch.threema.app.utils.ContactUtil;
 import ch.threema.app.utils.MessageUtil;
 import ch.threema.app.utils.NameUtil;
@@ -91,6 +89,7 @@ import ch.threema.storage.DatabaseService;
 import ch.threema.storage.models.AbstractMessageModel;
 import ch.threema.storage.models.ContactModel;
 import ch.threema.storage.models.MessageModel;
+import ch.threema.storage.models.MessageState;
 import ch.threema.storage.models.MessageType;
 import ch.threema.storage.models.ballot.BallotModel;
 import ch.threema.storage.models.data.MessageContentsType;
@@ -494,9 +493,15 @@ public class ContactMessageReceiver implements MessageReceiver<MessageModel> {
         );
     }
 
-    public void sendReaction(AbstractMessageModel messageModel, Reaction.ActionCase actionCase, @NonNull String emojiSequence, @NonNull Date reactedAt) {
+    /**
+     * Send a reaction to the given message model. Depending on reaction support, this may be mapped
+     * to a legacy reaction. In this case, the new message state that should be applied to the
+     * message model is returned.
+     */
+    @Nullable
+    public MessageState sendReaction(AbstractMessageModel messageModel, Reaction.ActionCase actionCase, @NonNull String emojiSequence, @NonNull Date reactedAt) {
         if (getEmojiReactionSupport() == MessageReceiver.Reactions_NONE) {
-            sendLegacyReaction(messageModel, actionCase, emojiSequence, reactedAt);
+            return sendLegacyReaction(messageModel, actionCase, emojiSequence, reactedAt);
         } else {
             scheduleTask(
                 new OutgoingContactReactionMessageTask(
@@ -509,10 +514,12 @@ public class ContactMessageReceiver implements MessageReceiver<MessageModel> {
                     serviceManager
                 )
             );
+            return null;
         }
     }
 
-    private void sendLegacyReaction(
+    @Nullable
+    private MessageState sendLegacyReaction(
         AbstractMessageModel messageModel,
         Reaction.ActionCase actionCase,
         @NonNull String emojiSequence,
@@ -522,7 +529,7 @@ public class ContactMessageReceiver implements MessageReceiver<MessageModel> {
             // In case we withdraw the reaction we do not send a delivery receipt because
             // withdrawing is not supported with delivery receipts.
             logger.info("Cannot withdraw legacy reaction");
-            return;
+            return null;
         }
 
         // fallback to ack/dec
@@ -534,6 +541,7 @@ public class ContactMessageReceiver implements MessageReceiver<MessageModel> {
                         new MessageId[] {MessageId.fromString(messageModel.getApiMessageId())},
                         reactedAt.getTime()
                     );
+                    return MessageState.USERACK;
                 } catch (ThreemaException e) {
                     logger.error("Could not sent ack message", e);
                 }
@@ -544,10 +552,11 @@ public class ContactMessageReceiver implements MessageReceiver<MessageModel> {
             if (MessageUtil.canSendUserDecline(messageModel)) {
                 try {
                     sendDeliveryReceipt(
-                        ProtocolDefines.DELIVERYRECEIPT_MSGUSERACK,
+                        ProtocolDefines.DELIVERYRECEIPT_MSGUSERDEC,
                         new MessageId[] {MessageId.fromString(messageModel.getApiMessageId())},
                         reactedAt.getTime()
                     );
+                    return MessageState.USERDEC;
                 } catch (ThreemaException e) {
                     logger.error("Could not sent ack message", e);
                 }
@@ -555,6 +564,7 @@ public class ContactMessageReceiver implements MessageReceiver<MessageModel> {
                 logger.error("Unable to send dec message");
             }
         }
+        return null;
     }
 
     @Override

+ 15 - 4
app/src/main/java/ch/threema/app/services/MessageServiceImpl.java

@@ -682,8 +682,11 @@ public class MessageServiceImpl implements MessageService {
             actionCase = Reaction.ActionCase.WITHDRAW;
         }
 
+        // If there is a new message state set, it means that a legacy reaction was sent and the
+        // state of the message needs to be updated.
+        MessageState newMessageState = null;
         if (receiver instanceof ContactMessageReceiver) {
-            ((ContactMessageReceiver) receiver).sendReaction(
+            newMessageState = ((ContactMessageReceiver) receiver).sendReaction(
                 message,
                 actionCase,
                 emojiSequence,
@@ -700,10 +703,18 @@ public class MessageServiceImpl implements MessageService {
             throw new ThreemaException("Unsupported receiver type of: " + receiver.getClass());
         }
 
-        if (actionCase == Reaction.ActionCase.APPLY) {
-            emojiReactionsRepository.createEntry(message, myIdentity, emojiSequence);
+        if (newMessageState == null) {
+            // In case the new message state is null, then an emoji reaction has been sent. The
+            // sequence can be stored normally.
+            if (actionCase == Reaction.ActionCase.APPLY) {
+                emojiReactionsRepository.createEntry(message, myIdentity, emojiSequence);
+            } else {
+                emojiReactionsRepository.removeEntry(message, myIdentity, emojiSequence);
+            }
         } else {
-            emojiReactionsRepository.removeEntry(message, myIdentity, emojiSequence);
+            // In case there is a new message state, then a legacy reaction has been used. In this
+            // case we need to update the message state.
+            updateAckDecState(message, newMessageState, null);
         }
 
         showToastOnPartialReactionSupport(

+ 21 - 1
app/src/main/java/ch/threema/app/services/messageplayer/AudioMessagePlayer.java

@@ -33,6 +33,7 @@ import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.media3.common.MediaItem;
 import androidx.media3.common.MediaMetadata;
+import androidx.media3.common.PlaybackException;
 import androidx.media3.common.Player;
 import androidx.media3.session.MediaController;
 
@@ -107,6 +108,25 @@ public class AudioMessagePlayer extends MessagePlayer {
     }
 
     private final Player.Listener playerListener = new Player.Listener() {
+        @Override
+        public void onPlayerError(@Nullable PlaybackException error) {
+            logger.error("Error while playing audio", error);
+        }
+
+        @Override
+        public void onEvents(@Nullable Player player, @Nullable Player.Events events) {
+            if (events == null) {
+                return;
+            }
+
+            StringBuilder eventsString = new StringBuilder();
+            for (int i = 0; i < events.size(); i++) {
+                eventsString.append(events.get(i));
+                eventsString.append(", ");
+            }
+            logger.info("Events: {}", eventsString);
+        }
+
         @Override
         public void onIsLoadingChanged(boolean isLoading) {
             logger.info(isLoading ? "onLoading" : "onLoaded");
@@ -362,7 +382,7 @@ public class AudioMessagePlayer extends MessagePlayer {
 
     @Override
     protected void makeResume(int source) {
-        logger.info("makeResume with source {} state (should be != 5) {}", source, state);
+        logger.info("makeResume with source {} state {} (should be != 5)", source, state);
         this.state = State_PLAYING;
         synchronized (this.playbackListeners) {
             for (Map.Entry<String, PlaybackListener> l : this.playbackListeners.entrySet()) {