Skip to content

Commit

Permalink
Fix build2
Browse files Browse the repository at this point in the history
  • Loading branch information
optimumpr committed Jul 12, 2024
1 parent 148fe92 commit ff2c836
Showing 1 changed file with 4 additions and 52 deletions.
56 changes: 4 additions & 52 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -33040,58 +33040,6 @@ private void didPressMessageUrl(CharacterStyle url, boolean longPress, MessageOb
if (cell != null) {
cell.resetPressedLink(-1);
}
builder.setTitle(formattedUrl);
builder.setTitleMultipleLines(true);
final MessageObject finalMessageObject = messageObject;
final String http = "http://";
final String https = "https://";
final String open = LocaleController.getString("Open", R.string.Open);
final String copy = LocaleController.getString("Copy", R.string.Copy);
final String copyW =
LocaleController.getString("CopyWithoutProtocol", R.string.CopyWithoutProtocol);
final CharSequence[] items = noforwards
? new CharSequence[]{open}
: (formattedUrl.startsWith(http) || formattedUrl.startsWith(https))
? new CharSequence[]{open, copy, copyW}
: new CharSequence[]{open, copy};
builder.setItems(items, (dialog, which) -> {
if (which == 0) {
logSponsoredClicked(finalMessageObject);
processExternalUrl(1, urlFinal, url, finalCell, false);
} else if (which == 1) {
String url1 = urlFinal;
boolean tel = false;
boolean mail = false;
if (url1.startsWith("mailto:")) {
url1 = url1.substring(7);
mail = true;
} else if (url1.startsWith("tel:")) {
url1 = url1.substring(4);
tel = true;
}
AndroidUtilities.addToClipboard(url1);
createUndoView();
if (undoView == null) {
return;
}
if (mail) {
undoView.showWithAction(0, UndoView.ACTION_EMAIL_COPIED, null);
} else if (tel) {
undoView.showWithAction(0, UndoView.ACTION_PHONE_COPIED, null);
} else {
undoView.showWithAction(0, UndoView.ACTION_LINK_COPIED, null);
}
} else if (which == 2) {
AndroidUtilities.addToClipboard(
urlFinal.replace(http, "").replace(https, ""));
}
});
builder.setOnPreDismissListener(di -> {
if (finalCell != null) {
finalCell.resetPressedLink(-1);
}
});
showDialog(builder.create());
} else {
logSponsoredClicked(messageObject);
boolean forceAlert = url instanceof URLSpanReplacement;
Expand Down Expand Up @@ -39330,6 +39278,10 @@ public void didLongPressLink(ChatMessageCell cell, MessageObject messageObject,
}
});

options.add(R.drawable.msg_copy, getString(R.string.CopyWithoutProtocol), () -> {
AndroidUtilities.addToClipboard(str.replace("http://", "").replace("https://", ""));
});

dialog.setItemOptions(options);
if (span instanceof URLSpanReplacement) {
SpannableString s = new SpannableString(((URLSpanReplacement) span).getURL());
Expand Down

0 comments on commit ff2c836

Please sign in to comment.