Skip to content

Commit

Permalink
update to 10.10.1 (4583)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaraush committed Apr 1, 2024
1 parent 3a822b1 commit a906f12
Show file tree
Hide file tree
Showing 66 changed files with 780 additions and 298 deletions.
Expand Up @@ -1490,6 +1490,13 @@ public static int migrate(MessagesStorage messagesStorage, int version) throws E
version = 151;
}

if (version == 151) {
database.executeFast("ALTER TABLE profile_stories ADD COLUMN seen INTEGER default 0;").stepThis().dispose();

database.executeFast("PRAGMA user_version = 152").stepThis().dispose();
version = 152;
}

return version;
}

Expand Down
Expand Up @@ -673,7 +673,7 @@ private void startUploadRequest() {
}
}), forceSmallFile ? ConnectionsManager.RequestFlagCanCompress : 0, ConnectionsManager.DEFAULT_DATACENTER_ID, connectionType, true);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("debug_uploading: " + " send reqId " + requestToken[0] + " " + uploadingFilePath);
FileLog.d("debug_uploading: " + " send reqId " + requestToken[0] + " " + uploadingFilePath + " file_part=" + currentRequestPartNum + " isBig=" + isBigFile + " file_id=" + currentFileId);
}
requestTokens.put(requestNumFinal, requestToken[0]);
}
Expand Down
Expand Up @@ -3836,8 +3836,8 @@ public void requestAudioFocus(boolean request) {
}
}

public void prepareResumedRecording(int currentAccount, MediaDataController.DraftVoice draft, long dialogId, MessageObject replyToMsg, MessageObject replyToTopMsg, TL_stories.StoryItem replyStory, int guid, boolean manual, String query_shortcut, int query_shortcut_id) {
manualRecording = manual;
public void prepareResumedRecording(int currentAccount, MediaDataController.DraftVoice draft, long dialogId, MessageObject replyToMsg, MessageObject replyToTopMsg, TL_stories.StoryItem replyStory, int guid, String query_shortcut, int query_shortcut_id) {
manualRecording = false;
requestAudioFocus(true);
recordQueue.cancelRunnable(recordStartRunnable);
recordQueue.postRunnable(() -> {
Expand Down Expand Up @@ -4151,6 +4151,22 @@ public void generateWaveform(MessageObject messageObject) {
});
}

public void cleanRecording(boolean delete) {
recordingAudio = null;
AutoDeleteMediaTask.unlockFile(recordingAudioFile);
if (delete && recordingAudioFile != null) {
try {
recordingAudioFile.delete();
} catch (Exception e) {
FileLog.e(e);
}
}
recordingAudioFile = null;
manualRecording = false;
raiseToEarRecord = false;
ignoreOnPause = false;
}

private void stopRecordingInternal(final int send, boolean notify, int scheduleDate, boolean once) {
if (send != 0) {
final TLRPC.TL_document audioToSend = recordingAudio;
Expand Down
Expand Up @@ -242,7 +242,7 @@ public ChatlistUpdatesStat(TL_chatlists.TL_chatlists_chatlistUpdates value) {
public boolean dialogFiltersLoaded;
public ArrayList<TLRPC.TL_dialogFilterSuggested> suggestedFilters = new ArrayList<>();

private LongSparseArray<ArrayList<TLRPC.Updates>> updatesQueueChannels = new LongSparseArray<>();
private final LongSparseArray<ArrayList<TLRPC.Updates>> updatesQueueChannels = new LongSparseArray<>();
private LongSparseLongArray updatesStartWaitTimeChannels = new LongSparseLongArray();
private LongSparseIntArray channelsPts = new LongSparseIntArray();
private LongSparseArray<Boolean> gettingDifferenceChannels = new LongSparseArray<>();
Expand Down Expand Up @@ -13485,9 +13485,11 @@ public void addUserToChat(
});
return;
}
if (processInvitedUsers != null) {
processInvitedUsers.run(null);
}
AndroidUtilities.runOnUIThread(() -> {
if (processInvitedUsers != null) {
processInvitedUsers.run(null);
}
});
if ("USER_ALREADY_PARTICIPANT".equals(error.text) && ignoreIfAlreadyExists) {
if (onFinishRunnable != null) {
AndroidUtilities.runOnUIThread(onFinishRunnable);
Expand Down Expand Up @@ -13523,9 +13525,11 @@ public void addUserToChat(
updates = (TLRPC.Updates) response;
} else {
FileLog.e("unexpected " + response + " in addUserToChat");
if (processInvitedUsers != null) {
processInvitedUsers.run(null);
}
AndroidUtilities.runOnUIThread(() -> {
if (processInvitedUsers != null) {
processInvitedUsers.run(null);
}
});
return;
}
for (int a = 0; a < updates.updates.size(); a++) {
Expand Down
Expand Up @@ -104,7 +104,7 @@ public class MessagesStorage extends BaseController {
}
}

public final static int LAST_DB_VERSION = 151;
public final static int LAST_DB_VERSION = 152;
private boolean databaseMigrationInProgress;
public boolean showClearDatabaseAlert;
private LongSparseIntArray dialogIsForum = new LongSparseIntArray();
Expand Down Expand Up @@ -698,7 +698,7 @@ public static void createTables(SQLiteDatabase database) throws SQLiteException
database.executeFast("CREATE TABLE stories (dialog_id INTEGER, story_id INTEGER, data BLOB, custom_params BLOB, PRIMARY KEY (dialog_id, story_id));").stepThis().dispose();
database.executeFast("CREATE TABLE stories_counter (dialog_id INTEGER PRIMARY KEY, count INTEGER, max_read INTEGER);").stepThis().dispose();

database.executeFast("CREATE TABLE profile_stories (dialog_id INTEGER, story_id INTEGER, data BLOB, type INTEGER, PRIMARY KEY(dialog_id, story_id));").stepThis().dispose();
database.executeFast("CREATE TABLE profile_stories (dialog_id INTEGER, story_id INTEGER, data BLOB, type INTEGER, seen INTEGER, PRIMARY KEY(dialog_id, story_id));").stepThis().dispose();

database.executeFast("CREATE TABLE story_drafts (id INTEGER PRIMARY KEY, date INTEGER, data BLOB, type INTEGER);").stepThis().dispose();

Expand Down
30 changes: 15 additions & 15 deletions TMessagesProj/src/main/java/org/telegram/messenger/SegmentTree.java
Expand Up @@ -3,9 +3,9 @@
public class SegmentTree {

private Node[] heap;
private int[] array;
private long[] array;

public SegmentTree(int[] array) {
public SegmentTree(long[] array) {
this.array = array;
if (array.length < 30) {
return;
Expand Down Expand Up @@ -37,9 +37,9 @@ private void build(int v, int from, int size) {
}
}

public int rMaxQ(int from, int to) {
public long rMaxQ(int from, int to) {
if (array.length < 30) {
int max = Integer.MIN_VALUE;
long max = Long.MIN_VALUE;
if (from < 0) from = 0;
if (to > array.length - 1) to = array.length - 1;
for (int i = from; i <= to; i++) {
Expand All @@ -50,7 +50,7 @@ public int rMaxQ(int from, int to) {
return rMaxQ(1, from, to);
}

private int rMaxQ(int v, int from, int to) {
private long rMaxQ(int v, int from, int to) {
Node n = heap[v];
//If you did a range update that contained this node, you can infer the Min value without going down the tree
if (n.pendingVal != null && contains(n.from, n.to, from, to)) {
Expand All @@ -63,18 +63,18 @@ private int rMaxQ(int v, int from, int to) {

if (intersects(from, to, n.from, n.to)) {
propagate(v);
int leftMin = rMaxQ(2 * v, from, to);
int rightMin = rMaxQ(2 * v + 1, from, to);
final long leftMin = rMaxQ(2 * v, from, to);
final long rightMin = rMaxQ(2 * v + 1, from, to);

return Math.max(leftMin, rightMin);
}

return 0;
}

public int rMinQ(int from, int to) {
public long rMinQ(int from, int to) {
if (array.length < 30) {
int min = Integer.MAX_VALUE;
long min = Long.MAX_VALUE;
if (from < 0) from = 0;
if (to > array.length - 1) to = array.length - 1;
for (int i = from; i <= to; i++) {
Expand All @@ -85,7 +85,7 @@ public int rMinQ(int from, int to) {
return rMinQ(1, from, to);
}

private int rMinQ(int v, int from, int to) {
private long rMinQ(int v, int from, int to) {
Node n = heap[v];
//If you did a range update that contained this node, you can infer the Min value without going down the tree
if (n.pendingVal != null && contains(n.from, n.to, from, to)) {
Expand All @@ -98,8 +98,8 @@ private int rMinQ(int v, int from, int to) {

if (intersects(from, to, n.from, n.to)) {
propagate(v);
int leftMin = rMinQ(2 * v, from, to);
int rightMin = rMinQ(2 * v + 1, from, to);
long leftMin = rMinQ(2 * v, from, to);
long rightMin = rMinQ(2 * v + 1, from, to);

return Math.min(leftMin, rightMin);
}
Expand Down Expand Up @@ -136,9 +136,9 @@ private boolean intersects(int from1, int to1, int from2, int to2) {
}

static class Node {
int sum;
int max;
int min;
long sum;
long max;
long min;

Integer pendingVal = null;
int from;
Expand Down
Expand Up @@ -445,6 +445,9 @@ private void setupMatrix(VideoEditedInfo.MediaEntity entity) {
if (bitmap != null) {
entity.matrix.postScale(1f / bitmap.getWidth(), 1f / bitmap.getHeight());
}
if ((entity.subType & 2) != 0) {
entity.matrix.postScale(-1, 1, .5f, .5f);
}
entity.matrix.postScale(entity.width * W, entity.height * H);
entity.matrix.postTranslate(entity.x * W, entity.y * H);
entity.matrix.postRotate((float) (-entity.rotation / Math.PI * 180), (entity.x + entity.width) * W, (entity.x + entity.height) * H);
Expand Down
22 changes: 22 additions & 0 deletions TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stories.java
Expand Up @@ -1128,6 +1128,28 @@ public void serializeToStream(AbstractSerializedData stream) {
}
}

public static class TL_stories_incrementStoryViews extends TLObject {
public static final int constructor = 0xb2028afb;

public TLRPC.InputPeer peer;
public ArrayList<Integer> id = new ArrayList<>();

public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return TLRPC.Bool.TLdeserialize(stream, constructor, exception);
}

public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
peer.serializeToStream(stream);
stream.writeInt32(0x1cb5c415);
int count = id.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
stream.writeInt32(id.get(a));
}
}
}

public static class TL_stories_getStoryViewsList extends TLObject {
public static final int constructor = 0x7ed23c57;

Expand Down
Expand Up @@ -1945,6 +1945,13 @@ public void showSubItem(int id, boolean animated) {
}
}

public void setSubItemShown(int id, boolean show) {
if (show)
showSubItem(id);
else
hideSubItem(id);
}

public int getVisibleSubItemsCount() {
int count = 0;
for (int i = 0; i < popupLayout.getItemsCount(); ++i) {
Expand Down
Expand Up @@ -167,7 +167,8 @@ public void set(final BaseFragment fragment, int currentAccount) {
noButton.setOnClickListener(v -> {
noButton.setLoading(true);
MessagesController.getInstance(currentAccount).getUnconfirmedAuthController().deny(auths, success -> {
showLoginPreventedSheet(success);
if (LaunchActivity.isActive)
showLoginPreventedSheet(success);
noButton.setLoading(false);
MessagesController.getInstance(currentAccount).getUnconfirmedAuthController().cleanup();
});
Expand Down
Expand Up @@ -374,7 +374,7 @@ private void setBalance(long crypto_amount, long amount) {
formatter.setGroupingUsed(false);
}
formatter.setMaximumFractionDigits(crypto_amount / 1_000_000_000.0 > 1.5 ? 2 : 6);
SpannableStringBuilder ssb = new SpannableStringBuilder(replaceTON("TON " + formatter.format(crypto_amount / 1_000_000_000.0), balanceTitle.getPaint()));
SpannableStringBuilder ssb = new SpannableStringBuilder(replaceTON("TON " + formatter.format(crypto_amount / 1_000_000_000.0), balanceTitle.getPaint(), .9f, true));
int index = TextUtils.indexOf(ssb, ".");
if (index >= 0) {
ssb.setSpan(balanceTitleSizeSpan, index, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
Expand Down Expand Up @@ -491,7 +491,7 @@ private void fillItems(ArrayList<UItem> items, UniversalAdapter adapter) {
}
items.add(UItem.asCenterShadow(titleInfo));
if (impressionsChart != null && !impressionsChart.isEmpty) {
items.add(UItem.asChart(StatisticActivity.VIEW_TYPE_LINEAR, stats_dc, impressionsChart));
items.add(UItem.asChart(StatisticActivity.VIEW_TYPE_BAR_LINEAR, stats_dc, impressionsChart));
items.add(UItem.asShadow(-1, null));
}
if (revenueChart != null && !revenueChart.isEmpty) {
Expand Down Expand Up @@ -557,10 +557,10 @@ private void onClick(UItem item, View view, int position, float x, float y) {
private void loadTransactions() {
if (loadingTransactions) return;
if (transactions.size() >= transactionsTotalCount && transactionsTotalCount != 0) return;
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId);
if (chat == null || !chat.creator) {
return;
}
// TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId);
// if (chat == null || !chat.creator) {
// return;
// }

loadingTransactions = true;
TL_stats.TL_getBroadcastRevenueTransactions req = new TL_stats.TL_getBroadcastRevenueTransactions();
Expand Down Expand Up @@ -608,25 +608,33 @@ private boolean onLongClick(UItem item, View view, int position, float x, float
public static CharSequence replaceTON(CharSequence text, TextPaint textPaint) {
return replaceTON(text, textPaint, 1f, true);
}
public static CharSequence replaceTON(CharSequence text, TextPaint textPaint, boolean animated) {
return replaceTON(text, textPaint, 1f, animated);
public static CharSequence replaceTON(CharSequence text, TextPaint textPaint, boolean large) {
return replaceTON(text, textPaint, 1f, large);
}
public static CharSequence replaceTON(CharSequence text, TextPaint textPaint, float scale, boolean animated) {

public static CharSequence replaceTON(CharSequence text, TextPaint textPaint, float scale, boolean large) {
return replaceTON(text, textPaint, scale, 0, large);
}

public static CharSequence replaceTON(CharSequence text, TextPaint textPaint, float scale, float translateY, boolean large) {
if (ChannelMonetizationLayout.tonString == null) {
ChannelMonetizationLayout.tonString = new HashMap<>();
}
final int key = textPaint.getFontMetricsInt().bottom * (animated ? 1 : -1);
final int key = textPaint.getFontMetricsInt().bottom * (large ? 1 : -1) * (int) (100 * scale);
SpannableString tonString = ChannelMonetizationLayout.tonString.get(key);
if (tonString == null) {
tonString = new SpannableString("T");
if (animated) {
AnimatedEmojiSpan span = new AnimatedEmojiSpan(DIAMOND_EMOJI, scale, textPaint.getFontMetricsInt());
span.emoji = "💎";
span.cacheType = AnimatedEmojiDrawable.CACHE_TYPE_STANDARD_EMOJI;
if (large) {
ColoredImageSpan span = new ColoredImageSpan(R.drawable.ton);
span.setScale(scale, scale);
span.setColorKey(Theme.key_windowBackgroundWhiteBlueText2);
span.setRelativeSize(textPaint.getFontMetricsInt());
span.spaceScaleX = .9f;
tonString.setSpan(span, 0, tonString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} else {
ColoredImageSpan span = new ColoredImageSpan(R.drawable.mini_ton);
span.setTranslateY(-dp(.66f));
span.setScale(scale, scale);
span.setTranslateY(translateY);
span.spaceScaleX = .95f;
tonString.setSpan(span, 0, tonString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
Expand Down Expand Up @@ -1088,9 +1096,11 @@ private void showLearnSheet() {
textView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider));
SpannableString animatedDiamond = new SpannableString("💎");
AnimatedEmojiSpan span = new AnimatedEmojiSpan(DIAMOND_EMOJI, .98f, textView.getPaint().getFontMetricsInt());
span.emoji = "💎";
span.cacheType = AnimatedEmojiDrawable.CACHE_TYPE_ALERT_STANDARD_EMOJI;
ColoredImageSpan span = new ColoredImageSpan(R.drawable.ton);
span.setScale(.9f, .9f);
span.setColorKey(Theme.key_windowBackgroundWhiteBlueText2);
span.setRelativeSize(textView.getPaint().getFontMetricsInt());
span.spaceScaleX = .9f;
animatedDiamond.setSpan(span, 0, animatedDiamond.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(AndroidUtilities.replaceCharSequence("💎", getString(R.string.MonetizationInfoTONTitle), animatedDiamond));
layout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 8, 20, 8, 0));
Expand Down
Expand Up @@ -66,7 +66,7 @@ protected void drawChart(Canvas canvas) {
} else {
p = chartData.xPercentage[1] * fullWidth;
}
int[] y = line.line.y;
final long[] y = line.line.y;
int j = 0;

float selectedX = 0f;
Expand Down Expand Up @@ -148,7 +148,7 @@ protected void drawPickerChart(Canvas canvas) {
} else {
p = chartData.xPercentage[1] * pickerWidth;
}
int[] y = line.line.y;
final long[] y = line.line.y;

float a = line.alpha;

Expand Down

0 comments on commit a906f12

Please sign in to comment.