Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable double tap quoting on mobile
Browse files Browse the repository at this point in the history
easafe committed Jun 24, 2024
1 parent 2af910c commit da28ddd
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/Client/Im/Chat.purs
Original file line number Diff line number Diff line change
@@ -417,21 +417,23 @@ checkTyping text now webSocket model@{ lastTyping: DateTimeWrapper lt, contacts,

--this messy ass event can be from double click, context menu or swipe
quoteMessage String Either Touch (Maybe Event) ImModel NextMessage
quoteMessage contents event model@{ chatting } =
quoteMessage contents event model@{ chatting, smallScreen } =
case event of
Right Nothing
model { toggleContextMenu = HideContextMenu } :> [ liftEffect quoteIt ]
Right (Just evt) →
model :>
[ liftEffect do
classes ← WDE.className <<< SU.fromJust $ do
target ← WEE.target evt
WDE.fromEventTarget target
if DS.contains (Pattern "message") classes then
quoteIt
else
pure Nothing
]
if smallScreen then []
else
[ liftEffect do
classes ← WDE.className <<< SU.fromJust $ do
target ← WEE.target evt
WDE.fromEventTarget target
if DS.contains (Pattern "message") classes then
quoteIt
else
pure Nothing
]
Left { startX, endX, startY, endY } → model :> [ if startX < endX && endX - startX >= threshold && startY - endY < threshold then liftEffect quoteIt else pure Nothing ]
where
threshold = 40

0 comments on commit da28ddd

Please sign in to comment.