mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Improve suggest export logic.
This commit is contained in:
parent
d0614efd65
commit
e21c354428
4 changed files with 17 additions and 4 deletions
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/view/history_view_element.h"
|
||||
#include "inline_bots/inline_bot_layout_item.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_photo.h"
|
||||
|
@ -93,6 +94,13 @@ void Session::suggestStartExport(TimeId availableAt) {
|
|||
suggestStartExport();
|
||||
}
|
||||
|
||||
void Session::clearExportSuggestion() {
|
||||
_exportAvailableAt = 0;
|
||||
if (_exportSuggestion) {
|
||||
_exportSuggestion->closeBox();
|
||||
}
|
||||
}
|
||||
|
||||
void Session::suggestStartExport() {
|
||||
if (_exportAvailableAt <= 0) {
|
||||
return;
|
||||
|
@ -110,7 +118,7 @@ void Session::suggestStartExport() {
|
|||
} else if (_export) {
|
||||
Export::View::ClearSuggestStart();
|
||||
} else {
|
||||
Export::View::SuggestStart();
|
||||
_exportSuggestion = Export::View::SuggestStart();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/timer.h"
|
||||
|
||||
class HistoryItem;
|
||||
class BoxContent;
|
||||
|
||||
namespace HistoryView {
|
||||
struct Group;
|
||||
|
@ -53,6 +54,7 @@ public:
|
|||
|
||||
void startExport();
|
||||
void suggestStartExport(TimeId availableAt);
|
||||
void clearExportSuggestion();
|
||||
rpl::producer<Export::View::PanelController*> currentExportView() const;
|
||||
bool exportInProgress() const;
|
||||
void stopExportWithConfirmation(FnMut<void()> callback);
|
||||
|
@ -509,6 +511,7 @@ private:
|
|||
std::unique_ptr<Export::View::PanelController> _exportPanel;
|
||||
rpl::event_stream<Export::View::PanelController*> _exportViewChanges;
|
||||
TimeId _exportAvailableAt = 0;
|
||||
QPointer<BoxContent> _exportSuggestion;
|
||||
|
||||
base::Variable<bool> _contactsLoaded = { false };
|
||||
base::Variable<bool> _allChatsLoaded = { false };
|
||||
|
|
|
@ -90,12 +90,14 @@ Environment PrepareEnvironment() {
|
|||
|
||||
} // namespace
|
||||
|
||||
void SuggestStart() {
|
||||
QPointer<BoxContent> SuggestStart() {
|
||||
ClearSuggestStart();
|
||||
Ui::show(Box<SuggestBox>(), LayerOption::KeepOther);
|
||||
return Ui::show(Box<SuggestBox>(), LayerOption::KeepOther).data();
|
||||
}
|
||||
|
||||
void ClearSuggestStart() {
|
||||
Auth().data().clearExportSuggestion();
|
||||
|
||||
auto settings = Local::ReadExportSettings();
|
||||
if (settings.availableAt) {
|
||||
settings.availableAt = 0;
|
||||
|
|
|
@ -21,7 +21,7 @@ class SeparatePanel;
|
|||
namespace Export {
|
||||
namespace View {
|
||||
|
||||
void SuggestStart();
|
||||
QPointer<BoxContent> SuggestStart();
|
||||
void ClearSuggestStart();
|
||||
|
||||
class Panel;
|
||||
|
|
Loading…
Add table
Reference in a new issue