diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index d72624060..1cac67d68 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -1015,7 +1015,7 @@ PeerData *ApiWrap::notifySettingReceived(MTPInputNotifyPeer notifyPeer, const MT } } break; } - AuthSession::Current().notifications()->checkDelayed(); + AuthSession::Current().notifications().checkDelayed(); return requestedPeer; } diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 21420aba9..482455138 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -2012,7 +2012,7 @@ namespace { dependent->dependencyItemRemoved(item); } } - AuthSession::Current().notifications()->clearFromItem(item); + AuthSession::Current().notifications().clearFromItem(item); if (Global::started() && !App::quitting()) { Global::RefItemRemoved().notify(item, true); } @@ -2321,7 +2321,7 @@ namespace { if (AuthSession::Exists()) { // Clear notifications to prevent any showNotification() calls while destroying items. - AuthSession::Current().notifications()->clearAllFast(); + AuthSession::Current().notifications().clearAllFast(); } histories().clear(); diff --git a/Telegram/SourceFiles/auth_session.cpp b/Telegram/SourceFiles/auth_session.cpp index bd03e5665..ba724c1ed 100644 --- a/Telegram/SourceFiles/auth_session.cpp +++ b/Telegram/SourceFiles/auth_session.cpp @@ -46,7 +46,7 @@ UserData *AuthSession::CurrentUser() { } base::Observable &AuthSession::CurrentDownloaderTaskFinished() { - return Current().downloader()->taskFinished(); + return Current().downloader().taskFinished(); } bool AuthSession::validateSelf(const MTPUser &user) { diff --git a/Telegram/SourceFiles/auth_session.h b/Telegram/SourceFiles/auth_session.h index e12bd5dbf..120032c59 100644 --- a/Telegram/SourceFiles/auth_session.h +++ b/Telegram/SourceFiles/auth_session.h @@ -53,14 +53,14 @@ public: } bool validateSelf(const MTPUser &user); - Storage::Downloader *downloader() { - return _downloader.get(); + Storage::Downloader &downloader() { + return *_downloader; } static base::Observable &CurrentDownloaderTaskFinished(); - Window::Notifications::System *notifications() { - return _notifications.get(); + Window::Notifications::System ¬ifications() { + return *_notifications; } class Data { diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 4287b7d3f..66a00e934 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -844,7 +844,7 @@ void ContactsBox::Inner::loadProfilePhotos() { auto yFrom = _visibleTop - _rowsTop; auto yTo = yFrom + (_visibleBottom - _visibleTop) * 5; - AuthSession::Current().downloader()->clearPriorities(); + AuthSession::Current().downloader().clearPriorities(); if (yTo < 0) return; if (yFrom < 0) yFrom = 0; @@ -1097,7 +1097,7 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) { QString text; skip = 0; if (bot()) { - text = lang((cDialogsReceived() && !_searching) ? (sharingBotGame() ? lng_bot_no_chats : lng_bot_no_groups) : lng_contacts_loading); + text = lang((AuthSession::Current().data().allChatsLoaded().value() && !_searching) ? (sharingBotGame() ? lng_bot_no_chats : lng_bot_no_groups) : lng_contacts_loading); } else if (_chat && _membersFilter == MembersFilter::Admins) { text = lang(lng_contacts_loading); p.fillRect(0, 0, width(), _aboutHeight - st::contactsPadding.bottom() - st::lineWidth, st::contactsAboutBg); @@ -1106,7 +1106,7 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) { int aboutw = width() - st::contactsPadding.left() - st::contactsPadding.right(); (_allAdmins->checked() ? _aboutAllAdmins : _aboutAdmins).draw(p, st::contactsPadding.left(), st::contactsAboutTop, aboutw); p.translate(0, _aboutHeight); - } else if (cContactsReceived() && !_searching) { + } else if (AuthSession::Current().data().contactsLoaded().value() && !_searching) { text = lang(lng_no_contacts); skip = st::noContactsFont->height; } else { @@ -1122,11 +1122,11 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) { p.setPen(st::noContactsColor); QString text; if (bot()) { - text = lang((cDialogsReceived() && !_searching) ? (sharingBotGame() ? lng_bot_chats_not_found : lng_bot_groups_not_found) : lng_contacts_loading); + text = lang((AuthSession::Current().data().allChatsLoaded().value() && !_searching) ? (sharingBotGame() ? lng_bot_chats_not_found : lng_bot_groups_not_found) : lng_contacts_loading); } else if (_chat && _membersFilter == MembersFilter::Admins) { text = lang(_chat->participants.isEmpty() ? lng_contacts_loading : lng_contacts_not_found); } else { - text = lang((cContactsReceived() && !_searching) ? lng_contacts_not_found : lng_contacts_loading); + text = lang((AuthSession::Current().data().contactsLoaded().value() && !_searching) ? lng_contacts_not_found : lng_contacts_loading); } p.drawText(QRect(0, 0, width(), st::noContactsHeight), text, style::al_center); } else { @@ -1769,7 +1769,7 @@ void ContactsBox::Inner::refresh() { if (!_addContactLnk->isHidden()) _addContactLnk->hide(); resize(width(), _rowsTop + _aboutHeight + st::noContactsHeight + st::contactsMarginBottom); } else { - if (cContactsReceived() && !bot()) { + if (AuthSession::Current().data().contactsLoaded().value() && !bot()) { if (_addContactLnk->isHidden()) _addContactLnk->show(); } else { if (!_addContactLnk->isHidden()) _addContactLnk->hide(); diff --git a/Telegram/SourceFiles/boxes/members_box.cpp b/Telegram/SourceFiles/boxes/members_box.cpp index f1bf3612f..fdc4b7907 100644 --- a/Telegram/SourceFiles/boxes/members_box.cpp +++ b/Telegram/SourceFiles/boxes/members_box.cpp @@ -344,7 +344,7 @@ void MembersBox::Inner::loadProfilePhotos() { auto yFrom = _visibleTop; auto yTo = yFrom + (_visibleBottom - _visibleTop) * 5; - AuthSession::Current().downloader()->clearPriorities(); + AuthSession::Current().downloader().clearPriorities(); if (yTo < 0) return; if (yFrom < 0) yFrom = 0; diff --git a/Telegram/SourceFiles/boxes/notifications_box.cpp b/Telegram/SourceFiles/boxes/notifications_box.cpp index 9550463d3..810c6c7f6 100644 --- a/Telegram/SourceFiles/boxes/notifications_box.cpp +++ b/Telegram/SourceFiles/boxes/notifications_box.cpp @@ -194,7 +194,7 @@ void NotificationsBox::countChanged() { if (currentCount() != Global::NotificationsCount()) { Global::SetNotificationsCount(currentCount()); - AuthSession::Current().notifications()->settingsChanged().notify(ChangeType::MaxCount); + AuthSession::Current().notifications().settingsChanged().notify(ChangeType::MaxCount); Local::writeUserSettings(); } } @@ -351,7 +351,7 @@ void NotificationsBox::setOverCorner(Notify::ScreenCorner corner) { _isOverCorner = true; setCursor(style::cur_pointer); Global::SetNotificationsDemoIsShown(true); - AuthSession::Current().notifications()->settingsChanged().notify(ChangeType::DemoIsShown); + AuthSession::Current().notifications().settingsChanged().notify(ChangeType::DemoIsShown); } _overCorner = corner; @@ -386,7 +386,7 @@ void NotificationsBox::clearOverCorner() { _isOverCorner = false; setCursor(style::cur_default); Global::SetNotificationsDemoIsShown(false); - AuthSession::Current().notifications()->settingsChanged().notify(ChangeType::DemoIsShown); + AuthSession::Current().notifications().settingsChanged().notify(ChangeType::DemoIsShown); for_const (auto &samples, _cornerSamples) { for_const (auto widget, samples) { @@ -413,7 +413,7 @@ void NotificationsBox::mouseReleaseEvent(QMouseEvent *e) { if (_chosenCorner != Global::NotificationsCorner()) { Global::SetNotificationsCorner(_chosenCorner); - AuthSession::Current().notifications()->settingsChanged().notify(ChangeType::Corner); + AuthSession::Current().notifications().settingsChanged().notify(ChangeType::Corner); Local::writeUserSettings(); } } diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp index e89dc9b4c..f69b89d22 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp @@ -716,7 +716,7 @@ void PeerListBox::Inner::loadProfilePhotos() { auto yFrom = _visibleTop; auto yTo = _visibleBottom + (_visibleBottom - _visibleTop) * PreloadHeightsCount; - AuthSession::Current().downloader()->clearPriorities(); + AuthSession::Current().downloader().clearPriorities(); if (yTo < 0) return; if (yFrom < 0) yFrom = 0; diff --git a/Telegram/SourceFiles/boxes/sharebox.cpp b/Telegram/SourceFiles/boxes/sharebox.cpp index 5914d2337..1708ab3d9 100644 --- a/Telegram/SourceFiles/boxes/sharebox.cpp +++ b/Telegram/SourceFiles/boxes/sharebox.cpp @@ -435,7 +435,7 @@ void ShareBox::Inner::loadProfilePhotos(int yFrom) { yFrom *= _columnCount; yTo *= _columnCount; - AuthSession::Current().downloader()->clearPriorities(); + AuthSession::Current().downloader().clearPriorities(); if (_filter.isEmpty()) { if (!_chatsIndexed->isEmpty()) { auto i = _chatsIndexed->cfind(yFrom, _rowHeight); diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index d8a17cd5b..9742c40af 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -212,7 +212,7 @@ void DialogsInner::paintRegion(Painter &p, const QRegion ®ion, bool paintingO if (!paintingOther) { p.setFont(st::noContactsFont); p.setPen(st::noContactsColor); - p.drawText(QRect(0, 0, fullWidth, st::noContactsHeight - (cContactsReceived() ? st::noContactsFont->height : 0)), lang(cContactsReceived() ? lng_no_chats : lng_contacts_loading), style::al_center); + p.drawText(QRect(0, 0, fullWidth, st::noContactsHeight - (AuthSession::Current().data().contactsLoaded().value() ? st::noContactsFont->height : 0)), lang(AuthSession::Current().data().contactsLoaded().value() ? lng_no_chats : lng_contacts_loading), style::al_center); } } } else if (_state == FilteredState || _state == SearchedState) { @@ -1001,7 +1001,7 @@ void DialogsInner::removeDialog(History *history) { if (_dialogsImportant) { history->removeFromChatList(Dialogs::Mode::Important, _dialogsImportant.get()); } - AuthSession::Current().notifications()->clearFromHistory(history); + AuthSession::Current().notifications().clearFromHistory(history); if (_contacts->contains(history->peer->id)) { if (!_contactsNoDialogs->contains(history->peer->id)) { _contactsNoDialogs->addByName(history); @@ -1650,7 +1650,7 @@ void DialogsInner::refresh(bool toTop) { if (_state == DefaultState) { if (shownDialogs()->isEmpty()) { h = st::noContactsHeight; - if (cContactsReceived()) { + if (AuthSession::Current().data().contactsLoaded().value()) { if (_addContactLnk->isHidden()) _addContactLnk->show(); } else { if (!_addContactLnk->isHidden()) _addContactLnk->hide(); @@ -1891,7 +1891,7 @@ void DialogsInner::loadPeerPhotos() { auto yFrom = _visibleTop; auto yTo = _visibleTop + (_visibleBottom - _visibleTop) * (PreloadHeightsCount + 1); - AuthSession::Current().downloader()->clearPriorities(); + AuthSession::Current().downloader().clearPriorities(); if (_state == DefaultState) { auto otherStart = shownDialogs()->size() * st::dialogsRowHeight; if (yFrom < otherStart) { @@ -2494,7 +2494,7 @@ void DialogsWidget::dialogsReceived(const MTPmessages_Dialogs &dialogs, mtpReque } break; } - if (!cContactsReceived() && !_contactsRequestId) { + if (!AuthSession::Current().data().contactsLoaded().value() && !_contactsRequestId) { _contactsRequestId = MTP::send(MTPcontacts_GetContacts(MTP_string("")), rpcDone(&DialogsWidget::contactsReceived), rpcFail(&DialogsWidget::contactsFailed)); } @@ -2726,7 +2726,6 @@ void DialogsWidget::loadDialogs() { if (_dialogsRequestId) return; if (_dialogsFull) { _inner->addAllSavedPeers(); - cSetDialogsReceived(true); return; } @@ -2748,14 +2747,11 @@ void DialogsWidget::loadPinnedDialogs() { void DialogsWidget::contactsReceived(const MTPcontacts_Contacts &result) { _contactsRequestId = 0; - cSetContactsReceived(true); if (result.type() == mtpc_contacts_contacts) { auto &d = result.c_contacts_contacts(); App::feedUsers(d.vusers); _inner->contactsReceived(d.vcontacts.v); } - if (App::main()) App::main()->contactsReceived(); - AuthSession::Current().data().contactsLoaded().set(true); } diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 75f54ce21..4aaa02425 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -1505,7 +1505,7 @@ MsgId History::inboxRead(MsgId upTo) { } showFrom = nullptr; - AuthSession::Current().notifications()->clearFromHistory(this); + AuthSession::Current().notifications().clearFromHistory(this); return upTo; } diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 36547c85b..eae3c9671 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -2034,7 +2034,7 @@ bool HistoryService::updateDependent(bool force) { updateDependentText(); } if (force && gotDependencyItem) { - AuthSession::Current().notifications()->checkDelayed(); + AuthSession::Current().notifications().checkDelayed(); } return (dependent->msg || !dependent->msgId); } diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 27bcf40e0..b833c2dde 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -3342,6 +3342,12 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) subscribe(Global::RefItemRemoved(), [this](HistoryItem *item) { itemRemoved(item); }); + subscribe(AuthSession::Current().data().contactsLoaded(), [this](bool) { + if (_peer) { + updateReportSpamStatus(); + updateControlsVisibility(); + } + }); } void HistoryWidget::start() { @@ -4430,7 +4436,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re if (_peer) { App::forgetMedia(); _serviceImageCacheSize = imageCacheSize(); - AuthSession::Current().downloader()->clearPriorities(); + AuthSession::Current().downloader().clearPriorities(); _history = App::history(_peer->id); _migrated = _peer->migrateFrom() ? App::history(_peer->migrateFrom()->id) : 0; @@ -4520,12 +4526,6 @@ void HistoryWidget::clearAllLoadRequests() { _preloadRequest = _preloadDownRequest = _firstLoadRequest = 0; } -void HistoryWidget::contactsReceived() { - if (!_peer) return; - updateReportSpamStatus(); - updateControlsVisibility(); -} - void HistoryWidget::updateAfterDrag() { if (_list) _list->dragActionUpdate(QCursor::pos()); } @@ -4607,7 +4607,7 @@ void HistoryWidget::updateReportSpamStatus() { } } } - if (!cContactsReceived() || _firstLoadRequest) { + if (!AuthSession::Current().data().contactsLoaded().value() || _firstLoadRequest) { _reportSpamStatus = dbiprsUnknown; } else if (_peer->isUser() && _peer->asUser()->contact > 0) { _reportSpamStatus = dbiprsHidden; @@ -4886,7 +4886,7 @@ void HistoryWidget::newUnreadMsg(History *history, HistoryItem *item) { return; } } - AuthSession::Current().notifications()->schedule(history, item); + AuthSession::Current().notifications().schedule(history, item); history->setUnreadCount(history->unreadCount() + 1); } diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 7c03132c1..3d9fb26b0 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -675,7 +675,6 @@ public: void applyCloudDraft(History *history); - void contactsReceived(); void updateHistoryDownPosition(); void updateHistoryDownVisibility(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index c750b5084..fceba67b0 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2182,10 +2182,6 @@ void MainWidget::clearBotStartToken(PeerData *peer) { } } -void MainWidget::contactsReceived() { - _history->contactsReceived(); -} - void MainWidget::updateAfterDrag() { if (_overview) { _overview->updateAfterDrag(); @@ -4187,7 +4183,7 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti if (!h) h = App::history(updatePeer->id); int32 changeIn = 0; if (isNotifyMuted(setTo, &changeIn)) { - AuthSession::Current().notifications()->clearFromHistory(h); + AuthSession::Current().notifications().clearFromHistory(h); h->setMute(true); App::regMuted(updatePeer, changeIn); } else { diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 10e1d85e0..3ad2d5e72 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -357,8 +357,6 @@ public: void choosePeer(PeerId peerId, MsgId showAtMsgId); // does offerPeer or showPeerHistory void clearBotStartToken(PeerData *peer); - void contactsReceived(); - void ptsWaiterStartTimerFor(ChannelData *channel, int32 ms); // ms <= 0 - stop timer void feedUpdates(const MTPUpdates &updates, uint64 randomId = 0); void feedUpdate(const MTPUpdate &update); diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index cc95970fb..d52f69885 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -228,7 +228,7 @@ void MainWindow::clearPasscode() { } else { _main->showAnimated(bg, true); } - AuthSession::Current().notifications()->updateAll(); + AuthSession::Current().notifications().updateAll(); updateGlobalMenu(); if (_main) { @@ -253,7 +253,7 @@ void MainWindow::setupPasscode() { } _shouldLockAt = 0; if (AuthSession::Exists()) { - AuthSession::Current().notifications()->updateAll(); + AuthSession::Current().notifications().updateAll(); } updateGlobalMenu(); } @@ -280,8 +280,6 @@ void MainWindow::checkAutoLock() { } void MainWindow::setupIntro() { - cSetContactsReceived(false); - cSetDialogsReceived(false); if (_intro && !_intro->isHidden() && !_main) return; Ui::hideSettingsAndLayer(true); @@ -830,9 +828,9 @@ void MainWindow::toggleDisplayNotifyFromTray() { } } Local::writeUserSettings(); - AuthSession::Current().notifications()->settingsChanged().notify(Window::Notifications::ChangeType::DesktopEnabled); + AuthSession::Current().notifications().settingsChanged().notify(Window::Notifications::ChangeType::DesktopEnabled); if (soundNotifyChanged) { - AuthSession::Current().notifications()->settingsChanged().notify(Window::Notifications::ChangeType::SoundEnabled); + AuthSession::Current().notifications().settingsChanged().notify(Window::Notifications::ChangeType::SoundEnabled); } } diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index c8e2b3267..f6ef89a4c 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -1168,7 +1168,7 @@ void MediaView::displayPhoto(PhotoData *photo, HistoryItem *item) { } _zoomToScreen = 0; - AuthSession::Current().downloader()->clearPriorities(); + AuthSession::Current().downloader().clearPriorities(); _full = -1; _current = QPixmap(); _down = OverNone; diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index ee586a94e..beb2e9df2 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -61,7 +61,7 @@ OverviewInner::OverviewInner(OverviewWidget *overview, Ui::ScrollArea *scroll, P , _cancelSearch(this, st::dialogsCancelSearch) , _itemsToBeLoaded(LinksOverviewPerPage * 2) , _width(st::windowMinWidth) { - subscribe(AuthSession::Current().downloader()->taskFinished(), [this] { update(); }); + subscribe(AuthSession::Current().downloader().taskFinished(), [this] { update(); }); subscribe(Global::RefItemRemoved(), [this](HistoryItem *item) { itemRemoved(item); }); @@ -1919,7 +1919,7 @@ void OverviewWidget::clear() { } void OverviewWidget::onScroll() { - AuthSession::Current().downloader()->clearPriorities(); + AuthSession::Current().downloader().clearPriorities(); int32 preloadThreshold = _scroll->height() * 5; bool needToPreload = false; do { diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index 56afa777c..a3272e9fc 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -114,9 +114,6 @@ QString gPlatformString; QUrl gUpdateURL; bool gIsElCapitan = false; -bool gContactsReceived = false; -bool gDialogsReceived = false; - int gOtherOnline = 0; SavedPeers gSavedPeers; diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h index 64505e9c1..6c131ec35 100644 --- a/Telegram/SourceFiles/settings.h +++ b/Telegram/SourceFiles/settings.h @@ -257,9 +257,6 @@ DeclareReadSetting(QString, PlatformString); DeclareReadSetting(bool, IsElCapitan); DeclareReadSetting(QUrl, UpdateURL); -DeclareSetting(bool, ContactsReceived); -DeclareSetting(bool, DialogsReceived); - DeclareSetting(int, OtherOnline); class PeerData; diff --git a/Telegram/SourceFiles/settings/settings_notifications_widget.cpp b/Telegram/SourceFiles/settings/settings_notifications_widget.cpp index fb8fe4b72..554191160 100644 --- a/Telegram/SourceFiles/settings/settings_notifications_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_notifications_widget.cpp @@ -42,7 +42,7 @@ using ChangeType = Window::Notifications::ChangeType; NotificationsWidget::NotificationsWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_notify)) { createControls(); - subscribe(AuthSession::Current().notifications()->settingsChanged(), [this](ChangeType type) { + subscribe(AuthSession::Current().notifications().settingsChanged(), [this](ChangeType type) { if (type == ChangeType::DesktopEnabled) { desktopEnabledUpdated(); } else if (type == ChangeType::ViewParams) { @@ -101,7 +101,7 @@ void NotificationsWidget::onDesktopNotifications() { } Global::SetDesktopNotify(_desktopNotifications->checked()); Local::writeUserSettings(); - AuthSession::Current().notifications()->settingsChanged().notify(ChangeType::DesktopEnabled); + AuthSession::Current().notifications().settingsChanged().notify(ChangeType::DesktopEnabled); } void NotificationsWidget::desktopEnabledUpdated() { @@ -124,7 +124,7 @@ void NotificationsWidget::onShowSenderName() { } Global::SetNotifyView(viewParam); Local::writeUserSettings(); - AuthSession::Current().notifications()->settingsChanged().notify(ChangeType::ViewParams); + AuthSession::Current().notifications().settingsChanged().notify(ChangeType::ViewParams); } void NotificationsWidget::onShowMessagePreview() { @@ -142,7 +142,7 @@ void NotificationsWidget::onShowMessagePreview() { Global::SetNotifyView(viewParam); Local::writeUserSettings(); - AuthSession::Current().notifications()->settingsChanged().notify(ChangeType::ViewParams); + AuthSession::Current().notifications().settingsChanged().notify(ChangeType::ViewParams); } void NotificationsWidget::viewParamUpdated() { @@ -157,7 +157,7 @@ void NotificationsWidget::onNativeNotifications() { Global::SetNativeNotifications(_nativeNotifications->checked()); Local::writeUserSettings(); - AuthSession::Current().notifications()->createManager(); + AuthSession::Current().notifications().createManager(); _advanced->toggleAnimated(!Global::NativeNotifications()); } @@ -173,13 +173,13 @@ void NotificationsWidget::onPlaySound() { Global::SetSoundNotify(_playSound->checked()); Local::writeUserSettings(); - AuthSession::Current().notifications()->settingsChanged().notify(ChangeType::SoundEnabled); + AuthSession::Current().notifications().settingsChanged().notify(ChangeType::SoundEnabled); } void NotificationsWidget::onIncludeMuted() { Global::SetIncludeMuted(_includeMuted->checked()); Local::writeUserSettings(); - AuthSession::Current().notifications()->settingsChanged().notify(ChangeType::IncludeMuted); + AuthSession::Current().notifications().settingsChanged().notify(ChangeType::IncludeMuted); } } // namespace Settings diff --git a/Telegram/SourceFiles/storage/file_download.cpp b/Telegram/SourceFiles/storage/file_download.cpp index 38cb3862a..ca048d7f8 100644 --- a/Telegram/SourceFiles/storage/file_download.cpp +++ b/Telegram/SourceFiles/storage/file_download.cpp @@ -71,7 +71,7 @@ namespace { } FileLoader::FileLoader(const QString &toFile, int32 size, LocationType locationType, LoadToCacheSetting toCache, LoadFromCloudSetting fromCloud, bool autoLoading) -: _downloader(AuthSession::Current().downloader()) +: _downloader(&AuthSession::Current().downloader()) , _autoLoading(autoLoading) , _file(toFile) , _fname(toFile) diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 0f45ba58b..0709fe000 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -64,7 +64,7 @@ std::unique_ptr Create(System *system) { } Manager::Manager(System *system) : Notifications::Manager(system) { - subscribe(system->authSession()->downloader()->taskFinished(), [this] { + subscribe(system->authSession()->downloader().taskFinished(), [this] { for_const (auto ¬ification, _notifications) { notification->updatePeerPhoto(); }