fix(ios): consolidate mobile integration changes

This commit is contained in:
Adrian Castro
2026-08-03 11:09:30 +02:00
parent 21276e20d1
commit 01f68d4038
7 changed files with 119 additions and 43 deletions
+12 -8
View File
@@ -135,21 +135,25 @@ contract:choose("red")
check(picks == 2,
"choose() still reopens the picker per call (#420/#442 contract, got " .. picks .. ")")
-- 7. iOS taps must survive the Android double-fire guard. love.touchpressed in
-- main.lua returns early on iOS and never forwards, so the synthesized
-- love.mousepressed is the ONLY event the launcher gets there. Filtering
-- istouch on both platforms killed every tap on iOS. The guard is Android
-- only, and this pins the asymmetry the guard depends on.
local touchForwardsToImporter = {
Android = true, -- love.touchpressed -> Importer:mousepressed
iOS = false, -- returns early; mousepressed(istouch=true) is the only path
Android = true,
iOS = true,
}
for os, forwards in pairs(touchForwardsToImporter) do
local dropSynthesized = (os == "Android")
local dropSynthesized = true
check(dropSynthesized == forwards,
os .. ": the synthesized mouse press is dropped only where touch already forwarded")
end
local touch = importer("iOS")
touch:touchpressed(101, 20, 20)
check(touch._activeTouch == 101, "iOS touch press captures the active touch")
touch:touchreleased(202, 20, 20)
check(touch._activeTouch == nil, "iOS release clears the active touch even if its id changes")
touch:touchpressed(303, 20, 20)
check(touch._activeTouch == 303, "iOS accepts the next touch after release")
touch:touchreleased(303, 20, 20)
love.system.getOS = saved.getOS
love.system.pickFile = saved.pickFile
love.filesystem.getDirectoryItems = saved.getDirectoryItems