Skip to content

Commit

Permalink
Update to 7.2.0 (2134)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Oct 30, 2020
1 parent aaa5dc0 commit 002c01e
Show file tree
Hide file tree
Showing 36 changed files with 1,634 additions and 434 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ android {
}
}

defaultConfig.versionCode = 2128
defaultConfig.versionCode = 2134

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ private static void gatherLinks(ArrayList<LinkSpec> links, Spannable s, Pattern
LinkSpec spec = new LinkSpec();

String url = makeUrl(m.group(0), schemes, m);
if (internalOnly && !Browser.isInternalUrl(url, null)) {
if (internalOnly && !Browser.isInternalUrl(url, true, null)) {
continue;
}
spec.url = url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class BuildVars {
public static boolean LOGS_ENABLED = false;
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static int BUILD_VERSION = 2129;
public static int BUILD_VERSION = 2134;
public static String BUILD_VERSION_STRING = "7.2.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,17 +583,17 @@ public ArrayList<TLRPC.TL_peerLocated> getCachedNearbyChats() {
return cachedNearbyChats;
}

protected void addSharingLocation(long did, int mid, int period, int radius, TLRPC.Message message) {
protected void addSharingLocation(TLRPC.Message message) {
final SharingLocationInfo info = new SharingLocationInfo();
info.did = did;
info.mid = mid;
info.period = period;
info.lastSentProximityMeters = info.proximityMeters = radius;
info.did = message.dialog_id;
info.mid = message.id;
info.period = message.media.period;
info.lastSentProximityMeters = info.proximityMeters = message.media.proximity_notification_radius;
info.account = currentAccount;
info.messageObject = new MessageObject(currentAccount, message, false, false);
info.stopTime = getConnectionsManager().getCurrentTime() + period;
final SharingLocationInfo old = sharingLocationsMap.get(did);
sharingLocationsMap.put(did, info);
info.stopTime = getConnectionsManager().getCurrentTime() + info.period;
final SharingLocationInfo old = sharingLocationsMap.get(info.did);
sharingLocationsMap.put(info.did, info);
if (old != null) {
sharingLocations.remove(old);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,13 +892,13 @@ private void updateDbToLastVersion(final int currentVersion) {
version = 68;
}
if (version == 68) {
database.executeFast("ALTER TABLE messages ADD COLUMN forwards INTEGER default 0").stepThis().dispose();
executeNoException("ALTER TABLE messages ADD COLUMN forwards INTEGER default 0");
database.executeFast("PRAGMA user_version = 69").stepThis().dispose();
version = 69;
}
if (version == 69) {
database.executeFast("ALTER TABLE messages ADD COLUMN replies_data BLOB default NULL").stepThis().dispose();
database.executeFast("ALTER TABLE messages ADD COLUMN thread_reply_id INTEGER default 0").stepThis().dispose();
executeNoException("ALTER TABLE messages ADD COLUMN replies_data BLOB default NULL");
executeNoException("ALTER TABLE messages ADD COLUMN thread_reply_id INTEGER default 0");
database.executeFast("CREATE INDEX IF NOT EXISTS uid_thread_reply_id_mid_idx_messages ON messages(uid, thread_reply_id, mid) WHERE thread_reply_id != 0;").stepThis().dispose();
database.executeFast("PRAGMA user_version = 70").stepThis().dispose();
version = 70;
Expand All @@ -909,7 +909,7 @@ private void updateDbToLastVersion(final int currentVersion) {
version = 71;
}
if (version == 71) {
database.executeFast("ALTER TABLE sharing_locations ADD COLUMN proximity INTEGER default 0").stepThis().dispose();
executeNoException("ALTER TABLE sharing_locations ADD COLUMN proximity INTEGER default 0");
database.executeFast("PRAGMA user_version = 72").stepThis().dispose();
version = 72;
}
Expand All @@ -927,6 +927,14 @@ private void updateDbToLastVersion(final int currentVersion) {
});
}

private void executeNoException(String query) {
try {
database.executeFast(query).stepThis().dispose();
} catch (Exception e) {
FileLog.e(e);
}
}

private void cleanupInternal(boolean deleteFiles) {
lastDateValue = 0;
lastSeqValue = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4846,7 +4846,7 @@ protected void performSendMessageRequest(final TLObject req, final MessageObject
}

if (MessageObject.isLiveLocationMessage(newMsgObj) && newMsgObj.via_bot_id == 0 && TextUtils.isEmpty(newMsgObj.via_bot_name)) {
getLocationController().addSharingLocation(newMsgObj.dialog_id, newMsgObj.id, newMsgObj.media.period, newMsgObj.media.proximity_notification_radius, newMsgObj);
getLocationController().addSharingLocation(newMsgObj);
}

if (!isSentError) {
Expand Down Expand Up @@ -4923,7 +4923,9 @@ private void updateMediaPaths(MessageObject newMsgObj, TLRPC.Message sentMessage
TLRPC.PhotoSize strippedOld = null;
TLRPC.PhotoSize strippedNew = null;
TLObject photoObject = null;
if (newMsgObj.isDice()) {
if (newMsgObj.isLiveLocation() && sentMessage.media instanceof TLRPC.TL_messageMediaGeoLive) {
newMsg.media.period = sentMessage.media.period;
} else if (newMsgObj.isDice()) {
TLRPC.TL_messageMediaDice mediaDice = (TLRPC.TL_messageMediaDice) newMsg.media;
TLRPC.TL_messageMediaDice mediaDiceNew = (TLRPC.TL_messageMediaDice) sentMessage.media;
mediaDice.value = mediaDiceNew.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,11 @@ public static void openUrl(final Context context, Uri uri, final boolean allowCu
}

public static boolean isInternalUrl(String url, boolean[] forceBrowser) {
return isInternalUri(Uri.parse(url), forceBrowser);
return isInternalUri(Uri.parse(url), false, forceBrowser);
}

public static boolean isInternalUrl(String url, boolean all, boolean[] forceBrowser) {
return isInternalUri(Uri.parse(url), all, forceBrowser);
}

public static boolean isPassportUrl(String url) {
Expand All @@ -341,6 +345,10 @@ public static boolean isPassportUrl(String url) {
}

public static boolean isInternalUri(Uri uri, boolean[] forceBrowser) {
return isInternalUri(uri, false, forceBrowser);
}

public static boolean isInternalUri(Uri uri, boolean all, boolean[] forceBrowser) {
String host = uri.getHost();
host = host != null ? host.toLowerCase() : "";
if ("ton".equals(uri.getScheme())) {
Expand All @@ -359,6 +367,9 @@ public static boolean isInternalUri(Uri uri, boolean[] forceBrowser) {
} else if ("telegram.dog".equals(host)) {
String path = uri.getPath();
if (path != null && path.length() > 1) {
if (all) {
return true;
}
path = path.substring(1).toLowerCase();
if (path.startsWith("blog") || path.equals("iv") || path.startsWith("faq") || path.equals("apps") || path.startsWith("s/")) {
if (forceBrowser != null) {
Expand All @@ -371,6 +382,9 @@ public static boolean isInternalUri(Uri uri, boolean[] forceBrowser) {
} else if ("telegram.me".equals(host) || "t.me".equals(host)) {
String path = uri.getPath();
if (path != null && path.length() > 1) {
if (all) {
return true;
}
path = path.substring(1).toLowerCase();
if (path.equals("iv") || path.startsWith("s/")) {
if (forceBrowser != null) {
Expand All @@ -380,6 +394,10 @@ public static boolean isInternalUri(Uri uri, boolean[] forceBrowser) {
}
return true;
}
} else if (all) {
if (host.endsWith("telegram.org") || host.endsWith("telegra.ph") || host.endsWith("telesco.pe")) {
return true;
}
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,8 @@ public void onAnimationEnd(Animator animation) {
fragment.onTransitionAnimationEnd(true, false);
fragment.onBecomeFullyVisible();
};
if (!fragment.needDelayOpenAnimation()) {
boolean noDelay;
if (noDelay = !fragment.needDelayOpenAnimation()) {
if (currentFragment != null) {
currentFragment.onTransitionAnimationStart(false, false);
}
Expand Down Expand Up @@ -1105,6 +1106,12 @@ public void run() {
return;
}
waitingForKeyboardCloseRunnable = null;
if (!noDelay) {
if (currentFragment != null) {
currentFragment.onTransitionAnimationStart(false, false);
}
fragment.onTransitionAnimationStart(true, false);
}
startLayoutAnimation(true, true, preview);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,10 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
} else {
if (searchFieldCaption.getVisibility() == VISIBLE) {
measureChildWithMargins(searchFieldCaption, widthMeasureSpec, MeasureSpec.getSize(widthMeasureSpec) / 2, heightMeasureSpec, 0);
width = searchFieldCaption.getMeasuredWidth() + AndroidUtilities.dp(4);
} else {
width = 0;
}
width = 0;
int minWidth = MeasureSpec.getSize(widthMeasureSpec);
ignoreRequestLayout = true;
measureChildWithMargins(searchFilterLayout, widthMeasureSpec, width, heightMeasureSpec, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7637,7 +7637,9 @@ public static void setDrawableColor(Drawable drawable, int color) {
if (drawable == null) {
return;
}
if (drawable instanceof MsgClockDrawable) {
if (drawable instanceof StatusDrawable) {
((StatusDrawable) drawable).setColor(color);
} else if (drawable instanceof MsgClockDrawable) {
((MsgClockDrawable) drawable).setColor(color);
} else if (drawable instanceof ShapeDrawable) {
((ShapeDrawable) drawable).getPaint().setColor(color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ public void searchDialogs(String text) {
notifyDataSetChanged();
if (needMessagesSearch != 2 && delegate != null) {
delegate.searchStateChanged(true, false);
} else {
waitingResponseCount--;
}

Utilities.searchQueue.postRunnable(searchRunnable = () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void setLiveLocations(ArrayList<LocationActivity.LiveLocation> liveLocati
currentLiveLocations = new ArrayList<>(liveLocations);
int uid = UserConfig.getInstance(currentAccount).getClientUserId();
for (int a = 0; a < currentLiveLocations.size(); a++) {
if (currentLiveLocations.get(a).id == uid) {
if (currentLiveLocations.get(a).id == uid || currentLiveLocations.get(a).object.out) {
currentLiveLocations.remove(a);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -316,15 +315,15 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
}
} else if (position > searchResult.size() && un != null) {
String foundUserName = searchAdapterHelper.getLastFoundUsername();
if (foundUserName.startsWith("@")) {
if (foundUserName != null && foundUserName.startsWith("@")) {
foundUserName = foundUserName.substring(1);
}
try {
int index;
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
spannableStringBuilder.append("@");
spannableStringBuilder.append(un);
if ((index = AndroidUtilities.indexOfIgnoreCase(un, foundUserName)) != -1) {
if (foundUserName != null && (index = AndroidUtilities.indexOfIgnoreCase(un, foundUserName)) != -1) {
int len = foundUserName.length();
if (index == 0) {
len++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3600,7 +3600,12 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe
}
photoImage.setAllowStartAnimation(messageObject.gifState != 1);
currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
photoParentObject = document;
if (currentPhotoObject != null) {
photoParentObject = document;
} else if (photo != null) {
currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 90);
photoParentObject = photo;
}
if (currentPhotoObject != null && (currentPhotoObject.w == 0 || currentPhotoObject.h == 0)) {
for (int a = 0; a < document.attributes.size(); a++) {
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
Expand Down Expand Up @@ -4777,13 +4782,18 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe
if (messageObject.isDice()) {
filter = String.format(Locale.US, "%d_%d_dice_%s_%s", w, h, messageObject.getDiceEmoji(), messageObject.toString());
photoImage.setAutoRepeat(2);
TLRPC.TL_messages_stickerSet stickerSet = MediaDataController.getInstance(currentAccount).getStickerSetByEmojiOrName(currentMessageObject.getDiceEmoji());
String emoji = currentMessageObject.getDiceEmoji();
TLRPC.TL_messages_stickerSet stickerSet = MediaDataController.getInstance(currentAccount).getStickerSetByEmojiOrName(emoji);
if (stickerSet != null) {
if (stickerSet.documents.size() > 0) {
int value = currentMessageObject.getDiceValue();
if (value <= 0) {
TLRPC.Document document = stickerSet.documents.get(0);
currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 40);
if ("\uD83C\uDFB0".equals(emoji)) {
currentPhotoObjectThumb = null;
} else {
currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 40);
}
photoParentObject = document;
}
}
Expand Down
Loading

0 comments on commit 002c01e

Please sign in to comment.