diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-03 21:59:49 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-03 22:01:29 +0200 |
commit | e18855cd9c1a651bc39e651c814415cfff4e5680 (patch) | |
tree | 0a0e50960094d9fe4996ac9752591567120c8ab7 /src/main/java/de | |
parent | 810ac88a4995851892b1af7a084dba677f4e1fb3 (diff) |
do not enable encryption for bug reports
Diffstat (limited to 'src/main/java/de')
5 files changed, 17 insertions, 40 deletions
diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java index 60f2410aa..7c676122b 100644 --- a/src/main/java/de/pixart/messenger/Config.java +++ b/src/main/java/de/pixart/messenger/Config.java @@ -3,6 +3,7 @@ package de.pixart.messenger; import android.graphics.Bitmap; import de.pixart.messenger.xmpp.chatstate.ChatState; +import rocks.xmpp.addr.Jid; public final class Config { @@ -37,7 +38,7 @@ public final class Config { public static final String LOGTAG = "Pix-Art_Messenger"; - public static final String BUG_REPORTS = "bugs@pix-art.de"; + public static final Jid BUG_REPORTS = Jid.of("bugs@pix-art.de"); public static final String inviteUserURL = "https://jabber.pix-art.de/i/"; public static final String inviteMUCURL = "https://jabber.pix-art.de/j/"; diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java index c9bbbfca2..81c52aa1c 100644 --- a/src/main/java/de/pixart/messenger/entities/Conversation.java +++ b/src/main/java/de/pixart/messenger/entities/Conversation.java @@ -762,7 +762,9 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl public int getNextEncryption() { final int defaultEncryption; AxolotlService axolotlService = account.getAxolotlService(); - if (axolotlService != null && axolotlService.isConversationAxolotlCapable(this)) { + if (contactJid.asBareJid().equals(Config.BUG_REPORTS)) { + defaultEncryption = Message.ENCRYPTION_NONE; + } else if (axolotlService != null && axolotlService.isConversationAxolotlCapable(this)) { defaultEncryption = Message.ENCRYPTION_AXOLOTL; } else { defaultEncryption = Message.ENCRYPTION_NONE; diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java index 501a394ad..7bf94e599 100644 --- a/src/main/java/de/pixart/messenger/entities/Message.java +++ b/src/main/java/de/pixart/messenger/entities/Message.java @@ -572,7 +572,7 @@ public class Message extends AbstractEntity { ((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) && UIHelper.sameDay(message.getTimeSent(), this.getTimeSent()) && this.getReadByMarkers().equals(message.getReadByMarkers()) && - !this.conversation.getJid().asBareJid().toString().equals(Config.BUG_REPORTS) + !this.conversation.getJid().asBareJid().equals(Config.BUG_REPORTS) ); } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index b2fd1813b..8284630ce 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -94,7 +94,6 @@ import de.pixart.messenger.persistance.FileBackend; import de.pixart.messenger.services.MessageArchiveService; import de.pixart.messenger.services.XmppConnectionService; import de.pixart.messenger.ui.adapter.MessageAdapter; -import de.pixart.messenger.ui.interfaces.OnSwipeTouchListener; import de.pixart.messenger.ui.util.ActivityResult; import de.pixart.messenger.ui.util.AttachmentTool; import de.pixart.messenger.ui.util.ConversationMenuConfigurator; @@ -2091,13 +2090,14 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke this.binding.messagesView.setSelection(pos); } } - this.binding.messagesView.setOnTouchListener(new OnSwipeTouchListener(getContext()) { + // todo add swipe listener --> causes strange scrolling in chats + /*this.binding.messagesView.setOnTouchListener(new OnSwipeTouchListener(getContext()) { @Override public void onSwipeRight() { Log.d(Config.LOGTAG, "Swipe right detected"); activity.onBackPressed(); } - }); + });*/ activity.onConversationRead(this.conversation); //TODO if we only do this when this fragment is running on main it won't *bing* in tablet layout which might be unnecessary since we can *see* it activity.xmppConnectionService.getNotificationService().setOpenConversation(this.conversation); diff --git a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java index b1799d490..ff2614840 100644 --- a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java +++ b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java @@ -1,8 +1,6 @@ package de.pixart.messenger.utils; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -28,7 +26,6 @@ import de.pixart.messenger.entities.Conversation; import de.pixart.messenger.entities.Message; import de.pixart.messenger.services.XmppConnectionService; import de.pixart.messenger.ui.XmppActivity; -import rocks.xmpp.addr.Jid; public class ExceptionHelper { private static final String FILENAME = "stacktrace.txt"; @@ -93,36 +90,13 @@ public class ExceptionHelper { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(activity.getString(R.string.crash_report_title)); builder.setMessage(activity.getText(R.string.crash_report_message)); - builder.setPositiveButton(activity.getText(R.string.send_now), - new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - - Log.d(Config.LOGTAG, "using account=" - + finalAccount.getJid().asBareJid() - + " to send in stack trace"); - - Conversation conversation = null; - try { - conversation = service.findOrCreateConversation(finalAccount, - Jid.of(Config.BUG_REPORTS), false, true); - } catch (final IllegalArgumentException ignored) { - } - Message message = new Message(conversation, report - .toString(), Message.ENCRYPTION_NONE); - service.sendMessage(message); - } - }); - builder.setNegativeButton(activity.getText(R.string.send_never), - new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - preferences.edit().putBoolean("crash_report", false) - .apply(); - } - }); + builder.setPositiveButton(activity.getText(R.string.send_now), (dialog, which) -> { + Log.d(Config.LOGTAG, "using account=" + finalAccount.getJid().asBareJid() + " to send in stack trace"); + Conversation conversation = service.findOrCreateConversation(finalAccount, Config.BUG_REPORTS, false, true); + Message message = new Message(conversation, report.toString(), Message.ENCRYPTION_NONE); + service.sendMessage(message); + }); + builder.setNegativeButton(activity.getText(R.string.send_never), (dialog, which) -> preferences.edit().putBoolean("never_send", true).apply()); builder.create().show(); return true; } catch (final IOException ignored) { @@ -130,7 +104,7 @@ public class ExceptionHelper { } } - public static void writeToStacktraceFile(Context context, String msg) { + static void writeToStacktraceFile(Context context, String msg) { try { OutputStream os = context.openFileOutput(FILENAME, Context.MODE_PRIVATE); os.write(msg.getBytes()); |