Skip to content

Commit

Permalink
style: add back official report alert
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Aug 3, 2024
1 parent 9891f34 commit d5128c2
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4837,20 +4837,20 @@ public static void createReportAlert(final Context context, final long dialog_id
return;
}

BottomBuilder builder = new BottomBuilder(context);
builder.getBuilder().setDimBehind(hideDim == null);
builder.getBuilder().setOnPreDismissListener(di -> {
BottomSheet.Builder builder = new BottomSheet.Builder(context, true, resourcesProvider);
builder.setDimBehind(hideDim == null);
builder.setOnPreDismissListener(di -> {
if (hideDim != null) {
hideDim.run();
}
});
builder.addTitle(LocaleController.getString("ReportChat", R.string.ReportChat), true);
String[] items;
builder.setTitle(LocaleController.getString("ReportChat", R.string.ReportChat), true);
CharSequence[] items;
int[] icons;
int[] types;
if (messageId != 0) {

items = new String[]{
items = new CharSequence[]{
LocaleController.getString("ReportChatSpam", R.string.ReportChatSpam),
LocaleController.getString("ReportChatViolence", R.string.ReportChatViolence),
LocaleController.getString("ReportChatChild", R.string.ReportChatChild),
Expand Down Expand Up @@ -4878,7 +4878,7 @@ public static void createReportAlert(final Context context, final long dialog_id
REPORT_TYPE_OTHER
};
} else {
items = new String[]{
items = new CharSequence[]{
LocaleController.getString("ReportChatSpam", R.string.ReportChatSpam),
LocaleController.getString("ReportChatFakeAccount", R.string.ReportChatFakeAccount),
LocaleController.getString("ReportChatViolence", R.string.ReportChatViolence),
Expand Down Expand Up @@ -4909,11 +4909,11 @@ public static void createReportAlert(final Context context, final long dialog_id
REPORT_TYPE_OTHER
};
}
builder.addItems(items, null, (i, text, cell) -> {
builder.setItems(items, icons, (dialogInterface, 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) {
((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) {
if (parentFragment instanceof ChatActivity) {
AndroidUtilities.requestAdjustNothing(parentFragment.getParentActivity(), parentFragment.getClassGuid());
Expand Down Expand Up @@ -4951,7 +4951,7 @@ protected void onSend(int type, String message) {
}
}
});
return Unit.INSTANCE;
return;
}
TLObject req;
TLRPC.InputPeer peer = MessagesController.getInstance(UserConfig.selectedAccount).getInputPeer(dialog_id);
Expand Down Expand Up @@ -5016,19 +5016,17 @@ protected void onSend(int type, String message) {
}
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) {
UndoView undoView = ((ChatActivity) parentFragment).getUndoView();
if (undoView != null) {
undoView.showWithAction(0, UndoView.ACTION_REPORT_SENT, null);
}
} else {
BulletinFactory.of(parentFragment).createReportSent(resourcesProvider).show();

return Unit.INSTANCE;
}

return Unit.INSTANCE;
});
BottomSheet sheet = builder.create();
parentFragment.showDialog(sheet);
Expand Down

0 comments on commit d5128c2

Please sign in to comment.