summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatbir Tanda <satbirtanda@gmail.com>2019-06-14 14:33:18 -0700
committerSatbir Tanda <satbirtanda@gmail.com>2019-06-14 14:33:18 -0700
commitddd6d4ce385281c93be402f9e9c2a0222f06e214 (patch)
tree3c4e172017a26b91e43da33c2c808b574f4f253b
parentf3738c8d4b961f25ce7d623ff70215fbe32f302e (diff)
downloadsdl_ios-ddd6d4ce385281c93be402f9e9c2a0222f06e214.tar.gz
Make recommended fixes
Need translations - will need string to be localized
-rw-r--r--SmartDeviceLink/SDLLockScreenManager.m18
-rw-r--r--SmartDeviceLink/SDLLockScreenViewController.h7
-rw-r--r--SmartDeviceLink/SDLLockScreenViewController.m14
3 files changed, 34 insertions, 5 deletions
diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m
index 72d99f1e8..9c505efc2 100644
--- a/SmartDeviceLink/SDLLockScreenManager.m
+++ b/SmartDeviceLink/SDLLockScreenManager.m
@@ -100,8 +100,8 @@ NS_ASSUME_NONNULL_BEGIN
// Lazy init of swipe gesture
- (UISwipeGestureRecognizer *)swipeGesture {
if (!_swipeGesture) {
- UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipeDown:)];
- [swipeGesture setDirection: UISwipeGestureRecognizerDirectionDown];
+ UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipeUp:)];
+ [swipeGesture setDirection: UISwipeGestureRecognizerDirectionUp];
_swipeGesture = swipeGesture;
}
return _swipeGesture;
@@ -177,6 +177,7 @@ NS_ASSUME_NONNULL_BEGIN
} else {
self.lockScreenDismissableEnabled = YES;
}
+
[self sdl_toggleLockscreenDismissalableWithState:self.lockScreenDismissableEnabled];
}
@@ -190,13 +191,24 @@ NS_ASSUME_NONNULL_BEGIN
SDLLockScreenManager *strongSelf = weakSelf;
if (enabled) {
[strongSelf.lockScreenViewController.view addGestureRecognizer:strongSelf.swipeGesture];
+
+ // If the VC is our special type, then set the locked label text. If they passed in a custom VC, there's no current way to update locked label text. If they're managing it themselves, they can grab the notification themselves.
+ // Translations needed
+ if ([self.lockScreenViewController isKindOfClass:[SDLLockScreenViewController class]]) {
+ ((SDLLockScreenViewController *)self.lockScreenViewController).lockedLabelText = NSLocalizedString(@"Swipe up to dismiss", nil);
+ }
} else {
[strongSelf.lockScreenViewController.view removeGestureRecognizer:strongSelf.swipeGesture];
+
+ // If the VC is our special type, then set the locked label text. If they passed in a custom VC, there's no current way to update locked label text. If they're managing it themselves, they can grab the notification themselves.
+ if ([self.lockScreenViewController isKindOfClass:[SDLLockScreenViewController class]]) {
+ ((SDLLockScreenViewController *)self.lockScreenViewController).lockedLabelText = nil;
+ }
}
});
}
-- (void)didSwipeDown:(UISwipeGestureRecognizer *)gesture {
+- (void)didSwipeUp:(UISwipeGestureRecognizer *)gesture {
[self.presenter dismiss];
}
diff --git a/SmartDeviceLink/SDLLockScreenViewController.h b/SmartDeviceLink/SDLLockScreenViewController.h
index d340db61a..62646a82d 100644
--- a/SmartDeviceLink/SDLLockScreenViewController.h
+++ b/SmartDeviceLink/SDLLockScreenViewController.h
@@ -27,6 +27,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (copy, nonatomic, nullable) UIColor *backgroundColor;
+/**
+ * The locked label string. This is settable by the lock screen manager to inform in the user about the dismissable state
+ */
+@property (copy, nonatomic, nullable) NSString *lockedLabelText;
+
@end
-NS_ASSUME_NONNULL_END \ No newline at end of file
+NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLLockScreenViewController.m b/SmartDeviceLink/SDLLockScreenViewController.m
index 291913aaa..c5dffa1fb 100644
--- a/SmartDeviceLink/SDLLockScreenViewController.m
+++ b/SmartDeviceLink/SDLLockScreenViewController.m
@@ -70,6 +70,11 @@ NS_ASSUME_NONNULL_BEGIN
[self sdl_layoutViews];
}
+- (void)setLockedLabelText:(NSString *_Nullable)lockedLabelText {
+ _lockedLabelText = lockedLabelText;
+
+ [self sdl_layoutViews];
+}
#pragma mark - Layout
@@ -87,7 +92,14 @@ NS_ASSUME_NONNULL_BEGIN
self.arrowDownImageView.tintColor = iconColor;
self.lockedLabel.textColor = iconColor;
-
+
+ // Translations needed
+ if (self.lockedLabelText != nil) {
+ self.lockedLabel.text = self.lockedLabelText;
+ } else {
+ self.lockedLabel.text = NSLocalizedString(@"Locked for your safety", nil);
+ }
+
self.view.backgroundColor = self.backgroundColor;
if (self.vehicleIcon != nil && self.appIcon != nil) {