From 657a8d7fb966ffe1902a8c7453701fb3524bc558 Mon Sep 17 00:00:00 2001 From: Byoungwook Park Date: Mon, 13 Nov 2023 19:14:24 +0900 Subject: [PATCH] fix: ios input crash --- .../IOSDeviceAgentLib/TouchControlPlayer.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/ios-device-agent/IOSDeviceAgent/IOSDeviceAgentLib/TouchControlPlayer.swift b/projects/ios-device-agent/IOSDeviceAgent/IOSDeviceAgentLib/TouchControlPlayer.swift index 2d19ee018..7467fc294 100644 --- a/projects/ios-device-agent/IOSDeviceAgent/IOSDeviceAgentLib/TouchControlPlayer.swift +++ b/projects/ios-device-agent/IOSDeviceAgent/IOSDeviceAgentLib/TouchControlPlayer.swift @@ -71,6 +71,14 @@ actor TouchControlPlayer: IControlPlayer { } let endPosition = try Transform.controlSpaceToScreenSpace(controlSpacePosition: up.control.position, screenSize: screenSize) + let gapTime = Date().unixTimeMilliseconds - down.control.timeStamp + if 3000 < gapTime { + return + } + + if down.control.timeStamp > up.control.timeStamp { + return + } var duration = up.control.timeStamp - down.control.timeStamp if duration < 100 { duration = 0