diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2020-05-06 14:02:46 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2020-05-06 14:02:46 -0400 |
commit | f7a2d9ee52063ea00799899950c95fa2778fd4cf (patch) | |
tree | 48d2e90e4304b7ac89e857e67ce7913a0c471aae | |
parent | f09d619e482fce2f4476a5d80bcb771a707570e7 (diff) | |
download | sdl_ios-f7a2d9ee52063ea00799899950c95fa2778fd4cf.tar.gz |
Add logs to focusable item locator
-rw-r--r-- | SmartDeviceLink/SDLFocusableItemLocator.m | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/SmartDeviceLink/SDLFocusableItemLocator.m b/SmartDeviceLink/SDLFocusableItemLocator.m index c33745fc2..e416c2a3a 100644 --- a/SmartDeviceLink/SDLFocusableItemLocator.m +++ b/SmartDeviceLink/SDLFocusableItemLocator.m @@ -52,10 +52,12 @@ NS_ASSUME_NONNULL_BEGIN } - (void)start { + SDLLogD(@"Starting"); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_projectionViewUpdated:) name:SDLDidUpdateProjectionView object:nil]; } - (void)stop { + SDLLogD(@"Stopping"); [[NSNotificationCenter defaultCenter] removeObserver:self]; [self.focusableViews removeAllObjects]; } @@ -71,7 +73,11 @@ NS_ASSUME_NONNULL_BEGIN [self.focusableViews exchangeObjectAtIndex:preferredViewIndex withObjectAtIndex:0]; } + SDLLogD(@"Updated VC layout, sending new haptic rects"); + SDLLogV(@"For focusable views: %@", self.focusableViews); [self sdl_sendHapticRPC]; + } else { + SDLLogE(@"Attempted to update user interface layout, but it only works on iOS 9.0+"); } } @@ -86,10 +92,14 @@ NS_ASSUME_NONNULL_BEGIN return; } + SDLLogD(@"Parsing UIView heirarchy"); + SDLLogV(@"UIView: %@", currentView); if (@available(iOS 9.0, *)) { + // Finding focusable subviews NSArray *focusableSubviews = [currentView.subviews filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(UIView * _Nullable evaluatedObject, NSDictionary<NSString *,id> * _Nullable bindings) { return (evaluatedObject.canBecomeFocused || [evaluatedObject isKindOfClass:[UIButton class]]); }]]; + SDLLogV(@"Found focusable subviews: %@", focusableSubviews); BOOL isButton = [currentView isKindOfClass:[UIButton class]]; if ((currentView.canBecomeFocused || isButton) && focusableSubviews.count == 0) { @@ -137,7 +147,7 @@ NS_ASSUME_NONNULL_BEGIN } SDLLogV(@"Sending haptic data: %@", hapticRects); - SDLSendHapticData* hapticRPC = [[SDLSendHapticData alloc] initWithHapticRectData:hapticRects]; + SDLSendHapticData *hapticRPC = [[SDLSendHapticData alloc] initWithHapticRectData:hapticRects]; [self.connectionManager sendConnectionManagerRequest:hapticRPC withResponseHandler:nil]; } @@ -159,6 +169,7 @@ NS_ASSUME_NONNULL_BEGIN } } + SDLLogD(@"Found a focusable view: %@, for point: %@", selectedView, NSStringFromCGPoint(point)); return selectedView; } |