mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 09:41:41 -05:00
Push new saved theme to the list.
This commit is contained in:
parent
bb7018424a
commit
2ab2eed633
3 changed files with 6 additions and 3 deletions
|
@ -282,11 +282,14 @@ const std::vector<CloudTheme> &CloudThemes::list() const {
|
|||
return _list;
|
||||
}
|
||||
|
||||
void CloudThemes::apply(const CloudTheme &theme) {
|
||||
void CloudThemes::savedFromEditor(const CloudTheme &theme) {
|
||||
const auto i = ranges::find(_list, theme.id, &CloudTheme::id);
|
||||
if (i != end(_list)) {
|
||||
*i = theme;
|
||||
_updates.fire({});
|
||||
} else {
|
||||
_list.insert(begin(_list), theme);
|
||||
_updates.fire({});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
void refresh();
|
||||
[[nodiscard]] rpl::producer<> updated() const;
|
||||
[[nodiscard]] const std::vector<CloudTheme> &list() const;
|
||||
void apply(const CloudTheme &data);
|
||||
void savedFromEditor(const CloudTheme &data);
|
||||
void remove(uint64 cloudThemeId);
|
||||
|
||||
void applyUpdate(const MTPTheme &theme);
|
||||
|
|
|
@ -549,7 +549,7 @@ Fn<void()> SavePreparedTheme(
|
|||
|
||||
const auto cloud = result.match([&](const MTPDtheme &data) {
|
||||
const auto result = Data::CloudTheme::Parse(session, data);
|
||||
session->data().cloudThemes().apply(result);
|
||||
session->data().cloudThemes().savedFromEditor(result);
|
||||
return result;
|
||||
}, [&](const MTPDthemeDocumentNotModified &data) {
|
||||
LOG(("API Error: Unexpected themeDocumentNotModified."));
|
||||
|
|
Loading…
Add table
Reference in a new issue