Skip to content

Commit

Permalink
Merge branch 'upstream' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xmdnx committed Mar 20, 2024
2 parents b833239 + 16e6c3d commit feccab4
Show file tree
Hide file tree
Showing 109 changed files with 2,762 additions and 1,488 deletions.
1 change: 1 addition & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -3013,6 +3013,7 @@ https://github.com/rabbitgramdesktop/rabbitgramdesktop/blob/dev/LEGAL
"lng_context_delete_msg" = "Delete Message";
"lng_context_auto_delete_in" = "auto-delete in {duration}";
"lng_context_select_msg" = "Select Message";
"lng_context_select_msg_bulk" = "Select up to this message";
"lng_context_report_msg" = "Report Message";
"lng_context_pin_msg" = "Pin Message";
"lng_context_unpin_msg" = "Unpin Message";
Expand Down
2 changes: 1 addition & 1 deletion Telegram/Resources/uwp/AppX/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="4.15.4.0" />
Version="4.15.5.0" />
<Properties>
<DisplayName>rabbitGram Desktop</DisplayName>
<PublisherDisplayName>xmdnx</PublisherDisplayName>
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Telegram.rc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,15,4,0
PRODUCTVERSION 4,15,4,0
FILEVERSION 4,15,5,0
PRODUCTVERSION 4,15,5,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "xmdnx"
VALUE "FileDescription", "rabbitGram Desktop"
VALUE "FileVersion", "4.15.4.0"
VALUE "FileVersion", "4.15.5.0"
VALUE "LegalCopyright", "Copyright (C) 2023-2024"
VALUE "ProductName", "rabbitGram Desktop"
VALUE "ProductVersion", "4.15.4.0"
VALUE "ProductVersion", "4.15.5.0"
END
END
BLOCK "VarFileInfo"
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Updater.rc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,15,4,0
PRODUCTVERSION 4,15,4,0
FILEVERSION 4,15,5,0
PRODUCTVERSION 4,15,5,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "xmdnx"
VALUE "FileDescription", "rabbitGram Desktop Updater"
VALUE "FileVersion", "4.15.4.0"
VALUE "FileVersion", "4.15.5.0"
VALUE "LegalCopyright", "Copyright (C) 2023-2024"
VALUE "ProductName", "rabbitGram Desktop"
VALUE "ProductVersion", "4.15.4.0"
VALUE "ProductVersion", "4.15.5.0"
END
END
BLOCK "VarFileInfo"
Expand Down
8 changes: 4 additions & 4 deletions Telegram/SourceFiles/api/api_bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,10 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
MTP_int(itemId),
MTP_int(id),
MTP_vector_from_range(
result
| ranges::views::transform([](
not_null<PeerData*> peer) {
return MTPInputPeer(peer->input); }))
result | ranges::views::transform([](
not_null<PeerData*> peer) {
return MTPInputPeer(peer->input);
}))
)).done([=](const MTPUpdates &result) {
peer->session().api().applyUpdates(result);
}).send();
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/apiwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
}
return QString();
}();
if (!text.isEmpty()) {
if (show && !text.isEmpty()) {
show->showToast(text, kJoinErrorDuration);
}
}
Expand Down
4 changes: 3 additions & 1 deletion Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ChoosePeerBoxController final
void submit();

QString savedMessagesChatStatus() const override {
return tr::lng_saved_forward_here(tr::now);
return {};
}

private:
Expand Down Expand Up @@ -295,6 +295,8 @@ object_ptr<Ui::BoxContent> CreatePeerByQueryBox(
case Type::User: {
const auto user = peer->asUser();
return user
&& !user->isInaccessible()
&& !user->isNotificationsUser()
&& checkRestriction(query.userIsBot, user->isBot())
&& checkRestriction(query.userIsPremium, user->isPremium());
}
Expand Down
5 changes: 5 additions & 0 deletions Telegram/SourceFiles/calls/calls_box_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,11 @@ base::unique_qptr<Ui::PopupMenu> BoxController::rowContextMenu(
_window->show(
Box<DeleteMessagesBox>(session, base::duplicate(ids)));
}, &st::menuIconDelete);
result->addAction(tr::lng_context_to_msg(tr::now), [=, window = _window] {
if (const auto item = session->data().message(ids.front())) {
window->showMessage(item);
}
}, &st::menuIconShowInChat);
return result;
}

Expand Down
46 changes: 42 additions & 4 deletions Telegram/SourceFiles/calls/calls_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ For license and copyright information please follow this link:
#include "mtproto/mtproto_config.h"
#include "core/application.h"
#include "core/core_settings.h"
#include "window/window_controller.h"
#include "media/audio/media_audio_track.h"
#include "base/platform/base_platform_info.h"
#include "calls/calls_panel.h"
Expand Down Expand Up @@ -420,6 +421,14 @@ void Call::actuallyAnswer() {
}).send();
}

void Call::captureMuteChanged(bool mute) {
setMuted(mute);
}

rpl::producer<Webrtc::DeviceResolvedId> Call::captureMuteDeviceId() {
return _captureDeviceId.value();
}

void Call::setMuted(bool mute) {
_muted = mute;
if (_instance) {
Expand Down Expand Up @@ -698,11 +707,15 @@ bool Call::handleUpdate(const MTPPhoneCall &call) {
}
}
if (data.is_need_rating() && _id && _accessHash) {
const auto window = Core::App().windowFor(_user);
const auto session = &_user->session();
const auto callId = _id;
const auto callAccessHash = _accessHash;
const auto box = Ui::show(Box<Ui::RateCallBox>(
Core::App().settings().sendSubmitWay()));
auto owned = Box<Ui::RateCallBox>(
Core::App().settings().sendSubmitWay());
const auto box = window
? window->show(std::move(owned))
: Ui::show(std::move(owned));
const auto sender = box->lifetime().make_state<MTP::Sender>(
&session->mtp());
box->sends(
Expand Down Expand Up @@ -1033,6 +1046,20 @@ void Call::createAndStartController(const MTPDphoneCall &call) {

raw->setIncomingVideoOutput(_videoIncoming->sink());
raw->setAudioOutputDuckingEnabled(settings.callAudioDuckingEnabled());

_state.value() | rpl::start_with_next([=](State state) {
const auto track = (state != State::FailedHangingUp)
&& (state != State::Failed)
&& (state != State::HangingUp)
&& (state != State::Ended)
&& (state != State::EndedByOtherDevice)
&& (state != State::Busy);
Core::App().mediaDevices().setCaptureMuteTracker(this, track);
}, _instanceLifetime);

_muted.value() | rpl::start_with_next([=](bool muted) {
Core::App().mediaDevices().setCaptureMuted(muted);
}, _instanceLifetime);
}

void Call::handleControllerStateChange(tgcalls::State state) {
Expand Down Expand Up @@ -1355,7 +1382,11 @@ void Call::handleRequestError(const QString &error) {
_user->name())
: QString();
if (!inform.isEmpty()) {
Ui::show(Ui::MakeInformBox(inform));
if (const auto window = Core::App().windowFor(_user)) {
window->show(Ui::MakeInformBox(inform));
} else {
Ui::show(Ui::MakeInformBox(inform));
}
}
finish(FinishType::Failed);
}
Expand All @@ -1369,12 +1400,19 @@ void Call::handleControllerError(const QString &error) {
? tr::lng_call_error_audio_io(tr::now)
: QString();
if (!inform.isEmpty()) {
Ui::show(Ui::MakeInformBox(inform));
if (const auto window = Core::App().windowFor(_user)) {
window->show(Ui::MakeInformBox(inform));
} else {
Ui::show(Ui::MakeInformBox(inform));
}
}
finish(FinishType::Failed);
}

void Call::destroyController() {
_instanceLifetime.destroy();
Core::App().mediaDevices().setCaptureMuteTracker(this, false);

if (_instance) {
_instance->stop([](tgcalls::FinalState) {
});
Expand Down
8 changes: 7 additions & 1 deletion Telegram/SourceFiles/calls/calls_call.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ enum class CallType {
Outgoing,
};

class Call : public base::has_weak_ptr {
class Call final
: public base::has_weak_ptr
, private Webrtc::CaptureMuteTracker {
public:
class Delegate {
public:
Expand Down Expand Up @@ -249,6 +251,9 @@ class Call : public base::has_weak_ptr {
void setSignalBarCount(int count);
void destroyController();

void captureMuteChanged(bool mute) override;
rpl::producer<Webrtc::DeviceResolvedId> captureMuteDeviceId() override;

void setupMediaDevices();
void setupOutgoingVideo();
void updateRemoteMediaState(
Expand Down Expand Up @@ -298,6 +303,7 @@ class Call : public base::has_weak_ptr {

std::unique_ptr<Media::Audio::Track> _waitingTrack;

rpl::lifetime _instanceLifetime;
rpl::lifetime _lifetime;

};
Expand Down
29 changes: 29 additions & 0 deletions Telegram/SourceFiles/calls/group/calls_group_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For license and copyright information please follow this link:
#include "base/random.h"
#include "webrtc/webrtc_video_track.h"
#include "webrtc/webrtc_create_adm.h"
#include "webrtc/webrtc_environment.h"

#include <tgcalls/group/GroupInstanceCustomImpl.h>
#include <tgcalls/VideoCaptureInterface.h>
Expand Down Expand Up @@ -667,6 +668,8 @@ GroupCall::GroupCall(
GroupCall::~GroupCall() {
destroyScreencast();
destroyController();

Core::App().mediaDevices().setCaptureMuteTracker(this, false);
}

bool GroupCall::isSharingScreen() const {
Expand Down Expand Up @@ -2087,6 +2090,32 @@ void GroupCall::setupMediaDevices() {
}) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) {
_cameraCapture->switchToDevice(deviceId.value.toStdString(), false);
}, _lifetime);

_muted.value() | rpl::start_with_next([=](MuteState state) {
const auto devices = &Core::App().mediaDevices();
const auto muted = (state != MuteState::Active)
&& (state != MuteState::PushToTalk);
const auto track = !muted || (state == MuteState::Muted);
devices->setCaptureMuteTracker(this, track);
devices->setCaptureMuted(muted);
}, _lifetime);
}

void GroupCall::captureMuteChanged(bool mute) {
const auto oldState = muted();
if (mute
&& (oldState == MuteState::ForceMuted
|| oldState == MuteState::RaisedHand
|| oldState == MuteState::Muted)) {
return;
} else if (!mute && oldState != MuteState::Muted) {
return;
}
setMutedAndUpdate(mute ? MuteState::Muted : MuteState::Active);
}

rpl::producer<Webrtc::DeviceResolvedId> GroupCall::captureMuteDeviceId() {
return _captureDeviceId.value();
}

int GroupCall::activeVideoSendersCount() const {
Expand Down
8 changes: 7 additions & 1 deletion Telegram/SourceFiles/calls/group/calls_group_call.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ For license and copyright information please follow this link:
#include "base/bytes.h"
#include "mtproto/sender.h"
#include "mtproto/mtproto_auth_key.h"
#include "webrtc/webrtc_device_common.h"
#include "webrtc/webrtc_device_resolver.h"

class History;
Expand Down Expand Up @@ -175,7 +176,9 @@ struct ParticipantVideoParams;
[[nodiscard]] uint32 GetAdditionalAudioSsrc(
const std::shared_ptr<ParticipantVideoParams> &params);

class GroupCall final : public base::has_weak_ptr {
class GroupCall final
: public base::has_weak_ptr
, private Webrtc::CaptureMuteTracker {
public:
class Delegate {
public:
Expand Down Expand Up @@ -550,6 +553,9 @@ class GroupCall final : public base::has_weak_ptr {
void applySelfUpdate(const MTPDgroupCallParticipant &data);
void applyOtherParticipantUpdate(const MTPDgroupCallParticipant &data);

void captureMuteChanged(bool mute) override;
rpl::producer<Webrtc::DeviceResolvedId> captureMuteDeviceId() override;

void setupMediaDevices();
void setupOutgoingVideo();
void setScreenEndpoint(std::string endpoint);
Expand Down
Loading

0 comments on commit feccab4

Please sign in to comment.