diff --git a/src/app/components/SwipeableMessageWrapper.tsx b/src/app/components/SwipeableMessageWrapper.tsx
index ef5d0cea..1c6121e8 100644
--- a/src/app/components/SwipeableMessageWrapper.tsx
+++ b/src/app/components/SwipeableMessageWrapper.tsx
@@ -8,14 +8,10 @@ import { RightSwipeAction, settingsAtom } from '../state/settings';
export function SwipeableMessageWrapper({
children,
- onReply,
- messageId,
- itemIndex
+ onReply
}: {
children: React.ReactNode;
onReply: () => void;
- messageId: string;
- itemIndex: number;
}) {
const settings = useAtomValue(settingsAtom);
const x = useMotionValue(0);
@@ -38,7 +34,6 @@ export function SwipeableMessageWrapper({
setIsReady(mx < -50);
} else {
if (mx < -50) {
- if ('vibrate' in navigator) navigator.vibrate(10);
onReply();
}
x.set(0);
@@ -48,23 +43,16 @@ export function SwipeableMessageWrapper({
axis: 'x',
bounds: { right: 0 },
rubberband: true,
- filterTaps: true,
- pointer: { capture: true }
+ filterTaps: true
});
- if (!settings.mobileGestures || !mobileOrTablet()) {
- return (
-
- {children}
-
- );
+ if (!isSwipeToReplyEnabled) {
+ return <>{children}>;
}
return (
diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx
index 3ce56704..8031d261 100644
--- a/src/app/features/room/RoomTimeline.tsx
+++ b/src/app/features/room/RoomTimeline.tsx
@@ -106,7 +106,6 @@ import { useSpaceOptionally } from '../../hooks/useSpace';
import { useRoomCreators } from '../../hooks/useRoomCreators';
import { useRoomPermissions } from '../../hooks/useRoomPermissions';
import { useGetMemberPowerTag } from '../../hooks/useMemberPowerTag';
-import { SwipeableMessageWrapper } from '../../components/SwipeableMessageWrapper';
const TimelineFloat = as<'div', css.TimelineFloatVariants>(
({ position, className, ...props }, ref) => (
@@ -1045,79 +1044,73 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
getMemberDisplayName(room, senderId, nicknames) ?? getMxIdLocalPart(senderId) ?? senderId;
return (
- triggerReply(mEventId)}
- >
-
- )
- }
- reactions={
- reactionRelations && (
-
- )
- }
- hideReadReceipts={hideActivity}
- showDeveloperTools={showDeveloperTools}
- memberPowerTag={getMemberPowerTag(senderId)}
- hour24Clock={hour24Clock}
- dateFormatString={dateFormatString}
- >
- {mEvent.isRedacted() ? (
-
- ) : (
-
- )}
-
-
+ )
+ }
+ reactions={
+ reactionRelations && (
+
+ )
+ }
+ hideReadReceipts={hideActivity}
+ showDeveloperTools={showDeveloperTools}
+ memberPowerTag={getMemberPowerTag(senderId)}
+ hour24Clock={hour24Clock}
+ dateFormatString={dateFormatString}
+ >
+ {mEvent.isRedacted() ? (
+
+ ) : (
+
+ )}
+
);
},
[MessageEvent.RoomMessageEncrypted]: (mEventId, mEvent, item, timelineSet, collapse) => {
diff --git a/src/app/features/room/message/Message.tsx b/src/app/features/room/message/Message.tsx
index 12e1a20d..c29f6ef1 100644
--- a/src/app/features/room/message/Message.tsx
+++ b/src/app/features/room/message/Message.tsx
@@ -83,6 +83,7 @@ import colorMXID from '../../../../util/colorMXID';
import { getPowerTagIconSrc } from '../../../hooks/useMemberPowerTag';
import { AccountDataEvent } from '../../../../types/matrix/accountData';
import { useSableCosmetics } from '../../../hooks/useSableCosmetics';
+import { SwipeableMessageWrapper } from '../../../components/SwipeableMessageWrapper';
export type ReactionHandler = (keyOrMxc: string, shortcode: string) => void;
@@ -879,6 +880,16 @@ export const Message = as<'div', MessageProps>(
}, 100);
};
+ const handleSwipeReply = () => {
+ const mockEvent = {
+ currentTarget: {
+ getAttribute: (attr: string) => (attr === 'data-event-id' ? mEvent.getId() : null),
+ },
+ } as unknown as React.MouseEvent;
+
+ onReplyClick(mockEvent);
+ };
+
const isThreadedMessage = mEvent.threadRootId !== undefined;
return (
@@ -1194,22 +1205,31 @@ export const Message = as<'div', MessageProps>(
)}
{messageLayout === MessageLayout.Compact && (
-
- {msgContentJSX}
-
- )}
+
+
+ {msgContentJSX}
+
+
+ )
+ }
{messageLayout === MessageLayout.Bubble && (
-
- {msgContentJSX}
-
+
+
+ {msgContentJSX}
+
+
)}
- {messageLayout !== MessageLayout.Compact && messageLayout !== MessageLayout.Bubble && (
-
- {headerJSX}
- {msgContentJSX}
-
- )}
-
+ {
+ messageLayout !== MessageLayout.Compact && messageLayout !== MessageLayout.Bubble && (
+
+
+ {headerJSX}
+ {msgContentJSX}
+
+
+ )
+ }
+
);
}
);