Skip to content

Commit

Permalink
fix: add a guard to not add the customer gesture recognizer multiple …
Browse files Browse the repository at this point in the history
…times
  • Loading branch information
PouriaAmini committed Jul 18, 2024
1 parent a9e8dac commit 1f40e9f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/Amplitude/Plugins/iOS/UIKitUserInteractions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class UIKitUserInteractions {

@objc static func windowDidBecomeKey(_ notification: NSNotification) {
guard setupAXBundle, let window = notification.object as? UIWindow else { return }

if let windowGestureRecognizers = window.gestureRecognizers, windowGestureRecognizers.contains(where: { $0 is _AmplitudeSwiftUIGestureRecognizer }) {
return
}

let swiftUIGestureRecognizer = _AmplitudeSwiftUIGestureRecognizer(target: UIKitUserInteractions.self, action: #selector(handleTap))
swiftUIGestureRecognizer.cancelsTouchesInView = false
Expand Down

0 comments on commit 1f40e9f

Please sign in to comment.