mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed color of float button from sponsored message bar in new window.
This commit is contained in:
parent
2b122087c4
commit
168162c174
1 changed files with 32 additions and 7 deletions
|
@ -89,15 +89,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] ColorFactory GenerateReplyColorCallback(
|
[[nodiscard]] ColorFactory GenerateReplyColorCallback(
|
||||||
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<RpWidget*> widget,
|
not_null<RpWidget*> widget,
|
||||||
FullMsgId fullId,
|
FullMsgId fullId,
|
||||||
int colorIndex) {
|
int colorIndex) {
|
||||||
const auto controller = FindSessionController(widget);
|
|
||||||
if (!controller) {
|
|
||||||
return []() -> Colors {
|
|
||||||
return { st::windowBgActive->c, st::windowActiveTextFg->c };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const auto peer = controller->session().data().peer(fullId.peer);
|
const auto peer = controller->session().data().peer(fullId.peer);
|
||||||
struct State final {
|
struct State final {
|
||||||
std::shared_ptr<Ui::ChatTheme> theme;
|
std::shared_ptr<Ui::ChatTheme> theme;
|
||||||
|
@ -112,7 +107,10 @@ public:
|
||||||
|
|
||||||
return [=]() -> Colors {
|
return [=]() -> Colors {
|
||||||
if (!state->theme) {
|
if (!state->theme) {
|
||||||
return { st::windowBgActive->c, st::windowActiveTextFg->c };
|
return {
|
||||||
|
anim::with_alpha(st::windowBgActive->c, .15),
|
||||||
|
st::windowActiveTextFg->c,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const auto context = controller->preparePaintContext({
|
const auto context = controller->preparePaintContext({
|
||||||
.theme = state->theme.get(),
|
.theme = state->theme.get(),
|
||||||
|
@ -125,6 +123,33 @@ public:
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] ColorFactory GenerateReplyColorCallback(
|
||||||
|
not_null<RpWidget*> widget,
|
||||||
|
FullMsgId fullId,
|
||||||
|
int colorIndex) {
|
||||||
|
if (const auto window = FindSessionController(widget)) {
|
||||||
|
return GenerateReplyColorCallback(window, widget, fullId, colorIndex);
|
||||||
|
}
|
||||||
|
const auto window
|
||||||
|
= widget->lifetime().make_state<Window::SessionController*>();
|
||||||
|
const auto callback = widget->lifetime().make_state<ColorFactory>();
|
||||||
|
return [=, color = colorIndex]() -> Colors {
|
||||||
|
if (*callback) {
|
||||||
|
return (*callback)();
|
||||||
|
}
|
||||||
|
*window = FindSessionController(widget);
|
||||||
|
if (const auto w = (*window)) {
|
||||||
|
*callback = GenerateReplyColorCallback(w, widget, fullId, color);
|
||||||
|
return (*callback)();
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
anim::with_alpha(st::windowBgActive->c, .15),
|
||||||
|
st::windowActiveTextFg->c,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void FillSponsoredMessageBar(
|
void FillSponsoredMessageBar(
|
||||||
|
|
Loading…
Add table
Reference in a new issue