summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2019-04-02 09:11:32 -0400
committerNicoleYarroch <nicole@livio.io>2019-04-02 09:11:32 -0400
commitbe232a4bec911f9d33b01885c368b27b5d574bf3 (patch)
treed4657c4a14dc8f12235c51ee6900b640492cfff0
parent1a44df8377904de637ec22998359ed50a6e67438 (diff)
downloadsdl_ios-be232a4bec911f9d33b01885c368b27b5d574bf3.tar.gz
Made some hit test fixes for single tap
-rw-r--r--SmartDeviceLink/SDLFocusableItemLocator.m10
-rw-r--r--SmartDeviceLink/SDLTouchManager.m4
2 files changed, 11 insertions, 3 deletions
diff --git a/SmartDeviceLink/SDLFocusableItemLocator.m b/SmartDeviceLink/SDLFocusableItemLocator.m
index 79838f089..7cfe90d07 100644
--- a/SmartDeviceLink/SDLFocusableItemLocator.m
+++ b/SmartDeviceLink/SDLFocusableItemLocator.m
@@ -122,6 +122,16 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark SDLFocusableItemHitTester functions
- (void)viewForPoint:(CGPoint)point selectedViewHandler:(nullable void (^)(UIView * _Nullable))selectedViewHandler {
+ if (NSThread.currentThread.isMainThread) {
+ return [self sdl_viewForPoint:point selectedViewHandler:selectedViewHandler];
+ }
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ return [self sdl_viewForPoint:point selectedViewHandler:selectedViewHandler];
+ });
+}
+
+- (void)sdl_viewForPoint:(CGPoint)point selectedViewHandler:(nullable void (^)(UIView * _Nullable))selectedViewHandler {
dispatch_async(dispatch_get_main_queue(), ^{
UIView *selectedView = nil;
diff --git a/SmartDeviceLink/SDLTouchManager.m b/SmartDeviceLink/SDLTouchManager.m
index 61334fbf2..03c78f9c1 100644
--- a/SmartDeviceLink/SDLTouchManager.m
+++ b/SmartDeviceLink/SDLTouchManager.m
@@ -463,10 +463,8 @@ static NSUInteger const MaximumNumberOfTouches = 2;
[strongSelf sdl_cancelSingleTapTimer];
if ([strongSelf.touchEventDelegate respondsToSelector:@selector(touchManager:didReceiveSingleTapForView:atPoint:)]) {
if (strongSelf.hitTester) {
- dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
- 0);
[strongSelf.hitTester viewForPoint:point selectedViewHandler:^(UIView * _Nullable selectedView) {
- dispatch_async(currentQueue, ^{
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self sdl_notifyDelegateSingleTapForView:selectedView point:point];
});
}];