mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Allow fix chats order and auto switch (support).
This commit is contained in:
@@ -23,6 +23,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "window/section_widget.h"
|
||||
#include "chat_helpers/tabbed_selector.h"
|
||||
#include "boxes/send_files_box.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "support/support_common.h"
|
||||
#include "observer_peer.h"
|
||||
|
||||
namespace {
|
||||
@@ -35,7 +37,9 @@ AuthSessionSettings::Variables::Variables()
|
||||
: sendFilesWay(SendFilesWay::Album)
|
||||
, selectorTab(ChatHelpers::SelectorTab::Emoji)
|
||||
, floatPlayerColumn(Window::Column::Second)
|
||||
, floatPlayerCorner(RectPart::TopRight) {
|
||||
, floatPlayerCorner(RectPart::TopRight)
|
||||
, sendSubmitWay(Ui::InputSubmitSettings::Enter)
|
||||
, supportSwitch(Support::SwitchSettings::None) {
|
||||
}
|
||||
|
||||
QByteArray AuthSessionSettings::serialize() const {
|
||||
@@ -74,6 +78,9 @@ QByteArray AuthSessionSettings::serialize() const {
|
||||
stream << qint32(_variables.thirdSectionExtendedBy);
|
||||
stream << qint32(_variables.sendFilesWay);
|
||||
stream << qint32(_variables.callsPeerToPeer.current());
|
||||
stream << qint32(_variables.sendSubmitWay);
|
||||
stream << qint32(_variables.supportSwitch);
|
||||
stream << qint32(_variables.supportFixChatsOrder ? 1 : 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -100,6 +107,10 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized)
|
||||
int thirdSectionExtendedBy = _variables.thirdSectionExtendedBy;
|
||||
qint32 sendFilesWay = static_cast<qint32>(_variables.sendFilesWay);
|
||||
qint32 callsPeerToPeer = qint32(_variables.callsPeerToPeer.current());
|
||||
qint32 sendSubmitWay = static_cast<qint32>(_variables.sendSubmitWay);
|
||||
qint32 supportSwitch = static_cast<qint32>(_variables.supportSwitch);
|
||||
qint32 supportFixChatsOrder = _variables.supportFixChatsOrder ? 1 : 0;
|
||||
|
||||
stream >> selectorTab;
|
||||
stream >> lastSeenWarningSeen;
|
||||
if (!stream.atEnd()) {
|
||||
@@ -154,6 +165,11 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized)
|
||||
if (!stream.atEnd()) {
|
||||
stream >> callsPeerToPeer;
|
||||
}
|
||||
if (!stream.atEnd()) {
|
||||
stream >> sendSubmitWay;
|
||||
stream >> supportSwitch;
|
||||
stream >> supportFixChatsOrder;
|
||||
}
|
||||
if (stream.status() != QDataStream::Ok) {
|
||||
LOG(("App Error: "
|
||||
"Bad data for AuthSessionSettings::constructFromSerialized()"));
|
||||
@@ -206,6 +222,20 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized)
|
||||
case Calls::PeerToPeer::Contacts:
|
||||
case Calls::PeerToPeer::Nobody: _variables.callsPeerToPeer = uncheckedCallsPeerToPeer; break;
|
||||
}
|
||||
auto uncheckedSendSubmitWay = static_cast<Ui::InputSubmitSettings>(
|
||||
sendSubmitWay);
|
||||
switch (uncheckedSendSubmitWay) {
|
||||
case Ui::InputSubmitSettings::Enter:
|
||||
case Ui::InputSubmitSettings::CtrlEnter: _variables.sendSubmitWay = uncheckedSendSubmitWay; break;
|
||||
}
|
||||
auto uncheckedSupportSwitch = static_cast<Support::SwitchSettings>(
|
||||
supportSwitch);
|
||||
switch (uncheckedSupportSwitch) {
|
||||
case Support::SwitchSettings::None:
|
||||
case Support::SwitchSettings::Next:
|
||||
case Support::SwitchSettings::Previous: _variables.supportSwitch = uncheckedSupportSwitch; break;
|
||||
}
|
||||
_variables.supportFixChatsOrder = (supportFixChatsOrder ? 1 : 0);
|
||||
}
|
||||
|
||||
void AuthSessionSettings::setTabbedSelectorSectionEnabled(bool enabled) {
|
||||
@@ -392,8 +422,8 @@ void AuthSession::checkAutoLockIn(TimeMs time) {
|
||||
}
|
||||
|
||||
bool AuthSession::supportMode() const {
|
||||
// return true; AssertIsDebug();
|
||||
return false;
|
||||
return true; AssertIsDebug();
|
||||
return _user->phone().startsWith(qstr("424"));
|
||||
}
|
||||
|
||||
AuthSession::~AuthSession() = default;
|
||||
|
Reference in New Issue
Block a user