mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Added ability to swipe between chats filters.
This commit is contained in:
parent
3315c9c7f4
commit
7197d9480b
2 changed files with 23 additions and 4 deletions
|
@ -687,7 +687,7 @@ void Widget::setupSwipeBack() {
|
||||||
};
|
};
|
||||||
Ui::Controls::SetupSwipeHandler(_scroll.data(), _scroll.data(), [=](
|
Ui::Controls::SetupSwipeHandler(_scroll.data(), _scroll.data(), [=](
|
||||||
Ui::Controls::SwipeContextData data) {
|
Ui::Controls::SwipeContextData data) {
|
||||||
if (data.translation > 0) {
|
if (data.translation != 0) {
|
||||||
if (!_swipeBackData.callback) {
|
if (!_swipeBackData.callback) {
|
||||||
_swipeBackData = Ui::Controls::SetupSwipeBack(
|
_swipeBackData = Ui::Controls::SetupSwipeBack(
|
||||||
this,
|
this,
|
||||||
|
@ -697,7 +697,7 @@ void Widget::setupSwipeBack() {
|
||||||
st::historyForwardChooseFg->c,
|
st::historyForwardChooseFg->c,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
false,
|
_swipeBackMirrored,
|
||||||
_swipeBackIconMirrored);
|
_swipeBackIconMirrored);
|
||||||
}
|
}
|
||||||
_swipeBackData.callback(data);
|
_swipeBackData.callback(data);
|
||||||
|
@ -709,11 +709,15 @@ void Widget::setupSwipeBack() {
|
||||||
}
|
}
|
||||||
}, [=](int, Qt::LayoutDirection direction) {
|
}, [=](int, Qt::LayoutDirection direction) {
|
||||||
_swipeBackIconMirrored = false;
|
_swipeBackIconMirrored = false;
|
||||||
|
_swipeBackMirrored = false;
|
||||||
if (_childListShown.current()) {
|
if (_childListShown.current()) {
|
||||||
return Ui::Controls::SwipeHandlerFinishData();
|
return Ui::Controls::SwipeHandlerFinishData();
|
||||||
}
|
}
|
||||||
const auto isRightToLeft = direction == Qt::RightToLeft;
|
const auto isRightToLeft = direction == Qt::RightToLeft;
|
||||||
if (isRightToLeft && controller()->openedFolder().current()) {
|
if (controller()->openedFolder().current()) {
|
||||||
|
if (!isRightToLeft) {
|
||||||
|
return Ui::Controls::SwipeHandlerFinishData();
|
||||||
|
}
|
||||||
return Ui::Controls::DefaultSwipeBackHandlerFinishData([=] {
|
return Ui::Controls::DefaultSwipeBackHandlerFinishData([=] {
|
||||||
_swipeBackData = {};
|
_swipeBackData = {};
|
||||||
if (controller()->openedFolder().current()) {
|
if (controller()->openedFolder().current()) {
|
||||||
|
@ -723,7 +727,10 @@ void Widget::setupSwipeBack() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (isRightToLeft && (controller()->shownForum().current())) {
|
if (controller()->shownForum().current()) {
|
||||||
|
if (!isRightToLeft) {
|
||||||
|
return Ui::Controls::SwipeHandlerFinishData();
|
||||||
|
}
|
||||||
const auto id = controller()->windowId();
|
const auto id = controller()->windowId();
|
||||||
const auto initial = id.forum();
|
const auto initial = id.forum();
|
||||||
if (initial) {
|
if (initial) {
|
||||||
|
@ -746,6 +753,17 @@ void Widget::setupSwipeBack() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (_chatFilters && session().data().chatsFilters().has()) {
|
||||||
|
_swipeBackMirrored = !isRightToLeft;
|
||||||
|
using namespace Window;
|
||||||
|
const auto next = !isRightToLeft;
|
||||||
|
if (CheckAndJumpToNearChatsFilter(controller(), next, false)) {
|
||||||
|
return Ui::Controls::DefaultSwipeBackHandlerFinishData([=] {
|
||||||
|
_swipeBackData = {};
|
||||||
|
CheckAndJumpToNearChatsFilter(controller(), next, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
return Ui::Controls::SwipeHandlerFinishData();
|
return Ui::Controls::SwipeHandlerFinishData();
|
||||||
}, nullptr);
|
}, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -386,6 +386,7 @@ private:
|
||||||
ChatTypeFilter _searchQueryFilter = {};
|
ChatTypeFilter _searchQueryFilter = {};
|
||||||
|
|
||||||
Ui::Controls::SwipeBackResult _swipeBackData;
|
Ui::Controls::SwipeBackResult _swipeBackData;
|
||||||
|
bool _swipeBackMirrored = false;
|
||||||
bool _swipeBackIconMirrored = false;
|
bool _swipeBackIconMirrored = false;
|
||||||
|
|
||||||
SearchProcessState _searchProcess;
|
SearchProcessState _searchProcess;
|
||||||
|
|
Loading…
Add table
Reference in a new issue