Skip to content

Commit 9fea726

Browse files
committed
update to 12.7.3 (6750)
1 parent f1ff624 commit 9fea726

43 files changed

Lines changed: 2411 additions & 463 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎TMessagesProj/jni/voip/tgcalls/group/GroupInstanceCustomImpl.cpp‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -644,21 +644,25 @@ class VideoSinkImpl : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
644644
virtual void OnFrame(const webrtc::VideoFrame& frame) override {
645645
std::unique_lock<std::mutex> lock{ _mutex };
646646
int64_t timestamp = rtc::TimeMillis();
647-
if (_lastFrame) {
648-
if (_lastFrame->video_frame_buffer()->width() != frame.video_frame_buffer()->width()) {
647+
const int width = frame.video_frame_buffer()->width();
648+
const int height = frame.video_frame_buffer()->height();
649+
if (_hasLastFrameSize) {
650+
if (_lastFrameWidth != width) {
649651
int64_t deltaTime = std::abs(_lastFrameSizeChangeTimestamp - timestamp);
650652
if (deltaTime < 200) {
651-
RTC_LOG(LS_WARNING) << "VideoSinkImpl: frequent frame size change detected for " << _endpointId << ": " << _lastFrameSizeChangeHeight << " -> " << _lastFrame->video_frame_buffer()->height() << " -> " << frame.video_frame_buffer()->height() << " in " << deltaTime << " ms";
653+
RTC_LOG(LS_WARNING) << "VideoSinkImpl: frequent frame size change detected for " << _endpointId << ": " << _lastFrameSizeChangeHeight << " -> " << _lastFrameHeight << " -> " << height << " in " << deltaTime << " ms";
652654
}
653655

654-
_lastFrameSizeChangeHeight = _lastFrame->video_frame_buffer()->height();
656+
_lastFrameSizeChangeHeight = _lastFrameHeight;
655657
_lastFrameSizeChangeTimestamp = timestamp;
656658
}
657659
} else {
658660
_lastFrameSizeChangeHeight = 0;
659661
_lastFrameSizeChangeTimestamp = timestamp;
660662
}
661-
_lastFrame = frame;
663+
_lastFrameWidth = width;
664+
_lastFrameHeight = height;
665+
_hasLastFrameSize = true;
662666
for (int i = (int)(_sinks.size()) - 1; i >= 0; i--) {
663667
auto strong = _sinks[i].lock();
664668
if (!strong) {
@@ -685,9 +689,6 @@ class VideoSinkImpl : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
685689
if (const auto strong = impl.lock()) {
686690
std::unique_lock<std::mutex> lock{ _mutex };
687691
_sinks.push_back(impl);
688-
if (_lastFrame) {
689-
strong->OnFrame(_lastFrame.value());
690-
}
691692
}
692693
}
693694

@@ -697,7 +698,9 @@ class VideoSinkImpl : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
697698

698699
private:
699700
std::vector<std::weak_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>>> _sinks;
700-
absl::optional<webrtc::VideoFrame> _lastFrame;
701+
bool _hasLastFrameSize = false;
702+
int _lastFrameWidth = 0;
703+
int _lastFrameHeight = 0;
701704
std::mutex _mutex;
702705
int64_t _lastFrameSizeChangeTimestamp = 0;
703706
int _lastFrameSizeChangeHeight = 0;

‎TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ public static void loadConfig() {
595595
nextMediaTap = preferences.getBoolean("next_media_on_tap", true);
596596
recordViaSco = preferences.getBoolean("record_via_sco", false);
597597
customTabs = preferences.getBoolean("custom_tabs", true);
598-
inappBrowser = preferences.getBoolean("inapp_browser", true);
598+
inappBrowser = preferences.getBoolean("inapp_browser", false);
599599
adaptableColorInBrowser = preferences.getBoolean("adaptableBrowser", false);
600600
onlyLocalInstantView = preferences.getBoolean("onlyLocalInstantView", BuildVars.DEBUG_PRIVATE_VERSION);
601601
directShare = preferences.getBoolean("direct_share", true);

‎TMessagesProj/src/main/java/org/telegram/messenger/browser/Browser.java‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ public static void openUrl(final Context context, Uri uri, boolean _allowCustom,
379379
.appendQueryParameter("autologin_token", autologin_token)
380380
.build();
381381
}
382-
if (allowCustom && !SharedConfig.inappBrowser && SharedConfig.customTabs && !internalUri && !scheme.equals("tel") && !isTonsite(uri.toString())) {
382+
if (allowCustom && !(SharedConfig.inappBrowser || isInstantViewOpen()) && SharedConfig.customTabs && !internalUri && !scheme.equals("tel") && !isTonsite(uri.toString())) {
383383
if (forceBrowser[0] || !openInExternalApp(context, uri.toString(), false) || !hasAppToOpen(context, uri.toString())) {
384384
if (MessagesController.getInstance(currentAccount).authDomains.contains(host)) {
385385
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
@@ -413,7 +413,7 @@ public static void openUrl(final Context context, Uri uri, boolean _allowCustom,
413413
try {
414414
final boolean inappBrowser = (
415415
allowInAppBrowser && BubbleActivity.instance == null &&
416-
SharedConfig.inappBrowser &&
416+
(SharedConfig.inappBrowser || isInstantViewOpen()) &&
417417
TextUtils.isEmpty(browserPackage) &&
418418
!RestrictedDomainsList.getInstance().isRestricted(AndroidUtilities.getHostAuthority(uri, true)) &&
419419
(uri.getScheme() == null || "https".equals(uri.getScheme()) || "http".equals(uri.getScheme()) || "tonsite".equals(uri.getScheme()))
@@ -475,6 +475,16 @@ public static boolean openAsInternalIntent(Context context, String url, boolean
475475
return true;
476476
}
477477

478+
public static boolean isInstantViewOpen() {
479+
BaseFragment fragment = LaunchActivity.getSafeLastFragment();
480+
if (fragment != null && fragment.getParentLayout() instanceof ActionBarLayout) {
481+
BaseFragment sheetFragment = ((ActionBarLayout) fragment.getParentLayout()).getSheetFragment();
482+
if (sheetFragment != null && sheetFragment.getArticleViewer() != null)
483+
return true;
484+
}
485+
return fragment != null && fragment.getArticleViewer() != null;
486+
}
487+
478488
public static boolean openInTelegramBrowser(Context context, String url, Browser.Progress progress) {
479489
if (LaunchActivity.instance != null) {
480490
BottomSheetTabs tabs = LaunchActivity.instance.getBottomSheetTabs();
@@ -483,12 +493,14 @@ public static boolean openInTelegramBrowser(Context context, String url, Browser
483493
}
484494
}
485495
BaseFragment fragment = LaunchActivity.getSafeLastFragment();
496+
if (fragment != null && fragment.getArticleViewer() != null) {
497+
fragment.getArticleViewer().open(url, progress);
498+
return true;
499+
}
486500
if (fragment != null && fragment.getParentLayout() instanceof ActionBarLayout) {
487501
fragment = ((ActionBarLayout) fragment.getParentLayout()).getSheetFragment();
488502
}
489-
if (fragment == null) {
490-
return false;
491-
}
503+
if (fragment == null) return false;
492504
fragment.createArticleViewer(false).open(url, progress);
493505
return true;
494506
}

‎TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,23 @@ public StoryViewer createOverlayStoryViewer() {
13511351
return storyViewer;
13521352
}
13531353

1354+
public ArticleViewer getArticleViewer() {
1355+
if (getLastSheet() instanceof ArticleViewer.Sheet && getLastSheet().isShown()) {
1356+
return ((ArticleViewer.Sheet) getLastSheet()).getArticleViewer();
1357+
}
1358+
if (
1359+
parentLayout instanceof ActionBarLayout &&
1360+
((ActionBarLayout) parentLayout).getSheetFragment(false) != null &&
1361+
((ActionBarLayout) parentLayout).getSheetFragment(false).getLastSheet() instanceof ArticleViewer.Sheet
1362+
) {
1363+
ArticleViewer.Sheet lastSheet = (ArticleViewer.Sheet) ((ActionBarLayout) parentLayout).getSheetFragment(false).getLastSheet();
1364+
if (lastSheet.isShown()) {
1365+
return lastSheet.getArticleViewer();
1366+
}
1367+
}
1368+
return null;
1369+
}
1370+
13541371
public ArticleViewer createArticleViewer(boolean forceRecreate) {
13551372
if (sheetsStack == null) {
13561373
sheetsStack = new ArrayList<>();

‎TMessagesProj/src/main/java/org/telegram/ui/CallLogActivity.java‎

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import org.telegram.ui.ActionBar.ActionBarMenuItem;
5959
import org.telegram.ui.ActionBar.AlertDialog;
6060
import org.telegram.ui.ActionBar.BackDrawable;
61+
import org.telegram.messenger.AccountInstance;
6162
import org.telegram.ui.ActionBar.BaseFragment;
6263
import org.telegram.ui.ActionBar.BottomSheet;
6364
import org.telegram.ui.ActionBar.Theme;
@@ -1886,38 +1887,43 @@ protected void onSend(LongSparseArray<TLRPC.Dialog> dids, int count, TLRPC.TL_fo
18861887
}
18871888

18881889
private void openCreateCall() {
1890+
openCreateCall(this);
1891+
}
1892+
1893+
public static void openCreateCall(BaseFragment parent) {
18891894
Bundle args = new Bundle();
18901895
args.putBoolean("isCall", true);
1896+
final int account = parent.getCurrentAccount();
18911897
final GroupCreateActivity fragment = new GroupCreateActivity(args) {
18921898
@Override
18931899
protected void onCallUsersSelected(HashSet<Long> users, boolean video) {
18941900
if (users.size() == 1) {
1895-
final TLRPC.User user = getMessagesController().getUser(users.iterator().next());
1896-
TLRPC.UserFull userFull = getMessagesController().getUserFull(user.id);
1901+
final TLRPC.User user = MessagesController.getInstance(account).getUser(users.iterator().next());
1902+
TLRPC.UserFull userFull = MessagesController.getInstance(account).getUserFull(user.id);
18971903
if (userFull == null) {
18981904
final TLRPC.TL_users_getFullUser req = new TLRPC.TL_users_getFullUser();
1899-
req.id = getMessagesController().getInputUser(user.id);
1900-
getConnectionsManager().sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
1905+
req.id = MessagesController.getInstance(account).getInputUser(user.id);
1906+
ConnectionsManager.getInstance(account).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
19011907
TLRPC.UserFull newUserFull = null;
19021908
if (res instanceof TLRPC.TL_users_userFull) {
19031909
final TLRPC.TL_users_userFull r = (TLRPC.TL_users_userFull) res;
1904-
MessagesController.getInstance(CallLogActivity.this.currentAccount).putUsers(r.users, false);
1905-
MessagesController.getInstance(CallLogActivity.this.currentAccount).putChats(r.chats, false);
1910+
MessagesController.getInstance(account).putUsers(r.users, false);
1911+
MessagesController.getInstance(account).putChats(r.chats, false);
19061912
newUserFull = r.full_user;
19071913
}
1908-
VoIPHelper.startCall(lastCallUser = user, video, newUserFull != null && newUserFull.video_calls_available, getParentActivity(), newUserFull, getAccountInstance());
1914+
VoIPHelper.startCall(user, video, newUserFull != null && newUserFull.video_calls_available, getParentActivity(), newUserFull, AccountInstance.getInstance(account));
19091915
}));
19101916
return;
19111917
}
1912-
VoIPHelper.startCall(lastCallUser = user, video, userFull != null && userFull.video_calls_available, getParentActivity(), userFull, getAccountInstance());
1918+
VoIPHelper.startCall(user, video, userFull != null && userFull.video_calls_available, getParentActivity(), userFull, AccountInstance.getInstance(account));
19131919
} else {
19141920
final TL_phone.createConferenceCall req = new TL_phone.createConferenceCall();
19151921
req.random_id = Utilities.random.nextInt();
1916-
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
1922+
ConnectionsManager.getInstance(account).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
19171923
if (res instanceof TLRPC.Updates) {
19181924
final TLRPC.Updates updates = (TLRPC.Updates) res;
1919-
MessagesController.getInstance(currentAccount).putUsers(updates.users, false);
1920-
MessagesController.getInstance(currentAccount).putChats(updates.chats, false);
1925+
MessagesController.getInstance(account).putUsers(updates.users, false);
1926+
MessagesController.getInstance(account).putChats(updates.chats, false);
19211927

19221928
TLRPC.GroupCall groupCall = null;
19231929
for (TLRPC.TL_updateGroupCall u : findUpdatesAndRemove(updates, TLRPC.TL_updateGroupCall.class)) {
@@ -1931,29 +1937,29 @@ protected void onCallUsersSelected(HashSet<Long> users, boolean video) {
19311937
final TLRPC.TL_inputGroupCall inputGroupCall = new TLRPC.TL_inputGroupCall();
19321938
inputGroupCall.id = groupCall.id;
19331939
inputGroupCall.access_hash = groupCall.access_hash;
1934-
VoIPHelper.joinConference(LaunchActivity.instance, currentAccount, inputGroupCall, video, groupCall, users);
1940+
VoIPHelper.joinConference(LaunchActivity.instance, account, inputGroupCall, video, groupCall, users);
19351941
}
19361942
} else if (res instanceof TL_phone.groupCall) {
19371943
final TL_phone.groupCall r = (TL_phone.groupCall) res;
1938-
MessagesController.getInstance(currentAccount).putUsers(r.users, false);
1939-
MessagesController.getInstance(currentAccount).putChats(r.chats, false);
1944+
MessagesController.getInstance(account).putUsers(r.users, false);
1945+
MessagesController.getInstance(account).putChats(r.chats, false);
19401946
if (LaunchActivity.instance == null) {
19411947
return;
19421948
}
19431949
final TLRPC.TL_inputGroupCall inputGroupCall = new TLRPC.TL_inputGroupCall();
19441950
inputGroupCall.id = r.call.id;
19451951
inputGroupCall.access_hash = r.call.access_hash;
1946-
VoIPHelper.joinConference(LaunchActivity.instance, currentAccount, inputGroupCall, video, r.call, users);
1952+
VoIPHelper.joinConference(LaunchActivity.instance, account, inputGroupCall, video, r.call, users);
19471953
} else if (err != null) {
1948-
BulletinFactory.of(CallLogActivity.this)
1954+
BulletinFactory.of(parent)
19491955
.showForError(err);
19501956
}
19511957
}));
19521958
}
19531959
finishFragment();
19541960
}
19551961
};
1956-
presentFragment(fragment);
1962+
parent.presentFragment(fragment);
19571963
}
19581964

19591965
public static void createCallLink(Context context, int currentAccount, Theme.ResourcesProvider resourceProvider, Runnable done) {

‎TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6795,7 +6795,7 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe
67956795
isThreadPost = isThreadChat && messageObject.messageOwner.fwd_from != null && messageObject.messageOwner.fwd_from.channel_post != 0 && messageObject.messageOwner.reply_to == null;
67966796
isAvatarVisible = needDrawAvatar() && (currentPosition == null || currentPosition.edge);
67976797
boolean drawAvatar = needDrawAvatar();
6798-
if (messageObject.customAvatarDrawable != null || messageObject.forceAvatar) {
6798+
if (messageObject.customAvatarDrawable != null || messageObject.forceAvatar || messageObject.messageOwner.guestchat_via_from != null) {
67996799
isAvatarVisible = true;
68006800
drawAvatar = true;
68016801
}
@@ -13885,7 +13885,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
1388513885
x = dp(15);
1388613886
if (isSideMenuLeftMargin()) {
1388713887
x += dp(ChatActivity.SIDE_MENU_WIDTH);
13888-
} else if ((isChat || currentMessageObject.isRepostPreview) && isAvatarVisible && !isPlayingRound) {
13888+
} else if ((isChat || currentMessageObject.isRepostPreview || currentMessageObject.messageOwner.guestchat_via_from != null) && isAvatarVisible && !isPlayingRound) {
1388913889
x += dp(48);
1389013890
}
1389113891
if (currentPosition != null && !currentPosition.edge) {

‎TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14824,7 +14824,7 @@ public void showFieldPanel(boolean show, MessageObject messageObjectToReply, Mes
1482414824
forbidForwardingWithDismiss = false;
1482514825
chatActivityEnterView.setForceShowSendButton(true, false);
1482614826
ArrayList<Long> uids = new ArrayList<>();
14827-
replyIconImageView.setImageResource(R.drawable.filled_forward);
14827+
replyIconImageView.setImageResource(R.drawable.filled_forward_settings);
1482814828
replyIconImageView.setContentDescription(LocaleController.getString(R.string.AccDescrForwarding));
1482914829
replyCloseImageView.setContentDescription(LocaleController.getString(R.string.AccDescrCancelForward));
1483014830
MessageObject object = messageObjectsToForward.get(0);
@@ -43477,7 +43477,8 @@ public void didLongPressLink(ChatMessageCell cell, MessageObject messageObject,
4347743477
final ScrimOptions dialog = new ScrimOptions(getContext(), themeDelegate);
4347843478
options.setOnDismiss(dialog::dismissFast);
4347943479

43480-
final boolean customTabs = SharedConfig.inappBrowser && !str.startsWith("video?") && !Browser.isInternalUri(Uri.parse(str), null);
43480+
final boolean allowCustomTabs = !str.startsWith("video?") && !Browser.isInternalUri(Uri.parse(str), null);
43481+
final boolean customTabs = SharedConfig.inappBrowser && allowCustomTabs;
4348143482
final boolean isHashtag = str.startsWith("#") || str.startsWith("$");
4348243483
final boolean isMail = str.startsWith("mailto:");
4348343484

@@ -43498,6 +43499,10 @@ public void didLongPressLink(ChatMessageCell cell, MessageObject messageObject,
4349843499
options.add(R.drawable.msg_language, getString(R.string.OpenInSystemBrowser), () -> {
4349943500
Browser.openInExternalBrowser(getParentActivity(), str, false);
4350043501
});
43502+
} else if (!isMail && !isHashtag && !customTabs && allowCustomTabs && !SharedConfig.inappBrowser) {
43503+
options.add(R.drawable.msg_language, getString(R.string.OpenInTelegramBrowser), () -> {
43504+
Browser.openInTelegramBrowser(getParentActivity(), str, null);
43505+
});
4350143506
}
4350243507

4350343508
TLRPC.MessageMedia media = MessageObject.getMedia(messageObject);

‎TMessagesProj/src/main/java/org/telegram/ui/Components/AIEditorAlert.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ private void showStyleHint() {
438438
}
439439

440440
styleHint = new HintView2(getContext(), HintView2.DIRECTION_TOP);
441+
styleHint.setRoundingWithCornerEffect(false);
442+
styleHint.setPadding(dp(8), 0, dp(8), 0);
443+
styleHint.setRounding(20);
444+
styleHint.setShadow(dp(12), 0, dp(4), Theme.multAlpha(0xFF000000, .25f));
441445
styleHint.setText(getString(R.string.AIEditorChooseStyle));
442446
styleHint.setJoint(0.5f, 0);
443447
styleHint.setDuration(8000L);

0 commit comments

Comments
 (0)