Option to report all chat requests as SPAM
(cherry picked from commit 71235d53f6414f4e2b004bd29c4586dd48b73e16)
This commit is contained in:
parent
c1476de375
commit
2094e3e5d6
2 changed files with 29 additions and 4 deletions
|
@ -1066,16 +1066,18 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.activity_conversations, menu);
|
getMenuInflater().inflate(R.menu.activity_conversations, menu);
|
||||||
final MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
|
final MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code);
|
||||||
|
final var reportSpamItem = menu.findItem(R.id.action_report_spam);
|
||||||
|
final var fragment = getFragmentManager().findFragmentById(R.id.main_fragment);
|
||||||
|
final var overview = fragment instanceof ConversationsOverviewFragment;
|
||||||
if (qrCodeScanMenuItem != null) {
|
if (qrCodeScanMenuItem != null) {
|
||||||
if (isCameraFeatureAvailable() && (xmppConnectionService == null || !xmppConnectionService.isOnboarding())) {
|
if (isCameraFeatureAvailable() && (xmppConnectionService == null || !xmppConnectionService.isOnboarding())) {
|
||||||
Fragment fragment = getFragmentManager().findFragmentById(R.id.main_fragment);
|
final var visible = getResources().getBoolean(R.bool.show_qr_code_scan) && overview;
|
||||||
boolean visible = getResources().getBoolean(R.bool.show_qr_code_scan)
|
|
||||||
&& fragment instanceof ConversationsOverviewFragment;
|
|
||||||
qrCodeScanMenuItem.setVisible(visible);
|
qrCodeScanMenuItem.setVisible(visible);
|
||||||
} else {
|
} else {
|
||||||
qrCodeScanMenuItem.setVisible(false);
|
qrCodeScanMenuItem.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reportSpamItem.setVisible(overview && mainFilter == DRAWER_CHAT_REQUESTS);
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1255,7 +1257,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
||||||
case R.id.action_search_all_conversations:
|
case R.id.action_search_all_conversations:
|
||||||
startActivity(new Intent(this, SearchActivity.class));
|
startActivity(new Intent(this, SearchActivity.class));
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_search_this_conversation:
|
case R.id.action_search_this_conversation: {
|
||||||
final Conversation conversation = ConversationFragment.getConversation(this);
|
final Conversation conversation = ConversationFragment.getConversation(this);
|
||||||
if (conversation == null) {
|
if (conversation == null) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1264,6 +1266,22 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
||||||
intent.putExtra(SearchActivity.EXTRA_CONVERSATION_UUID, conversation.getUuid());
|
intent.putExtra(SearchActivity.EXTRA_CONVERSATION_UUID, conversation.getUuid());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
case R.id.action_report_spam: {
|
||||||
|
final var list = new ArrayList<Conversation>();
|
||||||
|
populateWithOrderedConversations(list, true, false);
|
||||||
|
new AlertDialog.Builder(this)
|
||||||
|
.setTitle(R.string.report_spam)
|
||||||
|
.setMessage("Do you really want to block all these users and report as SPAM?")
|
||||||
|
.setPositiveButton(R.string.yes, (dialog, whichButton) -> {
|
||||||
|
for (final var conversation : list) {
|
||||||
|
final var m = conversation.getLatestMessage();
|
||||||
|
xmppConnectionService.sendBlockRequest(conversation, true, m == null ? null : m.getServerMsgId());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.no, null).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,4 +22,11 @@
|
||||||
android:title="@string/scan_qr_code"
|
android:title="@string/scan_qr_code"
|
||||||
android:visible="@bool/show_qr_code_scan"
|
android:visible="@bool/show_qr_code_scan"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_report_spam"
|
||||||
|
android:icon="@drawable/ic_report_24dp"
|
||||||
|
android:orderInCategory="11"
|
||||||
|
android:title="@string/report_spam"
|
||||||
|
android:visible="false"
|
||||||
|
app:showAsAction="always" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|
Loading…
Add table
Reference in a new issue