Compare commits

..

3 Commits

Author SHA1 Message Date
GitHub Actions
8cacf555e5 chore: bump version to 4.11.126 [skip ci] 2026-07-11 12:16:49 +00:00
5a1579dd01 Merge branch 'master' of http://synbox.ruv.wtf:8418/litruv/cinny-mobile
All checks were successful
Build / increment-version (push) Successful in 6s
Build / build-android (push) Successful in 4m46s
Build / create-release (push) Successful in 14s
2026-07-11 22:16:40 +10:00
792c735ffe feat: improve touch handling in MobileSwipeGestureHost for better swipe detection 2026-07-11 22:16:26 +10:00
2 changed files with 18 additions and 19 deletions

View File

@@ -220,6 +220,12 @@ export function MobileSwipeGestureHost({ children }: MobileSwipeGestureHostProps
const getEndedTouch = (evt: TouchEvent, touchId: number) => const getEndedTouch = (evt: TouchEvent, touchId: number) =>
Array.from(evt.changedTouches).find((touch) => touch.identifier === touchId); Array.from(evt.changedTouches).find((touch) => touch.identifier === touchId);
const isInsideSwipeHost = (target: EventTarget | null): boolean => {
const root = rootRef.current;
if (!root || !(target instanceof Node)) return false;
return root.contains(target);
};
const handleTouchStart = (evt: TouchEvent) => { const handleTouchStart = (evt: TouchEvent) => {
if (gestureRef.current.phase !== 'idle') return; if (gestureRef.current.phase !== 'idle') return;
@@ -232,7 +238,12 @@ export function MobileSwipeGestureHost({ children }: MobileSwipeGestureHostProps
const messageEl = findMessageElement(target); const messageEl = findMessageElement(target);
const messageId = messageEl?.getAttribute('data-message-id') ?? null; const messageId = messageEl?.getAttribute('data-message-id') ?? null;
const canStartBack = backEnabled && !shouldIgnoreBackTarget(target); // Only steal touches that start inside the detail/swipe host. Document-level
// listeners otherwise fight the always-visible sidebar (space icons sit in the
// former screen-left EDGE_WIDTH zone and lost clicks to preventDefault).
const insideHost = isInsideSwipeHost(target);
const canStartBack =
backEnabled && insideHost && !shouldIgnoreBackTarget(target);
const canStartReply = const canStartReply =
replyEnabled && replyEnabled &&
messageEl && messageEl &&
@@ -242,23 +253,11 @@ export function MobileSwipeGestureHost({ children }: MobileSwipeGestureHostProps
if (!canStartBack && !canStartReply) return; if (!canStartBack && !canStartReply) return;
if (touch.clientX <= EDGE_WIDTH && canStartBack) { const contentLeft = rootRef.current?.getBoundingClientRect().left ?? 0;
evt.preventDefault(); const nearContentLeftEdge =
gestureRef.current = { touch.clientX >= contentLeft && touch.clientX <= contentLeft + EDGE_WIDTH;
phase: 'back',
touchId: touch.identifier,
startX: touch.clientX,
startY: touch.clientY,
messageEl: null,
transformEl: null,
messageId: null,
edgeBack: true,
offset: 0,
};
document.documentElement.classList.add('mobile-gesture-lock');
return;
}
// Prefer pending over immediate back+preventDefault so a tap still clicks.
gestureRef.current = { gestureRef.current = {
phase: 'pending', phase: 'pending',
touchId: touch.identifier, touchId: touch.identifier,
@@ -267,7 +266,7 @@ export function MobileSwipeGestureHost({ children }: MobileSwipeGestureHostProps
messageEl: canStartReply ? messageEl : null, messageEl: canStartReply ? messageEl : null,
transformEl: canStartReply && messageEl ? findReplyTransformTarget(messageEl) : null, transformEl: canStartReply && messageEl ? findReplyTransformTarget(messageEl) : null,
messageId: canStartReply ? messageId : null, messageId: canStartReply ? messageId : null,
edgeBack: false, edgeBack: nearContentLeftEdge && canStartBack,
offset: 0, offset: 0,
}; };
}; };

View File

@@ -1,6 +1,6 @@
{ {
"name": "paarrot", "name": "paarrot",
"version": "4.11.125", "version": "4.11.126",
"description": "Paarrot - A Matrix client based on Cinny", "description": "Paarrot - A Matrix client based on Cinny",
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"