Merge branch 'develop' of https://github.com/cijo7/Conversations into cijo7-develop
This commit is contained in:
commit
75749d7c7b
|
@ -2,6 +2,7 @@ package eu.siacs.conversations.entities;
|
|||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import net.java.otr4j.OtrException;
|
||||
import net.java.otr4j.crypto.OtrCryptoException;
|
||||
|
@ -15,7 +16,6 @@ import org.json.JSONObject;
|
|||
|
||||
import java.security.interfaces.DSAPublicKey;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
|
@ -37,7 +37,6 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
|
||||
public static final int STATUS_AVAILABLE = 0;
|
||||
public static final int STATUS_ARCHIVED = 1;
|
||||
public static final int STATUS_DELETED = 2;
|
||||
|
||||
public static final int MODE_MULTI = 1;
|
||||
public static final int MODE_SINGLE = 0;
|
||||
|
@ -51,13 +50,15 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
public static final String MODE = "mode";
|
||||
public static final String ATTRIBUTES = "attributes";
|
||||
|
||||
public static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption";
|
||||
public static final String ATTRIBUTE_MUC_PASSWORD = "muc_password";
|
||||
public static final String ATTRIBUTE_MUTED_TILL = "muted_till";
|
||||
public static final String ATTRIBUTE_ALWAYS_NOTIFY = "always_notify";
|
||||
public static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
|
||||
public static final String ATTRIBUTE_LAST_CLEAR_HISTORY = "last_clear_history";
|
||||
|
||||
private static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
|
||||
|
||||
private static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption";
|
||||
static final String ATTRIBUTE_MUC_PASSWORD = "muc_password";
|
||||
|
||||
private String draftMessage;
|
||||
private String name;
|
||||
private String contactUuid;
|
||||
|
@ -347,7 +348,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
|
||||
public List<Jid> getAcceptedCryptoTargets() {
|
||||
if (mode == MODE_SINGLE) {
|
||||
return Arrays.asList(getJid().toBareJid());
|
||||
return Collections.singletonList(getJid().toBareJid());
|
||||
} else {
|
||||
return getJidListAttribute(ATTRIBUTE_CRYPTO_TARGETS);
|
||||
}
|
||||
|
@ -371,7 +372,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Conversation another) {
|
||||
public int compareTo(@NonNull Conversation another) {
|
||||
final Message left = getLatestMessage();
|
||||
final Message right = another.getLatestMessage();
|
||||
if (left.getTimeSent() > right.getTimeSent()) {
|
||||
|
@ -871,7 +872,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
}
|
||||
}
|
||||
|
||||
public List<Jid> getJidListAttribute(String key) {
|
||||
private List<Jid> getJidListAttribute(String key) {
|
||||
ArrayList<Jid> list = new ArrayList<>();
|
||||
synchronized (this.attributes) {
|
||||
try {
|
||||
|
@ -890,7 +891,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
return list;
|
||||
}
|
||||
|
||||
public int getIntAttribute(String key, int defaultValue) {
|
||||
private int getIntAttribute(String key, int defaultValue) {
|
||||
String value = this.getAttribute(key);
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
|
@ -916,7 +917,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||
}
|
||||
}
|
||||
|
||||
public boolean getBooleanAttribute(String key, boolean defaultValue) {
|
||||
private boolean getBooleanAttribute(String key, boolean defaultValue) {
|
||||
String value = this.getAttribute(key);
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package eu.siacs.conversations.parser;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
@ -116,7 +117,11 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
}
|
||||
if (clientMightSendHtml(conversation.getAccount(), from)) {
|
||||
Log.d(Config.LOGTAG,conversation.getAccount().getJid().toBareJid()+": received OTR message from bad behaving client. escaping HTML…");
|
||||
body = Html.fromHtml(body).toString();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
body = Html.fromHtml(body,Html.FROM_HTML_MODE_LEGACY).toString();
|
||||
} else {
|
||||
body = Html.fromHtml(body).toString();
|
||||
}
|
||||
}
|
||||
|
||||
final OtrService otrService = conversation.getAccount().getOtrService();
|
||||
|
|
|
@ -1487,7 +1487,7 @@ public class ConversationActivity extends XmppActivity
|
|||
}
|
||||
|
||||
private void setNeverAskForBatteryOptimizationsAgain() {
|
||||
getPreferences().edit().putBoolean("show_battery_optimization", false).commit();
|
||||
getPreferences().edit().putBoolean("show_battery_optimization", false).apply();
|
||||
}
|
||||
|
||||
private void openBatteryOptimizationDialogIfNeeded() {
|
||||
|
|
Loading…
Reference in a new issue