airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
203 stars 11 forks source link

iOS App running on Mac: TouchEvent.TOUCH_END events stop firing after right-click #3375

Open FliplineStudios opened 2 months ago

FliplineStudios commented 2 months ago

Problem Description

We have an iOS app that is also available on the Mac App Store on Apple Silicon Macs (it's not a native Mac app, it's a regular iPhone/iPad app that Apple lets you install on M1/M2/M3 Macs).

The game uses TouchEvents for most interactions, especially when clicking and dragging game elements where it's checking the touchPointID. There are no problems at all on iPhones and iPads.

The issue occurs when the app is installed on a Mac: All interactions initially work correctly (with Apple's iOS-app-on-Mac compatibility handling the TouchEvents just fine), up until the user right-clicks within the game window -- either using the secondary click on a Magic Mouse, or by tapping with two fingers on a MacBook touchpad.

After that point, no TouchEvent.TOUCH_END events will fire when releasing the mouse/touchpad. TouchEvent.TOUCH_BEGIN events will continue to work correctly, and both MouseEvent.MOUSE_DOWN and MouseEvent.MOUSE_UP events will continue to work correctly. It seems that TouchEvent.TOUCH_END is the only event affected after a right-click. Nothing is able to restore the TOUCH_END events after this occurs, the app itself must be quit and re-launched.

This is without using the "Touch Alternatives" that are available in the "Settings" menu when installing an iOS app on a Mac, it's just using the standard settings when launching an iOS app installed on Mac.

I'm not sure whether this is something specifically AIR related, or a bug with the M1/M2/M3 compatibility that Apple does for iOS apps on Macs.

If there was access to the process property isiOSAppOnMac we could perhaps recognize this and manually adjust our code to use MouseEvents without multitouch when installed on a Mac, but I don't know if this is accessible in an iOS app using AIR. (https://developer.apple.com/documentation/foundation/processinfo/3608556-isiosapponmac)

This is on an iOS app packaged with AIR 50.2.4.4 on MacOS Sonoma, though I didn't notice anything in newer AIR 51 release notes addressing this.

Steps to Reproduce

Known Workarounds

None

marchbold commented 2 months ago

I can add this flag into the Application ANE for you quickly if that would help?

FliplineStudios commented 2 months ago

@marchbold Oh that would be very helpful!

I did try using the current Application ANE to check the device details in case that showed anything detectable, but they're reporting "iPad8,6" the same as Capabilities.os (I'm assuming this is what Apple's iOS-app-on-Mac system tells the app it's running on for compatibility).

marchbold commented 2 months ago

No problems, I'll get an update out today for it.

FYI I've created an issue to track it: https://github.com/distriqt/ANE-Application/issues/291

ajwfrost commented 2 months ago

Hi @FliplineStudios - fyi, we have fixed the problem with TOUCH_END events. Although currently not getting right-mouse messages coming out from the app when running on macOS - the error itself happened because if you tap with two fingers on the touchpad, we only actually received a "touchesEnded" notification, no "touchesBegan"! And that screwed up some assumptions in the code about the ordering of events.

We have also updated the Capabilities.manufacturer value so that rather than "Adobe iOS" which it would currently say, if you're running on macOS then it will say "Adobe macOS". We'd been looking to do something similar to notify of when an Android app is running on a PC; at some point we may add a new field into that to try to give better information, although all the Apple UIDevice properties still suggest that we're running on an actual iPad: the OS version is correct (for the mac) but the OS and device IDs are wrong.. not sure whether Apple would change those at some point.

Anyway -> should be some improvements in the next release.