Skip to content

Commit

Permalink
Merge remote-tracking branch 'official/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Jan 18, 2024
2 parents ffaf897 + 928146c commit 0d99904
Show file tree
Hide file tree
Showing 180 changed files with 12,585 additions and 3,007 deletions.
8 changes: 4 additions & 4 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import cn.hutool.core.util.RuntimeUtil
apply plugin: "com.android.application"
apply plugin: "kotlin-android"

def verName = "10.5.0"
def verCode = 1153
def verName = "10.6.1"
def verCode = 1154


def officialVer = "10.5.0"
def officialCode = 4228
def officialVer = "10.6.1"
def officialCode = 4275

def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

Expand Down
60 changes: 53 additions & 7 deletions TMessagesProj/jni/tgnet/ApiScheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1210,21 +1210,30 @@ UserStatus *UserStatus::TLdeserialize(NativeByteBuffer *stream, uint32_t constru
case 0x8c703f:
result = new TL_userStatusOffline();
break;
case 0x7bf09fc:
result = new TL_userStatusLastWeek();
break;
case 0x9d05049:
result = new TL_userStatusEmpty();
break;
case 0x77ebc742:
result = new TL_userStatusLastMonth();
break;
case 0xedb93949:
result = new TL_userStatusOnline();
break;
case 0xe26f42f1:
case 0x7b197dc8:
result = new TL_userStatusRecently();
break;
case 0x541a1d1a:
result = new TL_userStatusLastWeek();
break;
case 0x65899777:
result = new TL_userStatusLastMonth();
break;
case 0xe26f42f1:
result = new TL_userStatusRecently_layer171();
break;
case 0x7bf09fc:
result = new TL_userStatusLastWeek_layer171();
break;
case 0x77ebc742:
result = new TL_userStatusLastMonth_layer171();
break;
default:
error = true;
if (LOGS_ENABLED) DEBUG_FATAL("can't parse magic %x in UserStatus", constructor);
Expand All @@ -1243,8 +1252,19 @@ void TL_userStatusOffline::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(expires);
}

void TL_userStatusLastWeek_layer171::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}

void TL_userStatusLastWeek::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
flags = by_me ? flags | 1 : flags &~ 1;
stream->writeInt32(flags);
}

void TL_userStatusLastWeek::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
flags = stream->readInt32(&error);
by_me = (flags & 1) != 0;
}

void TL_userStatusEmpty::serializeToStream(NativeByteBuffer *stream) {
Expand All @@ -1253,6 +1273,17 @@ void TL_userStatusEmpty::serializeToStream(NativeByteBuffer *stream) {

void TL_userStatusLastMonth::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
flags = by_me ? flags | 1 : flags &~ 1;
stream->writeInt32(flags);
}

void TL_userStatusLastMonth::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
flags = stream->readInt32(&error);
by_me = (flags & 1) != 0;
}

void TL_userStatusLastMonth_layer171::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}

void TL_userStatusOnline::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
Expand All @@ -1266,6 +1297,21 @@ void TL_userStatusOnline::serializeToStream(NativeByteBuffer *stream) {

void TL_userStatusRecently::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
flags = by_me ? flags | 1 : flags &~ 1;
stream->writeInt32(flags);
}

void TL_userStatusRecently::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
flags = stream->readInt32(&error);
by_me = (flags & 1) != 0;
}

void TL_userStatusRecently_layer171::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}

void TL_userStatusHidden::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}

FileLocation *FileLocation::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
Expand Down
45 changes: 45 additions & 0 deletions TMessagesProj/jni/tgnet/ApiScheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ class TL_userStatusOffline : public UserStatus {

class TL_userStatusLastWeek : public UserStatus {

public:
static const uint32_t constructor = 0x7bf09fc;

uint32_t flags;
bool by_me;

void serializeToStream(NativeByteBuffer *stream);
void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error);
};

class TL_userStatusLastWeek_layer171 : public UserStatus {

public:
static const uint32_t constructor = 0x7bf09fc;

Expand All @@ -219,6 +231,19 @@ class TL_userStatusEmpty : public UserStatus {

class TL_userStatusLastMonth : public UserStatus {

public:
static const uint32_t constructor = 0x65899777;

uint32_t flags;
bool by_me;

void serializeToStream(NativeByteBuffer *stream);

void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error);
};

class TL_userStatusLastMonth_layer171 : public UserStatus {

public:
static const uint32_t constructor = 0x77ebc742;

Expand All @@ -236,12 +261,32 @@ class TL_userStatusOnline : public UserStatus {

class TL_userStatusRecently : public UserStatus {

public:
static const uint32_t constructor = 0x7b197dc8;

uint32_t flags;
bool by_me;

void serializeToStream(NativeByteBuffer *stream);
void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error);
};

class TL_userStatusRecently_layer171 : public UserStatus {

public:
static const uint32_t constructor = 0xe26f42f1;

void serializeToStream(NativeByteBuffer *stream);
};

class TL_userStatusHidden : public UserStatus {

public:
static const uint32_t constructor = 0xcf7d64b1;

void serializeToStream(NativeByteBuffer *stream);
};

class FileLocation : public TLObject {

public:
Expand Down
6 changes: 2 additions & 4 deletions TMessagesProj/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,13 @@

<!--<meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true" />-->

<!-- <meta-data android:name="com.google.android.gms.car.notification.SmallIcon" android:resource="@drawable/ic_player" />-->
<!-- <meta-data android:name="com.google.android.gms.car.application" android:resource="@xml/automotive_app_desc" />-->
<meta-data android:name="com.google.android.gms.car.notification.SmallIcon" android:resource="@drawable/ic_player" />
<meta-data android:name="com.google.android.gms.car.application" android:resource="@xml/automotive_app_desc" />

<!--<meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="face,barcode" />-->

<meta-data android:name="android.max_aspect" android:value="2.5" />

<meta-data android:name="com.google.android.actions" android:resource="@xml/actions" />

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.util.Log;
import android.util.LongSparseArray;
import android.view.View;
import android.view.ViewPropertyAnimator;
Expand Down Expand Up @@ -51,6 +52,7 @@ public class ChatListItemAnimator extends DefaultItemAnimator {
private ArrayList<MessageObject.GroupedMessages> willChangedGroups = new ArrayList<>();

HashMap<RecyclerView.ViewHolder,Animator> animators = new HashMap<>();
ArrayList<View> thanosViews = new ArrayList<>();

ArrayList<Runnable> runOnAnimationsEnd = new ArrayList<>();
HashMap<Long, Long> groupIdToEnterDelay = new HashMap<>();
Expand Down Expand Up @@ -925,7 +927,12 @@ public void onAnimationEnd(Animator animator) {
animator.removeAllListeners();
restoreTransitionParams(holder.itemView);
if (holder.itemView instanceof ChatMessageCell) {
MessageObject.GroupedMessages group = ((ChatMessageCell) view).getCurrentMessagesGroup();
ChatMessageCell cell = (ChatMessageCell) holder.itemView;
if (cell.makeVisibleAfterChange) {
cell.makeVisibleAfterChange = false;
cell.setVisibility(View.VISIBLE);
}
MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup();
if (group != null) {
group.transitionParams.reset();
}
Expand Down Expand Up @@ -1092,6 +1099,12 @@ private void cancelAnimators() {
animator.cancel();
}
}
if (!thanosViews.isEmpty()) {
ThanosEffect thanosEffect = getThanosEffectContainer.run();
if (thanosEffect != null) {
thanosEffect.kill();
}
}
}

@Override
Expand All @@ -1100,6 +1113,12 @@ public void endAnimation(RecyclerView.ViewHolder item) {
if (animator != null) {
animator.cancel();
}
if (thanosViews.contains(item.itemView)) {
ThanosEffect thanosEffect = getThanosEffectContainer.run();
if (thanosEffect != null) {
thanosEffect.cancel(item.itemView);
}
}
super.endAnimation(item);
restoreTransitionParams(item.itemView);
}
Expand Down Expand Up @@ -1230,6 +1249,12 @@ protected boolean endChangeAnimationIfNecessary(ChangeInfo changeInfo, RecyclerV
if (a != null) {
a.cancel();
}
if (thanosViews.contains(item.itemView)) {
ThanosEffect thanosEffect = getThanosEffectContainer.run();
if (thanosEffect != null) {
thanosEffect.cancel(item.itemView);
}
}

boolean oldItem = false;
if (changeInfo.newHolder == item) {
Expand Down Expand Up @@ -1447,7 +1472,9 @@ protected void animateRemoveImpl(final RecyclerView.ViewHolder holder, boolean t
dispatchRemoveFinished(holder);
dispatchFinishedWhenDone();
}
thanosViews.remove(view);
});
thanosViews.add(view);
} else {
ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.ALPHA, view.getAlpha(), 0f);
dispatchRemoveStarting(holder);
Expand Down Expand Up @@ -1497,7 +1524,9 @@ private void animateRemoveGroupImpl(final ArrayList<RecyclerView.ViewHolder> hol
}
dispatchFinishedWhenDone();
}
thanosViews.removeAll(views);
});
thanosViews.add(views.get(0));
recyclerListView.stopScroll();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
import android.graphics.Rect;
import android.view.View;

import com.google.android.exoplayer2.util.Log;

import org.telegram.ui.Cells.ChatMessageCell;

import java.util.ArrayList;
import java.util.Arrays;

Expand Down Expand Up @@ -68,8 +72,9 @@ protected void recycleViewsFromStart(RecyclerView.Recycler recycler, int scrolli
} else {
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (mOrientationHelper.getDecoratedEnd(child) > scrollingOffset
|| mOrientationHelper.getTransformedEndWithDecoration(child) > scrollingOffset) {
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
if (child.getBottom() + params.bottomMargin > scrollingOffset
|| child.getTop() + child.getHeight() > scrollingOffset) {
// stop here
recycleChildren(recycler, 0, i);
return;
Expand Down Expand Up @@ -115,12 +120,15 @@ void layoutChunk(RecyclerView.Recycler recycler, RecyclerView.State state, Layou
final int otherDirSpecMode = mOrientationHelper.getModeInOther();

final boolean layingOutInPrimaryDirection = layoutState.mItemDirection == LayoutState.ITEM_DIRECTION_TAIL;
boolean working = true;
result.mConsumed = 0;
int yOffset = 0;

int startPosition = layoutState.mCurrentPosition;
if (layoutState.mLayoutDirection != LayoutState.LAYOUT_START && hasSiblingChild(layoutState.mCurrentPosition) && findViewByPosition(layoutState.mCurrentPosition + 1) == null) {
if (
mShouldReverseLayout &&
layoutState.mLayoutDirection != LayoutState.LAYOUT_START &&
hasSiblingChild(layoutState.mCurrentPosition) &&
findViewByPosition(layoutState.mCurrentPosition + 1) == null
) {
if (hasSiblingChild(layoutState.mCurrentPosition + 1)) {
layoutState.mCurrentPosition += 3;
} else {
Expand All @@ -144,18 +152,14 @@ void layoutChunk(RecyclerView.Recycler recycler, RecyclerView.State state, Layou
layoutState.mCurrentPosition = backupPosition;
}

boolean working = true;
while (working) {
int count = 0;
int consumedSpanCount = 0;
int remainingSpan = mSpanCount;

working = !additionalViews.isEmpty();
int firstPositionStart = layoutState.mCurrentPosition;

while (count < mSpanCount && layoutState.hasMore(state) && remainingSpan > 0) {
int pos = layoutState.mCurrentPosition;
final int spanSize = getSpanSize(recycler, state, pos);

remainingSpan -= spanSize;
if (remainingSpan < 0) {
break;
Expand All @@ -171,7 +175,6 @@ void layoutChunk(RecyclerView.Recycler recycler, RecyclerView.State state, Layou
if (view == null) {
break;
}
consumedSpanCount += spanSize;
mSet[count] = view;
count++;
if (layoutState.mLayoutDirection == LayoutState.LAYOUT_START && remainingSpan <= 0 && hasSiblingChild(pos)) {
Expand Down Expand Up @@ -236,9 +239,11 @@ void layoutChunk(RecyclerView.Recycler recycler, RecyclerView.State state, Layou
}

int left, right, top, bottom;

boolean fromOpositeSide = shouldLayoutChildFromOpositeSide(mSet[0]);
if (fromOpositeSide && layoutState.mLayoutDirection == LayoutState.LAYOUT_START || !fromOpositeSide && layoutState.mLayoutDirection == LayoutState.LAYOUT_END) {
boolean fromOppositeSide = shouldLayoutChildFromOpositeSide(mSet[0]);
if (
fromOppositeSide && layoutState.mLayoutDirection == LayoutState.LAYOUT_START ||
!fromOppositeSide && layoutState.mLayoutDirection == LayoutState.LAYOUT_END
) {
if (layoutState.mLayoutDirection == LayoutState.LAYOUT_START) {
bottom = layoutState.mOffset - result.mConsumed;
top = bottom - maxSize;
Expand Down Expand Up @@ -284,7 +289,7 @@ void layoutChunk(RecyclerView.Recycler recycler, RecyclerView.State state, Layou
left -= right;
}
layoutDecoratedWithMargins(view, left, top, left + right, bottom);
if (layoutState.mLayoutDirection != LayoutState.LAYOUT_START) {
if (layoutState.mLayoutDirection == LayoutState.LAYOUT_END) {
left += right;
}
if (params.isItemRemoved() || params.isItemChanged()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import android.os.SystemClock;

import com.google.android.exoplayer2.util.Log;

import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import org.telegram.tgnet.NativeByteBuffer;
Expand Down
Loading

0 comments on commit 0d99904

Please sign in to comment.