get rid of old bug reports system

This commit is contained in:
kosyak 2024-05-18 13:29:19 +02:00
parent f6c0a14299
commit 0ac9e037c3
6 changed files with 36 additions and 23 deletions

View file

@ -43,7 +43,6 @@ public final class Config {
public static final boolean QUICK_LOG = false; public static final boolean QUICK_LOG = false;
public static final Jid BUG_REPORTS = Jid.of("bugs@conversations.im");
public static final Uri HELP = Uri.parse("https://help.conversations.im"); public static final Uri HELP = Uri.parse("https://help.conversations.im");

View file

@ -255,9 +255,6 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
} }
private static boolean suitableForOmemoByDefault(final Conversation conversation) { private static boolean suitableForOmemoByDefault(final Conversation conversation) {
if (conversation.getJid().asBareJid().equals(Config.BUG_REPORTS)) {
return false;
}
if (conversation.getContact().isOwnServer()) { if (conversation.getContact().isOwnServer()) {
return false; return false;
} }

View file

@ -789,8 +789,7 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
!message.bodyIsOnlyEmojis() && !message.bodyIsOnlyEmojis() &&
((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) && ((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) &&
UIHelper.sameDay(message.getTimeSent(), this.getTimeSent()) && UIHelper.sameDay(message.getTimeSent(), this.getTimeSent()) &&
this.getReadByMarkers().equals(message.getReadByMarkers()) && this.getReadByMarkers().equals(message.getReadByMarkers())
!this.conversation.getJid().asBareJid().equals(Config.BUG_REPORTS)
); );
} }

View file

@ -136,6 +136,7 @@ import eu.siacs.conversations.ui.UiCallback;
import eu.siacs.conversations.ui.interfaces.OnAvatarPublication; import eu.siacs.conversations.ui.interfaces.OnAvatarPublication;
import eu.siacs.conversations.ui.interfaces.OnMediaLoaded; import eu.siacs.conversations.ui.interfaces.OnMediaLoaded;
import eu.siacs.conversations.ui.interfaces.OnSearchResultsAvailable; import eu.siacs.conversations.ui.interfaces.OnSearchResultsAvailable;
import eu.siacs.conversations.ui.util.ShareUtil;
import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.Compatibility; import eu.siacs.conversations.utils.Compatibility;
import eu.siacs.conversations.utils.ConversationsFileObserver; import eu.siacs.conversations.utils.ConversationsFileObserver;
@ -923,17 +924,7 @@ public class XmppConnectionService extends Service {
if (Strings.isNullOrEmpty(message)) { if (Strings.isNullOrEmpty(message)) {
return; return;
} }
final Account account = AccountUtils.getFirstEnabled(this); ShareUtil.share(getApplication(), message);
if (account == null) {
return;
}
final Conversation conversation =
findOrCreateConversation(account, Config.BUG_REPORTS, null, false, false, true, null);
final Message report = new Message(conversation, message, Message.ENCRYPTION_NONE);
report.setStatus(Message.STATUS_RECEIVED);
conversation.add(report);
databaseBackend.createMessage(report);
updateConversationUi();
} }
private void manageAccountConnectionStatesInternal() { private void manageAccountConnectionStatesInternal() {

View file

@ -29,6 +29,7 @@
package eu.siacs.conversations.ui.util; package eu.siacs.conversations.ui.util;
import android.app.Application;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
@ -87,6 +88,35 @@ public class ShareUtil {
} }
} }
public static void share(XmppActivity activity, String text) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, text);
shareIntent.setType("text/plain");
try {
activity.startActivity(Intent.createChooser(shareIntent, activity.getText(R.string.share_with)));
} catch (ActivityNotFoundException e) {
//This should happen only on faulty androids because normally chooser is always available
Toast.makeText(activity, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show();
}
}
public static void share(Application application, String text) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, text);
shareIntent.setType("text/plain");
try {
application.startActivity(Intent.createChooser(shareIntent, application.getText(R.string.share_with)));
} catch (ActivityNotFoundException e) {
//This should happen only on faulty androids because normally chooser is always available
Toast.makeText(application, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show();
}
}
public static void share(XmppActivity activity, List<Message> messages) { public static void share(XmppActivity activity, List<Message> messages) {
Intent shareIntent = new Intent(); Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE); shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);

View file

@ -26,6 +26,7 @@ import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.ui.XmppActivity;
import eu.siacs.conversations.ui.util.ShareUtil;
public class ExceptionHelper { public class ExceptionHelper {
@ -47,7 +48,7 @@ public class ExceptionHelper {
} }
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
boolean neverSend = preferences.getBoolean("never_send", false); boolean neverSend = preferences.getBoolean("never_send", false);
if (neverSend || Config.BUG_REPORTS == null) { if (neverSend) {
return false; return false;
} }
final Account account = AccountUtils.getFirstEnabled(service); final Account account = AccountUtils.getFirstEnabled(service);
@ -87,11 +88,7 @@ public class ExceptionHelper {
builder.setTitle(activity.getString(R.string.crash_report_title, activity.getString(R.string.app_name))); builder.setTitle(activity.getString(R.string.crash_report_title, activity.getString(R.string.app_name)));
builder.setMessage(activity.getString(R.string.crash_report_message, activity.getString(R.string.app_name))); builder.setMessage(activity.getString(R.string.crash_report_message, activity.getString(R.string.app_name)));
builder.setPositiveButton(activity.getText(R.string.send_now), (dialog, which) -> { builder.setPositiveButton(activity.getText(R.string.send_now), (dialog, which) -> {
ShareUtil.share(activity, report.toString());
Log.d(Config.LOGTAG, "using account=" + account.getJid().asBareJid() + " to send in stack trace");
Conversation conversation = service.findOrCreateConversation(account, Config.BUG_REPORTS, null, false, false, true, null);
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.setNegativeButton(activity.getText(R.string.send_never), (dialog, which) -> preferences.edit().putBoolean("never_send", true).apply());
builder.create().show(); builder.create().show();