style: add back official report alert

This commit is contained in:
xtaodada 2024-08-03 21:23:37 +08:00
parent 4a2e71816f
commit 9fee1cc2a0
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -4837,20 +4837,20 @@ public class AlertsCreator {
return; return;
} }
BottomBuilder builder = new BottomBuilder(context); BottomSheet.Builder builder = new BottomSheet.Builder(context, true, resourcesProvider);
builder.getBuilder().setDimBehind(hideDim == null); builder.setDimBehind(hideDim == null);
builder.getBuilder().setOnPreDismissListener(di -> { builder.setOnPreDismissListener(di -> {
if (hideDim != null) { if (hideDim != null) {
hideDim.run(); hideDim.run();
} }
}); });
builder.addTitle(LocaleController.getString("ReportChat", R.string.ReportChat), true); builder.setTitle(LocaleController.getString("ReportChat", R.string.ReportChat), true);
String[] items; CharSequence[] items;
int[] icons; int[] icons;
int[] types; int[] types;
if (messageId != 0) { if (messageId != 0) {
items = new String[]{ items = new CharSequence[]{
LocaleController.getString("ReportChatSpam", R.string.ReportChatSpam), LocaleController.getString("ReportChatSpam", R.string.ReportChatSpam),
LocaleController.getString("ReportChatViolence", R.string.ReportChatViolence), LocaleController.getString("ReportChatViolence", R.string.ReportChatViolence),
LocaleController.getString("ReportChatChild", R.string.ReportChatChild), LocaleController.getString("ReportChatChild", R.string.ReportChatChild),
@ -4878,7 +4878,7 @@ public class AlertsCreator {
REPORT_TYPE_OTHER REPORT_TYPE_OTHER
}; };
} else { } else {
items = new String[]{ items = new CharSequence[]{
LocaleController.getString("ReportChatSpam", R.string.ReportChatSpam), LocaleController.getString("ReportChatSpam", R.string.ReportChatSpam),
LocaleController.getString("ReportChatFakeAccount", R.string.ReportChatFakeAccount), LocaleController.getString("ReportChatFakeAccount", R.string.ReportChatFakeAccount),
LocaleController.getString("ReportChatViolence", R.string.ReportChatViolence), LocaleController.getString("ReportChatViolence", R.string.ReportChatViolence),
@ -4909,11 +4909,11 @@ public class AlertsCreator {
REPORT_TYPE_OTHER REPORT_TYPE_OTHER
}; };
} }
builder.addItems(items, null, (i, text, cell) -> { builder.setItems(items, icons, (dialogInterface, i) -> {
int type = types[i]; int type = types[i];
if (messageId == 0 && (type == REPORT_TYPE_SPAM || type == REPORT_TYPE_VIOLENCE || type == REPORT_TYPE_CHILD_ABUSE || type == REPORT_TYPE_PORNOGRAPHY || type == REPORT_TYPE_ILLEGAL_DRUGS || type == REPORT_TYPE_PERSONAL_DETAILS) && parentFragment instanceof ChatActivity) { if (messageId == 0 && (type == REPORT_TYPE_SPAM || type == REPORT_TYPE_VIOLENCE || type == REPORT_TYPE_CHILD_ABUSE || type == REPORT_TYPE_PORNOGRAPHY || type == REPORT_TYPE_ILLEGAL_DRUGS || type == REPORT_TYPE_PERSONAL_DETAILS) && parentFragment instanceof ChatActivity) {
((ChatActivity) parentFragment).openReportChat(type); ((ChatActivity) parentFragment).openReportChat(type);
return Unit.INSTANCE; return;
} else if (messageId == 0 && (type == REPORT_TYPE_OTHER || type == REPORT_TYPE_FAKE_ACCOUNT) || messageId != 0 && type == REPORT_TYPE_OTHER) { } else if (messageId == 0 && (type == REPORT_TYPE_OTHER || type == REPORT_TYPE_FAKE_ACCOUNT) || messageId != 0 && type == REPORT_TYPE_OTHER) {
if (parentFragment instanceof ChatActivity) { if (parentFragment instanceof ChatActivity) {
AndroidUtilities.requestAdjustNothing(parentFragment.getParentActivity(), parentFragment.getClassGuid()); AndroidUtilities.requestAdjustNothing(parentFragment.getParentActivity(), parentFragment.getClassGuid());
@ -4951,7 +4951,7 @@ public class AlertsCreator {
} }
} }
}); });
return Unit.INSTANCE; return;
} }
TLObject req; TLObject req;
TLRPC.InputPeer peer = MessagesController.getInstance(UserConfig.selectedAccount).getInputPeer(dialog_id); TLRPC.InputPeer peer = MessagesController.getInstance(UserConfig.selectedAccount).getInputPeer(dialog_id);
@ -5016,7 +5016,9 @@ public class AlertsCreator {
} }
req = request; req = request;
} }
ConnectionsManager.getInstance(UserConfig.selectedAccount).sendRequest(req, (response, error) -> AlertUtil.showToast(error)); ConnectionsManager.getInstance(UserConfig.selectedAccount).sendRequest(req, (response, error) -> {
});
if (parentFragment instanceof ChatActivity) { if (parentFragment instanceof ChatActivity) {
UndoView undoView = ((ChatActivity) parentFragment).getUndoView(); UndoView undoView = ((ChatActivity) parentFragment).getUndoView();
if (undoView != null) { if (undoView != null) {
@ -5024,11 +5026,7 @@ public class AlertsCreator {
} }
} else { } else {
BulletinFactory.of(parentFragment).createReportSent(resourcesProvider).show(); BulletinFactory.of(parentFragment).createReportSent(resourcesProvider).show();
return Unit.INSTANCE;
} }
return Unit.INSTANCE;
}); });
BottomSheet sheet = builder.create(); BottomSheet sheet = builder.create();
parentFragment.showDialog(sheet); parentFragment.showDialog(sheet);