summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2019-11-15 09:44:09 -0500
committerGitHub <noreply@github.com>2019-11-15 09:44:09 -0500
commit2a11feff387df14832c01c60f4fb180bb2464232 (patch)
tree14ff85e3450bc0424fdfa8f098b750d4618f75b6
parentba3953bc89ce71c548d6418e2ab5b28e7f51774f (diff)
parent8362a18039be7b9cbbd396af1fa63567ad1941ae (diff)
downloadsdl_ios-2a11feff387df14832c01c60f4fb180bb2464232.tar.gz
Merge pull request #1470 from smartdevicelink/bugfix/issue-1469-ios13-multiwindow
Fix apps running iOS 13 multi-window not working correctly with the lock screen
-rw-r--r--Cartfile.resolved2
-rw-r--r--Example Apps/Example Swift/AppDelegate.swift22
-rw-r--r--Example Apps/Example Swift/SceneDelegate.swift48
-rw-r--r--Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist19
-rw-r--r--SmartDeviceLink-iOS.xcodeproj/project.pbxproj8
-rw-r--r--SmartDeviceLink/Assets/Base.lproj/SDLLockScreen.storyboard160
-rw-r--r--SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/Contents.json23
-rw-r--r--SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black.pngbin0 -> 282 bytes
-rw-r--r--SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black@2x.pngbin0 -> 452 bytes
-rw-r--r--SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black@3x.pngbin0 -> 702 bytes
-rw-r--r--SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/Contents.json23
-rw-r--r--SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black.pngbin0 -> 269 bytes
-rw-r--r--SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black@2x.pngbin0 -> 402 bytes
-rw-r--r--SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black@3x.pngbin0 -> 674 bytes
-rw-r--r--SmartDeviceLink/SDLLockScreenManager.m5
-rw-r--r--SmartDeviceLink/SDLLockScreenPresenter.m219
-rw-r--r--SmartDeviceLink/SDLLockScreenViewController.m39
-rwxr-xr-xSmartDeviceLink/SDLScreenshotViewController.m12
18 files changed, 475 insertions, 105 deletions
diff --git a/Cartfile.resolved b/Cartfile.resolved
index c74a6b293..80bd7befb 100644
--- a/Cartfile.resolved
+++ b/Cartfile.resolved
@@ -1,4 +1,4 @@
github "Quick/Nimble" "v8.0.4"
github "Quick/Quick" "v2.2.0"
github "erikdoe/ocmock" "v3.4.3"
-github "uber/ios-snapshot-test-case" "6.1.0"
+github "uber/ios-snapshot-test-case" "6.2.0"
diff --git a/Example Apps/Example Swift/AppDelegate.swift b/Example Apps/Example Swift/AppDelegate.swift
index d602970c7..826537cb0 100644
--- a/Example Apps/Example Swift/AppDelegate.swift
+++ b/Example Apps/Example Swift/AppDelegate.swift
@@ -20,25 +20,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}
- func applicationWillResignActive(_ application: UIApplication) {
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
- }
-
- func applicationDidEnterBackground(_ application: UIApplication) {
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- }
-
- func applicationWillEnterForeground(_ application: UIApplication) {
- // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
- }
-
- func applicationDidBecomeActive(_ application: UIApplication) {
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- }
-
- func applicationWillTerminate(_ application: UIApplication) {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+ func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
+ return UISceneConfiguration(name: "Default", sessionRole: connectingSceneSession.role)
}
}
diff --git a/Example Apps/Example Swift/SceneDelegate.swift b/Example Apps/Example Swift/SceneDelegate.swift
new file mode 100644
index 000000000..c06c1dec6
--- /dev/null
+++ b/Example Apps/Example Swift/SceneDelegate.swift
@@ -0,0 +1,48 @@
+//
+// SceneDelegate.swift
+// SmartDeviceLink-Example-Swift
+//
+// Created by Joel Fischer on 11/6/19.
+// Copyright © 2019 smartdevicelink. All rights reserved.
+//
+
+import UIKit
+
+class SceneDelegate: UIResponder, UIWindowSceneDelegate {
+ var window: UIWindow?
+
+ func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
+ // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
+ // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
+ // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
+ guard let _ = (scene as? UIWindowScene) else { return }
+ }
+
+ func sceneDidDisconnect(_ scene: UIScene) {
+ // Called as the scene is being released by the system.
+ // This occurs shortly after the scene enters the background, or when its session is discarded.
+ // Release any resources associated with this scene that can be re-created the next time the scene connects.
+ // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
+ }
+
+ func sceneDidBecomeActive(_ scene: UIScene) {
+ // Called when the scene has moved from an inactive state to an active state.
+ // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
+ }
+
+ func sceneWillResignActive(_ scene: UIScene) {
+ // Called when the scene will move from an active state to an inactive state.
+ // This may occur due to temporary interruptions (ex. an incoming phone call).
+ }
+
+ func sceneWillEnterForeground(_ scene: UIScene) {
+ // Called as the scene transitions from the background to the foreground.
+ // Use this method to undo the changes made on entering the background.
+ }
+
+ func sceneDidEnterBackground(_ scene: UIScene) {
+ // Called as the scene transitions from the foreground to the background.
+ // Use this method to save data, release shared resources, and store enough scene-specific state information
+ // to restore the scene back to its current state.
+ }
+}
diff --git a/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist b/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist
index 9b5e3074e..5749315c6 100644
--- a/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist
+++ b/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist
@@ -73,6 +73,25 @@
<string>com.ford.sync.prot0</string>
<string>com.smartdevicelink.multisession</string>
</array>
+ <key>UIApplicationSceneManifest</key>
+ <dict>
+ <key>UIApplicationSupportsMultipleScenes</key>
+ <true/>
+ <key>UISceneConfigurations</key>
+ <dict>
+ <key>UIWindowSceneSessionRoleApplication</key>
+ <array>
+ <dict>
+ <key>UISceneDelegateClassName</key>
+ <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
+ <key>UISceneConfigurationName</key>
+ <string>Default</string>
+ <key>UISceneStoryboardFile</key>
+ <string>Main</string>
+ </dict>
+ </array>
+ </dict>
+ </dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
index 249491f82..900fce652 100644
--- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
+++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
@@ -1217,6 +1217,7 @@
5DBF0D5E1F3A68C0008AF2C9 /* SDLControlFramePayloadVideoStartServiceSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBF0D5D1F3A68C0008AF2C9 /* SDLControlFramePayloadVideoStartServiceSpec.m */; };
5DBF0D601F3B3DB4008AF2C9 /* SDLControlFrameVideoStartServiceAckSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBF0D5F1F3B3DB4008AF2C9 /* SDLControlFrameVideoStartServiceAckSpec.m */; };
5DC09EDA1F2F7FEC00F4AB1D /* SDLControlFramePayloadNakSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DC09ED91F2F7FEC00F4AB1D /* SDLControlFramePayloadNakSpec.m */; };
+ 5DC49BDD237314B500B2B8F2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DC49BDC237314B500B2B8F2 /* SceneDelegate.swift */; };
5DC978261B7A38640012C2F1 /* SDLGlobalsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */; };
5DCC458D221C9F6600036C2F /* SDLVersionSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DCC458C221C9F6600036C2F /* SDLVersionSpec.m */; };
5DCD7AE01FCCA8D200A0FC7F /* SDLCarWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DCD7ADC1FCCA8D100A0FC7F /* SDLCarWindow.h */; };
@@ -2964,6 +2965,7 @@
5DBF0D5D1F3A68C0008AF2C9 /* SDLControlFramePayloadVideoStartServiceSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLControlFramePayloadVideoStartServiceSpec.m; path = ControlFramePayloadSpecs/SDLControlFramePayloadVideoStartServiceSpec.m; sourceTree = "<group>"; };
5DBF0D5F1F3B3DB4008AF2C9 /* SDLControlFrameVideoStartServiceAckSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLControlFrameVideoStartServiceAckSpec.m; path = ControlFramePayloadSpecs/SDLControlFrameVideoStartServiceAckSpec.m; sourceTree = "<group>"; };
5DC09ED91F2F7FEC00F4AB1D /* SDLControlFramePayloadNakSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLControlFramePayloadNakSpec.m; path = ControlFramePayloadSpecs/SDLControlFramePayloadNakSpec.m; sourceTree = "<group>"; };
+ 5DC49BDC237314B500B2B8F2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SceneDelegate.swift; path = "Example Apps/Example Swift/SceneDelegate.swift"; sourceTree = SOURCE_ROOT; };
5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLGlobalsSpec.m; path = UtilitiesSpecs/SDLGlobalsSpec.m; sourceTree = "<group>"; };
5DCA93821EE0844D0015768E /* SmartDeviceLink.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = SmartDeviceLink.podspec; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
5DCC458C221C9F6600036C2F /* SDLVersionSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SDLVersionSpec.m; path = DevAPISpecs/SDLVersionSpec.m; sourceTree = "<group>"; };
@@ -6251,6 +6253,7 @@
5D1FF2F92130480C000EB9B4 /* SmartDeviceLink-Example-Swift-Info.plist */,
5D1FF2F7213047C1000EB9B4 /* AppDelegate.swift */,
5D1FF2F6213047C1000EB9B4 /* SmartDeviceLink-Example-Swift-Bridging-Header.h */,
+ 5DC49BDC237314B500B2B8F2 /* SceneDelegate.swift */,
);
name = "Supporting Files";
sourceTree = "<group>";
@@ -8350,6 +8353,7 @@
5D1FF2EC2130479C000EB9B4 /* ConnectionTCPTableViewController.swift in Sources */,
5D1FF2C4213045EB000EB9B4 /* AppConstants.m in Sources */,
5D1FF2DA21304746000EB9B4 /* ButtonManager.swift in Sources */,
+ 5DC49BDD237314B500B2B8F2 /* SceneDelegate.swift in Sources */,
5D1FF2DC21304746000EB9B4 /* AlertManager.swift in Sources */,
5D1FF2EB2130479C000EB9B4 /* ConnectionContainerViewController.swift in Sources */,
5D1FF2E021304746000EB9B4 /* MenuManager.swift in Sources */,
@@ -8761,7 +8765,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = NCVC2MHU7M;
INFOPLIST_FILE = "$(SRCROOT)/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 6.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.SDLTestApp;
@@ -8781,7 +8785,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = NCVC2MHU7M;
INFOPLIST_FILE = "$(SRCROOT)/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 6.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.SDLTestApp;
diff --git a/SmartDeviceLink/Assets/Base.lproj/SDLLockScreen.storyboard b/SmartDeviceLink/Assets/Base.lproj/SDLLockScreen.storyboard
index 611806ac1..fe7b3e564 100644
--- a/SmartDeviceLink/Assets/Base.lproj/SDLLockScreen.storyboard
+++ b/SmartDeviceLink/Assets/Base.lproj/SDLLockScreen.storyboard
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="sao-xX-Ugl">
- <device id="retina4_7" orientation="portrait" appearance="light"/>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="sao-xX-Ugl">
+ <device id="retina5_5" orientation="landscape" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@@ -16,89 +16,197 @@
<viewControllerLayoutGuide type="bottom" id="wh4-r5-yql"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="daa-1b-9se">
- <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+ <rect key="frame" x="0.0" y="0.0" width="736" height="414"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="fyC-E0-YKF">
- <rect key="frame" x="127.5" y="594" width="120" height="36"/>
+ <rect key="frame" x="308" y="341" width="120" height="36"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="Pm5-yr-PT3"/>
<constraint firstAttribute="height" constant="36" id="yVy-ww-yMp"/>
</constraints>
</imageView>
- <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qlE-SZ-K9i">
- <rect key="frame" x="67.5" y="155.5" width="240" height="128"/>
- <constraints>
- <constraint firstAttribute="width" constant="240" id="Bk8-YV-DHy"/>
- <constraint firstAttribute="height" constant="128" id="boE-Tt-Ols"/>
- </constraints>
- </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Locked for your safety" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2GC-iG-Bjq">
- <rect key="frame" x="16" y="642" width="343" height="17"/>
+ <rect key="frame" x="20" y="389" width="696" height="17"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="lock_arrow_up_black" translatesAutoresizingMaskIntoConstraints="NO" id="bgC-hp-jto">
- <rect key="frame" x="148.5" y="299.5" width="30" height="68"/>
+ <rect key="frame" x="168" y="334" width="30" height="68"/>
<constraints>
<constraint firstAttribute="height" constant="68" id="TX0-CV-jWt"/>
<constraint firstAttribute="width" constant="30" id="qg1-7M-JOH"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="lock_arrow_down_black" translatesAutoresizingMaskIntoConstraints="NO" id="QwS-i6-nIR">
- <rect key="frame" x="196.5" y="299.5" width="30" height="68"/>
+ <rect key="frame" x="216" y="334" width="30" height="68"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="dH7-wX-ij9"/>
<constraint firstAttribute="height" constant="68" id="hm6-eY-q7P"/>
</constraints>
</imageView>
- <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="M7Q-8D-weT">
- <rect key="frame" x="67.5" y="383.5" width="240" height="128"/>
- <constraints>
- <constraint firstAttribute="height" constant="128" id="1Px-le-yzw"/>
- <constraint firstAttribute="width" constant="240" id="eVl-bJ-3TM"/>
- </constraints>
- </imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="b2o-8D-i9T">
- <rect key="frame" x="95" y="295.5" width="185" height="76"/>
+ <rect key="frame" x="275.66666666666669" y="169" width="185" height="76"/>
<constraints>
<constraint firstAttribute="width" constant="185" id="CE6-0z-Lmn"/>
<constraint firstAttribute="height" constant="76" id="emS-mJ-Ryy"/>
</constraints>
</imageView>
<view opaque="NO" alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yyo-mJ-82g" userLabel="Center Spacer View">
- <rect key="frame" x="186.5" y="332.5" width="2" height="2"/>
+ <rect key="frame" x="367" y="206" width="2" height="2"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="1D8-iN-cG4"/>
<constraint firstAttribute="width" constant="2" id="BOG-80-2W5"/>
</constraints>
</view>
+ <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="M7Q-8D-weT">
+ <rect key="frame" x="532" y="143" width="184" height="128"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="128" id="1Px-le-yzw"/>
+ <constraint firstAttribute="width" constant="240" id="eVl-bJ-3TM"/>
+ </constraints>
+ <variation key="heightClass=compact-widthClass=compact">
+ <mask key="constraints">
+ <exclude reference="eVl-bJ-3TM"/>
+ </mask>
+ </variation>
+ <variation key="heightClass=compact-widthClass=regular">
+ <mask key="constraints">
+ <exclude reference="eVl-bJ-3TM"/>
+ </mask>
+ </variation>
+ </imageView>
+ <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qlE-SZ-K9i">
+ <rect key="frame" x="20" y="143" width="184" height="128"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="240" id="Bk8-YV-DHy"/>
+ <constraint firstAttribute="height" constant="128" id="boE-Tt-Ols"/>
+ </constraints>
+ <variation key="heightClass=compact-widthClass=compact">
+ <mask key="constraints">
+ <exclude reference="Bk8-YV-DHy"/>
+ </mask>
+ </variation>
+ <variation key="heightClass=compact-widthClass=regular">
+ <mask key="constraints">
+ <exclude reference="Bk8-YV-DHy"/>
+ </mask>
+ </variation>
+ </imageView>
+ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="lock_arrow_left_black" translatesAutoresizingMaskIntoConstraints="NO" id="xIz-6c-NNY">
+ <rect key="frame" x="334" y="174" width="68" height="30"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="68" id="Gfi-ib-u0N"/>
+ <constraint firstAttribute="height" constant="30" id="U3l-GC-Xrg"/>
+ </constraints>
+ </imageView>
+ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="lock_arrow_right_black" translatesAutoresizingMaskIntoConstraints="NO" id="MKF-hz-tMZ">
+ <rect key="frame" x="334" y="210" width="68" height="30"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="68" id="5al-TQ-IsD"/>
+ <constraint firstAttribute="height" constant="30" id="pZ2-7Y-9J8"/>
+ </constraints>
+ </imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
+ <constraint firstItem="M7Q-8D-weT" firstAttribute="width" secondItem="daa-1b-9se" secondAttribute="width" multiplier="0.25" id="0xM-dx-xZ0"/>
<constraint firstItem="bgC-hp-jto" firstAttribute="centerY" secondItem="daa-1b-9se" secondAttribute="centerY" id="3M5-ke-rxH"/>
+ <constraint firstItem="MKF-hz-tMZ" firstAttribute="centerX" secondItem="daa-1b-9se" secondAttribute="centerX" id="5Z9-0c-ZVz"/>
+ <constraint firstItem="M7Q-8D-weT" firstAttribute="centerY" secondItem="daa-1b-9se" secondAttribute="centerY" id="5xZ-by-Fu8"/>
<constraint firstAttribute="trailingMargin" secondItem="2GC-iG-Bjq" secondAttribute="trailing" id="8ye-Ub-7tt"/>
<constraint firstItem="wh4-r5-yql" firstAttribute="top" secondItem="2GC-iG-Bjq" secondAttribute="bottom" constant="8" id="BNz-vd-t0G"/>
<constraint firstItem="QwS-i6-nIR" firstAttribute="centerY" secondItem="daa-1b-9se" secondAttribute="centerY" id="Bda-7E-hB1"/>
+ <constraint firstAttribute="trailing" secondItem="M7Q-8D-weT" secondAttribute="trailing" constant="20" id="E1f-a6-rih"/>
<constraint firstItem="M7Q-8D-weT" firstAttribute="centerX" secondItem="daa-1b-9se" secondAttribute="centerX" id="FpJ-PV-OTU"/>
+ <constraint firstItem="MKF-hz-tMZ" firstAttribute="top" secondItem="yyo-mJ-82g" secondAttribute="bottom" constant="2" id="I5J-Pi-u6W"/>
<constraint firstItem="b2o-8D-i9T" firstAttribute="centerY" secondItem="daa-1b-9se" secondAttribute="centerY" id="Irb-tb-I3c"/>
<constraint firstItem="yyo-mJ-82g" firstAttribute="centerY" secondItem="daa-1b-9se" secondAttribute="centerY" id="KJS-9f-Xk1"/>
+ <constraint firstItem="qlE-SZ-K9i" firstAttribute="width" secondItem="daa-1b-9se" secondAttribute="width" multiplier="0.25" id="PAm-2N-EDL"/>
+ <constraint firstItem="qlE-SZ-K9i" firstAttribute="leading" secondItem="daa-1b-9se" secondAttribute="leading" constant="20" id="Qrg-WO-zs6"/>
+ <constraint firstItem="xIz-6c-NNY" firstAttribute="centerX" secondItem="daa-1b-9se" secondAttribute="centerX" id="SM4-aR-RUB"/>
<constraint firstItem="b2o-8D-i9T" firstAttribute="centerX" secondItem="daa-1b-9se" secondAttribute="centerX" id="TOb-Qt-FwN"/>
<constraint firstItem="fyC-E0-YKF" firstAttribute="centerX" secondItem="daa-1b-9se" secondAttribute="centerX" id="VU4-AJ-Uzf"/>
+ <constraint firstItem="qlE-SZ-K9i" firstAttribute="leading" secondItem="daa-1b-9se" secondAttribute="leading" constant="20" id="WXE-1r-KaS"/>
<constraint firstItem="yyo-mJ-82g" firstAttribute="centerX" secondItem="daa-1b-9se" secondAttribute="centerX" id="YcC-cU-iOu"/>
<constraint firstItem="qlE-SZ-K9i" firstAttribute="centerX" secondItem="daa-1b-9se" secondAttribute="centerX" id="a80-NE-fUz"/>
<constraint firstItem="2GC-iG-Bjq" firstAttribute="top" secondItem="fyC-E0-YKF" secondAttribute="bottom" constant="12" id="aY6-Wi-6Ss"/>
+ <constraint firstItem="yyo-mJ-82g" firstAttribute="top" secondItem="xIz-6c-NNY" secondAttribute="bottom" constant="2" id="bP2-G8-FR4"/>
<constraint firstItem="yyo-mJ-82g" firstAttribute="leading" secondItem="bgC-hp-jto" secondAttribute="trailing" constant="8" id="cFE-fa-NpO"/>
<constraint firstItem="QwS-i6-nIR" firstAttribute="leading" secondItem="yyo-mJ-82g" secondAttribute="trailing" constant="8" id="d7Z-Gl-Q0P"/>
<constraint firstItem="M7Q-8D-weT" firstAttribute="top" secondItem="bgC-hp-jto" secondAttribute="bottom" constant="16" id="eba-BW-tt4"/>
+ <constraint firstItem="qlE-SZ-K9i" firstAttribute="centerY" secondItem="daa-1b-9se" secondAttribute="centerY" id="euB-xP-ET0"/>
<constraint firstItem="bgC-hp-jto" firstAttribute="top" secondItem="qlE-SZ-K9i" secondAttribute="bottom" constant="16" id="gwo-mS-ib9"/>
<constraint firstAttribute="leadingMargin" secondItem="2GC-iG-Bjq" secondAttribute="leading" id="vFo-Ag-WyF"/>
</constraints>
+ <variation key="default">
+ <mask key="subviews">
+ <exclude reference="xIz-6c-NNY"/>
+ <exclude reference="MKF-hz-tMZ"/>
+ </mask>
+ <mask key="constraints">
+ <exclude reference="PAm-2N-EDL"/>
+ <exclude reference="Qrg-WO-zs6"/>
+ <exclude reference="WXE-1r-KaS"/>
+ <exclude reference="euB-xP-ET0"/>
+ <exclude reference="0xM-dx-xZ0"/>
+ <exclude reference="5xZ-by-Fu8"/>
+ <exclude reference="E1f-a6-rih"/>
+ </mask>
+ </variation>
+ <variation key="heightClass=compact-widthClass=compact">
+ <mask key="subviews">
+ <exclude reference="bgC-hp-jto"/>
+ <exclude reference="QwS-i6-nIR"/>
+ <include reference="xIz-6c-NNY"/>
+ <include reference="MKF-hz-tMZ"/>
+ </mask>
+ <mask key="constraints">
+ <exclude reference="gwo-mS-ib9"/>
+ <include reference="PAm-2N-EDL"/>
+ <include reference="Qrg-WO-zs6"/>
+ <include reference="WXE-1r-KaS"/>
+ <exclude reference="a80-NE-fUz"/>
+ <include reference="euB-xP-ET0"/>
+ <include reference="0xM-dx-xZ0"/>
+ <include reference="5xZ-by-Fu8"/>
+ <include reference="E1f-a6-rih"/>
+ <exclude reference="FpJ-PV-OTU"/>
+ <exclude reference="eba-BW-tt4"/>
+ </mask>
+ </variation>
+ <variation key="heightClass=compact-widthClass=regular">
+ <mask key="subviews">
+ <exclude reference="bgC-hp-jto"/>
+ <exclude reference="QwS-i6-nIR"/>
+ <include reference="xIz-6c-NNY"/>
+ <include reference="MKF-hz-tMZ"/>
+ </mask>
+ <mask key="constraints">
+ <exclude reference="gwo-mS-ib9"/>
+ <include reference="PAm-2N-EDL"/>
+ <include reference="WXE-1r-KaS"/>
+ <exclude reference="a80-NE-fUz"/>
+ <include reference="euB-xP-ET0"/>
+ <include reference="0xM-dx-xZ0"/>
+ <include reference="5xZ-by-Fu8"/>
+ <include reference="E1f-a6-rih"/>
+ <exclude reference="FpJ-PV-OTU"/>
+ <exclude reference="eba-BW-tt4"/>
+ </mask>
+ </variation>
+ <variation key="heightClass=regular-widthClass=regular">
+ <mask key="constraints">
+ <include reference="Qrg-WO-zs6"/>
+ </mask>
+ </variation>
</view>
<connections>
<outlet property="arrowDownImageView" destination="QwS-i6-nIR" id="saq-rY-Rze"/>
+ <outlet property="arrowLeftImageView" destination="xIz-6c-NNY" id="XiY-fc-Ppu"/>
+ <outlet property="arrowRightImageView" destination="MKF-hz-tMZ" id="0N7-49-CIM"/>
<outlet property="arrowUpImageView" destination="bgC-hp-jto" id="Eej-gQ-YBF"/>
<outlet property="backupImageView" destination="b2o-8D-i9T" id="uRA-dC-93k"/>
<outlet property="lockedLabel" destination="2GC-iG-Bjq" id="Eth-07-rcX"/>
@@ -109,11 +217,13 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Wfa-ZV-GKT" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="639" y="866"/>
+ <point key="canvasLocation" x="878.804347826087" y="886.95652173913049"/>
</scene>
</scenes>
<resources>
<image name="lock_arrow_down_black" width="30" height="68"/>
+ <image name="lock_arrow_left_black" width="68" height="30"/>
+ <image name="lock_arrow_right_black" width="68" height="30"/>
<image name="lock_arrow_up_black" width="30" height="68"/>
</resources>
</document>
diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/Contents.json b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/Contents.json
new file mode 100644
index 000000000..b93cb64e9
--- /dev/null
+++ b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "lock_arrow_left_black.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "lock_arrow_left_black@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "lock_arrow_left_black@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+} \ No newline at end of file
diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black.png
new file mode 100644
index 000000000..3b98a89cd
--- /dev/null
+++ b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black.png
Binary files differ
diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black@2x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black@2x.png
new file mode 100644
index 000000000..be0ed0560
--- /dev/null
+++ b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black@2x.png
Binary files differ
diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black@3x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black@3x.png
new file mode 100644
index 000000000..ce65add74
--- /dev/null
+++ b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_left_black.imageset/lock_arrow_left_black@3x.png
Binary files differ
diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/Contents.json b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/Contents.json
new file mode 100644
index 000000000..b3c3a4a16
--- /dev/null
+++ b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "lock_arrow_right_black.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "lock_arrow_right_black@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "lock_arrow_right_black@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+} \ No newline at end of file
diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black.png
new file mode 100644
index 000000000..fdd933091
--- /dev/null
+++ b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black.png
Binary files differ
diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black@2x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black@2x.png
new file mode 100644
index 000000000..d90331bba
--- /dev/null
+++ b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black@2x.png
Binary files differ
diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black@3x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black@3x.png
new file mode 100644
index 000000000..b7bd42eb5
--- /dev/null
+++ b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_right_black.imageset/lock_arrow_right_black@3x.png
Binary files differ
diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m
index 85b601ce0..8faa127c1 100644
--- a/SmartDeviceLink/SDLLockScreenManager.m
+++ b/SmartDeviceLink/SDLLockScreenManager.m
@@ -132,6 +132,11 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)sdl_appDidBecomeActive:(NSNotification *)notification {
+ // App may have been disconnected in the background
+ if (!self.canPresent && self.presenter.presented) {
+ [self.presenter dismiss];
+ }
+
[self sdl_checkLockScreen];
}
diff --git a/SmartDeviceLink/SDLLockScreenPresenter.m b/SmartDeviceLink/SDLLockScreenPresenter.m
index 3162f8cc9..20b9b3897 100644
--- a/SmartDeviceLink/SDLLockScreenPresenter.m
+++ b/SmartDeviceLink/SDLLockScreenPresenter.m
@@ -25,29 +25,84 @@ NS_ASSUME_NONNULL_BEGIN
@implementation SDLLockScreenPresenter
+#pragma mark - Lifecycle
+
- (instancetype)init {
self = [super init];
if (!self) { return nil; }
CGRect screenFrame = [[UIScreen mainScreen] bounds];
_lockWindow = [[UIWindow alloc] initWithFrame:screenFrame];
+ _lockWindow.backgroundColor = [UIColor clearColor];
_screenshotViewController = [[SDLScreenshotViewController alloc] init];
_lockWindow.rootViewController = _screenshotViewController;
return self;
}
+#pragma mark - Present Lock Window
+
- (void)present {
+ SDLLogD(@"Trying to present lock screen");
dispatch_async(dispatch_get_main_queue(), ^{
- if (self.lockWindow.isKeyWindow) {
- SDLLogW(@"Attempted to present lock window when it is already presented");
- return;
+ if (@available(iOS 13.0, *)) {
+ [self sdl_presentIOS13];
+ } else {
+ [self sdl_presentIOS12];
}
+ });
+}
+
+- (void)sdl_presentIOS12 {
+ if (self.lockWindow.isKeyWindow) {
+ SDLLogW(@"Attempted to present lock window when it is already presented");
+ return;
+ }
- NSArray* windows = [[UIApplication sharedApplication] windows];
+ NSArray* windows = [[UIApplication sharedApplication] windows];
+ UIWindow *appWindow = nil;
+ for (UIWindow *window in windows) {
+ if (window != self.lockWindow) {
+ appWindow = window;
+ break;
+ }
+ }
+
+ if (appWindow == nil) {
+ SDLLogE(@"Unable to find the app's window");
+ return;
+ }
+
+ [self sdl_presentWithAppWindow:appWindow];
+}
+
+- (void)sdl_presentIOS13 {
+ if (@available(iOS 13.0, *)) {
+ UIWindowScene *appWindowScene = nil;
+ for (UIScene *scene in [UIApplication sharedApplication].connectedScenes) {
+ SDLLogV(@"Checking scene: %@", scene);
+ // The scene is either foreground active / inactive, background, or unattached. If the latter three, we don't want to do anything with them. Also check that the scene is for the application and not an external display or CarPlay.
+ if ((scene.activationState != UISceneActivationStateForegroundActive) ||
+ (![scene.session.role isEqualToString: UIWindowSceneSessionRoleApplication])) {
+ SDLLogV(@"Skipping scene due to activation state or role");
+ continue;
+ }
+
+ // The scene is foreground active or inactive. Now find the windows.
+ if ([scene isKindOfClass:[UIWindowScene class]]) {
+ appWindowScene = (UIWindowScene *)scene;
+ break;
+ } else {
+ SDLLogV(@"Skipping scene due to it not being a UIWindowScene");
+ continue;
+ }
+ }
+
+ NSArray<UIWindow *> *windows = appWindowScene.windows;
UIWindow *appWindow = nil;
for (UIWindow *window in windows) {
if (window != self.lockWindow) {
+ SDLLogV(@"Found app window");
appWindow = window;
break;
}
@@ -58,69 +113,141 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
- // We let ourselves know that the lockscreen will present, because we have to pause streaming video for that 0.3 seconds or else it will be very janky.
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerWillPresentLockScreenViewController object:nil];
+ if (![windows containsObject:self.lockWindow]) {
+ self.lockWindow = [[UIWindow alloc] initWithWindowScene:appWindowScene];
+ self.lockWindow.backgroundColor = [UIColor clearColor];
+ self.lockWindow.rootViewController = self.screenshotViewController;
+ }
+
+ [self sdl_presentWithAppWindow:appWindow];
+ }
+}
- CGRect firstFrame = appWindow.frame;
- firstFrame.origin.x = CGRectGetWidth(firstFrame);
- appWindow.frame = firstFrame;
+- (void)sdl_presentWithAppWindow:(nullable UIWindow *)appWindow {
+ if (appWindow == nil) {
+ SDLLogW(@"Attempted to present lock window but app window is nil");
+ return;
+ }
- // We then move the lockWindow to the original appWindow location.
- self.lockWindow.frame = appWindow.bounds;
- [self.screenshotViewController loadScreenshotOfWindow:appWindow];
- [self.lockWindow makeKeyAndVisible];
+ SDLLogD(@"Presenting lock screen window from app window: %@", appWindow);
- // And present the lock screen.
- SDLLogD(@"Present lock screen window");
- [self.lockWindow.rootViewController presentViewController:self.lockViewController animated:YES completion:^{
- // Tell ourselves we are done.
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerDidPresentLockScreenViewController object:nil];
- }];
- });
+ // We let ourselves know that the lockscreen will present, because we have to pause streaming video for that 0.3 seconds or else it will be very janky.
+ [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerWillPresentLockScreenViewController object:nil];
+
+ CGRect firstFrame = appWindow.frame;
+ firstFrame.origin.x = CGRectGetWidth(firstFrame);
+ appWindow.frame = firstFrame;
+
+ // We then move the lockWindow to the original appWindow location.
+ self.lockWindow.frame = appWindow.bounds;
+ [self.screenshotViewController loadScreenshotOfWindow:appWindow];
+ [self.lockWindow makeKeyAndVisible];
+
+ // And present the lock screen.
+ SDLLogD(@"Present lock screen window");
+ [self.lockWindow.rootViewController presentViewController:self.lockViewController animated:YES completion:^{
+ // Tell ourselves we are done.
+ [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerDidPresentLockScreenViewController object:nil];
+ }];
}
+#pragma mark - Dismiss Lock Window
+
- (void)dismiss {
+ SDLLogD(@"Trying to dismiss lock screen");
dispatch_async(dispatch_get_main_queue(), ^{
- NSArray* windows = [[UIApplication sharedApplication] windows];
+ if (@available(iOS 13.0, *)) {
+ [self sdl_dismissIOS13];
+ } else {
+ [self sdl_dismissIOS12];
+ }
+ });
+}
+
+- (void)sdl_dismissIOS12 {
+ NSArray* windows = [[UIApplication sharedApplication] windows];
+ UIWindow *appWindow = nil;
+ for (UIWindow *window in windows) {
+ SDLLogV(@"Checking window: %@", window);
+ if (window != self.lockWindow) {
+ appWindow = window;
+ break;
+ }
+ }
+
+ [self sdl_dismissWithAppWindow:appWindow];
+}
+
+- (void)sdl_dismissIOS13 {
+ if (@available(iOS 13.0, *)) {
+ UIWindowScene *appWindowScene = nil;
+ for (UIScene *scene in [UIApplication sharedApplication].connectedScenes) {
+ SDLLogV(@"Checking scene: %@", scene);
+ // The scene is either foreground active / inactive, background, or unattached. If the latter three, we don't want to do anything with them. Also check that the scene is for the application and not an external display or CarPlay.
+ if ((scene.activationState != UISceneActivationStateForegroundActive) ||
+ (![scene.session.role isEqualToString: UIWindowSceneSessionRoleApplication])) {
+ SDLLogV(@"Skipping scene due to activation state or role");
+ continue;
+ }
+
+ // The scene is foreground active or inactive. Now find the windows.
+ if ([scene isKindOfClass:[UIWindowScene class]]) {
+ appWindowScene = (UIWindowScene *)scene;
+ break;
+ } else {
+ SDLLogV(@"Skipping scene due to it not being a UIWindowScene");
+ continue;
+ }
+ }
+
+ NSArray<UIWindow *> *windows = appWindowScene.windows;
UIWindow *appWindow = nil;
for (UIWindow *window in windows) {
+ SDLLogV(@"Checking window: %@", window);
if (window != self.lockWindow) {
appWindow = window;
break;
}
}
- if (appWindow == nil) {
- SDLLogE(@"Unable to find the app's window");
- return;
- } else if (appWindow.isKeyWindow) {
- SDLLogW(@"Attempted to dismiss lock screen, but it is already dismissed");
- return;
- } else if (self.lockViewController == nil) {
- SDLLogW(@"Attempted to dismiss lock screen, but lockViewController is not set");
- return;
- }
+ [self sdl_dismissWithAppWindow:appWindow];
+ }
+}
- // Let us know we are about to dismiss.
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerWillDismissLockScreenViewController object:nil];
+- (void)sdl_dismissWithAppWindow:(nullable UIWindow *)appWindow {
+ if (appWindow == nil) {
+ SDLLogE(@"Unable to find the app's window");
+ return;
+ } else if (appWindow.isKeyWindow) {
+ SDLLogW(@"Attempted to dismiss lock screen, but it is already dismissed");
+ return;
+ } else if (self.lockViewController == nil) {
+ SDLLogW(@"Attempted to dismiss lock screen, but lockViewController is not set");
+ return;
+ }
- // Dismiss the lockscreen
- SDLLogD(@"Dismiss lock screen window");
- [self.lockViewController dismissViewControllerAnimated:YES completion:^{
- CGRect lockFrame = self.lockWindow.frame;
- lockFrame.origin.x = CGRectGetWidth(lockFrame);
- self.lockWindow.frame = lockFrame;
+ // Let us know we are about to dismiss.
+ [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerWillDismissLockScreenViewController object:nil];
- // Quickly move the map back, and make it the key window.
- appWindow.frame = self.lockWindow.bounds;
- [appWindow makeKeyAndVisible];
+ // Dismiss the lockscreen
+ SDLLogD(@"Dismiss lock screen window from app window: %@", appWindow);
+ [self.lockViewController dismissViewControllerAnimated:YES completion:^{
+ CGRect lockFrame = self.lockWindow.frame;
+ lockFrame.origin.x = CGRectGetWidth(lockFrame);
+ self.lockWindow.frame = lockFrame;
- // Tell ourselves we are done.
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerDidDismissLockScreenViewController object:nil];
- }];
- });
+ // Quickly move the map back, and make it the key window.
+ appWindow.frame = self.lockWindow.bounds;
+ [appWindow makeKeyAndVisible];
+
+ // Tell ourselves we are done.
+ [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerDidDismissLockScreenViewController object:nil];
+ }];
}
+
+#pragma mark - isPresented Getter
+
- (BOOL)presented {
__block BOOL isPresented = NO;
if ([NSThread isMainThread]) {
diff --git a/SmartDeviceLink/SDLLockScreenViewController.m b/SmartDeviceLink/SDLLockScreenViewController.m
index 9c5a14c99..6fc91e9ea 100644
--- a/SmartDeviceLink/SDLLockScreenViewController.m
+++ b/SmartDeviceLink/SDLLockScreenViewController.m
@@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (weak, nonatomic) IBOutlet UILabel *lockedLabel;
@property (weak, nonatomic) IBOutlet UIImageView *arrowUpImageView;
@property (weak, nonatomic) IBOutlet UIImageView *arrowDownImageView;
+@property (weak, nonatomic) IBOutlet UIImageView *arrowLeftImageView;
+@property (weak, nonatomic) IBOutlet UIImageView *arrowRightImageView;
@property (strong, nonatomic) SwipeGestureCallbackBlock dismissGestureCallback;
@property (strong, nonatomic, nullable) UISwipeGestureRecognizer *swipeGesture;
@@ -38,11 +40,19 @@ NS_ASSUME_NONNULL_BEGIN
}
- (BOOL)shouldAutorotate {
- return NO;
+ if (self.presentingViewController != nil) {
+ return self.presentingViewController.shouldAutorotate;
+ } else {
+ return YES;
+ }
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
- return UIInterfaceOrientationMaskPortrait;
+ if (self.presentingViewController != nil) {
+ return self.presentingViewController.supportedInterfaceOrientations;
+ } else {
+ return UIInterfaceOrientationMaskAll;
+ }
}
- (UIStatusBarStyle)preferredStatusBarStyle {
@@ -73,7 +83,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setLockedLabelText:(NSString *_Nullable)lockedLabelText {
_lockedLabelText = lockedLabelText;
-
+
[self sdl_layoutViews];
}
@@ -108,19 +118,22 @@ NS_ASSUME_NONNULL_BEGIN
self.arrowUpImageView.image = [self.class sdl_imageWithName:@"lock_arrow_up_black"];
self.arrowUpImageView.tintColor = iconColor;
-
self.arrowDownImageView.image = [self.class sdl_imageWithName:@"lock_arrow_down_black"];
self.arrowDownImageView.tintColor = iconColor;
+ self.arrowLeftImageView.image = [self.class sdl_imageWithName:@"lock_arrow_left_black"];
+ self.arrowLeftImageView.tintColor = iconColor;
+ self.arrowRightImageView.image = [self.class sdl_imageWithName:@"lock_arrow_right_black"];
+ self.arrowRightImageView.tintColor = iconColor;
self.lockedLabel.textColor = iconColor;
self.lockedLabel.numberOfLines = 0;
-
+
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) {
@@ -150,9 +163,11 @@ NS_ASSUME_NONNULL_BEGIN
self.backupImageView.image = nil;
self.backupImageView.tintColor = nil;
-
+
self.arrowUpImageView.alpha = 1.0;
self.arrowDownImageView.alpha = 1.0;
+ self.arrowLeftImageView.alpha = 1.0;
+ self.arrowRightImageView.alpha = 1.0;
self.sdlIconImageView.alpha = 1.0;
}
@@ -163,9 +178,11 @@ NS_ASSUME_NONNULL_BEGIN
self.backupImageView.image = self.appIcon;
self.backupImageView.tintColor = nil;
-
+
self.arrowUpImageView.alpha = 0.0;
self.arrowDownImageView.alpha = 0.0;
+ self.arrowLeftImageView.alpha = 0.0;
+ self.arrowRightImageView.alpha = 0.0;
self.sdlIconImageView.alpha = 1.0;
}
@@ -176,9 +193,11 @@ NS_ASSUME_NONNULL_BEGIN
self.backupImageView.image = self.vehicleIcon;
self.backupImageView.tintColor = nil;
-
+
self.arrowUpImageView.alpha = 0.0;
self.arrowDownImageView.alpha = 0.0;
+ self.arrowLeftImageView.alpha = 0.0;
+ self.arrowRightImageView.alpha = 0.0;
self.sdlIconImageView.alpha = 1.0;
}
@@ -192,6 +211,8 @@ NS_ASSUME_NONNULL_BEGIN
self.arrowUpImageView.alpha = 0.0;
self.arrowDownImageView.alpha = 0.0;
+ self.arrowLeftImageView.alpha = 0.0;
+ self.arrowRightImageView.alpha = 0.0;
self.sdlIconImageView.alpha = 0.0;
}
diff --git a/SmartDeviceLink/SDLScreenshotViewController.m b/SmartDeviceLink/SDLScreenshotViewController.m
index 9ac5f4a8c..da3060aab 100755
--- a/SmartDeviceLink/SDLScreenshotViewController.m
+++ b/SmartDeviceLink/SDLScreenshotViewController.m
@@ -13,6 +13,7 @@
@interface SDLScreenshotViewController ()
@property (nonatomic, strong) UIImageView *imageView;
+@property (nonatomic, strong, nullable) UIWindow *currentAppWindow;
@end
@@ -34,7 +35,9 @@
// HAX: https://github.com/smartdevicelink/sdl_ios/issues/1250
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
- UIViewController *viewController = [self sdl_topMostControllerForWindow:[UIApplication sharedApplication].windows[0]];
+ if (self.currentAppWindow == nil) { return UIInterfaceOrientationMaskAll; }
+
+ UIViewController *viewController = [self sdl_topMostControllerForWindow:self.currentAppWindow];
if (viewController == self) {
return UIInterfaceOrientationMaskAll;
@@ -47,7 +50,9 @@
// HAX: https://github.com/smartdevicelink/sdl_ios/issues/1250
- (BOOL)shouldAutorotate {
- UIViewController *viewController = [self sdl_topMostControllerForWindow:[UIApplication sharedApplication].windows[0]];
+ if (self.currentAppWindow == nil) { return YES; }
+
+ UIViewController *viewController = [self sdl_topMostControllerForWindow:self.currentAppWindow];
if (viewController == self) {
return YES;
@@ -73,6 +78,9 @@
}
- (void)loadScreenshotOfWindow:(UIWindow *)window {
+ self.currentAppWindow = window;
+ if (self.currentAppWindow == nil) { return; }
+
UIGraphicsBeginImageContextWithOptions(window.bounds.size, YES, 0.0f);
[window drawViewHierarchyInRect:window.bounds afterScreenUpdates:NO];