mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Suggest start export when time comes.
This commit is contained in:
@@ -83,6 +83,29 @@ void Session::startExport() {
|
||||
}, _export->lifetime());
|
||||
}
|
||||
|
||||
void Session::suggestStartExport(TimeId availableAt) {
|
||||
_exportAvailableAt = availableAt;
|
||||
suggestStartExport();
|
||||
}
|
||||
|
||||
void Session::suggestStartExport() {
|
||||
if (_exportAvailableAt <= 0) {
|
||||
return;
|
||||
}
|
||||
const auto now = unixtime();
|
||||
const auto left = (_exportAvailableAt <= now)
|
||||
? 0
|
||||
: (_exportAvailableAt - now);
|
||||
if (!left) {
|
||||
Export::View::SuggestStart();
|
||||
} else {
|
||||
App::CallDelayed(
|
||||
std::min(left + 5, 3600) * TimeMs(1000),
|
||||
_session,
|
||||
[=] { suggestStartExport(); });
|
||||
}
|
||||
}
|
||||
|
||||
rpl::producer<Export::View::PanelController*> Session::currentExportView(
|
||||
) const {
|
||||
return _exportViewChanges.events_starting_with(_exportPanel.get());
|
||||
|
@@ -52,6 +52,7 @@ public:
|
||||
}
|
||||
|
||||
void startExport();
|
||||
void suggestStartExport(TimeId availableAt);
|
||||
rpl::producer<Export::View::PanelController*> currentExportView() const;
|
||||
bool exportInProgress() const;
|
||||
void stopExportWithConfirmation(FnMut<void()> callback);
|
||||
@@ -408,6 +409,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void suggestStartExport();
|
||||
|
||||
void setupContactViewsViewer();
|
||||
void setupChannelLeavingViewer();
|
||||
void photoApplyFields(
|
||||
@@ -505,6 +508,7 @@ private:
|
||||
std::unique_ptr<Export::ControllerWrap> _export;
|
||||
std::unique_ptr<Export::View::PanelController> _exportPanel;
|
||||
rpl::event_stream<Export::View::PanelController*> _exportViewChanges;
|
||||
TimeId _exportAvailableAt = 0;
|
||||
|
||||
base::Variable<bool> _contactsLoaded = { false };
|
||||
base::Variable<bool> _allChatsLoaded = { false };
|
||||
|
Reference in New Issue
Block a user