mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-12 03:27:42 +00:00
Merge branch 'dev' into v2-file-server
This commit is contained in:
@@ -130,12 +130,7 @@ class JobQueue : JobDelegate {
|
||||
}
|
||||
// Message send jobs waiting for the attachment to upload
|
||||
if (job is MessageSendJob && error is MessageSendJob.AwaitingAttachmentUploadException) {
|
||||
val retryInterval: Long = 1000 * 4
|
||||
Log.i("Loki", "Message send job waiting for attachment upload to finish.")
|
||||
timer.schedule(delay = retryInterval) {
|
||||
Log.i("Loki", "Retrying ${job::class.simpleName}.")
|
||||
queue.offer(job)
|
||||
}
|
||||
return
|
||||
}
|
||||
// Regular job failure
|
||||
|
@@ -225,7 +225,8 @@ fun MessageReceiver.handleVisibleMessage(message: VisibleMessage, proto: SignalS
|
||||
}
|
||||
val openGroupServerID = message.openGroupServerMessageID
|
||||
if (openGroupServerID != null) {
|
||||
storage.setOpenGroupServerMessageID(messageID, openGroupServerID, threadID, !message.isMediaMessage())
|
||||
val isSms = !(message.isMediaMessage() || attachments.isNotEmpty())
|
||||
storage.setOpenGroupServerMessageID(messageID, openGroupServerID, threadID, isSms)
|
||||
}
|
||||
// Cancel any typing indicators if needed
|
||||
cancelTypingIndicatorsIfNeeded(message.sender!!)
|
||||
|
@@ -73,8 +73,8 @@ class OpenGroupV2Poller(private val openGroups: List<OpenGroupV2>, private val e
|
||||
return OpenGroupAPIV2.compactPoll(rooms = rooms, server).successBackground { results ->
|
||||
results.forEach { (room, results) ->
|
||||
val serverRoomId = "$server.$room"
|
||||
handleDeletedMessages(serverRoomId,results.deletions)
|
||||
handleNewMessages(serverRoomId, results.messages.sortedBy { it.serverID }, isBackgroundPoll)
|
||||
handleDeletedMessages(serverRoomId,results.deletions)
|
||||
}
|
||||
}.always {
|
||||
isPollOngoing = false
|
||||
@@ -120,7 +120,11 @@ class OpenGroupV2Poller(private val openGroups: List<OpenGroupV2>, private val e
|
||||
val threadId = messagingModule.storage.getThreadIdFor(Address.fromSerialized(address)) ?: return
|
||||
|
||||
val deletedMessageIDs = deletedMessageServerIDs.mapNotNull { serverId ->
|
||||
messagingModule.messageDataProvider.getMessageID(serverId, threadId)
|
||||
val id = messagingModule.messageDataProvider.getMessageID(serverId, threadId)
|
||||
if (id == null) {
|
||||
Log.d("Loki", "Couldn't find server ID $serverId")
|
||||
}
|
||||
id
|
||||
}
|
||||
deletedMessageIDs.forEach { (messageId, isSms) ->
|
||||
MessagingModuleConfiguration.shared.messageDataProvider.deleteMessage(messageId, isSms)
|
||||
|
@@ -58,7 +58,6 @@ public enum MaterialColor {
|
||||
|
||||
private final String serialized;
|
||||
|
||||
|
||||
MaterialColor(@ColorRes int mainColor, @ColorRes int tintColor, @ColorRes int shadeColor, String serialized) {
|
||||
this.mainColor = mainColor;
|
||||
this.tintColor = tintColor;
|
||||
@@ -110,9 +109,9 @@ public enum MaterialColor {
|
||||
}
|
||||
|
||||
public boolean represents(Context context, int colorValue) {
|
||||
return context.getResources().getColor(mainColor) == colorValue ||
|
||||
context.getResources().getColor(tintColor) == colorValue ||
|
||||
context.getResources().getColor(shadeColor) == colorValue;
|
||||
return context.getResources().getColor(mainColor) == colorValue
|
||||
|| context.getResources().getColor(tintColor) == colorValue
|
||||
|| context.getResources().getColor(shadeColor) == colorValue;
|
||||
}
|
||||
|
||||
public String serialize() {
|
||||
|
@@ -1,70 +0,0 @@
|
||||
package org.session.libsession.utilities.color;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MaterialColors {
|
||||
|
||||
public static final MaterialColorList CONVERSATION_PALETTE = new MaterialColorList(new ArrayList<>(Arrays.asList(
|
||||
MaterialColor.PLUM,
|
||||
MaterialColor.CRIMSON,
|
||||
MaterialColor.VERMILLION,
|
||||
MaterialColor.VIOLET,
|
||||
MaterialColor.BLUE,
|
||||
MaterialColor.INDIGO,
|
||||
MaterialColor.FOREST,
|
||||
MaterialColor.WINTERGREEN,
|
||||
MaterialColor.TEAL,
|
||||
MaterialColor.BURLAP,
|
||||
MaterialColor.TAUPE,
|
||||
MaterialColor.STEEL
|
||||
)));
|
||||
|
||||
public static class MaterialColorList {
|
||||
|
||||
private final List<MaterialColor> colors;
|
||||
|
||||
private MaterialColorList(List<MaterialColor> colors) {
|
||||
this.colors = colors;
|
||||
}
|
||||
|
||||
public MaterialColor get(int index) {
|
||||
return colors.get(index);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return colors.size();
|
||||
}
|
||||
|
||||
public @Nullable MaterialColor getByColor(Context context, int colorValue) {
|
||||
for (MaterialColor color : colors) {
|
||||
if (color.represents(context, colorValue)) {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int[] asConversationColorArray(@NonNull Context context) {
|
||||
int[] results = new int[colors.size()];
|
||||
int index = 0;
|
||||
|
||||
for (MaterialColor color : colors) {
|
||||
results[index++] = color.toConversationColor(context);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,12 +1,10 @@
|
||||
package org.session.libsession.utilities.color.spans;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import android.text.TextPaint;
|
||||
import android.text.style.MetricAffectingSpan;
|
||||
|
||||
public class CenterAlignedRelativeSizeSpan extends MetricAffectingSpan {
|
||||
|
||||
private final float relativeSize;
|
||||
|
||||
public CenterAlignedRelativeSizeSpan(float relativeSize) {
|
||||
|
Reference in New Issue
Block a user