From ff44094ded20bdfffa2b411ca0a11333f2752f66 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 24 Jul 2019 13:45:24 +0200 Subject: [PATCH] Rename AuthSession to Main::Session. --- Telegram/SourceFiles/api/api_sending.cpp | 2 +- Telegram/SourceFiles/apiwrap.cpp | 6 +- Telegram/SourceFiles/apiwrap.h | 11 +- Telegram/SourceFiles/app.cpp | 4 +- .../SourceFiles/boxes/add_contact_box.cpp | 16 +-- Telegram/SourceFiles/boxes/add_contact_box.h | 26 ++-- .../SourceFiles/boxes/auto_download_box.cpp | 2 +- Telegram/SourceFiles/boxes/background_box.cpp | 2 +- .../boxes/background_preview_box.cpp | 2 +- .../SourceFiles/boxes/change_phone_box.cpp | 2 +- Telegram/SourceFiles/boxes/confirm_box.cpp | 2 +- .../SourceFiles/boxes/edit_caption_box.cpp | 2 +- .../SourceFiles/boxes/edit_privacy_box.cpp | 2 +- .../SourceFiles/boxes/local_storage_box.cpp | 2 +- .../SourceFiles/boxes/mute_settings_box.cpp | 2 +- Telegram/SourceFiles/boxes/passcode_box.cpp | 2 +- Telegram/SourceFiles/boxes/peer_list_box.cpp | 2 +- .../boxes/peer_list_controllers.cpp | 2 +- .../boxes/peers/add_participants_box.cpp | 2 +- .../boxes/peers/edit_contact_box.cpp | 2 +- .../boxes/peers/edit_linked_chat_box.cpp | 2 +- .../boxes/peers/edit_participant_box.cpp | 2 +- .../boxes/peers/edit_participants_box.cpp | 2 +- .../boxes/peers/edit_peer_info_box.cpp | 2 +- .../boxes/peers/edit_peer_type_box.cpp | 2 +- Telegram/SourceFiles/boxes/rate_call_box.cpp | 2 +- .../boxes/self_destruction_box.cpp | 2 +- Telegram/SourceFiles/boxes/sessions_box.cpp | 2 +- Telegram/SourceFiles/boxes/share_box.cpp | 5 +- .../SourceFiles/boxes/sticker_set_box.cpp | 2 +- Telegram/SourceFiles/boxes/stickers_box.cpp | 4 +- Telegram/SourceFiles/boxes/url_auth_box.cpp | 2 +- Telegram/SourceFiles/boxes/username_box.cpp | 2 +- .../calls/calls_box_controller.cpp | 2 +- Telegram/SourceFiles/calls/calls_call.cpp | 2 +- Telegram/SourceFiles/calls/calls_instance.cpp | 2 +- Telegram/SourceFiles/calls/calls_panel.cpp | 2 +- .../SourceFiles/chat_helpers/bot_keyboard.cpp | 2 +- .../chat_helpers/emoji_keywords.cpp | 10 +- .../SourceFiles/chat_helpers/emoji_keywords.h | 2 +- .../chat_helpers/emoji_suggestions_widget.cpp | 2 +- .../chat_helpers/field_autocomplete.cpp | 2 +- .../chat_helpers/message_field.cpp | 2 +- .../SourceFiles/chat_helpers/stickers.cpp | 4 +- Telegram/SourceFiles/chat_helpers/stickers.h | 5 +- .../chat_helpers/stickers_list_widget.cpp | 4 +- .../chat_helpers/stickers_list_widget.h | 6 +- .../chat_helpers/tabbed_selector.cpp | 2 +- .../chat_helpers/tabbed_selector.h | 4 +- Telegram/SourceFiles/core/application.cpp | 6 +- Telegram/SourceFiles/core/application.h | 3 +- Telegram/SourceFiles/core/changelogs.cpp | 4 +- Telegram/SourceFiles/core/changelogs.h | 10 +- .../SourceFiles/core/click_handler_types.cpp | 2 +- Telegram/SourceFiles/core/file_utilities.cpp | 2 +- .../SourceFiles/core/local_url_handlers.cpp | 20 +-- Telegram/SourceFiles/data/data_channel.cpp | 2 +- .../SourceFiles/data/data_channel_admins.cpp | 2 +- Telegram/SourceFiles/data/data_chat.cpp | 2 +- Telegram/SourceFiles/data/data_document.cpp | 2 +- Telegram/SourceFiles/data/data_document.h | 9 +- .../data/data_document_good_thumbnail.cpp | 2 +- Telegram/SourceFiles/data/data_folder.cpp | 4 +- Telegram/SourceFiles/data/data_folder.h | 5 +- Telegram/SourceFiles/data/data_peer.cpp | 4 +- Telegram/SourceFiles/data/data_peer.h | 12 +- Telegram/SourceFiles/data/data_photo.cpp | 2 +- Telegram/SourceFiles/data/data_photo.h | 6 +- Telegram/SourceFiles/data/data_poll.cpp | 2 +- Telegram/SourceFiles/data/data_pts_waiter.cpp | 2 +- .../data/data_search_controller.cpp | 2 +- Telegram/SourceFiles/data/data_session.cpp | 6 +- Telegram/SourceFiles/data/data_session.h | 10 +- .../SourceFiles/data/data_shared_media.cpp | 2 +- Telegram/SourceFiles/data/data_types.cpp | 2 +- .../SourceFiles/data/data_user_photos.cpp | 2 +- Telegram/SourceFiles/data/data_wall_paper.cpp | 2 +- Telegram/SourceFiles/data/data_web_page.cpp | 2 +- .../SourceFiles/dialogs/dialogs_entry.cpp | 4 +- Telegram/SourceFiles/dialogs/dialogs_entry.h | 6 +- .../dialogs/dialogs_indexed_list.cpp | 2 +- .../dialogs/dialogs_inner_widget.cpp | 4 +- .../dialogs/dialogs_inner_widget.h | 6 +- .../dialogs_search_from_controllers.cpp | 2 +- .../SourceFiles/dialogs/dialogs_widget.cpp | 2 +- Telegram/SourceFiles/dialogs/dialogs_widget.h | 4 +- .../view/export_view_panel_controller.cpp | 2 +- .../export/view/export_view_settings.cpp | 2 +- Telegram/SourceFiles/facades.cpp | 2 +- .../admin_log/history_admin_log_inner.cpp | 4 +- .../admin_log/history_admin_log_inner.h | 6 +- .../admin_log/history_admin_log_item.cpp | 2 +- Telegram/SourceFiles/history/history.cpp | 2 +- Telegram/SourceFiles/history/history.h | 5 +- .../history/history_inner_widget.cpp | 4 +- .../history/history_inner_widget.h | 2 +- Telegram/SourceFiles/history/history_item.cpp | 2 +- .../history/history_item_components.cpp | 2 +- .../SourceFiles/history/history_message.cpp | 2 +- .../SourceFiles/history/history_service.cpp | 2 +- .../SourceFiles/history/history_widget.cpp | 2 +- .../history/media/history_media_contact.cpp | 2 +- .../history/media/history_media_poll.cpp | 2 +- .../view/history_view_contact_status.cpp | 2 +- .../view/history_view_context_menu.cpp | 2 +- .../history/view/history_view_list_widget.cpp | 4 +- .../history/view/history_view_list_widget.h | 6 +- .../history/view/history_view_message.cpp | 2 +- .../view/history_view_top_bar_widget.cpp | 4 +- .../view/history_view_top_bar_widget.h | 6 +- .../info_common_groups_widget.cpp | 2 +- .../SourceFiles/info/info_content_widget.cpp | 2 +- Telegram/SourceFiles/info/info_controller.cpp | 2 +- .../SourceFiles/info/info_layer_widget.cpp | 2 +- Telegram/SourceFiles/info/info_memento.cpp | 2 +- Telegram/SourceFiles/info/info_top_bar.cpp | 2 +- .../SourceFiles/info/info_wrap_widget.cpp | 2 +- .../info/media/info_media_list_widget.cpp | 4 +- .../info/media/info_media_list_widget.h | 7 +- .../info/profile/info_profile_actions.cpp | 2 +- .../info/profile/info_profile_cover.cpp | 2 +- .../profile/info_profile_inner_widget.cpp | 2 +- .../info_profile_members_controllers.cpp | 2 +- .../info/profile/info_profile_values.cpp | 2 +- .../inline_bot_layout_internal.cpp | 2 +- .../inline_bots/inline_bot_result.cpp | 2 +- .../inline_bots/inline_results_widget.cpp | 2 +- Telegram/SourceFiles/intro/introwidget.cpp | 2 +- .../SourceFiles/lang/lang_cloud_manager.cpp | 6 +- Telegram/SourceFiles/main/main_account.cpp | 64 +++++----- Telegram/SourceFiles/main/main_account.h | 34 ++--- .../main_session.cpp} | 117 +++++++++--------- .../{auth_session.h => main/main_session.h} | 35 +++--- Telegram/SourceFiles/mainwidget.cpp | 10 +- Telegram/SourceFiles/mainwidget.h | 7 +- Telegram/SourceFiles/mainwindow.cpp | 4 +- .../SourceFiles/media/audio/media_audio.cpp | 2 +- .../media/player/media_player_float.cpp | 2 +- .../media/player/media_player_instance.cpp | 6 +- .../media/player/media_player_panel.cpp | 2 +- .../player/media_player_volume_controller.cpp | 2 +- .../media/player/media_player_widget.cpp | 2 +- .../media_streaming_loader_mtproto.cpp | 2 +- .../media/view/media_view_group_thumbs.cpp | 2 +- .../media/view/media_view_overlay_widget.cpp | 6 +- .../mtproto/dedicated_file_loader.cpp | 10 +- Telegram/SourceFiles/mtproto/mtp_instance.cpp | 4 +- .../passport/passport_form_controller.cpp | 2 +- .../passport/passport_panel_details_row.cpp | 2 +- .../SourceFiles/platform/mac/mac_touchbar.mm | 2 +- .../platform/mac/main_window_mac.mm | 4 +- .../platform/win/windows_event_filter.cpp | 4 +- .../profile/profile_block_group_members.cpp | 2 +- .../profile/profile_block_peer_list.cpp | 2 +- .../settings/settings_advanced.cpp | 2 +- .../SourceFiles/settings/settings_chat.cpp | 2 +- .../SourceFiles/settings/settings_codes.cpp | 6 +- .../SourceFiles/settings/settings_common.cpp | 2 +- .../settings/settings_information.cpp | 2 +- .../SourceFiles/settings/settings_main.cpp | 4 +- .../settings/settings_notifications.cpp | 2 +- .../settings/settings_privacy_controllers.cpp | 2 +- .../settings/settings_privacy_security.cpp | 4 +- .../settings/settings_privacy_security.h | 3 +- .../SourceFiles/storage/file_download.cpp | 6 +- Telegram/SourceFiles/storage/file_download.h | 7 +- Telegram/SourceFiles/storage/file_upload.cpp | 2 +- .../SourceFiles/storage/localimageloader.cpp | 2 +- Telegram/SourceFiles/storage/localstorage.cpp | 48 +++---- Telegram/SourceFiles/storage/localstorage.h | 2 +- .../SourceFiles/storage/serialize_common.cpp | 2 +- .../storage/serialize_document.cpp | 2 +- .../support/support_autocomplete.cpp | 4 +- .../support/support_autocomplete.h | 8 +- .../SourceFiles/support/support_helper.cpp | 6 +- Telegram/SourceFiles/support/support_helper.h | 10 +- .../SourceFiles/support/support_templates.cpp | 4 +- .../SourceFiles/support/support_templates.h | 8 +- Telegram/SourceFiles/ui/emoji_config.cpp | 2 +- Telegram/SourceFiles/ui/image/image.cpp | 2 +- .../SourceFiles/ui/image/image_location.cpp | 2 +- .../SourceFiles/ui/image/image_source.cpp | 2 +- Telegram/SourceFiles/ui/special_buttons.cpp | 2 +- Telegram/SourceFiles/ui/text/text_entity.cpp | 2 +- .../SourceFiles/ui/widgets/input_fields.cpp | 4 +- Telegram/SourceFiles/window/layer_widget.cpp | 2 +- Telegram/SourceFiles/window/main_window.cpp | 4 +- .../window/notifications_manager.cpp | 6 +- .../window/notifications_manager.h | 10 +- .../window/notifications_manager_default.cpp | 2 +- .../SourceFiles/window/section_widget.cpp | 2 +- Telegram/SourceFiles/window/section_widget.h | 6 +- .../window/themes/window_theme.cpp | 6 +- .../SourceFiles/window/themes/window_theme.h | 6 +- .../SourceFiles/window/window_controller.cpp | 2 +- .../window/window_lock_widgets.cpp | 2 +- .../SourceFiles/window/window_main_menu.cpp | 2 +- .../SourceFiles/window/window_peer_menu.cpp | 2 +- .../window/window_session_controller.cpp | 8 +- .../window/window_session_controller.h | 13 +- Telegram/gyp/telegram_sources.txt | 4 +- 201 files changed, 543 insertions(+), 477 deletions(-) rename Telegram/SourceFiles/{auth_session.cpp => main/main_session.cpp} (84%) rename Telegram/SourceFiles/{auth_session.h => main/main_session.h} (95%) diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp index 2253e5f52..172e895e5 100644 --- a/Telegram/SourceFiles/api/api_sending.cpp +++ b/Telegram/SourceFiles/api/api_sending.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history.h" #include "history/history_message.h" // NewMessageFlags. #include "ui/text/text_entity.h" // TextWithEntities. -#include "auth_session.h" +#include "main/main_session.h" #include "mainwidget.h" #include "apiwrap.h" diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 0adff412d..0ff554e6f 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -35,7 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_item_components.h" //#include "history/feed/history_feed_section.h" // #feed #include "storage/localstorage.h" -#include "auth_session.h" +#include "main/main_session.h" #include "boxes/confirm_box.h" #include "boxes/stickers_box.h" #include "boxes/sticker_set_box.h" @@ -226,7 +226,7 @@ bool ApiWrap::BlockedUsersSlice::operator!=(const BlockedUsersSlice &other) cons return !(*this == other); } -ApiWrap::ApiWrap(not_null session) +ApiWrap::ApiWrap(not_null session) : _session(session) , _messageDataResolveDelayed([=] { resolveMessageDatas(); }) , _webPagesTimer([=] { resolveWebPages(); }) @@ -249,7 +249,7 @@ ApiWrap::ApiWrap(not_null session) }); } -AuthSession &ApiWrap::session() const { +Main::Session &ApiWrap::session() const { return *_session; } diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index 3132ebd21..a0bba5c06 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -16,13 +16,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_messages.h" class TaskQueue; -class AuthSession; struct MessageGroupId; struct SendingAlbum; enum class SendMediaType; struct FileLoadTo; class mtpFileLoader; +namespace Main { +class Session; +} // namespace Main + namespace Data { struct UpdatedFileReferences; class WallPaper; @@ -132,9 +135,9 @@ public: bool operator!=(const BlockedUsersSlice &other) const; }; - explicit ApiWrap(not_null session); + explicit ApiWrap(not_null session); - AuthSession &session() const; + Main::Session &session() const; void applyUpdates( const MTPUpdates &updates, @@ -710,7 +713,7 @@ private: void sendDialogRequests(); - not_null _session; + not_null _session; base::flat_map _modifyRequests; diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index e8db57021..8b5e0cbd9 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -40,7 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "numbers.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_overview.h" #include "styles/style_mediaview.h" #include "styles/style_chat_helpers.h" @@ -314,7 +314,7 @@ namespace App { void quit() { if (quitting()) { return; - } else if (AuthSession::Exists() + } else if (Main::Session::Exists() && Auth().data().exportInProgress()) { Auth().data().stopExportWithConfirmation([] { App::quit(); }); return; diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index 7c0a1dd5f..860fdc8cc 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -37,7 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwindow.h" #include "apiwrap.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" namespace { @@ -156,7 +156,7 @@ class RevokePublicLinkBox::Inner : public TWidget, private MTP::Sender { public: Inner( QWidget *parent, - not_null session, + not_null session, Fn revokeCallback); protected: @@ -176,7 +176,7 @@ private: void paintChat(Painter &p, const ChatRow &row, bool selected) const; void updateSelected(); - const not_null _session; + const not_null _session; PeerData *_selected = nullptr; PeerData *_pressed = nullptr; @@ -195,13 +195,13 @@ private: AddContactBox::AddContactBox( QWidget*, - not_null session) + not_null session) : AddContactBox(nullptr, session, QString(), QString(), QString()) { } AddContactBox::AddContactBox( QWidget*, - not_null session, + not_null session, QString fname, QString lname, QString phone) @@ -389,7 +389,7 @@ void AddContactBox::updateButtons() { GroupInfoBox::GroupInfoBox( QWidget*, - not_null session, + not_null session, Type type, const QString &title, Fn)> channelDone) @@ -1251,7 +1251,7 @@ bool EditNameBox::saveSelfFail(const RPCError &error) { RevokePublicLinkBox::Inner::Inner( QWidget *parent, - not_null session, + not_null session, Fn revokeCallback) : TWidget(parent) , _session(session) @@ -1295,7 +1295,7 @@ RevokePublicLinkBox::Inner::Inner( RevokePublicLinkBox::RevokePublicLinkBox( QWidget*, - not_null session, + not_null session, Fn revokeCallback) : _session(session) , _aboutRevoke( diff --git a/Telegram/SourceFiles/boxes/add_contact_box.h b/Telegram/SourceFiles/boxes/add_contact_box.h index fc0af49fa..7278522e1 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.h +++ b/Telegram/SourceFiles/boxes/add_contact_box.h @@ -13,11 +13,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL class ConfirmBox; class PeerListBox; -class AuthSession; -constexpr auto kMaxBioLength = 70; - -style::InputField CreateBioFieldStyle(); +namespace Main { +class Session; +} // namespace Main namespace Ui { class FlatLabel; @@ -33,11 +32,16 @@ class LinkButton; class UserpicButton; } // namespace Ui +constexpr auto kMaxBioLength = 70; + enum class PeerFloodType { Send, InviteGroup, InviteChannel, }; + +style::InputField CreateBioFieldStyle(); + QString PeerFloodErrorText(PeerFloodType type); void ShowAddParticipantsError( const QString &error, @@ -46,10 +50,10 @@ void ShowAddParticipantsError( class AddContactBox : public BoxContent { public: - AddContactBox(QWidget*, not_null session); + AddContactBox(QWidget*, not_null session); AddContactBox( QWidget*, - not_null session, + not_null session, QString fname, QString lname, QString phone); @@ -69,7 +73,7 @@ private: void updateButtons(); void importDone(const MTPcontacts_ImportedContacts &result); - const not_null _session; + const not_null _session; object_ptr _first; object_ptr _last; @@ -94,7 +98,7 @@ public: }; GroupInfoBox( QWidget*, - not_null session, + not_null session, Type type, const QString &title = QString(), Fn)> channelDone = nullptr); @@ -114,7 +118,7 @@ private: void descriptionResized(); void updateMaxHeight(); - const not_null _session; + const not_null _session; Type _type = Type::Group; QString _initialTitle; @@ -227,7 +231,7 @@ class RevokePublicLinkBox : public BoxContent, public RPCSender { public: RevokePublicLinkBox( QWidget*, - not_null session, + not_null session, Fn revokeCallback); protected: @@ -236,7 +240,7 @@ protected: void resizeEvent(QResizeEvent *e) override; private: - const not_null _session; + const not_null _session; object_ptr _aboutRevoke; diff --git a/Telegram/SourceFiles/boxes/auto_download_box.cpp b/Telegram/SourceFiles/boxes/auto_download_box.cpp index 5e715a94e..34d00a982 100644 --- a/Telegram/SourceFiles/boxes/auto_download_box.cpp +++ b/Telegram/SourceFiles/boxes/auto_download_box.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/auto_download_box.h" #include "lang/lang_keys.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "info/profile/info_profile_button.h" #include "ui/widgets/continuous_sliders.h" diff --git a/Telegram/SourceFiles/boxes/background_box.cpp b/Telegram/SourceFiles/boxes/background_box.cpp index 5175dbeba..c58b0404d 100644 --- a/Telegram/SourceFiles/boxes/background_box.cpp +++ b/Telegram/SourceFiles/boxes/background_box.cpp @@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "ui/effects/round_checkbox.h" #include "ui/image/image.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "mtproto/sender.h" #include "data/data_session.h" diff --git a/Telegram/SourceFiles/boxes/background_preview_box.cpp b/Telegram/SourceFiles/boxes/background_preview_box.cpp index bbd5355c3..eaebe3c29 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/background_preview_box.cpp @@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history.h" #include "history/history_message.h" #include "history/view/history_view_message.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "data/data_session.h" #include "data/data_user.h" diff --git a/Telegram/SourceFiles/boxes/change_phone_box.cpp b/Telegram/SourceFiles/boxes/change_phone_box.cpp index 9e80bc64f..919b54f46 100644 --- a/Telegram/SourceFiles/boxes/change_phone_box.cpp +++ b/Telegram/SourceFiles/boxes/change_phone_box.cpp @@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/text/text_utilities.h" #include "boxes/confirm_phone_box.h" #include "boxes/confirm_box.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index 19618f6a9..4f2b6942d 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -31,7 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_chat.h" #include "data/data_user.h" #include "base/unixtime.h" -#include "auth_session.h" +#include "main/main_session.h" #include "observer_peer.h" TextParseOptions _confirmBoxTextOptions = { diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index 967731cda..8839d86bf 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/edit_caption_box.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "chat_helpers/emoji_suggestions_widget.h" #include "chat_helpers/message_field.h" #include "chat_helpers/tabbed_panel.h" diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp index 895bb43a9..6a9baec1e 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp @@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/binary_guard.h" #include "lang/lang_keys.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_user.h" #include "data/data_chat.h" #include "data/data_channel.h" diff --git a/Telegram/SourceFiles/boxes/local_storage_box.cpp b/Telegram/SourceFiles/boxes/local_storage_box.cpp index fc50c9d4e..7614a0c4c 100644 --- a/Telegram/SourceFiles/boxes/local_storage_box.cpp +++ b/Telegram/SourceFiles/boxes/local_storage_box.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "lang/lang_keys.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "layout.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/boxes/mute_settings_box.cpp b/Telegram/SourceFiles/boxes/mute_settings_box.cpp index 55d1a4e4f..d809afe17 100644 --- a/Telegram/SourceFiles/boxes/mute_settings_box.cpp +++ b/Telegram/SourceFiles/boxes/mute_settings_box.cpp @@ -8,7 +8,7 @@ Copyright (C) 2017, Nicholas Guriev #include "boxes/mute_settings_box.h" #include "lang/lang_keys.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "styles/style_boxes.h" #include "ui/special_buttons.h" diff --git a/Telegram/SourceFiles/boxes/passcode_box.cpp b/Telegram/SourceFiles/boxes/passcode_box.cpp index 60419f24e..05cfa92ef 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.cpp +++ b/Telegram/SourceFiles/boxes/passcode_box.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/confirm_box.h" #include "boxes/confirm_phone_box.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "storage/localstorage.h" #include "ui/widgets/buttons.h" #include "ui/widgets/input_fields.h" diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp index 83c923f2f..c64eddb42 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp @@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_boxes.h" #include "styles/style_dialogs.h" #include "styles/style_widgets.h" -#include "auth_session.h" +#include "main/main_session.h" #include "mainwidget.h" #include "ui/widgets/multi_select.h" #include "ui/widgets/labels.h" diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index 40b7d0a29..83fc416ea 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/confirm_box.h" #include "observer_peer.h" #include "ui/widgets/checkbox.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "data/data_channel.h" #include "data/data_chat.h" diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp index ebf26c579..ce2f0a6b0 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp @@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history.h" #include "dialogs/dialogs_indexed_list.h" #include "base/unixtime.h" -#include "auth_session.h" +#include "main/main_session.h" #include "mainwidget.h" #include "mainwindow.h" #include "window/window_session_controller.h" diff --git a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp index e1936d1a9..62258b82e 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp @@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "window/window_controller.h" #include "ui/toast/toast.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "styles/style_boxes.h" #include "styles/style_info.h" diff --git a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp index 5618eeb17..6ea8e2228 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp @@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/confirm_box.h" #include "boxes/add_contact_box.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_boxes.h" #include "styles/style_info.h" diff --git a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp index a256b06ff..851629750 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp @@ -35,7 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/core_cloud_password.h" #include "base/unixtime.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_boxes.h" #include "styles/style_info.h" diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index 7737d3208..5db743d7b 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/peers/add_participants_box.h" #include "boxes/confirm_box.h" #include "boxes/add_contact_box.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "lang/lang_keys.h" #include "mainwidget.h" diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index dc1c436f0..858525bc3 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/peers/edit_peer_info_box.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "boxes/add_contact_box.h" #include "boxes/confirm_box.h" #include "boxes/peer_list_controllers.h" diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp index 37fa9b921..8948e3313 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/peers/edit_peer_type_box.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "boxes/add_contact_box.h" #include "boxes/confirm_box.h" #include "boxes/peer_list_controllers.h" diff --git a/Telegram/SourceFiles/boxes/rate_call_box.cpp b/Telegram/SourceFiles/boxes/rate_call_box.cpp index ea059dbcf..dd269168b 100644 --- a/Telegram/SourceFiles/boxes/rate_call_box.cpp +++ b/Telegram/SourceFiles/boxes/rate_call_box.cpp @@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/buttons.h" #include "ui/widgets/input_fields.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" namespace { diff --git a/Telegram/SourceFiles/boxes/self_destruction_box.cpp b/Telegram/SourceFiles/boxes/self_destruction_box.cpp index adba8faa9..208d94a04 100644 --- a/Telegram/SourceFiles/boxes/self_destruction_box.cpp +++ b/Telegram/SourceFiles/boxes/self_destruction_box.cpp @@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/checkbox.h" #include "ui/widgets/labels.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_boxes.h" SelfDestructionBox::SelfDestructionBox( diff --git a/Telegram/SourceFiles/boxes/sessions_box.cpp b/Telegram/SourceFiles/boxes/sessions_box.cpp index 69fa65233..40a213aba 100644 --- a/Telegram/SourceFiles/boxes/sessions_box.cpp +++ b/Telegram/SourceFiles/boxes/sessions_box.cpp @@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/localstorage.h" #include "mainwidget.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "base/unixtime.h" #include "boxes/confirm_box.h" diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index 4b06fd643..087739235 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -33,12 +33,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_user.h" #include "data/data_session.h" #include "data/data_folder.h" -#include "auth_session.h" +#include "main/main_session.h" #include "core/application.h" #include "styles/style_boxes.h" #include "styles/style_history.h" - class ShareBox::Inner : public Ui::RpWidget , public RPCSender @@ -1106,7 +1105,7 @@ void ShareGameScoreByHash(const QString &hash) { } auto hashDataInts = reinterpret_cast(hashData.data()); - if (!AuthSession::Exists() || hashDataInts[0] != Auth().userId()) { + if (!Main::Session::Exists() || hashDataInts[0] != Auth().userId()) { Ui::show(Box(tr::lng_share_wrong_user(tr::now))); return; } diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index 44b44e1de..2a45abf02 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lottie/lottie_animation.h" #include "window/window_session_controller.h" #include "base/unixtime.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "mainwidget.h" #include "mainwindow.h" diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 39d600c39..9073698c8 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -31,7 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/input_fields.h" #include "ui/image/image.h" #include "window/window_session_controller.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_boxes.h" #include "styles/style_chat_helpers.h" @@ -611,7 +611,7 @@ void StickersBox::saveChanges() { if (_someArchivedLoaded) { Local::writeArchivedStickers(); } - if (AuthSession::Exists()) { + if (Main::Session::Exists()) { Auth().api().saveStickerSets(_installed.widget()->getOrder(), _installed.widget()->getRemovedSets()); } } diff --git a/Telegram/SourceFiles/boxes/url_auth_box.cpp b/Telegram/SourceFiles/boxes/url_auth_box.cpp index 9febe29a0..f2d47ba6d 100644 --- a/Telegram/SourceFiles/boxes/url_auth_box.cpp +++ b/Telegram/SourceFiles/boxes/url_auth_box.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/checkbox.h" #include "ui/widgets/labels.h" #include "lang/lang_keys.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/boxes/username_box.cpp b/Telegram/SourceFiles/boxes/username_box.cpp index 298b03cac..d9e08ba8c 100644 --- a/Telegram/SourceFiles/boxes/username_box.cpp +++ b/Telegram/SourceFiles/boxes/username_box.cpp @@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/input_fields.h" #include "ui/toast/toast.h" #include "core/application.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "data/data_user.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/calls/calls_box_controller.cpp b/Telegram/SourceFiles/calls/calls_box_controller.cpp index a902bd883..f3ffe1470 100644 --- a/Telegram/SourceFiles/calls/calls_box_controller.cpp +++ b/Telegram/SourceFiles/calls/calls_box_controller.cpp @@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history.h" #include "history/history_item.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "data/data_media_types.h" diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index cb3ebeab7..b2413bcaf 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "calls/calls_call.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "lang/lang_keys.h" #include "boxes/confirm_box.h" diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index 3f1fbedc5..fb7ac701f 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mtproto/connection.h" #include "core/application.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "lang/lang_keys.h" #include "boxes/confirm_box.h" diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 11eb33091..7284cd208 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "mainwindow.h" #include "lang/lang_keys.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "observer_peer.h" #include "platform/platform_specific.h" diff --git a/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp b/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp index a41d87c9e..810b58af6 100644 --- a/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp +++ b/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp @@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_item_components.h" #include "data/data_user.h" #include "data/data_session.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_widgets.h" #include "styles/style_history.h" diff --git a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp index d50c297cd..ceae00309 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp @@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "platform/platform_info.h" #include "ui/emoji_config.h" #include "main/main_account.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" namespace ChatHelpers { @@ -468,7 +468,7 @@ int EmojiKeywords::LangPack::maxQueryLength() const { EmojiKeywords::EmojiKeywords() { crl::on_main(&_guard, [=] { - handleAuthSessionChanges(); + handleSessionChanges(); }); } @@ -486,9 +486,9 @@ void EmojiKeywords::langPackRefreshed() { _refreshed.fire({}); } -void EmojiKeywords::handleAuthSessionChanges() { +void EmojiKeywords::handleSessionChanges() { Core::App().activeAccount().sessionValue( - ) | rpl::map([](AuthSession *session) { + ) | rpl::map([](Main::Session *session) { return session ? &session->api() : nullptr; }) | rpl::start_with_next([=](ApiWrap *api) { apiChanged(api); @@ -528,7 +528,7 @@ void EmojiKeywords::refresh() { } std::vector EmojiKeywords::languages() { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return {}; } refreshInputLanguages(); diff --git a/Telegram/SourceFiles/chat_helpers/emoji_keywords.h b/Telegram/SourceFiles/chat_helpers/emoji_keywords.h index 2d31ea8aa..7c9509b86 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_keywords.h +++ b/Telegram/SourceFiles/chat_helpers/emoji_keywords.h @@ -52,7 +52,7 @@ private: ApiWrap *api() override; void langPackRefreshed() override; - void handleAuthSessionChanges(); + void handleSessionChanges(); void apiChanged(ApiWrap *api); void refreshInputLanguages(); [[nodiscard]] std::vector languages(); diff --git a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp index 98779d21f..254e56aae 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "platform/platform_specific.h" #include "core/application.h" #include "core/event_filter.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_chat_helpers.h" namespace Ui { diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index 45cfa0b84..d9449ca35 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lottie/lottie_single_player.h" #include "ui/widgets/scroll_area.h" #include "ui/image/image.h" -#include "auth_session.h" +#include "main/main_session.h" #include "chat_helpers/stickers.h" #include "base/unixtime.h" #include "styles/style_history.h" diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 37d944ec8..f810ba302 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "lang/lang_keys.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_boxes.h" #include "styles/style_history.h" diff --git a/Telegram/SourceFiles/chat_helpers/stickers.cpp b/Telegram/SourceFiles/chat_helpers/stickers.cpp index ded98679b..0529c7126 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers.cpp @@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "storage/localstorage.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "mainwindow.h" #include "ui/toast/toast.h" #include "ui/emoji_config.h" @@ -1115,7 +1115,7 @@ auto LottieCachedFromContent( Method &&method, Storage::Cache::Key baseKey, LottieSize sizeTag, - not_null session, + not_null session, const QByteArray &content, QSize box) { const auto key = Storage::Cache::Key{ diff --git a/Telegram/SourceFiles/chat_helpers/stickers.h b/Telegram/SourceFiles/chat_helpers/stickers.h index f5bd29985..6825ff83f 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers.h +++ b/Telegram/SourceFiles/chat_helpers/stickers.h @@ -11,7 +11,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/image/image_source.h" class DocumentData; -class AuthSession; + +namespace Main { +class Session; +} // namespace Main namespace Storage { namespace Cache { diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 9688a32e2..1b8104732 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -28,7 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/stickers_box.h" #include "boxes/confirm_box.h" #include "window/window_session_controller.h" // GifPauseReason. -#include "auth_session.h" +#include "main/main_session.h" #include "observer_peer.h" #include "apiwrap.h" #include "styles/style_chat_helpers.h" @@ -850,7 +850,7 @@ StickersListWidget::StickersListWidget( })); } -AuthSession &StickersListWidget::session() const { +Main::Session &StickersListWidget::session() const { return controller()->session(); } diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h index 835a61529..6da5c3ba8 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h @@ -12,7 +12,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/variant.h" #include "base/timer.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Window { class SessionController; @@ -42,7 +44,7 @@ public: QWidget *parent, not_null controller); - AuthSession &session() const; + Main::Session &session() const; rpl::producer> chosen() const; rpl::producer<> scrollUpdated() const; diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp index 57724bbf4..b6c378213 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp @@ -372,7 +372,7 @@ TabbedSelector::TabbedSelector( TabbedSelector::~TabbedSelector() = default; -AuthSession &TabbedSelector::session() const { +Main::Session &TabbedSelector::session() const { return _controller->session(); } diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h index a497ad6ae..3ed8d2ed3 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h @@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/animations.h" #include "ui/effects/panel_animation.h" #include "mtproto/sender.h" -#include "auth_session.h" +#include "main/main_session.h" namespace InlineBots { class Result; @@ -57,7 +57,7 @@ public: Mode mode = Mode::Full); ~TabbedSelector(); - AuthSession &session() const; + Main::Session &session() const; rpl::producer emojiChosen() const; rpl::producer> fileChosen() const; diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index bc1addfb8..c91dd5f04 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwindow.h" #include "dialogs/dialogs_entry.h" #include "history/history.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "calls/calls_instance.h" #include "lang/lang_file_parser.h" @@ -116,8 +116,8 @@ Application::~Application() { _window.reset(); _mediaView.reset(); - // This can call writeMap() that serializes AuthSession. - // In case it gets called after authSessionDestroy() we get missing data. + // This can call writeMap() that serializes Main::Session. + // In case it gets called after destroySession() we get missing data. Local::finish(); // Some MTP requests can be cancelled from data clearing. diff --git a/Telegram/SourceFiles/core/application.h b/Telegram/SourceFiles/core/application.h index a86b2b849..f9d8c444d 100644 --- a/Telegram/SourceFiles/core/application.h +++ b/Telegram/SourceFiles/core/application.h @@ -11,7 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mtproto/auth_key.h" #include "base/timer.h" -class AuthSessionSettings; class MainWindow; class MainWidget; class FileUploader; @@ -140,7 +139,7 @@ public: return *_account; } - // AuthSession component. + // Main::Session component. int unreadBadge() const; bool unreadBadgeMuted() const; diff --git a/Telegram/SourceFiles/core/changelogs.cpp b/Telegram/SourceFiles/core/changelogs.cpp index dd3adc156..40222ccc9 100644 --- a/Telegram/SourceFiles/core/changelogs.cpp +++ b/Telegram/SourceFiles/core/changelogs.cpp @@ -71,7 +71,7 @@ QString FormatVersionPrecise(int version) { } // namespace -Changelogs::Changelogs(not_null session, int oldVersion) +Changelogs::Changelogs(not_null session, int oldVersion) : _session(session) , _oldVersion(oldVersion) { _session->data().chatsListChanges( @@ -83,7 +83,7 @@ Changelogs::Changelogs(not_null session, int oldVersion) } std::unique_ptr Changelogs::Create( - not_null session) { + not_null session) { const auto oldVersion = Local::oldMapVersion(); return (oldVersion > 0 && oldVersion < AppVersion) ? std::make_unique(session, oldVersion) diff --git a/Telegram/SourceFiles/core/changelogs.h b/Telegram/SourceFiles/core/changelogs.h index 3e8007cef..598f4eb5f 100644 --- a/Telegram/SourceFiles/core/changelogs.h +++ b/Telegram/SourceFiles/core/changelogs.h @@ -9,16 +9,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/weak_ptr.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Core { class Changelogs : public base::has_weak_ptr, private base::Subscriber { public: - Changelogs(not_null session, int oldVersion); + Changelogs(not_null session, int oldVersion); static std::unique_ptr Create( - not_null session); + not_null session); private: void requestCloudLogs(); @@ -27,7 +29,7 @@ private: void addBetaLogs(); void addBetaLog(int changeVersion, const char *changes); - const not_null _session; + const not_null _session; const int _oldVersion = 0; rpl::lifetime _chatsSubscription; bool _addedSomeLocal = false; diff --git a/Telegram/SourceFiles/core/click_handler_types.cpp b/Telegram/SourceFiles/core/click_handler_types.cpp index 15b4262a5..9ef340fe7 100644 --- a/Telegram/SourceFiles/core/click_handler_types.cpp +++ b/Telegram/SourceFiles/core/click_handler_types.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/local_url_handlers.h" #include "core/file_utilities.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "platform/platform_specific.h" #include "history/view/history_view_element.h" #include "history/history_item.h" diff --git a/Telegram/SourceFiles/core/file_utilities.cpp b/Telegram/SourceFiles/core/file_utilities.cpp index 71c200777..6be11623d 100644 --- a/Telegram/SourceFiles/core/file_utilities.cpp +++ b/Telegram/SourceFiles/core/file_utilities.cpp @@ -148,7 +148,7 @@ QString DefaultDownloadPath() { return QStandardPaths::writableLocation( QStandardPaths::DownloadLocation) + '/' - + (AuthSession::Exists() && Auth().supportMode() + + (Main::Session::Exists() && Auth().supportMode() ? "Tsupport Desktop" : str_const_toString(AppName)) + '/'; diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 60e4627ff..d7468ea25 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_channel.h" #include "mainwindow.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" namespace Core { @@ -34,7 +34,7 @@ namespace { using Match = qthelp::RegularExpressionMatch; bool JoinGroupByHash(const Match &match, const QVariant &context) { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return false; } const auto hash = match->captured(1); @@ -62,7 +62,7 @@ bool JoinGroupByHash(const Match &match, const QVariant &context) { } bool ShowStickerSet(const Match &match, const QVariant &context) { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return false; } Core::App().hideMediaView(); @@ -79,7 +79,7 @@ bool SetLanguage(const Match &match, const QVariant &context) { } bool ShareUrl(const Match &match, const QVariant &context) { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return false; } auto params = url_parse_params( @@ -94,7 +94,7 @@ bool ShareUrl(const Match &match, const QVariant &context) { } bool ConfirmPhone(const Match &match, const QVariant &context) { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return false; } auto params = url_parse_params( @@ -110,7 +110,7 @@ bool ConfirmPhone(const Match &match, const QVariant &context) { } bool ShareGameScore(const Match &match, const QVariant &context) { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return false; } const auto params = url_parse_params( @@ -167,7 +167,7 @@ bool ShowPassport(const Match &match, const QVariant &context) { } bool ShowWallPaper(const Match &match, const QVariant &context) { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return false; } const auto params = url_parse_params( @@ -179,7 +179,7 @@ bool ShowWallPaper(const Match &match, const QVariant &context) { } bool ResolveUsername(const Match &match, const QVariant &context) { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return false; } const auto params = url_parse_params( @@ -229,7 +229,7 @@ bool ResolveUsername(const Match &match, const QVariant &context) { } bool ResolvePrivatePost(const Match &match, const QVariant &context) { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return false; } const auto params = url_parse_params( @@ -274,7 +274,7 @@ bool ResolvePrivatePost(const Match &match, const QVariant &context) { } bool HandleUnknown(const Match &match, const QVariant &context) { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return false; } const auto request = match->captured(1); diff --git a/Telegram/SourceFiles/data/data_channel.cpp b/Telegram/SourceFiles/data/data_channel.cpp index daa5f3e78..fd67b1460 100644 --- a/Telegram/SourceFiles/data/data_channel.cpp +++ b/Telegram/SourceFiles/data/data_channel.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/unixtime.h" #include "history/history.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" namespace { diff --git a/Telegram/SourceFiles/data/data_channel_admins.cpp b/Telegram/SourceFiles/data/data_channel_admins.cpp index 9eef1dedd..e7ac8ced1 100644 --- a/Telegram/SourceFiles/data/data_channel_admins.cpp +++ b/Telegram/SourceFiles/data/data_channel_admins.cpp @@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history.h" #include "data/data_channel.h" #include "data/data_session.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Data { diff --git a/Telegram/SourceFiles/data/data_chat.cpp b/Telegram/SourceFiles/data/data_chat.cpp index 143ba1332..9e7870b8e 100644 --- a/Telegram/SourceFiles/data/data_chat.cpp +++ b/Telegram/SourceFiles/data/data_chat.cpp @@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_channel.h" #include "data/data_session.h" #include "history/history.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "observer_peer.h" diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index ec4ffd4bd..9a13d7855 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -453,7 +453,7 @@ Data::Session &DocumentData::owner() const { return *_owner; } -AuthSession &DocumentData::session() const { +Main::Session &DocumentData::session() const { return _owner->session(); } diff --git a/Telegram/SourceFiles/data/data_document.h b/Telegram/SourceFiles/data/data_document.h index 371fe17c5..79375a9f1 100644 --- a/Telegram/SourceFiles/data/data_document.h +++ b/Telegram/SourceFiles/data/data_document.h @@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_types.h" #include "ui/image/image.h" +class mtpFileLoader; + namespace Images { class Source; } // namespace Images @@ -31,8 +33,9 @@ namespace Data { class Session; } // namespace Data -class AuthSession; -class mtpFileLoader; +namespace Main { +class Session; +} // namespace Main inline uint64 mediaMix32To64(int32 a, int32 b) { return (uint64(*reinterpret_cast(&a)) << 32) @@ -84,7 +87,7 @@ public: DocumentData(not_null owner, DocumentId id); [[nodiscard]] Data::Session &owner() const; - [[nodiscard]] AuthSession &session() const; + [[nodiscard]] Main::Session &session() const; void setattributes( const QVector &attributes); diff --git a/Telegram/SourceFiles/data/data_document_good_thumbnail.cpp b/Telegram/SourceFiles/data/data_document_good_thumbnail.cpp index b89dc487e..bc3667b67 100644 --- a/Telegram/SourceFiles/data/data_document_good_thumbnail.cpp +++ b/Telegram/SourceFiles/data/data_document_good_thumbnail.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_file_origin.h" #include "media/clip/media_clip_reader.h" #include "lottie/lottie_animation.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Data { namespace { diff --git a/Telegram/SourceFiles/data/data_folder.cpp b/Telegram/SourceFiles/data/data_folder.cpp index 7fb776e8d..e49932ae8 100644 --- a/Telegram/SourceFiles/data/data_folder.cpp +++ b/Telegram/SourceFiles/data/data_folder.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "main/main_account.h" //#include "storage/storage_feed_messages.h" // #feed -#include "auth_session.h" +#include "main/main_session.h" #include "observer_peer.h" #include "apiwrap.h" #include "mainwidget.h" @@ -30,7 +30,7 @@ constexpr auto kLoadedChatsMinCount = 20; constexpr auto kShowChatNamesCount = 8; rpl::producer PinnedDialogsInFolderMaxValue( - not_null session) { + not_null session) { return rpl::single( rpl::empty_value() ) | rpl::then( diff --git a/Telegram/SourceFiles/data/data_folder.h b/Telegram/SourceFiles/data/data_folder.h index d6ea50b70..26a9b8d58 100644 --- a/Telegram/SourceFiles/data/data_folder.h +++ b/Telegram/SourceFiles/data/data_folder.h @@ -12,7 +12,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_messages.h" class ChannelData; -class AuthSession; + +namespace Main { +class Session; +} // namespace Main namespace Data { diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index 3285a9e55..e19932fa4 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "observer_peer.h" #include "apiwrap.h" #include "boxes/confirm_box.h" -#include "auth_session.h" +#include "main/main_session.h" #include "core/application.h" #include "mainwindow.h" #include "window/window_session_controller.h" @@ -108,7 +108,7 @@ Data::Session &PeerData::owner() const { return *_owner; } -AuthSession &PeerData::session() const { +Main::Session &PeerData::session() const { return _owner->session(); } diff --git a/Telegram/SourceFiles/data/data_peer.h b/Telegram/SourceFiles/data/data_peer.h index ee003dd23..9d5716bb1 100644 --- a/Telegram/SourceFiles/data/data_peer.h +++ b/Telegram/SourceFiles/data/data_peer.h @@ -11,18 +11,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_flags.h" #include "data/data_notify_settings.h" -namespace Ui { -class EmptyUserpic; -} // namespace Ui - -class AuthSession; class PeerData; class UserData; class ChatData; class ChannelData; +namespace Ui { +class EmptyUserpic; +} // namespace Ui + namespace Main { class Account; +class Session; } // namespace Main namespace Data { @@ -125,7 +125,7 @@ public: static constexpr auto kServiceNotificationsId = peerFromUser(777000); [[nodiscard]] Data::Session &owner() const; - [[nodiscard]] AuthSession &session() const; + [[nodiscard]] Main::Session &session() const; [[nodiscard]] Main::Account &account() const; [[nodiscard]] bool isUser() const { diff --git a/Telegram/SourceFiles/data/data_photo.cpp b/Telegram/SourceFiles/data/data_photo.cpp index 9ffbd57f3..bf4406a68 100644 --- a/Telegram/SourceFiles/data/data_photo.cpp +++ b/Telegram/SourceFiles/data/data_photo.cpp @@ -23,7 +23,7 @@ Data::Session &PhotoData::owner() const { return *_owner; } -AuthSession &PhotoData::session() const { +Main::Session &PhotoData::session() const { return _owner->session(); } diff --git a/Telegram/SourceFiles/data/data_photo.h b/Telegram/SourceFiles/data/data_photo.h index a8472a26e..9a3315fc6 100644 --- a/Telegram/SourceFiles/data/data_photo.h +++ b/Telegram/SourceFiles/data/data_photo.h @@ -9,7 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_types.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Data { class Session; @@ -20,7 +22,7 @@ public: PhotoData(not_null owner, PhotoId id); [[nodiscard]] Data::Session &owner() const; - [[nodiscard]] AuthSession &session() const; + [[nodiscard]] Main::Session &session() const; void automaticLoad( Data::FileOrigin origin, diff --git a/Telegram/SourceFiles/data/data_poll.cpp b/Telegram/SourceFiles/data/data_poll.cpp index 6489a309d..072604edb 100644 --- a/Telegram/SourceFiles/data/data_poll.cpp +++ b/Telegram/SourceFiles/data/data_poll.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_poll.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" namespace { diff --git a/Telegram/SourceFiles/data/data_pts_waiter.cpp b/Telegram/SourceFiles/data/data_pts_waiter.cpp index 9ffb5f642..580a8f5e9 100644 --- a/Telegram/SourceFiles/data/data_pts_waiter.cpp +++ b/Telegram/SourceFiles/data/data_pts_waiter.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_pts_waiter.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" uint64 PtsWaiter::ptsKey(PtsSkippedQueue queue, int32 pts) { diff --git a/Telegram/SourceFiles/data/data_search_controller.cpp b/Telegram/SourceFiles/data/data_search_controller.cpp index d78b1c5b4..6ae59fa8d 100644 --- a/Telegram/SourceFiles/data/data_search_controller.cpp +++ b/Telegram/SourceFiles/data/data_search_controller.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "data/data_search_controller.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "data/data_messages.h" #include "data/data_channel.h" diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 0ed4e3977..103190eff 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "mainwidget.h" #include "core/application.h" @@ -157,7 +157,7 @@ MTPPhotoSize FindDocumentThumbnail(const MTPDdocument &data) { } rpl::producer PinnedDialogsCountMaxValue( - not_null session) { + not_null session) { return rpl::single( rpl::empty_value() ) | rpl::then( @@ -189,7 +189,7 @@ bool PruneDestroyedAndSet( } // namespace -Session::Session(not_null session) +Session::Session(not_null session) : _session(session) , _cache(Core::App().databases().get( Local::cachePath(), diff --git a/Telegram/SourceFiles/data/data_session.h b/Telegram/SourceFiles/data/data_session.h index 119424e81..e49bd2502 100644 --- a/Telegram/SourceFiles/data/data_session.h +++ b/Telegram/SourceFiles/data/data_session.h @@ -33,7 +33,9 @@ class Element; class ElementDelegate; } // namespace HistoryView -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Media { namespace Clip { @@ -70,10 +72,10 @@ public: QString text; }; - explicit Session(not_null session); + explicit Session(not_null session); ~Session(); - [[nodiscard]] AuthSession &session() const { + [[nodiscard]] Main::Session &session() const { return *_session; } @@ -811,7 +813,7 @@ private: void setWallpapers(const QVector &data, int32 hash); - not_null _session; + not_null _session; Storage::DatabasePointer _cache; Storage::DatabasePointer _bigFileCache; diff --git a/Telegram/SourceFiles/data/data_shared_media.cpp b/Telegram/SourceFiles/data/data_shared_media.cpp index 1b5534247..652c9b7e1 100644 --- a/Telegram/SourceFiles/data/data_shared_media.cpp +++ b/Telegram/SourceFiles/data/data_shared_media.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_shared_media.h" #include -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "storage/storage_facade.h" #include "storage/storage_shared_media.h" diff --git a/Telegram/SourceFiles/data/data_types.cpp b/Telegram/SourceFiles/data/data_types.cpp index b9529ed48..413f6428c 100644 --- a/Telegram/SourceFiles/data/data_types.cpp +++ b/Telegram/SourceFiles/data/data_types.cpp @@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/input_fields.h" #include "storage/cache/storage_cache_types.h" #include "base/openssl_help.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Data { namespace { diff --git a/Telegram/SourceFiles/data/data_user_photos.cpp b/Telegram/SourceFiles/data/data_user_photos.cpp index 7715f358e..f2a118a9c 100644 --- a/Telegram/SourceFiles/data/data_user_photos.cpp +++ b/Telegram/SourceFiles/data/data_user_photos.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "data/data_user_photos.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "data/data_session.h" #include "storage/storage_facade.h" diff --git a/Telegram/SourceFiles/data/data_wall_paper.cpp b/Telegram/SourceFiles/data/data_wall_paper.cpp index 5510d88bb..18a497997 100644 --- a/Telegram/SourceFiles/data/data_wall_paper.cpp +++ b/Telegram/SourceFiles/data/data_wall_paper.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "storage/serialize_common.h" #include "core/application.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Data { namespace { diff --git a/Telegram/SourceFiles/data/data_web_page.cpp b/Telegram/SourceFiles/data/data_web_page.cpp index de36516ce..afc40f445 100644 --- a/Telegram/SourceFiles/data/data_web_page.cpp +++ b/Telegram/SourceFiles/data/data_web_page.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "data/data_web_page.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "mainwidget.h" #include "data/data_session.h" diff --git a/Telegram/SourceFiles/dialogs/dialogs_entry.cpp b/Telegram/SourceFiles/dialogs/dialogs_entry.cpp index 5e81184b0..ffee2f9a9 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_entry.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_entry.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "data/data_folder.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "history/history_item.h" #include "history/history.h" #include "styles/style_dialogs.h" // st::dialogsTextWidthMin @@ -49,7 +49,7 @@ Data::Session &Entry::owner() const { return *_owner; } -AuthSession &Entry::session() const { +Main::Session &Entry::session() const { return _owner->session(); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_entry.h b/Telegram/SourceFiles/dialogs/dialogs_entry.h index f881b879d..ed0ec0191 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_entry.h +++ b/Telegram/SourceFiles/dialogs/dialogs_entry.h @@ -11,7 +11,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "dialogs/dialogs_key.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Data { class Session; @@ -93,7 +95,7 @@ public: virtual ~Entry() = default; Data::Session &owner() const; - AuthSession &session() const; + Main::Session &session() const; PositionChange adjustByPosInChatList(Mode list); bool inChatList(Mode list = Mode::All) const { diff --git a/Telegram/SourceFiles/dialogs/dialogs_indexed_list.cpp b/Telegram/SourceFiles/dialogs/dialogs_indexed_list.cpp index 1cb769ee8..b5bb69044 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_indexed_list.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_indexed_list.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "dialogs/dialogs_indexed_list.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "history/history.h" diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 41a0e05b0..bef98c114 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -34,7 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/themes/window_theme.h" #include "observer_peer.h" #include "chat_helpers/stickers.h" -#include "auth_session.h" +#include "main/main_session.h" #include "window/notifications_manager.h" #include "window/window_session_controller.h" #include "window/window_peer_menu.h" @@ -250,7 +250,7 @@ InnerWidget::InnerWidget( setupShortcuts(); } -AuthSession &InnerWidget::session() const { +Main::Session &InnerWidget::session() const { return _controller->session(); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h index 40bcd2826..da10156be 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h @@ -13,7 +13,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/rp_widget.h" #include "base/flags.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Ui { class IconButton; @@ -163,7 +165,7 @@ private: NextOrOriginal, }; - AuthSession &session() const; + Main::Session &session() const; void dialogRowReplaced(Row *oldRow, Row *newRow); diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp index 445563644..b5823b308 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp @@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_chat.h" #include "data/data_user.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" namespace Dialogs { diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 296d63026..79f27cc42 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "mainwindow.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "core/application.h" #include "core/event_filter.h" diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.h b/Telegram/SourceFiles/dialogs/dialogs_widget.h index a04240214..01808db86 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.h +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.h @@ -13,7 +13,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "dialogs/dialogs_key.h" #include "ui/special_buttons.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace HistoryView { class TopBarWidget; diff --git a/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp b/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp index 0b7f96669..dcf3e27fc 100644 --- a/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp +++ b/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/localstorage.h" #include "core/file_utilities.h" #include "platform/platform_info.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "base/unixtime.h" #include "styles/style_export.h" diff --git a/Telegram/SourceFiles/export/view/export_view_settings.cpp b/Telegram/SourceFiles/export/view/export_view_settings.cpp index ce023ebe3..1a6e4fd32 100644 --- a/Telegram/SourceFiles/export/view/export_view_settings.cpp +++ b/Telegram/SourceFiles/export/view/export_view_settings.cpp @@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/file_utilities.h" #include "boxes/calendar_box.h" #include "base/unixtime.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_widgets.h" #include "styles/style_export.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index 7c41a1aec..ee94788ad 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwindow.h" #include "mainwidget.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "boxes/confirm_box.h" #include "boxes/url_auth_box.h" #include "window/layer_widget.h" diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index 3ecb283c9..711f26498 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -28,7 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "layout.h" #include "window/window_session_controller.h" -#include "auth_session.h" +#include "main/main_session.h" #include "ui/widgets/popup_menu.h" #include "ui/image/image.h" #include "ui/text/text_utilities.h" @@ -277,7 +277,7 @@ InnerWidget::InnerWidget( requestAdmins(); } -AuthSession &InnerWidget::session() const { +Main::Session &InnerWidget::session() const { return _controller->session(); } diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.h b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.h index 5f34d59fe..cf29d9d05 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.h +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.h @@ -16,7 +16,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mtproto/sender.h" #include "base/timer.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace HistoryView { class Element; @@ -50,7 +52,7 @@ public: not_null controller, not_null channel); - AuthSession &session() const; + Main::Session &session() const; base::Observable showSearchSignal; base::Observable scrollToSignal; diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index e8e1b834f..c06f20c57 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/unixtime.h" #include "core/application.h" #include "mainwindow.h" // App::wnd()->sessionController -#include "auth_session.h" +#include "main/main_session.h" namespace AdminLog { namespace { diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 5e7f43489..9d421fb5e 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwidget.h" #include "mainwindow.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" #include "window/notifications_manager.h" #include "calls/calls_instance.h" #include "storage/localstorage.h" diff --git a/Telegram/SourceFiles/history/history.h b/Telegram/SourceFiles/history/history.h index 711c1b477..ef2edc549 100644 --- a/Telegram/SourceFiles/history/history.h +++ b/Telegram/SourceFiles/history/history.h @@ -23,7 +23,10 @@ class HistoryItem; class HistoryMessage; class HistoryService; class HistoryMedia; -class AuthSession; + +namespace Main { +class Session; +} // namespace Main namespace Data { struct Draft; diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 5ecab7403..77f814ff8 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -38,7 +38,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwindow.h" #include "mainwidget.h" #include "layout.h" -#include "auth_session.h" +#include "main/main_session.h" #include "core/application.h" #include "apiwrap.h" #include "platform/platform_info.h" @@ -185,7 +185,7 @@ HistoryInner::HistoryInner( }, lifetime()); } -AuthSession &HistoryInner::session() const { +Main::Session &HistoryInner::session() const { return _controller->session(); } diff --git a/Telegram/SourceFiles/history/history_inner_widget.h b/Telegram/SourceFiles/history/history_inner_widget.h index 2b6435221..18545c0ba 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.h +++ b/Telegram/SourceFiles/history/history_inner_widget.h @@ -52,7 +52,7 @@ public: Ui::ScrollArea *scroll, not_null history); - AuthSession &session() const; + Main::Session &session() const; void messagesReceived(PeerData *peer, const QVector &messages); void messagesReceivedDown(PeerData *peer, const QVector &messages); diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index fa5cc7949..5ddf5c05a 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_facade.h" #include "storage/storage_shared_media.h" //#include "storage/storage_feed_messages.h" // #feed -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "media/audio/media_audio.h" #include "core/application.h" diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index d938c8cb1..512c2b84d 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "data/data_user.h" #include "data/data_file_origin.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_widgets.h" #include "styles/style_history.h" #include "window/window_session_controller.h" diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index a7116b535..98c603a51 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_service.h" #include "history/view/history_view_service_message.h" #include "history/view/history_view_context_menu.h" // For CopyPostLink(). -#include "auth_session.h" +#include "main/main_session.h" #include "boxes/share_box.h" #include "boxes/confirm_box.h" #include "ui/toast/toast.h" diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index 39e6c9a61..8a68e82e5 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "layout.h" #include "history/history.h" diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index edd4f2e3e..b5b9c4b31 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -73,7 +73,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/popup_menu.h" #include "ui/text_options.h" #include "ui/unread_badge.h" -#include "auth_session.h" +#include "main/main_session.h" #include "window/themes/window_theme.h" #include "window/notifications_manager.h" #include "window/window_session_controller.h" diff --git a/Telegram/SourceFiles/history/media/history_media_contact.cpp b/Telegram/SourceFiles/history/media/history_media_contact.cpp index 67580c8ec..eb742f394 100644 --- a/Telegram/SourceFiles/history/media/history_media_contact.cpp +++ b/Telegram/SourceFiles/history/media/history_media_contact.cpp @@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "data/data_user.h" #include "data/data_media_types.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_history.h" namespace { diff --git a/Telegram/SourceFiles/history/media/history_media_poll.cpp b/Telegram/SourceFiles/history/media/history_media_poll.cpp index 57678b81a..d22de0426 100644 --- a/Telegram/SourceFiles/history/media/history_media_poll.cpp +++ b/Telegram/SourceFiles/history/media/history_media_poll.cpp @@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_poll.h" #include "data/data_session.h" #include "layout.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "styles/style_history.h" #include "styles/style_widgets.h" diff --git a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp index 0936bbc87..0c9d260fe 100644 --- a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp +++ b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp @@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_controller.h" #include "window/window_session_controller.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "boxes/confirm_box.h" #include "boxes/generic_box.h" // window->show(Box(InitMethod())) #include "boxes/peers/edit_contact_box.h" diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 97505bfd3..f90924b87 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -34,7 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "mainwidget.h" #include "mainwindow.h" // App::wnd()->sessionController -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" namespace HistoryView { diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index bcfe1ef25..02f46c5c5 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "layout.h" #include "window/window_session_controller.h" #include "window/window_peer_menu.h" -#include "auth_session.h" +#include "main/main_session.h" #include "ui/widgets/popup_menu.h" #include "ui/toast/toast.h" #include "lang/lang_keys.h" @@ -295,7 +295,7 @@ ListWidget::ListWidget( }); } -AuthSession &ListWidget::session() const { +Main::Session &ListWidget::session() const { return _controller->session(); } diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.h b/Telegram/SourceFiles/history/view/history_view_list_widget.h index df13214c1..98553d3c8 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.h +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.h @@ -15,7 +15,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_messages.h" #include "history/view/history_view_element.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Ui { class PopupMenu; @@ -130,7 +132,7 @@ public: not_null controller, not_null delegate); - AuthSession &session() const; + Main::Session &session() const; not_null delegate() const; diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 779c433cf..b736d8b26 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "mainwidget.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "window/window_session_controller.h" #include "layout.h" #include "styles/style_widgets.h" diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 8cdc983d5..a972b69ff 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_shared_media.h" #include "mainwidget.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "lang/lang_keys.h" #include "core/shortcuts.h" #include "ui/special_buttons.h" @@ -145,7 +145,7 @@ TopBarWidget::TopBarWidget( TopBarWidget::~TopBarWidget() = default; -AuthSession &TopBarWidget::session() const { +Main::Session &TopBarWidget::session() const { return _controller->session(); } diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h index c2f9f4962..bc1ced310 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h @@ -12,7 +12,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/timer.h" #include "dialogs/dialogs_key.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Ui { class AbstractButton; @@ -43,7 +45,7 @@ public: not_null controller); ~TopBarWidget(); - AuthSession &session() const; + Main::Session &session() const; void updateControlsVisibility(); void finishAnimating(); diff --git a/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.cpp b/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.cpp index c53c248d5..be6b791fa 100644 --- a/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.cpp +++ b/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.cpp @@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/scroll_area.h" #include "data/data_user.h" #include "data/data_session.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_info.h" namespace Info { diff --git a/Telegram/SourceFiles/info/info_content_widget.cpp b/Telegram/SourceFiles/info/info_content_widget.cpp index c5b296838..c61ee13c1 100644 --- a/Telegram/SourceFiles/info/info_content_widget.cpp +++ b/Telegram/SourceFiles/info/info_content_widget.cpp @@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "info/info_controller.h" #include "boxes/peer_list_box.h" #include "data/data_session.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_info.h" #include "styles/style_profile.h" diff --git a/Telegram/SourceFiles/info/info_controller.cpp b/Telegram/SourceFiles/info/info_controller.cpp index b2f2927b7..68c328428 100644 --- a/Telegram/SourceFiles/info/info_controller.cpp +++ b/Telegram/SourceFiles/info/info_controller.cpp @@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_channel.h" #include "data/data_chat.h" #include "data/data_session.h" -#include "auth_session.h" +#include "main/main_session.h" #include "window/window_session_controller.h" namespace Info { diff --git a/Telegram/SourceFiles/info/info_layer_widget.cpp b/Telegram/SourceFiles/info/info_layer_widget.cpp index 2a5baf922..70acaa1fa 100644 --- a/Telegram/SourceFiles/info/info_layer_widget.cpp +++ b/Telegram/SourceFiles/info/info_layer_widget.cpp @@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/section_widget.h" #include "window/window_session_controller.h" #include "window/main_window.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_info.h" #include "styles/style_window.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/info/info_memento.cpp b/Telegram/SourceFiles/info/info_memento.cpp index e6d3df774..4e81e1053 100644 --- a/Telegram/SourceFiles/info/info_memento.cpp +++ b/Telegram/SourceFiles/info/info_memento.cpp @@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_channel.h" #include "data/data_chat.h" #include "data/data_session.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Info { diff --git a/Telegram/SourceFiles/info/info_top_bar.cpp b/Telegram/SourceFiles/info/info_top_bar.cpp index 13003c132..f00d453df 100644 --- a/Telegram/SourceFiles/info/info_top_bar.cpp +++ b/Telegram/SourceFiles/info/info_top_bar.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/confirm_box.h" #include "boxes/peer_list_controllers.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "ui/widgets/buttons.h" #include "ui/widgets/labels.h" #include "ui/widgets/input_fields.h" diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index b0dd056f9..0ff8df071 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_peer_menu.h" #include "boxes/peer_list_box.h" #include "boxes/confirm_box.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_session.h" #include "data/data_user.h" #include "mainwidget.h" diff --git a/Telegram/SourceFiles/info/media/info_media_list_widget.cpp b/Telegram/SourceFiles/info/media/info_media_list_widget.cpp index a96bea911..4dc05f78a 100644 --- a/Telegram/SourceFiles/info/media/info_media_list_widget.cpp +++ b/Telegram/SourceFiles/info/media/info_media_list_widget.cpp @@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/file_download.h" #include "ui/widgets/popup_menu.h" #include "lang/lang_keys.h" -#include "auth_session.h" +#include "main/main_session.h" #include "mainwidget.h" #include "window/main_window.h" #include "styles/style_overview.h" @@ -554,7 +554,7 @@ ListWidget::ListWidget( start(); } -AuthSession &ListWidget::session() const { +Main::Session &ListWidget::session() const { return _controller->session(); } diff --git a/Telegram/SourceFiles/info/media/info_media_list_widget.h b/Telegram/SourceFiles/info/media/info_media_list_widget.h index 0995a0117..c1d4722c3 100644 --- a/Telegram/SourceFiles/info/media/info_media_list_widget.h +++ b/Telegram/SourceFiles/info/media/info_media_list_widget.h @@ -12,7 +12,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_shared_media.h" class DeleteMessagesBox; -class AuthSession; + +namespace Main { +class Session; +} // namespace Main namespace HistoryView { struct TextState; @@ -50,7 +53,7 @@ public: QWidget *parent, not_null controller); - AuthSession &session() const; + Main::Session &session() const; void restart(); diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index cc23349bf..c7f230f1e 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -41,7 +41,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_peer_menu.h" #include "mainwidget.h" #include "mainwindow.h" // MainWindow::controller. -#include "auth_session.h" +#include "main/main_session.h" #include "core/application.h" #include "apiwrap.h" #include "styles/style_info.h" diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp index bb2cdaecc..bc7b0ca96 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp @@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "observer_peer.h" #include "core/application.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" namespace Info { diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp index 2b32063bc..adf1ef84f 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp @@ -26,7 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/confirm_box.h" #include "boxes/report_box.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "window/main_window.h" #include "window/window_session_controller.h" diff --git a/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp b/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp index 62093e9ed..b47065e73 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp @@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/popup_menu.h" #include "lang/lang_keys.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "mainwidget.h" #include "observer_peer.h" #include "data/data_channel.h" diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.cpp b/Telegram/SourceFiles/info/profile/info_profile_values.cpp index 987946e5b..390bc31b6 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "observer_peer.h" #include "core/application.h" -#include "auth_session.h" +#include "main/main_session.h" #include "ui/wrap/slide_wrap.h" #include "ui/text/text_utilities.h" #include "lang/lang_keys.h" diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp index 2aa97988c..4b44550f7 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp @@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/view/history_view_cursor_state.h" #include "storage/localstorage.h" #include "ui/image/image.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "lang/lang_keys.h" diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp index 6ee242bb3..42eaa11ff 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/mime_type.h" #include "ui/image/image.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" namespace InlineBots { namespace { diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp index 7f25fc6b1..c5a234933 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp @@ -26,7 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwindow.h" #include "apiwrap.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "window/window_session_controller.h" #include "ui/widgets/scroll_area.h" #include "ui/widgets/labels.h" diff --git a/Telegram/SourceFiles/intro/introwidget.cpp b/Telegram/SourceFiles/intro/introwidget.cpp index 1567ee565..4397d244f 100644 --- a/Telegram/SourceFiles/intro/introwidget.cpp +++ b/Telegram/SourceFiles/intro/introwidget.cpp @@ -35,7 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_user.h" #include "window/themes/window_theme.h" #include "lang/lang_cloud_manager.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_boxes.h" #include "styles/style_intro.h" #include "styles/style_window.h" diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp index 236f7a3c7..7a40953bd 100644 --- a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp +++ b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/localstorage.h" #include "core/application.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "boxes/confirm_box.h" #include "ui/wrap/padding_wrap.h" #include "ui/widgets/labels.h" @@ -238,7 +238,7 @@ void CloudManager::setSuggestedLanguage(const QString &langCode) { _languageWasSuggested = true; _firstLanguageSuggestion.notify(); - if (AuthSession::Exists() + if (Main::Session::Exists() && _langpack.id().isEmpty() && !_suggestedLanguage.isEmpty()) { _offerSwitchToId = _suggestedLanguage; @@ -372,7 +372,7 @@ bool CloudManager::canApplyWithoutRestart(const QString &id) const { } // We don't support instant language switch if the auth session exists :( - return !AuthSession::Exists(); + return !Main::Session::Exists(); } void CloudManager::resetToDefault() { diff --git a/Telegram/SourceFiles/main/main_account.cpp b/Telegram/SourceFiles/main/main_account.cpp index 79aaa775b..dc5f23116 100644 --- a/Telegram/SourceFiles/main/main_account.cpp +++ b/Telegram/SourceFiles/main/main_account.cpp @@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "media/audio/media_audio.h" #include "mainwidget.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Main { @@ -95,14 +95,14 @@ void Account::createSession(const MTPUser &user) { return true; })); - _session = std::make_unique(this, user); + _session = std::make_unique(this, user); _sessionValue = _session.get(); } void Account::destroySession() { - _storedAuthSession.reset(); - _authSessionUserId = 0; - _authSessionUserSerialized = {}; + _storedSettings.reset(); + _sessionUserId = 0; + _sessionUserSerialized = {}; if (!sessionExists()) { return; } @@ -120,23 +120,23 @@ bool Account::sessionExists() const { return (_sessionValue.current() != nullptr); } -AuthSession &Account::session() { +Session &Account::session() { Expects(sessionExists()); return *_sessionValue.current(); } -const AuthSession &Account::session() const { +const Session &Account::session() const { Expects(sessionExists()); return *_sessionValue.current(); } -rpl::producer Account::sessionValue() const { +rpl::producer Account::sessionValue() const { return _sessionValue.value(); } -rpl::producer Account::sessionChanges() const { +rpl::producer Account::sessionChanges() const { return _sessionValue.changes(); } @@ -214,29 +214,29 @@ QByteArray Account::serializeMtpAuthorization() const { return serialize(_mtpConfig.mainDcId, keys, keysToDestroy); } -void Account::setAuthSessionUserId(UserId userId) { +void Account::setSessionUserId(UserId userId) { Expects(!sessionExists()); - _authSessionUserId = userId; + _sessionUserId = userId; } -void Account::setAuthSessionFromStorage( - std::unique_ptr data, +void Account::setSessionFromStorage( + std::unique_ptr data, QByteArray &&selfSerialized, int32 selfStreamVersion) { Expects(!sessionExists()); - DEBUG_LOG(("authSessionUserSerialized set: %1" + DEBUG_LOG(("sessionUserSerialized set: %1" ).arg(selfSerialized.size())); - _storedAuthSession = std::move(data); - _authSessionUserSerialized = std::move(selfSerialized); - _authSessionUserStreamVersion = selfStreamVersion; + _storedSettings = std::move(data); + _sessionUserSerialized = std::move(selfSerialized); + _sessionUserStreamVersion = selfStreamVersion; } -AuthSessionSettings *Account::getAuthSessionSettings() { - if (_authSessionUserId) { - return _storedAuthSession ? _storedAuthSession.get() : nullptr; +Settings *Account::getSessionSettings() { + if (_sessionUserId) { + return _storedSettings ? _storedSettings.get() : nullptr; } else if (sessionExists()) { return &session().settings(); } @@ -257,7 +257,7 @@ void Account::setMtpAuthorization(const QByteArray &serialized) { return; } - setAuthSessionUserId(userId); + setSessionUserId(userId); _mtpConfig.mainDcId = mainDcId; const auto readKeys = [&stream](auto &keys) { @@ -315,19 +315,19 @@ void Account::startMtp() { destroyMtpKeys(base::take(_mtpKeysToDestroy)); } - if (_authSessionUserId) { - DEBUG_LOG(("authSessionUserSerialized.size: %1" - ).arg(_authSessionUserSerialized.size())); - QDataStream peekStream(_authSessionUserSerialized); + if (_sessionUserId) { + DEBUG_LOG(("sessionUserSerialized.size: %1" + ).arg(_sessionUserSerialized.size())); + QDataStream peekStream(_sessionUserSerialized); const auto phone = Serialize::peekUserPhone( - _authSessionUserStreamVersion, + _sessionUserStreamVersion, peekStream); const auto flags = MTPDuser::Flag::f_self | (phone.isEmpty() ? MTPDuser::Flag() : MTPDuser::Flag::f_phone); createSession(MTP_user( MTP_flags(flags), - MTP_int(base::take(_authSessionUserId)), + MTP_int(base::take(_sessionUserId)), MTPlong(), // access_hash MTPstring(), // first_name MTPstring(), // last_name @@ -340,14 +340,14 @@ void Account::startMtp() { MTPstring(), // bot_inline_placeholder MTPstring())); // lang_code Local::readSelf( - base::take(_authSessionUserSerialized), - base::take(_authSessionUserStreamVersion)); + base::take(_sessionUserSerialized), + base::take(_sessionUserStreamVersion)); } - if (_storedAuthSession) { + if (_storedSettings) { if (sessionExists()) { - session().moveSettingsFrom(std::move(*_storedAuthSession)); + session().moveSettingsFrom(std::move(*_storedSettings)); } - _storedAuthSession.reset(); + _storedSettings.reset(); } if (sessionExists()) { diff --git a/Telegram/SourceFiles/main/main_account.h b/Telegram/SourceFiles/main/main_account.h index 2c98d0703..08d46b555 100644 --- a/Telegram/SourceFiles/main/main_account.h +++ b/Telegram/SourceFiles/main/main_account.h @@ -10,11 +10,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mtproto/auth_key.h" #include "base/weak_ptr.h" -class AuthSession; -class AuthSessionSettings; - namespace Main { +class Session; +class Settings; + class Account final : public base::has_weak_ptr { public: explicit Account(const QString &dataName); @@ -30,10 +30,10 @@ public: void forcedLogOut(); [[nodiscard]] bool sessionExists() const; - [[nodiscard]] AuthSession &session(); - [[nodiscard]] const AuthSession &session() const; - [[nodiscard]] rpl::producer sessionValue() const; - [[nodiscard]] rpl::producer sessionChanges() const; + [[nodiscard]] Session &session(); + [[nodiscard]] const Session &session() const; + [[nodiscard]] rpl::producer sessionValue() const; + [[nodiscard]] rpl::producer sessionChanges() const; [[nodiscard]] MTP::Instance *mtp() { return _mtp.get(); @@ -44,12 +44,12 @@ public: // Set from legacy storage. void setMtpMainDcId(MTP::DcId mainDcId); void setMtpKey(MTP::DcId dcId, const MTP::AuthKey::Data &keyData); - void setAuthSessionUserId(UserId userId); - void setAuthSessionFromStorage( - std::unique_ptr data, + void setSessionUserId(UserId userId); + void setSessionFromStorage( + std::unique_ptr data, QByteArray &&selfSerialized, int32 selfStreamVersion); - [[nodiscard]] AuthSessionSettings *getAuthSessionSettings(); + [[nodiscard]] Settings *getSessionSettings(); // Serialization. [[nodiscard]] QByteArray serializeMtpAuthorization() const; @@ -77,13 +77,13 @@ private: std::unique_ptr _mtpForKeysDestroy; rpl::event_stream<> _configUpdates; - std::unique_ptr _session; - rpl::variable _sessionValue; + std::unique_ptr _session; + rpl::variable _sessionValue; - UserId _authSessionUserId = 0; - QByteArray _authSessionUserSerialized; - int32 _authSessionUserStreamVersion = 0; - std::unique_ptr _storedAuthSession; + UserId _sessionUserId = 0; + QByteArray _sessionUserSerialized; + int32 _sessionUserStreamVersion = 0; + std::unique_ptr _storedSettings; MTP::Instance::Config _mtpConfig; MTP::AuthKeysList _mtpKeysToDestroy; diff --git a/Telegram/SourceFiles/auth_session.cpp b/Telegram/SourceFiles/main/main_session.cpp similarity index 84% rename from Telegram/SourceFiles/auth_session.cpp rename to Telegram/SourceFiles/main/main_session.cpp index 2b47176c9..039fdfe19 100644 --- a/Telegram/SourceFiles/auth_session.cpp +++ b/Telegram/SourceFiles/main/main_session.cpp @@ -5,7 +5,7 @@ the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "core/application.h" @@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "support/support_helper.h" #include "observer_peer.h" +namespace Main { namespace { constexpr auto kAutoLockTimeoutLateMs = crl::time(3000); @@ -37,7 +38,7 @@ constexpr auto kLegacyCallsPeerToPeerNobody = 4; } // namespace -AuthSessionSettings::Variables::Variables() +Settings::Variables::Variables() : sendFilesWay(SendFilesWay::Album) , selectorTab(ChatHelpers::SelectorTab::Emoji) , floatPlayerColumn(Window::Column::Second) @@ -46,7 +47,7 @@ AuthSessionSettings::Variables::Variables() , supportSwitch(Support::SwitchSettings::Next) { } -QByteArray AuthSessionSettings::serialize() const { +QByteArray Settings::serialize() const { const auto autoDownload = _variables.autoDownload.serialize(); auto size = sizeof(qint32) * 23; for (auto i = _variables.soundOverrides.cbegin(), e = _variables.soundOverrides.cend(); i != e; ++i) { @@ -102,7 +103,7 @@ QByteArray AuthSessionSettings::serialize() const { return result; } -void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized) { +void Settings::constructFromSerialized(const QByteArray &serialized) { if (serialized.isEmpty()) { return; } @@ -231,7 +232,7 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized) } if (stream.status() != QDataStream::Ok) { LOG(("App Error: " - "Bad data for AuthSessionSettings::constructFromSerialized()")); + "Bad data for Settings::constructFromSerialized()")); return; } if (!autoDownload.isEmpty() @@ -304,31 +305,31 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized) _variables.skipArchiveInSearch = (skipArchiveInSearch == 1); } -void AuthSessionSettings::setSupportChatsTimeSlice(int slice) { +void Settings::setSupportChatsTimeSlice(int slice) { _variables.supportChatsTimeSlice = slice; } -int AuthSessionSettings::supportChatsTimeSlice() const { +int Settings::supportChatsTimeSlice() const { return _variables.supportChatsTimeSlice.current(); } -rpl::producer AuthSessionSettings::supportChatsTimeSliceValue() const { +rpl::producer Settings::supportChatsTimeSliceValue() const { return _variables.supportChatsTimeSlice.value(); } -void AuthSessionSettings::setSupportAllSearchResults(bool all) { +void Settings::setSupportAllSearchResults(bool all) { _variables.supportAllSearchResults = all; } -bool AuthSessionSettings::supportAllSearchResults() const { +bool Settings::supportAllSearchResults() const { return _variables.supportAllSearchResults.current(); } -rpl::producer AuthSessionSettings::supportAllSearchResultsValue() const { +rpl::producer Settings::supportAllSearchResultsValue() const { return _variables.supportAllSearchResults.value(); } -void AuthSessionSettings::setTabbedSelectorSectionEnabled(bool enabled) { +void Settings::setTabbedSelectorSectionEnabled(bool enabled) { _variables.tabbedSelectorSectionEnabled = enabled; if (enabled) { setThirdSectionInfoEnabled(false); @@ -336,12 +337,12 @@ void AuthSessionSettings::setTabbedSelectorSectionEnabled(bool enabled) { setTabbedReplacedWithInfo(false); } -rpl::producer AuthSessionSettings::tabbedReplacedWithInfoValue() const { +rpl::producer Settings::tabbedReplacedWithInfoValue() const { return _tabbedReplacedWithInfoValue.events_starting_with( tabbedReplacedWithInfo()); } -void AuthSessionSettings::setThirdSectionInfoEnabled(bool enabled) { +void Settings::setThirdSectionInfoEnabled(bool enabled) { if (_variables.thirdSectionInfoEnabled != enabled) { _variables.thirdSectionInfoEnabled = enabled; if (enabled) { @@ -352,19 +353,19 @@ void AuthSessionSettings::setThirdSectionInfoEnabled(bool enabled) { } } -rpl::producer AuthSessionSettings::thirdSectionInfoEnabledValue() const { +rpl::producer Settings::thirdSectionInfoEnabledValue() const { return _thirdSectionInfoEnabledValue.events_starting_with( thirdSectionInfoEnabled()); } -void AuthSessionSettings::setTabbedReplacedWithInfo(bool enabled) { +void Settings::setTabbedReplacedWithInfo(bool enabled) { if (_tabbedReplacedWithInfo != enabled) { _tabbedReplacedWithInfo = enabled; _tabbedReplacedWithInfoValue.fire_copy(enabled); } } -QString AuthSessionSettings::getSoundPath(const QString &key) const { +QString Settings::getSoundPath(const QString &key) const { auto it = _variables.soundOverrides.constFind(key); if (it != _variables.soundOverrides.end()) { return it.value(); @@ -372,83 +373,79 @@ QString AuthSessionSettings::getSoundPath(const QString &key) const { return qsl(":/sounds/") + key + qsl(".mp3"); } -void AuthSessionSettings::setDialogsWidthRatio(float64 ratio) { +void Settings::setDialogsWidthRatio(float64 ratio) { _variables.dialogsWidthRatio = ratio; } -float64 AuthSessionSettings::dialogsWidthRatio() const { +float64 Settings::dialogsWidthRatio() const { return _variables.dialogsWidthRatio.current(); } -rpl::producer AuthSessionSettings::dialogsWidthRatioChanges() const { +rpl::producer Settings::dialogsWidthRatioChanges() const { return _variables.dialogsWidthRatio.changes(); } -void AuthSessionSettings::setThirdColumnWidth(int width) { +void Settings::setThirdColumnWidth(int width) { _variables.thirdColumnWidth = width; } -int AuthSessionSettings::thirdColumnWidth() const { +int Settings::thirdColumnWidth() const { return _variables.thirdColumnWidth.current(); } -rpl::producer AuthSessionSettings::thirdColumnWidthChanges() const { +rpl::producer Settings::thirdColumnWidthChanges() const { return _variables.thirdColumnWidth.changes(); } -void AuthSessionSettings::setArchiveCollapsed(bool collapsed) { +void Settings::setArchiveCollapsed(bool collapsed) { _variables.archiveCollapsed = collapsed; } -bool AuthSessionSettings::archiveCollapsed() const { +bool Settings::archiveCollapsed() const { return _variables.archiveCollapsed.current(); } -rpl::producer AuthSessionSettings::archiveCollapsedChanges() const { +rpl::producer Settings::archiveCollapsedChanges() const { return _variables.archiveCollapsed.changes(); } -void AuthSessionSettings::setArchiveInMainMenu(bool inMainMenu) { +void Settings::setArchiveInMainMenu(bool inMainMenu) { _variables.archiveInMainMenu = inMainMenu; } -bool AuthSessionSettings::archiveInMainMenu() const { +bool Settings::archiveInMainMenu() const { return _variables.archiveInMainMenu.current(); } -rpl::producer AuthSessionSettings::archiveInMainMenuChanges() const { +rpl::producer Settings::archiveInMainMenuChanges() const { return _variables.archiveInMainMenu.changes(); } -void AuthSessionSettings::setNotifyAboutPinned(bool notify) { +void Settings::setNotifyAboutPinned(bool notify) { _variables.notifyAboutPinned = notify; } -bool AuthSessionSettings::notifyAboutPinned() const { +bool Settings::notifyAboutPinned() const { return _variables.notifyAboutPinned.current(); } -rpl::producer AuthSessionSettings::notifyAboutPinnedChanges() const { +rpl::producer Settings::notifyAboutPinnedChanges() const { return _variables.notifyAboutPinned.changes(); } -void AuthSessionSettings::setSkipArchiveInSearch(bool skip) { +void Settings::setSkipArchiveInSearch(bool skip) { _variables.skipArchiveInSearch = skip; } -bool AuthSessionSettings::skipArchiveInSearch() const { +bool Settings::skipArchiveInSearch() const { return _variables.skipArchiveInSearch.current(); } -rpl::producer AuthSessionSettings::skipArchiveInSearchChanges() const { +rpl::producer Settings::skipArchiveInSearchChanges() const { return _variables.skipArchiveInSearch.changes(); } -AuthSession &Auth() { - return Core::App().activeAccount().session(); -} - -AuthSession::AuthSession( +Session::Session( not_null account, const MTPUser &user) : _account(account) @@ -502,33 +499,33 @@ AuthSession::AuthSession( Window::Theme::Background()->start(); } -AuthSession::~AuthSession() { +Session::~Session() { ClickHandler::clearActive(); ClickHandler::unpressed(); } -Main::Account &AuthSession::account() const { +Main::Account &Session::account() const { return *_account; } -bool AuthSession::Exists() { +bool Session::Exists() { return Core::IsAppLaunched() && Core::App().activeAccount().sessionExists(); } -base::Observable &AuthSession::downloaderTaskFinished() { +base::Observable &Session::downloaderTaskFinished() { return downloader().taskFinished(); } -UserId AuthSession::userId() const { +UserId Session::userId() const { return _user->bareId(); } -PeerId AuthSession::userPeerId() const { +PeerId Session::userPeerId() const { return _user->id; } -bool AuthSession::validateSelf(const MTPUser &user) { +bool Session::validateSelf(const MTPUser &user) { if (user.type() != mtpc_user || !user.c_user().is_self()) { LOG(("API Error: bad self user received.")); return false; @@ -540,7 +537,7 @@ bool AuthSession::validateSelf(const MTPUser &user) { return true; } -void AuthSession::moveSettingsFrom(AuthSessionSettings &&other) { +void Session::moveSettingsFrom(Settings &&other) { _settings.moveFrom(std::move(other)); if (_settings.hadLegacyCallsPeerToPeerNobody()) { api().savePrivacy( @@ -552,29 +549,29 @@ void AuthSession::moveSettingsFrom(AuthSessionSettings &&other) { } } -void AuthSession::saveSettingsDelayed(crl::time delay) { +void Session::saveSettingsDelayed(crl::time delay) { Expects(this == &Auth()); _saveDataTimer.callOnce(delay); } -not_null AuthSession::mtp() { +not_null Session::mtp() { return _account->mtp(); } -void AuthSession::localPasscodeChanged() { +void Session::localPasscodeChanged() { _shouldLockAt = 0; _autoLockTimer.cancel(); checkAutoLock(); } -void AuthSession::termsDeleteNow() { +void Session::termsDeleteNow() { api().request(MTPaccount_DeleteAccount( MTP_string("Decline ToS update") )).send(); } -void AuthSession::checkAutoLock() { +void Session::checkAutoLock() { if (!Global::LocalPasscode() || Core::App().passcodeLocked()) { _shouldLockAt = 0; @@ -596,7 +593,7 @@ void AuthSession::checkAutoLock() { } } -void AuthSession::checkAutoLockIn(crl::time time) { +void Session::checkAutoLockIn(crl::time time) { if (_autoLockTimer.isActive()) { auto remain = _autoLockTimer.remainingTime(); if (remain > 0 && remain <= time) return; @@ -604,16 +601,22 @@ void AuthSession::checkAutoLockIn(crl::time time) { _autoLockTimer.callOnce(time); } -bool AuthSession::supportMode() const { +bool Session::supportMode() const { return (_supportHelper != nullptr); } -Support::Helper &AuthSession::supportHelper() const { +Support::Helper &Session::supportHelper() const { Expects(supportMode()); return *_supportHelper; } -Support::Templates& AuthSession::supportTemplates() const { +Support::Templates& Session::supportTemplates() const { return supportHelper().templates(); } + +} // namespace Main + +Main::Session &Auth() { + return Core::App().activeAccount().session(); +} diff --git a/Telegram/SourceFiles/auth_session.h b/Telegram/SourceFiles/main/main_session.h similarity index 95% rename from Telegram/SourceFiles/auth_session.h rename to Telegram/SourceFiles/main/main_session.h index 201882fc2..b121d2abe 100644 --- a/Telegram/SourceFiles/auth_session.h +++ b/Telegram/SourceFiles/main/main_session.h @@ -16,10 +16,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL class ApiWrap; enum class SendFilesWay; -namespace Main { -class Account; -} // namespace Main - namespace Ui { enum class InputSubmitSettings; } // namespace Ui @@ -59,9 +55,13 @@ namespace Core { class Changelogs; } // namespace Core -class AuthSessionSettings final { +namespace Main { + +class Account; + +class Settings final { public: - void moveFrom(AuthSessionSettings &&other) { + void moveFrom(Settings &&other) { _variables = std::move(other._variables); } QByteArray serialize() const; @@ -284,18 +284,15 @@ private: }; -class AuthSession; -AuthSession &Auth(); - -class AuthSession final +class Session final : public base::has_weak_ptr , private base::Subscriber { public: - AuthSession(not_null account, const MTPUser &user); - ~AuthSession(); + Session(not_null account, const MTPUser &user); + ~Session(); - AuthSession(const AuthSession &other) = delete; - AuthSession &operator=(const AuthSession &other) = delete; + Session(const Session &other) = delete; + Session &operator=(const Session &other) = delete; static bool Exists(); @@ -327,10 +324,10 @@ public: Data::Session &data() { return *_data; } - AuthSessionSettings &settings() { + Settings &settings() { return _settings; } - void moveSettingsFrom(AuthSessionSettings &&other); + void moveSettingsFrom(Settings &&other); void saveSettingsDelayed(crl::time delay = kDefaultSaveDelay); not_null mtp(); @@ -363,7 +360,7 @@ private: const not_null _account; - AuthSessionSettings _settings; + Settings _settings; base::Timer _saveDataTimer; crl::time _shouldLockAt = 0; @@ -388,3 +385,7 @@ private: rpl::lifetime _lifetime; }; + +} // namespace Main + +Main::Session &Auth(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 47f11df2c..c56f80332 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -89,7 +89,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "export/export_settings.h" #include "export/view/export_view_top_bar.h" #include "export/view/export_view_panel_controller.h" -#include "auth_session.h" +#include "main/main_session.h" #include "support/support_helper.h" #include "storage/storage_facade.h" #include "storage/storage_shared_media.h" @@ -156,7 +156,7 @@ bool HasForceLogoutNotification(const MTPUpdates &updates) { } bool ForwardedInfoDataLoaded( - not_null session, + not_null session, const MTPMessageFwdHeader &header) { return header.match([&](const MTPDmessageFwdHeader &data) { if (const auto channelId = data.vchannel_id()) { @@ -181,7 +181,7 @@ bool ForwardedInfoDataLoaded( } bool MentionUsersLoaded( - not_null session, + not_null session, const MTPVector &entities) { for (const auto &entity : entities.v) { auto type = entity.type(); @@ -202,7 +202,7 @@ bool MentionUsersLoaded( } DataIsLoadedResult AllDataLoadedForMessage( - not_null session, + not_null session, const MTPMessage &message) { return message.match([&](const MTPDmessage &message) { if (const auto fromId = message.vfrom_id()) { @@ -488,7 +488,7 @@ MainWidget::MainWidget( } } -AuthSession &MainWidget::session() const { +Main::Session &MainWidget::session() const { return _controller->session(); } diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 4c5124e82..83482d24d 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -14,7 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "media/player/media_player_float.h" #include "data/data_pts_waiter.h" -class AuthSession; struct HistoryMessageMarkupButton; class MainWindow; class ConfirmBox; @@ -22,6 +21,10 @@ class HistoryWidget; class StackItem; struct FileLoadResult; +namespace Main { +class Session; +} // namespace Main + namespace Notify { struct PeerUpdate; } // namespace Notify @@ -99,7 +102,7 @@ public: MainWidget(QWidget *parent, not_null controller); - AuthSession &session() const; + Main::Session &session() const; bool isMainSectionShown() const; bool isThirdSectionShown() const; diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 232ed3452..2d9ff8887 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/shortcuts.h" #include "core/sandbox.h" #include "core/application.h" -#include "auth_session.h" +#include "main/main_session.h" #include "intro/introwidget.h" #include "main/main_account.h" // Account::sessionValue. #include "mainwidget.h" @@ -83,7 +83,7 @@ MainWindow::MainWindow(not_null controller) setLocale(QLocale(QLocale::English, QLocale::UnitedStates)); account().sessionValue( - ) | rpl::start_with_next([=](AuthSession *session) { + ) | rpl::start_with_next([=](Main::Session *session) { updateGlobalMenu(); if (!session) { _mediaPreview.destroy(); diff --git a/Telegram/SourceFiles/media/audio/media_audio.cpp b/Telegram/SourceFiles/media/audio/media_audio.cpp index 0ac35790b..af0935f6e 100644 --- a/Telegram/SourceFiles/media/audio/media_audio.cpp +++ b/Telegram/SourceFiles/media/audio/media_audio.cpp @@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "platform/platform_audio.h" #include "core/application.h" -#include "auth_session.h" +#include "main/main_session.h" #include #include diff --git a/Telegram/SourceFiles/media/player/media_player_float.cpp b/Telegram/SourceFiles/media/player/media_player_float.cpp index a9b7b4fe9..b640e492b 100644 --- a/Telegram/SourceFiles/media/player/media_player_float.cpp +++ b/Telegram/SourceFiles/media/player/media_player_float.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "media/player/media_player_instance.h" #include "window/window_session_controller.h" #include "window/section_widget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_media_player.h" #include "styles/style_history.h" diff --git a/Telegram/SourceFiles/media/player/media_player_instance.cpp b/Telegram/SourceFiles/media/player/media_player_instance.cpp index 1d24bb523..937401b4a 100644 --- a/Telegram/SourceFiles/media/player/media_player_instance.cpp +++ b/Telegram/SourceFiles/media/player/media_player_instance.cpp @@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "main/main_account.h" // Account::sessionValue. #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Media { namespace Player { @@ -93,9 +93,9 @@ Instance::Instance() handleSongUpdate(audioId); }); - // While we have one Media::Player::Instance for all authsessions we have to do this. + // While we have one Media::Player::Instance for all sessions we have to do this. Core::App().activeAccount().sessionValue( - ) | rpl::start_with_next([=](AuthSession *session) { + ) | rpl::start_with_next([=](Main::Session *session) { if (session) { subscribe(session->calls().currentCallChanged(), [=](Calls::Call *call) { if (call) { diff --git a/Telegram/SourceFiles/media/player/media_player_panel.cpp b/Telegram/SourceFiles/media/player/media_player_panel.cpp index ccc7e482d..9f00beb53 100644 --- a/Telegram/SourceFiles/media/player/media_player_panel.cpp +++ b/Telegram/SourceFiles/media/player/media_player_panel.cpp @@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/shadow.h" #include "ui/widgets/scroll_area.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_overview.h" #include "styles/style_widgets.h" #include "styles/style_media_player.h" diff --git a/Telegram/SourceFiles/media/player/media_player_volume_controller.cpp b/Telegram/SourceFiles/media/player/media_player_volume_controller.cpp index 08bbb0649..cd5472c7b 100644 --- a/Telegram/SourceFiles/media/player/media_player_volume_controller.cpp +++ b/Telegram/SourceFiles/media/player/media_player_volume_controller.cpp @@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_media_player.h" #include "styles/style_widgets.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Media { namespace Player { diff --git a/Telegram/SourceFiles/media/player/media_player_widget.cpp b/Telegram/SourceFiles/media/player/media_player_widget.cpp index 34f6ecf96..5c744035b 100644 --- a/Telegram/SourceFiles/media/player/media_player_widget.cpp +++ b/Telegram/SourceFiles/media/player/media_player_widget.cpp @@ -26,7 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_item.h" #include "storage/localstorage.h" #include "layout.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Media { namespace Player { diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_loader_mtproto.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_loader_mtproto.cpp index 0908f5d9f..4938828a0 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_loader_mtproto.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_loader_mtproto.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "media/streaming/media_streaming_loader_mtproto.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "storage/streamed_file_downloader.h" #include "storage/cache/storage_cache_types.h" diff --git a/Telegram/SourceFiles/media/view/media_view_group_thumbs.cpp b/Telegram/SourceFiles/media/view/media_view_group_thumbs.cpp index ffd63e399..8c5b4fbde 100644 --- a/Telegram/SourceFiles/media/view/media_view_group_thumbs.cpp +++ b/Telegram/SourceFiles/media/view/media_view_group_thumbs.cpp @@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history.h" #include "history/media/history_media.h" #include "ui/image/image.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_mediaview.h" namespace Media { diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 9d0bdab0e..c5b6be2cf 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -40,7 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_account.h" // Account::sessionValue. #include "base/unixtime.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" #include "layout.h" #include "storage/file_download.h" #include "calls/calls_instance.h" @@ -236,9 +236,9 @@ OverlayWidget::OverlayWidget() connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(onScreenResized(int))); - // While we have one mediaview for all authsessions we have to do this. + // While we have one mediaview for all sessions we have to do this. Core::App().activeAccount().sessionValue( - ) | rpl::start_with_next([=](AuthSession *session) { + ) | rpl::start_with_next([=](Main::Session *session) { if (session) { subscribe(session->downloaderTaskFinished(), [=] { if (!isHidden()) { diff --git a/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp b/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp index 139c1cca7..bf646e394 100644 --- a/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp +++ b/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "mtproto/dedicated_file_loader.h" -#include "auth_session.h" +#include "main/main_session.h" #include "core/application.h" #include "main/main_account.h" // Account::sessionChanges. @@ -91,7 +91,7 @@ WeakInstance::WeakInstance(QPointer instance) die(); }); Core::App().activeAccount().sessionChanges( - ) | rpl::filter([](AuthSession *session) { + ) | rpl::filter([](Main::Session *session) { return !session; }) | rpl::start_with_next([=] { die(); @@ -99,7 +99,7 @@ WeakInstance::WeakInstance(QPointer instance) } bool WeakInstance::valid() const { - return (_instance != nullptr) && AuthSession::Exists(); + return (_instance != nullptr) && Main::Session::Exists(); } QPointer WeakInstance::instance() const { @@ -367,13 +367,13 @@ void ResolveChannel( ).arg(username)); fail(); }; - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { failed(); return; } struct ResolveResult { - base::weak_ptr auth; + base::weak_ptr auth; MTPInputChannel channel; }; static std::map ResolveCache; diff --git a/Telegram/SourceFiles/mtproto/mtp_instance.cpp b/Telegram/SourceFiles/mtproto/mtp_instance.cpp index 496fe7228..84267dd9a 100644 --- a/Telegram/SourceFiles/mtproto/mtp_instance.cpp +++ b/Telegram/SourceFiles/mtproto/mtp_instance.cpp @@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/localstorage.h" #include "calls/calls_instance.h" #include "main/main_account.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "core/application.h" #include "base/unixtime.h" @@ -1130,7 +1130,7 @@ bool Instance::Private::rpcErrorOccured(mtpRequestId requestId, const RPCFailHan } bool Instance::Private::hasAuthorization() { - return AuthSession::Exists(); + return Main::Session::Exists(); } void Instance::Private::importDone(const MTPauth_Authorization &result, mtpRequestId requestId) { diff --git a/Telegram/SourceFiles/passport/passport_form_controller.cpp b/Telegram/SourceFiles/passport/passport_form_controller.cpp index bdbda95b7..8e0f8a3ad 100644 --- a/Telegram/SourceFiles/passport/passport_form_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_form_controller.cpp @@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "core/click_handler_types.h" #include "ui/toast/toast.h" -#include "auth_session.h" +#include "main/main_session.h" #include "storage/localimageloader.h" #include "storage/localstorage.h" #include "storage/file_upload.h" diff --git a/Telegram/SourceFiles/passport/passport_panel_details_row.cpp b/Telegram/SourceFiles/passport/passport_panel_details_row.cpp index f3f2d6b78..cad3555a3 100644 --- a/Telegram/SourceFiles/passport/passport_panel_details_row.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_details_row.cpp @@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/checkbox.h" #include "ui/wrap/slide_wrap.h" #include "ui/countryinput.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_user.h" #include "data/data_countries.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/platform/mac/mac_touchbar.mm b/Telegram/SourceFiles/platform/mac/mac_touchbar.mm index 55a69c923..90d7eb5f3 100644 --- a/Telegram/SourceFiles/platform/mac/mac_touchbar.mm +++ b/Telegram/SourceFiles/platform/mac/mac_touchbar.mm @@ -10,7 +10,7 @@ #import #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "api/api_sending.h" #include "boxes/confirm_box.h" #include "chat_helpers/emoji_list_widget.h" diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm index de3d5f559..23c20b8b8 100644 --- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm +++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwindow.h" #include "mainwidget.h" #include "core/application.h" -#include "auth_session.h" +#include "main/main_session.h" #include "history/history.h" #include "history/history_widget.h" #include "history/history_inner_widget.h" @@ -433,7 +433,7 @@ void MainWindow::initTouchBar() { } account().sessionValue( - ) | rpl::start_with_next([=](AuthSession *session) { + ) | rpl::start_with_next([=](Main::Session *session) { if (session) { // We need only common pinned dialogs. if (!_private->_touchBar) { diff --git a/Telegram/SourceFiles/platform/win/windows_event_filter.cpp b/Telegram/SourceFiles/platform/win/windows_event_filter.cpp index 861f430fe..2c3a55049 100644 --- a/Telegram/SourceFiles/platform/win/windows_event_filter.cpp +++ b/Telegram/SourceFiles/platform/win/windows_event_filter.cpp @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "platform/win/windows_dlls.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Platform { namespace { @@ -87,7 +87,7 @@ bool EventFilter::mainWindowEvent( switch (msg) { case WM_TIMECHANGE: { - if (AuthSession::Exists()) { + if (Main::Session::Exists()) { Auth().checkAutoLockIn(100); } } return false; diff --git a/Telegram/SourceFiles/profile/profile_block_group_members.cpp b/Telegram/SourceFiles/profile/profile_block_group_members.cpp index a884eb7c3..affd74544 100644 --- a/Telegram/SourceFiles/profile/profile_block_group_members.cpp +++ b/Telegram/SourceFiles/profile/profile_block_group_members.cpp @@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwidget.h" #include "apiwrap.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" #include "lang/lang_keys.h" namespace Profile { diff --git a/Telegram/SourceFiles/profile/profile_block_peer_list.cpp b/Telegram/SourceFiles/profile/profile_block_peer_list.cpp index 4cffb8ded..16a29b19c 100644 --- a/Telegram/SourceFiles/profile/profile_block_peer_list.cpp +++ b/Telegram/SourceFiles/profile/profile_block_peer_list.cpp @@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/ripple_animation.h" #include "ui/text_options.h" #include "data/data_peer.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_profile.h" #include "styles/style_widgets.h" diff --git a/Telegram/SourceFiles/settings/settings_advanced.cpp b/Telegram/SourceFiles/settings/settings_advanced.cpp index a88c99696..5f4456c38 100644 --- a/Telegram/SourceFiles/settings/settings_advanced.cpp +++ b/Telegram/SourceFiles/settings/settings_advanced.cpp @@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "storage/localstorage.h" #include "data/data_session.h" -#include "auth_session.h" +#include "main/main_session.h" #include "layout.h" #include "styles/style_settings.h" diff --git a/Telegram/SourceFiles/settings/settings_chat.cpp b/Telegram/SourceFiles/settings/settings_chat.cpp index 5b97e6fe6..cb626ab93 100644 --- a/Telegram/SourceFiles/settings/settings_chat.cpp +++ b/Telegram/SourceFiles/settings/settings_chat.cpp @@ -35,7 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "platform/platform_info.h" #include "support/support_common.h" #include "support/support_templates.h" -#include "auth_session.h" +#include "main/main_session.h" #include "mainwidget.h" #include "styles/style_settings.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/settings/settings_codes.cpp b/Telegram/SourceFiles/settings/settings_codes.cpp index 2220cd887..f4522887a 100644 --- a/Telegram/SourceFiles/settings/settings_codes.cpp +++ b/Telegram/SourceFiles/settings/settings_codes.cpp @@ -133,12 +133,12 @@ auto GenerateCodes() { }; for (auto &key : audioKeys) { codes.emplace(key, [audioFilters, key] { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { return; } FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open audio file", audioFilters, [key](const FileDialog::OpenResult &result) { - if (AuthSession::Exists() && !result.paths.isEmpty()) { + if (Main::Session::Exists() && !result.paths.isEmpty()) { auto track = Media::Audio::Current().createTrack(); track->fillFromFile(result.paths.front()); if (track->failed()) { @@ -152,7 +152,7 @@ auto GenerateCodes() { }); } codes.emplace(qsl("sounds_reset"), [] { - if (AuthSession::Exists()) { + if (Main::Session::Exists()) { Auth().settings().clearSoundOverrides(); Local::writeUserSettings(); Ui::show(Box("All sound overrides were reset.")); diff --git a/Telegram/SourceFiles/settings/settings_common.cpp b/Telegram/SourceFiles/settings/settings_common.cpp index 9ce301522..a7cc1022c 100644 --- a/Telegram/SourceFiles/settings/settings_common.cpp +++ b/Telegram/SourceFiles/settings/settings_common.cpp @@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/abstract_box.h" #include "lang/lang_keys.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "styles/style_boxes.h" #include "styles/style_settings.h" diff --git a/Telegram/SourceFiles/settings/settings_information.cpp b/Telegram/SourceFiles/settings/settings_information.cpp index 059c01a51..0572a773d 100644 --- a/Telegram/SourceFiles/settings/settings_information.cpp +++ b/Telegram/SourceFiles/settings/settings_information.cpp @@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "info/profile/info_profile_values.h" #include "info/profile/info_profile_button.h" #include "lang/lang_keys.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "core/file_utilities.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index e4fd468a4..861afef9a 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "lang/lang_keys.h" #include "storage/localstorage.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "window/window_session_controller.h" #include "core/file_utilities.h" @@ -233,7 +233,7 @@ void SetupHelp(not_null container) { SetupFaq(container); - if (AuthSession::Exists()) { + if (::Main::Session::Exists()) { const auto button = AddButton( container, tr::lng_settings_ask_question(), diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp index 680b34d9d..1465bcf95 100644 --- a/Telegram/SourceFiles/settings/settings_notifications.cpp +++ b/Telegram/SourceFiles/settings/settings_notifications.cpp @@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "platform/platform_info.h" #include "mainwindow.h" #include "core/application.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "styles/style_settings.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp index 7a3c1c3b0..7ea0e13d5 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "observer_peer.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "storage/localstorage.h" #include "data/data_user.h" #include "data/data_session.h" diff --git a/Telegram/SourceFiles/settings/settings_privacy_security.cpp b/Telegram/SourceFiles/settings/settings_privacy_security.cpp index 9382624db..34b60af0b 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_security.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_security.cpp @@ -30,7 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "data/data_chat.h" #include "data/data_channel.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "styles/style_settings.h" #include "styles/style_boxes.h" @@ -475,7 +475,7 @@ bool CheckEditCloudPassword() { return false; } -object_ptr EditCloudPasswordBox(not_null session) { +object_ptr EditCloudPasswordBox(not_null session) { const auto current = session->api().passwordStateCurrent(); Assert(current.has_value()); diff --git a/Telegram/SourceFiles/settings/settings_privacy_security.h b/Telegram/SourceFiles/settings/settings_privacy_security.h index 8a5b83ec7..0023ab44b 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_security.h +++ b/Telegram/SourceFiles/settings/settings_privacy_security.h @@ -17,7 +17,8 @@ namespace Settings { int ExceptionUsersCount(const std::vector> &exceptions); bool CheckEditCloudPassword(); -object_ptr EditCloudPasswordBox(not_null session); +object_ptr EditCloudPasswordBox( + not_null<::Main::Session*> session); void RemoveCloudPassword(); object_ptr CloudPasswordAppOutdatedBox(); diff --git a/Telegram/SourceFiles/storage/file_download.cpp b/Telegram/SourceFiles/storage/file_download.cpp index 53bc94d62..f823260b0 100644 --- a/Telegram/SourceFiles/storage/file_download.cpp +++ b/Telegram/SourceFiles/storage/file_download.cpp @@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/localstorage.h" #include "platform/platform_file_utilities.h" #include "mtproto/connection.h" // for MTP::kAckSendWaiting -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "core/crash_reports.h" #include "base/bytes.h" @@ -171,7 +171,7 @@ FileLoader::FileLoader( Expects(!_filename.isEmpty() || (_size <= Storage::kMaxFileInMemory)); } -AuthSession &FileLoader::session() const { +Main::Session &FileLoader::session() const { return _downloader->api().session(); } @@ -494,7 +494,7 @@ void FileLoader::cancel(bool fail) { _file.setFileName(_filename); } - // Current cancel() call could be made from ~AuthSession(). + // Current cancel() call could be made from ~Main::Session(). crl::on_main(sessionGuard, [=] { LoadNextFromQueue(queue); }); } diff --git a/Telegram/SourceFiles/storage/file_download.h b/Telegram/SourceFiles/storage/file_download.h index 03a198c1d..828b091f9 100644 --- a/Telegram/SourceFiles/storage/file_download.h +++ b/Telegram/SourceFiles/storage/file_download.h @@ -13,7 +13,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_file_origin.h" class ApiWrap; -class AuthSession; + +namespace Main { +class Session; +} // namespace Main namespace Storage { namespace Cache { @@ -110,7 +113,7 @@ public: bool autoLoading, uint8 cacheTag); - AuthSession &session() const; + Main::Session &session() const; bool finished() const { return _finished; diff --git a/Telegram/SourceFiles/storage/file_upload.cpp b/Telegram/SourceFiles/storage/file_upload.cpp index af3d36ac3..6a7faaf68 100644 --- a/Telegram/SourceFiles/storage/file_upload.cpp +++ b/Telegram/SourceFiles/storage/file_upload.cpp @@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_document.h" #include "data/data_photo.h" #include "data/data_session.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Storage { namespace { diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp index 186e0697a..930d635e1 100644 --- a/Telegram/SourceFiles/storage/localimageloader.cpp +++ b/Telegram/SourceFiles/storage/localimageloader.cpp @@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_media_prepare.h" #include "mainwidget.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" namespace { diff --git a/Telegram/SourceFiles/storage/localstorage.cpp b/Telegram/SourceFiles/storage/localstorage.cpp index 5d6f02561..e0cfedbb6 100644 --- a/Telegram/SourceFiles/storage/localstorage.cpp +++ b/Telegram/SourceFiles/storage/localstorage.cpp @@ -31,7 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mtproto/dc_options.h" #include "core/application.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" #include "window/window_session_controller.h" #include "base/flags.h" #include "data/data_session.h" @@ -598,7 +598,7 @@ enum { dbiDcOptions = 0x4a, dbiMtpAuthorization = 0x4b, dbiLastSeenWarningSeenOld = 0x4c, - dbiAuthSessionSettings = 0x4d, + dbiSessionSettings = 0x4d, dbiLangPackKey = 0x4e, dbiConnectionType = 0x4f, dbiStickersFavedLimit = 0x50, @@ -700,12 +700,12 @@ enum class WriteMapWhen { Soon, }; -std::unique_ptr StoredAuthSessionCache; -AuthSessionSettings &GetStoredAuthSessionCache() { - if (!StoredAuthSessionCache) { - StoredAuthSessionCache = std::make_unique(); +std::unique_ptr StoredSessionSettings; +Main::Settings &GetStoredSessionSettings() { + if (!StoredSessionSettings) { + StoredSessionSettings = std::make_unique(); } - return *StoredAuthSessionCache; + return *StoredSessionSettings; } void _writeMap(WriteMapWhen when = WriteMapWhen::Soon); @@ -974,7 +974,7 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting DEBUG_LOG(("MTP Info: user found, dc %1, uid %2").arg(dcId).arg(userId)); Core::App().activeAccount().setMtpMainDcId(dcId); - Core::App().activeAccount().setAuthSessionUserId(userId); + Core::App().activeAccount().setSessionUserId(userId); } break; case dbiKey: { @@ -1083,7 +1083,7 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting if (!_checkStreamStatus(stream)) return false; using namespace Data::AutoDownload; - auto &settings = GetStoredAuthSessionCache().autoDownload(); + auto &settings = GetStoredSessionSettings().autoDownload(); const auto disabled = [](qint32 value, qint32 mask) { return (value & mask) != 0; }; @@ -1141,7 +1141,7 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting stream >> v; if (!_checkStreamStatus(stream)) return false; - GetStoredAuthSessionCache().setIncludeMutedCounter(v == 1); + GetStoredSessionSettings().setIncludeMutedCounter(v == 1); } break; case dbiShowingSavedGifsOld: { @@ -1194,7 +1194,7 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting stream >> v; if (!_checkStreamStatus(stream)) return false; - GetStoredAuthSessionCache().setDialogsWidthRatio(v / 1000000.); + GetStoredSessionSettings().setDialogsWidthRatio(v / 1000000.); } break; case dbiLastSeenWarningSeenOld: { @@ -1202,15 +1202,15 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting stream >> v; if (!_checkStreamStatus(stream)) return false; - GetStoredAuthSessionCache().setLastSeenWarningSeen(v == 1); + GetStoredSessionSettings().setLastSeenWarningSeen(v == 1); } break; - case dbiAuthSessionSettings: { + case dbiSessionSettings: { QByteArray v; stream >> v; if (!_checkStreamStatus(stream)) return false; - GetStoredAuthSessionCache().constructFromSerialized(v); + GetStoredSessionSettings().constructFromSerialized(v); } break; case dbiWorkMode: { @@ -1540,7 +1540,7 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting && unchecked != SendSettings::CtrlEnter) { return false; } - GetStoredAuthSessionCache().setSendSubmitWay(unchecked); + GetStoredSessionSettings().setSendSubmitWay(unchecked); } break; case dbiCatsAndDogs: { // deprecated @@ -1671,7 +1671,7 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting stream >> v; if (!_checkStreamStatus(stream)) return false; - GetStoredAuthSessionCache().setSendFilesWay((v == 1) + GetStoredSessionSettings().setSendFilesWay((v == 1) ? SendFilesWay::Album : SendFilesWay::Files); } break; @@ -2033,9 +2033,9 @@ void _writeUserSettings() { recentEmojiPreloadData.push_back(qMakePair(item.first->id(), item.second)); } } - auto userDataInstance = StoredAuthSessionCache - ? StoredAuthSessionCache.get() - : Core::App().activeAccount().getAuthSessionSettings(); + auto userDataInstance = StoredSessionSettings + ? StoredSessionSettings.get() + : Core::App().activeAccount().getSessionSettings(); auto userData = userDataInstance ? userDataInstance->serialize() : QByteArray(); @@ -2091,7 +2091,7 @@ void _writeUserSettings() { data.stream << quint32(dbiUseExternalVideoPlayer) << qint32(cUseExternalVideoPlayer()); data.stream << quint32(dbiCacheSettings) << qint64(_cacheTotalSizeLimit) << qint32(_cacheTotalTimeLimit) << qint64(_cacheBigFileTotalSizeLimit) << qint32(_cacheBigFileTotalTimeLimit); if (!userData.isEmpty()) { - data.stream << quint32(dbiAuthSessionSettings) << userData; + data.stream << quint32(dbiSessionSettings) << userData; } data.stream << quint32(dbiPlaybackSpeed) << qint32(Global::VoiceMsgPlaybackDoubled() ? 2 : 1); @@ -2389,8 +2389,8 @@ ReadMapState _readMap(const QByteArray &pass) { _readMtpData(); DEBUG_LOG(("selfSerialized set: %1").arg(selfSerialized.size())); - Core::App().activeAccount().setAuthSessionFromStorage( - std::move(StoredAuthSessionCache), + Core::App().activeAccount().setSessionFromStorage( + std::move(StoredSessionSettings), std::move(selfSerialized), _oldMapVersion); @@ -2437,7 +2437,7 @@ void _writeMap(WriteMapWhen when) { uint32 mapSize = 0; const auto self = [] { - if (!AuthSession::Exists()) { + if (!Main::Session::Exists()) { DEBUG_LOG(("AuthSelf Warning: Session does not exist.")); return QByteArray(); } @@ -2791,7 +2791,7 @@ void reset() { _cacheTotalTimeLimit = Database::Settings().totalTimeLimit; _cacheBigFileTotalSizeLimit = Database::Settings().totalSizeLimit; _cacheBigFileTotalTimeLimit = Database::Settings().totalTimeLimit; - StoredAuthSessionCache.reset(); + StoredSessionSettings.reset(); _mapChanged = true; _writeMap(WriteMapWhen::Now); diff --git a/Telegram/SourceFiles/storage/localstorage.h b/Telegram/SourceFiles/storage/localstorage.h index 135632536..67065eb05 100644 --- a/Telegram/SourceFiles/storage/localstorage.h +++ b/Telegram/SourceFiles/storage/localstorage.h @@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/file_download.h" #include "storage/cache/storage_cache_database.h" #include "storage/localimageloader.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Data { class WallPaper; diff --git a/Telegram/SourceFiles/storage/serialize_common.cpp b/Telegram/SourceFiles/storage/serialize_common.cpp index b349d75a5..3da99d45f 100644 --- a/Telegram/SourceFiles/storage/serialize_common.cpp +++ b/Telegram/SourceFiles/storage/serialize_common.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "storage/serialize_common.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_channel.h" #include "data/data_chat.h" #include "data/data_user.h" diff --git a/Telegram/SourceFiles/storage/serialize_document.cpp b/Telegram/SourceFiles/storage/serialize_document.cpp index dff29af5f..c82a0ca72 100644 --- a/Telegram/SourceFiles/storage/serialize_document.cpp +++ b/Telegram/SourceFiles/storage/serialize_document.cpp @@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "chat_helpers/stickers.h" #include "data/data_session.h" #include "ui/image/image.h" -#include "auth_session.h" +#include "main/main_session.h" namespace { diff --git a/Telegram/SourceFiles/support/support_autocomplete.cpp b/Telegram/SourceFiles/support/support_autocomplete.cpp index 524b0764d..253d34520 100644 --- a/Telegram/SourceFiles/support/support_autocomplete.cpp +++ b/Telegram/SourceFiles/support/support_autocomplete.cpp @@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "data/data_session.h" #include "base/unixtime.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "styles/style_chat_helpers.h" #include "styles/style_window.h" @@ -325,7 +325,7 @@ AdminLog::OwnedItem GenerateContactItem( } // namespace -Autocomplete::Autocomplete(QWidget *parent, not_null session) +Autocomplete::Autocomplete(QWidget *parent, not_null session) : RpWidget(parent) , _session(session) { setupContent(); diff --git a/Telegram/SourceFiles/support/support_autocomplete.h b/Telegram/SourceFiles/support/support_autocomplete.h index 5a2169a07..4f552d11f 100644 --- a/Telegram/SourceFiles/support/support_autocomplete.h +++ b/Telegram/SourceFiles/support/support_autocomplete.h @@ -13,7 +13,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/view/history_view_element.h" #include "history/history.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Ui { class ScrollArea; @@ -31,7 +33,7 @@ struct Contact { class Autocomplete : public Ui::RpWidget { public: - Autocomplete(QWidget *parent, not_null session); + Autocomplete(QWidget *parent, not_null session); void activate(not_null field); void deactivate(); @@ -47,7 +49,7 @@ private: void setupContent(); void submitValue(const QString &value); - not_null _session; + not_null _session; Fn _activate; Fn _deactivate; Fn _moveSelection; diff --git a/Telegram/SourceFiles/support/support_helper.cpp b/Telegram/SourceFiles/support/support_helper.cpp index 894a20e11..fcfee7eae 100644 --- a/Telegram/SourceFiles/support/support_helper.cpp +++ b/Telegram/SourceFiles/support/support_helper.cpp @@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_media_prepare.h" #include "storage/localimageloader.h" #include "core/sandbox.h" -#include "auth_session.h" +#include "main/main_session.h" #include "observer_peer.h" #include "apiwrap.h" #include "styles/style_boxes.h" @@ -273,7 +273,7 @@ TimeId OccupiedBySomeoneTill(History *history) { } // namespace -Helper::Helper(not_null session) +Helper::Helper(not_null session) : _session(session) , _templates(_session) , _reoccupyTimer([=] { reoccupy(); }) @@ -291,7 +291,7 @@ Helper::Helper(not_null session) }).send(); } -std::unique_ptr Helper::Create(not_null session) { +std::unique_ptr Helper::Create(not_null session) { //return std::make_unique(session); AssertIsDebug(); const auto valid = session->user()->phone().startsWith(qstr("424")); return valid ? std::make_unique(session) : nullptr; diff --git a/Telegram/SourceFiles/support/support_helper.h b/Telegram/SourceFiles/support/support_helper.h index 607676616..e26c3e1ac 100644 --- a/Telegram/SourceFiles/support/support_helper.h +++ b/Telegram/SourceFiles/support/support_helper.h @@ -11,7 +11,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "support/support_templates.h" #include "mtproto/sender.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Window { class SessionController; @@ -37,9 +39,9 @@ inline bool operator!=(const UserInfo &a, const UserInfo &b) { class Helper : private MTP::Sender { public: - explicit Helper(not_null session); + explicit Helper(not_null session); - static std::unique_ptr Create(not_null session); + static std::unique_ptr Create(not_null session); void registerWindow(not_null controller); void cloudDraftChanged(not_null history); @@ -82,7 +84,7 @@ private: TextWithEntities text, Fn done); - not_null _session; + not_null _session; Templates _templates; QString _supportName; QString _supportNameNormalized; diff --git a/Telegram/SourceFiles/support/support_templates.cpp b/Telegram/SourceFiles/support/support_templates.cpp index deff385e0..09d8c816f 100644 --- a/Telegram/SourceFiles/support/support_templates.cpp +++ b/Telegram/SourceFiles/support/support_templates.cpp @@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/toast/toast.h" #include "data/data_session.h" #include "core/shortcuts.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Support { namespace details { @@ -448,7 +448,7 @@ struct Templates::Updates { std::map requests; }; -Templates::Templates(not_null session) : _session(session) { +Templates::Templates(not_null session) : _session(session) { load(); Shortcuts::Requests( ) | rpl::start_with_next([=](not_null request) { diff --git a/Telegram/SourceFiles/support/support_templates.h b/Telegram/SourceFiles/support/support_templates.h index b309fefb0..648bee58f 100644 --- a/Telegram/SourceFiles/support/support_templates.h +++ b/Telegram/SourceFiles/support/support_templates.h @@ -9,7 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/binary_guard.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Support { namespace details { @@ -42,7 +44,7 @@ struct TemplatesIndex { class Templates : public base::has_weak_ptr { public: - explicit Templates(not_null session); + explicit Templates(not_null session); void reload(); @@ -75,7 +77,7 @@ private: void checkUpdateFinished(); void setData(details::TemplatesData &&data); - not_null _session; + not_null _session; details::TemplatesData _data; details::TemplatesIndex _index; diff --git a/Telegram/SourceFiles/ui/emoji_config.cpp b/Telegram/SourceFiles/ui/emoji_config.cpp index 6e6dd77e4..2b926763f 100644 --- a/Telegram/SourceFiles/ui/emoji_config.cpp +++ b/Telegram/SourceFiles/ui/emoji_config.cpp @@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/bytes.h" #include "base/openssl_help.h" #include "base/parse_helper.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Ui { namespace Emoji { diff --git a/Telegram/SourceFiles/ui/image/image.cpp b/Telegram/SourceFiles/ui/image/image.cpp index fb3bb5829..868febf2d 100644 --- a/Telegram/SourceFiles/ui/image/image.cpp +++ b/Telegram/SourceFiles/ui/image/image.cpp @@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "data/data_file_origin.h" #include "chat_helpers/stickers.h" -#include "auth_session.h" +#include "main/main_session.h" using namespace Images; diff --git a/Telegram/SourceFiles/ui/image/image_location.cpp b/Telegram/SourceFiles/ui/image/image_location.cpp index e6831a49b..f72b5ac92 100644 --- a/Telegram/SourceFiles/ui/image/image_location.cpp +++ b/Telegram/SourceFiles/ui/image/image_location.cpp @@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/serialize_common.h" #include "data/data_file_origin.h" #include "base/overload.h" -#include "auth_session.h" +#include "main/main_session.h" namespace { diff --git a/Telegram/SourceFiles/ui/image/image_source.cpp b/Telegram/SourceFiles/ui/image/image_source.cpp index 0c8d25dd2..374f7b739 100644 --- a/Telegram/SourceFiles/ui/image/image_source.cpp +++ b/Telegram/SourceFiles/ui/image/image_source.cpp @@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/cache/storage_cache_database.h" #include "history/history_item.h" #include "history/history.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Images { diff --git a/Telegram/SourceFiles/ui/special_buttons.cpp b/Telegram/SourceFiles/ui/special_buttons.cpp index 44b46b880..fa5aba2bb 100644 --- a/Telegram/SourceFiles/ui/special_buttons.cpp +++ b/Telegram/SourceFiles/ui/special_buttons.cpp @@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/confirm_box.h" #include "window/window_session_controller.h" #include "lang/lang_keys.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "mainwidget.h" #include "observer_peer.h" diff --git a/Telegram/SourceFiles/ui/text/text_entity.cpp b/Telegram/SourceFiles/ui/text/text_entity.cpp index b0b21bab3..2cb1b3c76 100644 --- a/Telegram/SourceFiles/ui/text/text_entity.cpp +++ b/Telegram/SourceFiles/ui/text/text_entity.cpp @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "ui/text/text_entity.h" -#include "auth_session.h" +#include "main/main_session.h" #include "lang/lang_tag.h" #include "base/qthelp_url.h" #include "ui/emoji_config.h" diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.cpp b/Telegram/SourceFiles/ui/widgets/input_fields.cpp index 3e6bb1702..5fc342e3c 100644 --- a/Telegram/SourceFiles/ui/widgets/input_fields.cpp +++ b/Telegram/SourceFiles/ui/widgets/input_fields.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_countries.h" // Data::ValidPhoneCode #include "mainwindow.h" #include "numbers.h" -#include "auth_session.h" +#include "main/main_session.h" #include "core/application.h" namespace Ui { @@ -4321,7 +4321,7 @@ void PhoneInput::focusInEvent(QFocusEvent *e) { void PhoneInput::clearText() { QString phone; - if (AuthSession::Exists()) { + if (Main::Session::Exists()) { const auto self = Auth().user(); QVector newPattern = phoneNumberParse(self->phone()); if (!newPattern.isEmpty()) { diff --git a/Telegram/SourceFiles/window/layer_widget.cpp b/Telegram/SourceFiles/window/layer_widget.cpp index 8a4de07aa..1c1bb24ee 100644 --- a/Telegram/SourceFiles/window/layer_widget.cpp +++ b/Telegram/SourceFiles/window/layer_widget.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/emoji_config.h" #include "window/window_main_menu.h" #include "lottie/lottie_single_player.h" -#include "auth_session.h" +#include "main/main_session.h" #include "chat_helpers/stickers.h" #include "window/window_session_controller.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 021dc3640..c77358078 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -17,13 +17,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_outdated_bar.h" #include "window/window_controller.h" #include "boxes/confirm_box.h" -#include "main/main_account.h" // Account::authSessionValue. +#include "main/main_account.h" // Account::sessionValue. #include "core/click_handler_types.h" #include "core/application.h" #include "core/sandbox.h" #include "lang/lang_keys.h" #include "data/data_session.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "mainwindow.h" #include "styles/style_window.h" diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 8312acc0c..7bdc9a5fd 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwindow.h" #include "mainwidget.h" #include "apiwrap.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Window { namespace Notifications { @@ -35,7 +35,7 @@ constexpr auto kWaitingForAllGroupedDelay = crl::time(1000); } // namespace -System::System(not_null session) +System::System(not_null session) : _session(session) , _waitTimer([=] { showNext(); }) , _waitForAllGroupedTimer([=] { showGrouped(); }) { @@ -66,7 +66,7 @@ void System::schedule( not_null item) { if (App::quitting() || !history->currentNotification() - || !AuthSession::Exists()) return; + || !Main::Session::Exists()) return; const auto notifyBy = (!history->peer->isUser() && item->mentionsMe()) ? item->from().get() diff --git a/Telegram/SourceFiles/window/notifications_manager.h b/Telegram/SourceFiles/window/notifications_manager.h index c3e7f9d3f..1b6eb0693 100644 --- a/Telegram/SourceFiles/window/notifications_manager.h +++ b/Telegram/SourceFiles/window/notifications_manager.h @@ -9,7 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/timer.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Platform { namespace Notifications { @@ -55,7 +57,7 @@ class Manager; class System final : private base::Subscriber { public: - explicit System(not_null session); + explicit System(not_null session); void createManager(); @@ -71,7 +73,7 @@ public: return _settingsChanged; } - AuthSession &session() const { + Main::Session &session() const { return *_session; } @@ -82,7 +84,7 @@ private: void showGrouped(); void ensureSoundCreated(); - not_null _session; + not_null _session; QMap> _whenMaps; diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 56f6f5b5e..b15c1e9c3 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_boxes.h" #include "styles/style_window.h" #include "storage/file_download.h" -#include "auth_session.h" +#include "main/main_session.h" #include "history/history.h" #include "history/history_item.h" #include "platform/platform_specific.h" diff --git a/Telegram/SourceFiles/window/section_widget.cpp b/Telegram/SourceFiles/window/section_widget.cpp index d66f899ba..199eacb4d 100644 --- a/Telegram/SourceFiles/window/section_widget.cpp +++ b/Telegram/SourceFiles/window/section_widget.cpp @@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Window { -AuthSession &AbstractSectionWidget::session() const { +Main::Session &AbstractSectionWidget::session() const { return _controller->session(); } diff --git a/Telegram/SourceFiles/window/section_widget.h b/Telegram/SourceFiles/window/section_widget.h index 0bb6a27c1..96cb896d9 100644 --- a/Telegram/SourceFiles/window/section_widget.h +++ b/Telegram/SourceFiles/window/section_widget.h @@ -10,7 +10,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/rp_widget.h" #include "dialogs/dialogs_key.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Window { @@ -37,7 +39,7 @@ public: , _controller(controller) { } - AuthSession &session() const; + Main::Session &session() const; // Float player interface. virtual bool wheelEventFromFloatPlayer(QEvent *e) { diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp index b8f17b3dc..21451d8b8 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme.cpp @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/themes/window_theme_preview.h" #include "mainwidget.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "storage/localstorage.h" #include "storage/localimageloader.h" @@ -400,9 +400,9 @@ void ChatBackground::start() { } Core::App().activeAccount().sessionValue( - ) | rpl::filter([=](AuthSession *session) { + ) | rpl::filter([=](Main::Session *session) { return session != _session; - }) | rpl::start_with_next([=](AuthSession *session) { + }) | rpl::start_with_next([=](Main::Session *session) { _session = session; checkUploadWallPaper(); }, _lifetime); diff --git a/Telegram/SourceFiles/window/themes/window_theme.h b/Telegram/SourceFiles/window/themes/window_theme.h index 80dfe3aba..323c93189 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.h +++ b/Telegram/SourceFiles/window/themes/window_theme.h @@ -9,7 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_wall_paper.h" -class AuthSession; +namespace Main { +class Session; +} // namespace Main namespace Window { namespace Theme { @@ -164,7 +166,7 @@ private: friend void KeepApplied(); friend bool IsNonDefaultBackground(); - AuthSession *_session = nullptr; + Main::Session *_session = nullptr; Data::WallPaper _paper = Data::details::UninitializedWallPaper(); std::optional _paperColor; QImage _original; diff --git a/Telegram/SourceFiles/window/window_controller.cpp b/Telegram/SourceFiles/window/window_controller.cpp index b2a7640ec..5b1cc7a32 100644 --- a/Telegram/SourceFiles/window/window_controller.cpp +++ b/Telegram/SourceFiles/window/window_controller.cpp @@ -18,7 +18,7 @@ Controller::Controller(not_null account) : _account(account) , _widget(this) { _account->sessionValue( - ) | rpl::start_with_next([=](AuthSession *session) { + ) | rpl::start_with_next([=](Main::Session *session) { _sessionController = session ? std::make_unique(session, &_widget) : nullptr; diff --git a/Telegram/SourceFiles/window/window_lock_widgets.cpp b/Telegram/SourceFiles/window/window_lock_widgets.cpp index 03d34b093..2ebc88176 100644 --- a/Telegram/SourceFiles/window/window_lock_widgets.cpp +++ b/Telegram/SourceFiles/window/window_lock_widgets.cpp @@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_boxes.h" #include "window/window_slide_animation.h" #include "window/window_session_controller.h" -#include "auth_session.h" +#include "main/main_session.h" namespace Window { diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index b89b00012..b7e79d989 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "core/click_handler_types.h" #include "observer_peer.h" -#include "auth_session.h" +#include "main/main_session.h" #include "data/data_folder.h" #include "data/data_session.h" #include "data/data_user.h" diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index bf0b858d5..a85816080 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/text/text_utilities.h" #include "ui/widgets/labels.h" #include "ui/widgets/checkbox.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "mainwidget.h" #include "mainwindow.h" diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index d04559433..65ab217a5 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -26,7 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/calendar_box.h" #include "mainwidget.h" #include "mainwindow.h" -#include "auth_session.h" +#include "main/main_session.h" #include "apiwrap.h" #include "support/support_helper.h" #include "styles/style_window.h" @@ -52,11 +52,11 @@ void DateClickHandler::onClick(ClickContext context) const { App::wnd()->sessionController()->showJumpToDate(_chat, _date); } -SessionNavigation::SessionNavigation(not_null session) +SessionNavigation::SessionNavigation(not_null session) : _session(session) { } -AuthSession &SessionNavigation::session() const { +Main::Session &SessionNavigation::session() const { return *_session; } @@ -98,7 +98,7 @@ void SessionNavigation::showSettings(const SectionShow ¶ms) { } SessionController::SessionController( - not_null session, + not_null session, not_null window) : SessionNavigation(session) , _window(window) { diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index 06878a496..6dd3f1805 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -12,11 +12,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/observer.h" #include "dialogs/dialogs_key.h" -class AuthSession; class MainWidget; class HistoryMessage; class HistoryService; +namespace Main { +class Session; +} // namespace Main + namespace Settings { enum class Type; } // namespace Settings @@ -104,9 +107,9 @@ class SessionController; class SessionNavigation { public: - explicit SessionNavigation(not_null session); + explicit SessionNavigation(not_null session); - AuthSession &session() const; + Main::Session &session() const; virtual void showSection( SectionMemento &&memento, @@ -133,7 +136,7 @@ public: virtual ~SessionNavigation() = default; private: - const not_null _session; + const not_null _session; }; @@ -142,7 +145,7 @@ class SessionController , private base::Subscriber { public: SessionController( - not_null session, + not_null session, not_null window); not_null window() const { diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt index 1849a457a..a621d1bc6 100644 --- a/Telegram/gyp/telegram_sources.txt +++ b/Telegram/gyp/telegram_sources.txt @@ -445,6 +445,8 @@ <(src_loc)/lang/lang_values.h <(src_loc)/main/main_account.cpp <(src_loc)/main/main_account.h +<(src_loc)/main/main_session.cpp +<(src_loc)/main/main_session.h <(src_loc)/media/audio/media_audio.cpp <(src_loc)/media/audio/media_audio.h <(src_loc)/media/audio/media_audio_capture.cpp @@ -874,8 +876,6 @@ <(src_loc)/apiwrap.h <(src_loc)/app.cpp <(src_loc)/app.h -<(src_loc)/auth_session.cpp -<(src_loc)/auth_session.h <(src_loc)/config.h <(src_loc)/facades.cpp <(src_loc)/facades.h