diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2017-01-27 10:35:15 -0800 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2017-01-27 10:35:15 -0800 |
commit | cd72e95f8a77eb654d729c368f22a2d6ce793880 (patch) | |
tree | 2f6e6bc46f3b90cb9743f569daf4b3388bd85a98 | |
parent | 8a91643010aa7ae5a03d1ddd184654fb8d81b773 (diff) | |
parent | c69e93b965646ad240fde10303a3f1cb31be1dc8 (diff) | |
download | sdl_ios-cd72e95f8a77eb654d729c368f22a2d6ce793880.tar.gz |
Merge remote-tracking branch 'origin/develop' into feature/issue_275_protocol_spec_enums
* origin/develop: (28 commits)
Fixed issue with tests not compiling after merging master into develop.
Fixed issue with retain cycle within the dispatch_after block.
Fix double semi-colon
Re-add reconnecting state
Don’t auto-reconnect in example project
Cleaned up ProxyManager startWithReadyHandler:
In order to restart properly, we need to start only after managerDidDisconnect (per new documentation).
Adding a fix to restarting the proxy around an Apple Bug.
Adding a note about stopping SDLManager.
Removing Reconnecting state and instead using started.
Updated lifecycle manager states to handle stopping the manager correctly.
Remove NSMutableDictionary+Store.h from podspec
Revert "Updated SDLManagerError enum to include a warning case."
Updated SDLManagerError enum to include a warning case.
Fixed issue with test case not passing.
Update with changes to make registration handling testable
Actual failure in registration now calls the readyHandler
Make `NSMutableDictionary+Store.h` private
Fixed issue with stopping the proxy didn't actually stop it.
Don’t loop over enums when we don’t have to
...
123 files changed, 616 insertions, 1351 deletions
diff --git a/SmartDeviceLink-iOS.podspec b/SmartDeviceLink-iOS.podspec index 7369776b1..7601ab9ff 100644 --- a/SmartDeviceLink-iOS.podspec +++ b/SmartDeviceLink-iOS.podspec @@ -6,13 +6,12 @@ s.summary = "Connect your app with cars!" s.homepage = "https://github.com/smartdevicelink/SmartDeviceLink-iOS" s.license = { :type => "New BSD", :file => "LICENSE" } s.author = { "SmartDeviceLink Team" => "developer@smartdevicelink.com" } -s.platform = :ios, "6.0" +s.platform = :ios, "7.0" s.source = { :git => "https://github.com/smartdevicelink/sdl_ios.git", :tag => s.version.to_s } s.source_files = "SmartDeviceLink/*.{h,m}" s.requires_arc = true s.resource_bundles = { 'SmartDeviceLink' => ['SmartDeviceLink/Assets/**/*', 'SmartDeviceLink/iOS 7 Assets/*'] } s.public_header_files = [ -'SmartDeviceLink/NSMutableDictionary+Store.h', 'SmartDeviceLink/SmartDeviceLink.h', 'SmartDeviceLink/SDLJingle.h', 'SmartDeviceLink/SDLProxy.h', diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 3bb5759c9..e1c950dae 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -846,10 +846,6 @@ 5DBAE0AB1D3588AC00CE00BF /* SDLNotificationDispatcherSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBAE0AA1D3588AC00CE00BF /* SDLNotificationDispatcherSpec.m */; }; 5DBAE0AD1D368D1A00CE00BF /* SDLResponseDispatcherSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBAE0AC1D368D1A00CE00BF /* SDLResponseDispatcherSpec.m */; }; 5DC978261B7A38640012C2F1 /* SDLGlobalsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */; }; - 5DCC19A01B8221F3004FFAD9 /* SDLURLSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DCC199E1B8221F3004FFAD9 /* SDLURLSession.h */; }; - 5DCC19A11B8221F3004FFAD9 /* SDLURLSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DCC199F1B8221F3004FFAD9 /* SDLURLSession.m */; }; - 5DCC19A41B822804004FFAD9 /* SDLURLRequestTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DCC19A21B822804004FFAD9 /* SDLURLRequestTask.h */; }; - 5DCC19A51B822804004FFAD9 /* SDLURLRequestTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DCC19A31B822804004FFAD9 /* SDLURLRequestTask.m */; }; 5DCF76F51ACDBAD300BB647B /* SDLSendLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DCF76F31ACDBAD300BB647B /* SDLSendLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DCF76F61ACDBAD300BB647B /* SDLSendLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DCF76F41ACDBAD300BB647B /* SDLSendLocation.m */; }; 5DCF76F91ACDD7CD00BB647B /* SDLSendLocationResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DCF76F71ACDD7CD00BB647B /* SDLSendLocationResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -862,12 +858,10 @@ 5DE372A61ACC35B400849FAA /* SDLDebugToolConsole.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DE372A51ACC35B400849FAA /* SDLDebugToolConsole.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DE5ABB71B0E38C90067BB02 /* SDLSystemRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FBD21A84238B00846EE7 /* SDLSystemRequest.h */; }; 5DE5ABB81B0E38C90067BB02 /* SDLSystemRequestResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FBD41A84238B00846EE7 /* SDLSystemRequestResponse.h */; }; - 5DEE55C01B8509CB004F0D0F /* SDLURLRequestTaskSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DEE55BF1B8509CB004F0D0F /* SDLURLRequestTaskSpec.m */; }; - 5DF2BB9D1B94E38A00CE5994 /* SDLURLSessionSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DF2BB9C1B94E38A00CE5994 /* SDLURLSessionSpec.m */; }; 5DFFB9151BD7C89700DB3F04 /* SDLConnectionManagerType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DFFB9141BD7C89700DB3F04 /* SDLConnectionManagerType.h */; }; DA0C46AD1DCD35080001F2A8 /* SDLNames.m in Sources */ = {isa = PBXBuildFile; fileRef = DA0C46AC1DCD35080001F2A8 /* SDLNames.m */; }; DA0C46AF1DCD41E30001F2A8 /* SDLMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = DA0C46AE1DCD41E30001F2A8 /* SDLMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DA318C1F1DD0F06C00C035AC /* NSMutableDictionary+Store.h in Headers */ = {isa = PBXBuildFile; fileRef = DA318C1D1DD0F06C00C035AC /* NSMutableDictionary+Store.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA318C1F1DD0F06C00C035AC /* NSMutableDictionary+Store.h in Headers */ = {isa = PBXBuildFile; fileRef = DA318C1D1DD0F06C00C035AC /* NSMutableDictionary+Store.h */; }; DA318C201DD0F06C00C035AC /* NSMutableDictionary+Store.m in Sources */ = {isa = PBXBuildFile; fileRef = DA318C1E1DD0F06C00C035AC /* NSMutableDictionary+Store.m */; }; DA4353DF1D271FD10099B8C4 /* CGPointUtilSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4353DE1D271FD10099B8C4 /* CGPointUtilSpec.m */; }; DA4353E31D2720A30099B8C4 /* SDLPinchGestureSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4353E21D2720A30099B8C4 /* SDLPinchGestureSpec.m */; }; @@ -877,21 +871,12 @@ DA7515B11D95FAA000F29323 /* lock_arrow_down_black.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515981D95FAA000F29323 /* lock_arrow_down_black.png */; }; DA7515B21D95FAA000F29323 /* lock_arrow_down_black@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515991D95FAA000F29323 /* lock_arrow_down_black@2x.png */; }; DA7515B31D95FAA000F29323 /* lock_arrow_down_black@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA75159A1D95FAA000F29323 /* lock_arrow_down_black@3x.png */; }; - DA7515B41D95FAA000F29323 /* lock_arrow_down_white.png in Resources */ = {isa = PBXBuildFile; fileRef = DA75159C1D95FAA000F29323 /* lock_arrow_down_white.png */; }; - DA7515B51D95FAA000F29323 /* lock_arrow_down_white@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA75159D1D95FAA000F29323 /* lock_arrow_down_white@2x.png */; }; - DA7515B61D95FAA000F29323 /* lock_arrow_down_white@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA75159E1D95FAA000F29323 /* lock_arrow_down_white@3x.png */; }; DA7515B71D95FAA000F29323 /* lock_arrow_up_black.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515A11D95FAA000F29323 /* lock_arrow_up_black.png */; }; DA7515B81D95FAA000F29323 /* lock_arrow_up_black@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515A21D95FAA000F29323 /* lock_arrow_up_black@2x.png */; }; DA7515B91D95FAA000F29323 /* lock_arrow_up_black@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515A31D95FAA000F29323 /* lock_arrow_up_black@3x.png */; }; - DA7515BA1D95FAA000F29323 /* lock_arrow_up_white.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515A51D95FAA000F29323 /* lock_arrow_up_white.png */; }; - DA7515BB1D95FAA000F29323 /* lock_arrow_up_white@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515A61D95FAA000F29323 /* lock_arrow_up_white@2x.png */; }; - DA7515BC1D95FAA000F29323 /* lock_arrow_up_white@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515A71D95FAA000F29323 /* lock_arrow_up_white@3x.png */; }; DA7515BD1D95FAA000F29323 /* sdl_logo_black.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515AA1D95FAA000F29323 /* sdl_logo_black.png */; }; DA7515BE1D95FAA000F29323 /* sdl_logo_black@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515AB1D95FAA000F29323 /* sdl_logo_black@2x.png */; }; DA7515BF1D95FAA000F29323 /* sdl_logo_black@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515AC1D95FAA000F29323 /* sdl_logo_black@3x.png */; }; - DA7515C01D95FAA000F29323 /* sdl_logo_white.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515AE1D95FAA000F29323 /* sdl_logo_white.png */; }; - DA7515C11D95FAA000F29323 /* sdl_logo_white@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515AF1D95FAA000F29323 /* sdl_logo_white@2x.png */; }; - DA7515C21D95FAA000F29323 /* sdl_logo_white@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA7515B01D95FAA000F29323 /* sdl_logo_white@3x.png */; }; DA96C0661D4D4F730022F520 /* SDLAppInfoSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA96C0651D4D4F730022F520 /* SDLAppInfoSpec.m */; }; DA9F7E631DCBFAC800ACAE48 /* SDLDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9F7E611DCBFAC800ACAE48 /* SDLDateTime.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA9F7E641DCBFAC800ACAE48 /* SDLDateTime.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9F7E621DCBFAC800ACAE48 /* SDLDateTime.m */; }; @@ -1874,10 +1859,6 @@ 5DBAE0AA1D3588AC00CE00BF /* SDLNotificationDispatcherSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLNotificationDispatcherSpec.m; path = DevAPISpecs/SDLNotificationDispatcherSpec.m; sourceTree = "<group>"; }; 5DBAE0AC1D368D1A00CE00BF /* SDLResponseDispatcherSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLResponseDispatcherSpec.m; path = DevAPISpecs/SDLResponseDispatcherSpec.m; sourceTree = "<group>"; }; 5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLGlobalsSpec.m; path = UtilitiesSpecs/SDLGlobalsSpec.m; sourceTree = "<group>"; }; - 5DCC199E1B8221F3004FFAD9 /* SDLURLSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLURLSession.h; sourceTree = "<group>"; }; - 5DCC199F1B8221F3004FFAD9 /* SDLURLSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLURLSession.m; sourceTree = "<group>"; }; - 5DCC19A21B822804004FFAD9 /* SDLURLRequestTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLURLRequestTask.h; sourceTree = "<group>"; }; - 5DCC19A31B822804004FFAD9 /* SDLURLRequestTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLURLRequestTask.m; sourceTree = "<group>"; }; 5DCF76F31ACDBAD300BB647B /* SDLSendLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLSendLocation.h; sourceTree = "<group>"; }; 5DCF76F41ACDBAD300BB647B /* SDLSendLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLSendLocation.m; sourceTree = "<group>"; }; 5DCF76F71ACDD7CD00BB647B /* SDLSendLocationResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLSendLocationResponse.h; sourceTree = "<group>"; }; @@ -1903,21 +1884,12 @@ DA7515981D95FAA000F29323 /* lock_arrow_down_black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lock_arrow_down_black.png; sourceTree = "<group>"; }; DA7515991D95FAA000F29323 /* lock_arrow_down_black@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_down_black@2x.png"; sourceTree = "<group>"; }; DA75159A1D95FAA000F29323 /* lock_arrow_down_black@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_down_black@3x.png"; sourceTree = "<group>"; }; - DA75159C1D95FAA000F29323 /* lock_arrow_down_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lock_arrow_down_white.png; sourceTree = "<group>"; }; - DA75159D1D95FAA000F29323 /* lock_arrow_down_white@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_down_white@2x.png"; sourceTree = "<group>"; }; - DA75159E1D95FAA000F29323 /* lock_arrow_down_white@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_down_white@3x.png"; sourceTree = "<group>"; }; DA7515A11D95FAA000F29323 /* lock_arrow_up_black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lock_arrow_up_black.png; sourceTree = "<group>"; }; DA7515A21D95FAA000F29323 /* lock_arrow_up_black@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_up_black@2x.png"; sourceTree = "<group>"; }; DA7515A31D95FAA000F29323 /* lock_arrow_up_black@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_up_black@3x.png"; sourceTree = "<group>"; }; - DA7515A51D95FAA000F29323 /* lock_arrow_up_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lock_arrow_up_white.png; sourceTree = "<group>"; }; - DA7515A61D95FAA000F29323 /* lock_arrow_up_white@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_up_white@2x.png"; sourceTree = "<group>"; }; - DA7515A71D95FAA000F29323 /* lock_arrow_up_white@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_up_white@3x.png"; sourceTree = "<group>"; }; DA7515AA1D95FAA000F29323 /* sdl_logo_black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sdl_logo_black.png; sourceTree = "<group>"; }; DA7515AB1D95FAA000F29323 /* sdl_logo_black@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sdl_logo_black@2x.png"; sourceTree = "<group>"; }; DA7515AC1D95FAA000F29323 /* sdl_logo_black@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sdl_logo_black@3x.png"; sourceTree = "<group>"; }; - DA7515AE1D95FAA000F29323 /* sdl_logo_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sdl_logo_white.png; sourceTree = "<group>"; }; - DA7515AF1D95FAA000F29323 /* sdl_logo_white@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sdl_logo_white@2x.png"; sourceTree = "<group>"; }; - DA7515B01D95FAA000F29323 /* sdl_logo_white@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sdl_logo_white@3x.png"; sourceTree = "<group>"; }; DA96C0651D4D4F730022F520 /* SDLAppInfoSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLAppInfoSpec.m; sourceTree = "<group>"; }; DA9F7E611DCBFAC800ACAE48 /* SDLDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDateTime.h; sourceTree = "<group>"; }; DA9F7E621DCBFAC800ACAE48 /* SDLDateTime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDateTime.m; sourceTree = "<group>"; }; @@ -3049,7 +3021,6 @@ isa = PBXGroup; children = ( DAC5724C1D0FE3B60004288B /* Touches */, - 5DCC199D1B8221D2004FFAD9 /* HTTP Connection */, E9C32B831AB20B2900F283AF /* @categories */, 5D5934F91A851A8000687FB9 /* Prioritized Objects */, 5D61FAD21A84238A00846EE7 /* SDLHexUtility.h */, @@ -3642,17 +3613,6 @@ name = Dispatchers; sourceTree = "<group>"; }; - 5DCC199D1B8221D2004FFAD9 /* HTTP Connection */ = { - isa = PBXGroup; - children = ( - 5DCC199E1B8221F3004FFAD9 /* SDLURLSession.h */, - 5DCC199F1B8221F3004FFAD9 /* SDLURLSession.m */, - 5DCC19A21B822804004FFAD9 /* SDLURLRequestTask.h */, - 5DCC19A31B822804004FFAD9 /* SDLURLRequestTask.m */, - ); - name = "HTTP Connection"; - sourceTree = "<group>"; - }; 5DE372A71ACC35C100849FAA /* @protocols */ = { isa = PBXGroup; children = ( @@ -3696,7 +3656,6 @@ isa = PBXGroup; children = ( DA7515971D95FAA000F29323 /* black */, - DA75159B1D95FAA000F29323 /* white */, ); path = lock_arrow_down; sourceTree = "<group>"; @@ -3711,21 +3670,10 @@ path = black; sourceTree = "<group>"; }; - DA75159B1D95FAA000F29323 /* white */ = { - isa = PBXGroup; - children = ( - DA75159C1D95FAA000F29323 /* lock_arrow_down_white.png */, - DA75159D1D95FAA000F29323 /* lock_arrow_down_white@2x.png */, - DA75159E1D95FAA000F29323 /* lock_arrow_down_white@3x.png */, - ); - path = white; - sourceTree = "<group>"; - }; DA75159F1D95FAA000F29323 /* lock_arrow_up */ = { isa = PBXGroup; children = ( DA7515A01D95FAA000F29323 /* black */, - DA7515A41D95FAA000F29323 /* white */, ); path = lock_arrow_up; sourceTree = "<group>"; @@ -3740,21 +3688,10 @@ path = black; sourceTree = "<group>"; }; - DA7515A41D95FAA000F29323 /* white */ = { - isa = PBXGroup; - children = ( - DA7515A51D95FAA000F29323 /* lock_arrow_up_white.png */, - DA7515A61D95FAA000F29323 /* lock_arrow_up_white@2x.png */, - DA7515A71D95FAA000F29323 /* lock_arrow_up_white@3x.png */, - ); - path = white; - sourceTree = "<group>"; - }; DA7515A81D95FAA000F29323 /* sdl_logo */ = { isa = PBXGroup; children = ( DA7515A91D95FAA000F29323 /* black */, - DA7515AD1D95FAA000F29323 /* white */, ); path = sdl_logo; sourceTree = "<group>"; @@ -3769,16 +3706,6 @@ path = black; sourceTree = "<group>"; }; - DA7515AD1D95FAA000F29323 /* white */ = { - isa = PBXGroup; - children = ( - DA7515AE1D95FAA000F29323 /* sdl_logo_white.png */, - DA7515AF1D95FAA000F29323 /* sdl_logo_white@2x.png */, - DA7515B01D95FAA000F29323 /* sdl_logo_white@3x.png */, - ); - path = white; - sourceTree = "<group>"; - }; DAC5724C1D0FE3B60004288B /* Touches */ = { isa = PBXGroup; children = ( @@ -3955,7 +3882,6 @@ 5D61FD5F1A84238C00846EE7 /* SDLRegisterAppInterfaceResponse.h in Headers */, 5D61FD191A84238C00846EE7 /* SDLOnSyncPData.h in Headers */, 5D61FE091A84238C00846EE7 /* SDLVehicleDataType.h in Headers */, - 5DCC19A01B8221F3004FFAD9 /* SDLURLSession.h in Headers */, 5D61FDB11A84238C00846EE7 /* SDLSubscribeVehicleData.h in Headers */, 5DCF76F51ACDBAD300BB647B /* SDLSendLocation.h in Headers */, 5D61FC9E1A84238C00846EE7 /* SDLEncodedSyncPData.h in Headers */, @@ -4055,7 +3981,6 @@ DA9F7E7F1DCC028B00ACAE48 /* SDLOnWaypointChange.h in Headers */, 5D61FCE41A84238C00846EE7 /* SDLKeyboardProperties.h in Headers */, 5D61FDED1A84238C00846EE7 /* SDLUnsubscribeVehicleDataResponse.h in Headers */, - 5DCC19A41B822804004FFAD9 /* SDLURLRequestTask.h in Headers */, 5D61FCCF1A84238C00846EE7 /* SDLImageField.h in Headers */, 5D535DC51B72473800CF7760 /* SDLGlobals.h in Headers */, 5D79A03B1CE36F030035797B /* SDLUploadFileOperation.h in Headers */, @@ -4268,24 +4193,15 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - DA7515B51D95FAA000F29323 /* lock_arrow_down_white@2x.png in Resources */, DA7515BE1D95FAA000F29323 /* sdl_logo_black@2x.png in Resources */, DA7515B91D95FAA000F29323 /* lock_arrow_up_black@3x.png in Resources */, DA7515B71D95FAA000F29323 /* lock_arrow_up_black.png in Resources */, - DA7515BC1D95FAA000F29323 /* lock_arrow_up_white@3x.png in Resources */, DA7515B81D95FAA000F29323 /* lock_arrow_up_black@2x.png in Resources */, - DA7515C21D95FAA000F29323 /* sdl_logo_white@3x.png in Resources */, - DA7515C01D95FAA000F29323 /* sdl_logo_white.png in Resources */, - DA7515C11D95FAA000F29323 /* sdl_logo_white@2x.png in Resources */, DA7515BD1D95FAA000F29323 /* sdl_logo_black.png in Resources */, DA7515B11D95FAA000F29323 /* lock_arrow_down_black.png in Resources */, - DA7515BA1D95FAA000F29323 /* lock_arrow_up_white.png in Resources */, 5D6F7A3E1BC811FC0070BF37 /* SDLAssets.xcassets in Resources */, 5D616B451D552F7A00553F6B /* SDLLockScreen.storyboard in Resources */, - DA7515BB1D95FAA000F29323 /* lock_arrow_up_white@2x.png in Resources */, - DA7515B61D95FAA000F29323 /* lock_arrow_down_white@3x.png in Resources */, DA7515B21D95FAA000F29323 /* lock_arrow_down_black@2x.png in Resources */, - DA7515B41D95FAA000F29323 /* lock_arrow_down_white.png in Resources */, DA7515B31D95FAA000F29323 /* lock_arrow_down_black@3x.png in Resources */, DA7515BF1D95FAA000F29323 /* sdl_logo_black@3x.png in Resources */, ); @@ -4331,7 +4247,6 @@ buildActionMask = 2147483647; files = ( 332A914F1CED9CC60043824C /* SDLAppInfo.m in Sources */, - 5DCC19A51B822804004FFAD9 /* SDLURLRequestTask.m in Sources */, DA9F7E841DCC047200ACAE48 /* SDLWaypointType.m in Sources */, 5D61FC561A84238C00846EE7 /* SDLButtonName.m in Sources */, 5D61FCC21A84238C00846EE7 /* SDLHMILevel.m in Sources */, @@ -4460,7 +4375,6 @@ 5D61FC4E1A84238C00846EE7 /* SDLBitsPerSample.m in Sources */, 5D61FDEA1A84238C00846EE7 /* SDLUnsubscribeButtonResponse.m in Sources */, 5D61FCA61A84238C00846EE7 /* SDLEndAudioPassThruResponse.m in Sources */, - 5DCC19A11B8221F3004FFAD9 /* SDLURLSession.m in Sources */, 5D61FD281A84238C00846EE7 /* SDLPerformAudioPassThruResponse.m in Sources */, 5D61FDCE1A84238C00846EE7 /* SDLTimerMode.m in Sources */, 5D61FD701A84238C00846EE7 /* SDLRPCPayload.m in Sources */, @@ -4699,7 +4613,6 @@ 162E836C1A9BDE8B00906325 /* SDLSystemRequestResponseSpec.m in Sources */, 162E833C1A9BDE8B00906325 /* SDLSetMediaClockTimerSpec.m in Sources */, 162E83061A9BDE8B00906325 /* SDLVehicleDataEventStatusSpec.m in Sources */, - 5DEE55C01B8509CB004F0D0F /* SDLURLRequestTaskSpec.m in Sources */, 162E83911A9BDE8B00906325 /* SDLTouchCoordSpec.m in Sources */, 162E832B1A9BDE8B00906325 /* SDLDeleteSubMenuSpec.m in Sources */, 162E83411A9BDE8B00906325 /* SDLSubscribeButtonSpec.m in Sources */, @@ -4778,7 +4691,6 @@ 162E82FB1A9BDE8B00906325 /* SDLSpeechCapabilitiesSpec.m in Sources */, 162E830D1A9BDE8B00906325 /* SDLWiperStatusSpec.m in Sources */, 162E832C1A9BDE8B00906325 /* SDLDiagnosticMessageSpec.m in Sources */, - 5DF2BB9D1B94E38A00CE5994 /* SDLURLSessionSpec.m in Sources */, 162E83381A9BDE8B00906325 /* SDLScrollableMessageSpec.m in Sources */, 162E82E81A9BDE8B00906325 /* SDLKeyboardLayoutSpec.m in Sources */, DA9F7EA41DCC05EE00ACAE48 /* SDLSubscribeWaypointsSpec.m in Sources */, diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/Contents.json b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/Contents.json deleted file mode 100644 index 765c60c66..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "lock_arrow_down_white.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "lock_arrow_down_white@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "lock_arrow_down_white@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -}
\ No newline at end of file diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/lock_arrow_down_white.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/lock_arrow_down_white.png Binary files differdeleted file mode 100644 index 07e620d05..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/lock_arrow_down_white.png +++ /dev/null diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/lock_arrow_down_white@2x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/lock_arrow_down_white@2x.png Binary files differdeleted file mode 100644 index 57fa8120f..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/lock_arrow_down_white@2x.png +++ /dev/null diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/lock_arrow_down_white@3x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/lock_arrow_down_white@3x.png Binary files differdeleted file mode 100644 index b354c1a13..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_down_white.imageset/lock_arrow_down_white@3x.png +++ /dev/null diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/Contents.json b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/Contents.json deleted file mode 100644 index 3140e0f82..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "lock_arrow_up_white.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "lock_arrow_up_white@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "lock_arrow_up_white@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -}
\ No newline at end of file diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/lock_arrow_up_white.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/lock_arrow_up_white.png Binary files differdeleted file mode 100644 index bb0662fe5..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/lock_arrow_up_white.png +++ /dev/null diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/lock_arrow_up_white@2x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/lock_arrow_up_white@2x.png Binary files differdeleted file mode 100644 index f45e6b299..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/lock_arrow_up_white@2x.png +++ /dev/null diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/lock_arrow_up_white@3x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/lock_arrow_up_white@3x.png Binary files differdeleted file mode 100644 index d30fc404c..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/lock_arrow_up_white.imageset/lock_arrow_up_white@3x.png +++ /dev/null diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/Contents.json b/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/Contents.json deleted file mode 100644 index 3943b868e..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "sdl_logo_white.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "sdl_logo_white@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "sdl_logo_white@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -}
\ No newline at end of file diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/sdl_logo_white.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/sdl_logo_white.png Binary files differdeleted file mode 100644 index 1c35ef9b3..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/sdl_logo_white.png +++ /dev/null diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/sdl_logo_white@2x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/sdl_logo_white@2x.png Binary files differdeleted file mode 100644 index b7d0bd92a..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/sdl_logo_white@2x.png +++ /dev/null diff --git a/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/sdl_logo_white@3x.png b/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/sdl_logo_white@3x.png Binary files differdeleted file mode 100644 index b8b9ef757..000000000 --- a/SmartDeviceLink/Assets/SDLAssets.xcassets/sdl_logo_white.imageset/sdl_logo_white@3x.png +++ /dev/null diff --git a/SmartDeviceLink/Info.plist b/SmartDeviceLink/Info.plist index 3050683a6..192a3f9a6 100644 --- a/SmartDeviceLink/Info.plist +++ b/SmartDeviceLink/Info.plist @@ -9,7 +9,7 @@ <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>7.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> diff --git a/SmartDeviceLink/NSMutableDictionary+Store.h b/SmartDeviceLink/NSMutableDictionary+Store.h index dca054d94..7bc77366a 100644 --- a/SmartDeviceLink/NSMutableDictionary+Store.h +++ b/SmartDeviceLink/NSMutableDictionary+Store.h @@ -19,8 +19,7 @@ typedef NSString* SDLEnum SDL_SWIFT_ENUM; - (void)sdl_setObject:(NSObject *)object forName:(SDLName)name; - (nullable id)sdl_objectForName:(SDLName)name; - (nullable id)sdl_objectForName:(SDLName)name ofClass:(Class)classType; -- (NSMutableArray *)sdl_objectsForName:(SDLName)name ofClass:(Class)classType; -- (NSMutableArray<SDLEnum> *)sdl_enumsForName:(SDLName)name; +- (NSArray *)sdl_objectsForName:(SDLName)name ofClass:(Class)classType; @end diff --git a/SmartDeviceLink/NSMutableDictionary+Store.m b/SmartDeviceLink/NSMutableDictionary+Store.m index 0fd7eec5c..92007cf25 100644 --- a/SmartDeviceLink/NSMutableDictionary+Store.m +++ b/SmartDeviceLink/NSMutableDictionary+Store.m @@ -33,29 +33,18 @@ NS_ASSUME_NONNULL_BEGIN } } -- (NSMutableArray *)sdl_objectsForName:(SDLName)name ofClass:(Class)classType { - NSMutableArray *array = [self sdl_objectForName:name]; - if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:classType.class]) { +- (NSArray *)sdl_objectsForName:(SDLName)name ofClass:(Class)classType { + NSArray *array = [self sdl_objectForName:name]; + if ([array count] < 1 || [array.firstObject isMemberOfClass:classType.class]) { + // It's an array of the actual class type, just return return array; } else { + // It's an array of dictionaries, make them into their class type NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; for (NSDictionary<NSString *, id> *dict in array) { [newList addObject:[[classType alloc] initWithDictionary:dict]]; } - return newList; - } -} - -- (NSMutableArray<SDLEnum> *)sdl_enumsForName:(SDLName)name { - NSMutableArray<SDLEnum> *array = [self sdl_objectForName:name]; - if ([array count] < 1) { - return array; - } else { - NSMutableArray<SDLEnum> *newList = [NSMutableArray arrayWithCapacity:[array count]]; - for (SDLEnum enumString in array) { - [newList addObject:enumString]; - } - return newList; + return [newList copy]; } } diff --git a/SmartDeviceLink/SDLAddCommand.h b/SmartDeviceLink/SDLAddCommand.h index 59ef5cb02..fb7ea7498 100644 --- a/SmartDeviceLink/SDLAddCommand.h +++ b/SmartDeviceLink/SDLAddCommand.h @@ -91,7 +91,7 @@ NS_ASSUME_NONNULL_BEGIN * * Optional, Array of Strings, Max String length 99 chars, Array size 1 - 100 */ -@property (nullable, strong, nonatomic) NSMutableArray<NSString *> *vrCommands; +@property (nullable, strong, nonatomic) NSArray<NSString *> *vrCommands; /** * @abstract Image struct containing a static or dynamic icon diff --git a/SmartDeviceLink/SDLAddCommand.m b/SmartDeviceLink/SDLAddCommand.m index ddf4ee4ce..4a5cb6659 100644 --- a/SmartDeviceLink/SDLAddCommand.m +++ b/SmartDeviceLink/SDLAddCommand.m @@ -84,11 +84,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameMenuParams ofClass:SDLMenuParams.class]; } -- (void)setVrCommands:(nullable NSMutableArray<NSString *> *)vrCommands { +- (void)setVrCommands:(nullable NSArray<NSString *> *)vrCommands { [parameters sdl_setObject:vrCommands forName:SDLNameVRCommands]; } -- (nullable NSMutableArray<NSString *> *)vrCommands { +- (nullable NSArray<NSString *> *)vrCommands { return [parameters sdl_objectForName:SDLNameVRCommands]; } diff --git a/SmartDeviceLink/SDLAlert.h b/SmartDeviceLink/SDLAlert.h index 22b4e9d50..d8f893b7e 100644 --- a/SmartDeviceLink/SDLAlert.h +++ b/SmartDeviceLink/SDLAlert.h @@ -111,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN * * @see SDLTTSChunk */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLTTSChunk *> *ttsChunks; +@property (nullable, strong, nonatomic) NSArray<SDLTTSChunk *> *ttsChunks; /** * @abstract The duration of the displayed portion of the alert, in milliseconds. @@ -153,7 +153,7 @@ NS_ASSUME_NONNULL_BEGIN * * @see SDLSoftButton */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLSoftButton *> *softButtons; +@property (nullable, strong, nonatomic) NSArray<SDLSoftButton *> *softButtons; @end diff --git a/SmartDeviceLink/SDLAlert.m b/SmartDeviceLink/SDLAlert.m index 2b5640505..0f7c78a10 100644 --- a/SmartDeviceLink/SDLAlert.m +++ b/SmartDeviceLink/SDLAlert.m @@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN } - (instancetype)initWithTTS:(nullable NSString *)ttsText alertText1:(nullable NSString *)alertText1 alertText2:(nullable NSString *)alertText2 alertText3:(nullable NSString *)alertText3 playTone:(BOOL)playTone duration:(UInt16)duration { - NSMutableArray *ttsChunks = [SDLTTSChunk textChunksFromString:ttsText]; + NSArray *ttsChunks = [SDLTTSChunk textChunksFromString:ttsText]; return [self initWithTTSChunks:ttsChunks alertText1:alertText1 alertText2:alertText2 alertText3:alertText3 playTone:playTone duration:duration softButtons:nil]; } @@ -97,11 +97,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameAlertText3]; } -- (void)setTtsChunks:(nullable NSMutableArray<SDLTTSChunk *> *)ttsChunks { +- (void)setTtsChunks:(nullable NSArray<SDLTTSChunk *> *)ttsChunks { [parameters sdl_setObject:ttsChunks forName:SDLNameTTSChunks]; } -- (nullable NSMutableArray<SDLTTSChunk *> *)ttsChunks { +- (nullable NSArray<SDLTTSChunk *> *)ttsChunks { return [parameters sdl_objectsForName:SDLNameTTSChunks ofClass:SDLTTSChunk.class]; } @@ -129,11 +129,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameProgressIndicator]; } -- (void)setSoftButtons:(nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (void)setSoftButtons:(nullable NSArray<SDLSoftButton *> *)softButtons { [parameters sdl_setObject:softButtons forName:SDLNameSoftButtons]; } -- (nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (nullable NSArray<SDLSoftButton *> *)softButtons { return [parameters sdl_objectsForName:SDLNameSoftButtons ofClass:SDLSoftButton.class]; } diff --git a/SmartDeviceLink/SDLAlertManeuver.h b/SmartDeviceLink/SDLAlertManeuver.h index 66baa8585..b7181c04f 100644 --- a/SmartDeviceLink/SDLAlertManeuver.h +++ b/SmartDeviceLink/SDLAlertManeuver.h @@ -19,8 +19,8 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithTTS:(nullable NSString *)ttsText softButtons:(nullable NSArray<SDLSoftButton *> *)softButtons; - (instancetype)initWithTTSChunks:(nullable NSArray<SDLTTSChunk *> *)ttsChunks softButtons:(nullable NSArray<SDLSoftButton *> *)softButtons; -@property (nullable, strong, nonatomic) NSMutableArray<SDLTTSChunk *> *ttsChunks; -@property (nullable, strong, nonatomic) NSMutableArray<SDLSoftButton *> *softButtons; +@property (nullable, strong, nonatomic) NSArray<SDLTTSChunk *> *ttsChunks; +@property (nullable, strong, nonatomic) NSArray<SDLSoftButton *> *softButtons; @end diff --git a/SmartDeviceLink/SDLAlertManeuver.m b/SmartDeviceLink/SDLAlertManeuver.m index 433669cab..f56a53572 100644 --- a/SmartDeviceLink/SDLAlertManeuver.m +++ b/SmartDeviceLink/SDLAlertManeuver.m @@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithTTS:(nullable NSString *)ttsText softButtons:(nullable NSArray<SDLSoftButton *> *)softButtons { - NSMutableArray *ttsChunks = [SDLTTSChunk textChunksFromString:ttsText]; + NSArray *ttsChunks = [SDLTTSChunk textChunksFromString:ttsText]; return [self initWithTTSChunks:ttsChunks softButtons:softButtons]; } @@ -37,19 +37,19 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setTtsChunks:(nullable NSMutableArray<SDLTTSChunk *> *)ttsChunks { +- (void)setTtsChunks:(nullable NSArray<SDLTTSChunk *> *)ttsChunks { [parameters sdl_setObject:ttsChunks forName:SDLNameTTSChunks]; } -- (nullable NSMutableArray<SDLTTSChunk *> *)ttsChunks { +- (nullable NSArray<SDLTTSChunk *> *)ttsChunks { return [parameters sdl_objectsForName:SDLNameTTSChunks ofClass:SDLTTSChunk.class]; } -- (void)setSoftButtons:(nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (void)setSoftButtons:(nullable NSArray<SDLSoftButton *> *)softButtons { [parameters sdl_setObject:softButtons forName:SDLNameSoftButtons]; } -- (nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (nullable NSArray<SDLSoftButton *> *)softButtons { return [parameters sdl_objectsForName:SDLNameSoftButtons ofClass:SDLSoftButton.class]; } diff --git a/SmartDeviceLink/SDLChoice.h b/SmartDeviceLink/SDLChoice.h index 1e88f097b..d5f521882 100644 --- a/SmartDeviceLink/SDLChoice.h +++ b/SmartDeviceLink/SDLChoice.h @@ -36,7 +36,7 @@ * </tr> * <tr> * <td>vrCommands</td> - * <td>NSMutableArray *</td> + * <td>NSArray *</td> * <td>An array of strings to be used as VR synonyms for this choice. If this array is provided, it must have at least one non-empty element</td> * <td>SmartDeviceLink 1.0</td> * </tr> @@ -77,7 +77,7 @@ NS_ASSUME_NONNULL_BEGIN * * Required, Array of Strings, Array length 1 - 100, Max String length 99 chars */ -@property (strong, nonatomic) NSMutableArray<NSString *> *vrCommands; +@property (strong, nonatomic) NSArray<NSString *> *vrCommands; /** * @abstract The image of the choice diff --git a/SmartDeviceLink/SDLChoice.m b/SmartDeviceLink/SDLChoice.m index b5fd077f5..919ef6102 100644 --- a/SmartDeviceLink/SDLChoice.m +++ b/SmartDeviceLink/SDLChoice.m @@ -54,11 +54,11 @@ NS_ASSUME_NONNULL_BEGIN return [store sdl_objectForName:SDLNameMenuName]; } -- (void)setVrCommands:(NSMutableArray<NSString *> *)vrCommands { +- (void)setVrCommands:(NSArray<NSString *> *)vrCommands { [store sdl_setObject:vrCommands forName:SDLNameVRCommands]; } -- (NSMutableArray<NSString *> *)vrCommands { +- (NSArray<NSString *> *)vrCommands { return [store sdl_objectForName:SDLNameVRCommands]; } diff --git a/SmartDeviceLink/SDLCreateInteractionChoiceSet.h b/SmartDeviceLink/SDLCreateInteractionChoiceSet.h index 2679f0266..80ae3e9a9 100644 --- a/SmartDeviceLink/SDLCreateInteractionChoiceSet.h +++ b/SmartDeviceLink/SDLCreateInteractionChoiceSet.h @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN * * Required, SDLChoice, Array size 1 - 100 */ -@property (strong, nonatomic) NSMutableArray<SDLChoice *> *choiceSet; +@property (strong, nonatomic) NSArray<SDLChoice *> *choiceSet; @end diff --git a/SmartDeviceLink/SDLCreateInteractionChoiceSet.m b/SmartDeviceLink/SDLCreateInteractionChoiceSet.m index f9e5ca73e..570054eec 100644 --- a/SmartDeviceLink/SDLCreateInteractionChoiceSet.m +++ b/SmartDeviceLink/SDLCreateInteractionChoiceSet.m @@ -37,11 +37,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameInteractionChoiceSetId]; } -- (void)setChoiceSet:(NSMutableArray<SDLChoice *> *)choiceSet { +- (void)setChoiceSet:(NSArray<SDLChoice *> *)choiceSet { [parameters sdl_setObject:choiceSet forName:SDLNameChoiceSet]; } -- (NSMutableArray<SDLChoice *> *)choiceSet { +- (NSArray<SDLChoice *> *)choiceSet { return [parameters sdl_objectsForName:SDLNameChoiceSet ofClass:SDLChoice.class]; } diff --git a/SmartDeviceLink/SDLDiagnosticMessage.h b/SmartDeviceLink/SDLDiagnosticMessage.h index e5bff4a58..d056c5488 100644 --- a/SmartDeviceLink/SDLDiagnosticMessage.h +++ b/SmartDeviceLink/SDLDiagnosticMessage.h @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN * * Required, Array of NSNumber (Integers), Array size 1 - 65535, Integer Size 0 - 255 */ -@property (strong, nonatomic) NSMutableArray<NSNumber<SDLInt> *> *messageData; +@property (strong, nonatomic) NSArray<NSNumber<SDLInt> *> *messageData; @end diff --git a/SmartDeviceLink/SDLDiagnosticMessage.m b/SmartDeviceLink/SDLDiagnosticMessage.m index 4b874a6e2..dff509a4d 100644 --- a/SmartDeviceLink/SDLDiagnosticMessage.m +++ b/SmartDeviceLink/SDLDiagnosticMessage.m @@ -46,11 +46,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameMessageLength]; } -- (void)setMessageData:(NSMutableArray<NSNumber<SDLInt> *> *)messageData { +- (void)setMessageData:(NSArray<NSNumber<SDLInt> *> *)messageData { [parameters sdl_setObject:messageData forName:SDLNameMessageData]; } -- (NSMutableArray<NSNumber<SDLInt> *> *)messageData { +- (NSArray<NSNumber<SDLInt> *> *)messageData { return [parameters sdl_objectForName:SDLNameMessageData]; } diff --git a/SmartDeviceLink/SDLDiagnosticMessageResponse.h b/SmartDeviceLink/SDLDiagnosticMessageResponse.h index 5c4c8745f..60124540e 100644 --- a/SmartDeviceLink/SDLDiagnosticMessageResponse.h +++ b/SmartDeviceLink/SDLDiagnosticMessageResponse.h @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLDiagnosticMessageResponse : SDLRPCResponse -@property (strong, nonatomic) NSMutableArray<NSNumber<SDLInt> *> *messageDataResult; +@property (strong, nonatomic) NSArray<NSNumber<SDLInt> *> *messageDataResult; @end diff --git a/SmartDeviceLink/SDLDiagnosticMessageResponse.m b/SmartDeviceLink/SDLDiagnosticMessageResponse.m index 9353a755f..3c8a31444 100644 --- a/SmartDeviceLink/SDLDiagnosticMessageResponse.m +++ b/SmartDeviceLink/SDLDiagnosticMessageResponse.m @@ -16,11 +16,11 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setMessageDataResult:(NSMutableArray<NSNumber<SDLInt> *> *)messageDataResult { +- (void)setMessageDataResult:(NSArray<NSNumber<SDLInt> *> *)messageDataResult { [parameters sdl_setObject:messageDataResult forName:SDLNameMessageDataResult]; } -- (NSMutableArray<NSNumber<SDLInt> *> *)messageDataResult { +- (NSArray<NSNumber<SDLInt> *> *)messageDataResult { return [parameters objectForKey:SDLNameMessageDataResult]; } diff --git a/SmartDeviceLink/SDLDisplayCapabilities.h b/SmartDeviceLink/SDLDisplayCapabilities.h index 437f686fc..3ef70cb1b 100644 --- a/SmartDeviceLink/SDLDisplayCapabilities.h +++ b/SmartDeviceLink/SDLDisplayCapabilities.h @@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN * * Required, Array of SDLTextField, 1 - 100 objects */ -@property (strong, nonatomic) NSMutableArray<SDLTextField *> *textFields; +@property (strong, nonatomic) NSArray<SDLTextField *> *textFields; /** * @abstract An array of SDLImageField elements @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN * * Optional, Array of SDLImageField, 1 - 100 objects */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLImageField *> *imageFields; +@property (nullable, strong, nonatomic) NSArray<SDLImageField *> *imageFields; /** * @abstract An array of SDLMediaClockFormat elements, defining the valid string formats used in specifying the contents of the media clock field @@ -56,7 +56,7 @@ NS_ASSUME_NONNULL_BEGIN * * Required, Array of SDLMediaClockFormats, 0 - 100 objects */ -@property (strong, nonatomic) NSMutableArray<SDLMediaClockFormat> *mediaClockFormats; +@property (strong, nonatomic) NSArray<SDLMediaClockFormat> *mediaClockFormats; /** * @abstract The display's persistent screen supports. @@ -74,7 +74,7 @@ NS_ASSUME_NONNULL_BEGIN * * Optional, Array of String, max string size 100, 0 - 100 objects */ -@property (nullable, strong, nonatomic) NSMutableArray<NSString *> *templatesAvailable; +@property (nullable, strong, nonatomic) NSArray<NSString *> *templatesAvailable; /** * @abstract A set of all parameters related to a prescribed screen area (e.g. for video / touch input) diff --git a/SmartDeviceLink/SDLDisplayCapabilities.m b/SmartDeviceLink/SDLDisplayCapabilities.m index dc3e45c5f..06a8912e7 100644 --- a/SmartDeviceLink/SDLDisplayCapabilities.m +++ b/SmartDeviceLink/SDLDisplayCapabilities.m @@ -21,28 +21,28 @@ NS_ASSUME_NONNULL_BEGIN return [store sdl_objectForName:SDLNameDisplayType]; } -- (void)setTextFields:(NSMutableArray<SDLTextField *> *)textFields { +- (void)setTextFields:(NSArray<SDLTextField *> *)textFields { [store sdl_setObject:textFields forName:SDLNameTextFields]; } -- (NSMutableArray<SDLTextField *> *)textFields { +- (NSArray<SDLTextField *> *)textFields { return [store sdl_objectsForName:SDLNameTextFields ofClass:SDLTextField.class]; } -- (void)setImageFields:(nullable NSMutableArray<SDLImageField *> *)imageFields { +- (void)setImageFields:(nullable NSArray<SDLImageField *> *)imageFields { [store sdl_setObject:imageFields forName:SDLNameImageFields]; } -- (nullable NSMutableArray<SDLImageField *> *)imageFields { +- (nullable NSArray<SDLImageField *> *)imageFields { return [store sdl_objectsForName:SDLNameImageFields ofClass:SDLImageField.class]; } -- (void)setMediaClockFormats:(NSMutableArray<SDLMediaClockFormat> *)mediaClockFormats { +- (void)setMediaClockFormats:(NSArray<SDLMediaClockFormat> *)mediaClockFormats { [store sdl_setObject:mediaClockFormats forName:SDLNameMediaClockFormats]; } -- (NSMutableArray<SDLMediaClockFormat> *)mediaClockFormats { - return [store sdl_enumsForName:SDLNameMediaClockFormats]; +- (NSArray<SDLMediaClockFormat> *)mediaClockFormats { + return [store sdl_objectForName:SDLNameMediaClockFormats]; } - (void)setGraphicSupported:(NSNumber<SDLBool> *)graphicSupported { @@ -53,11 +53,11 @@ NS_ASSUME_NONNULL_BEGIN return [store sdl_objectForName:SDLNameGraphicSupported]; } -- (void)setTemplatesAvailable:(nullable NSMutableArray<NSString *> *)templatesAvailable { +- (void)setTemplatesAvailable:(nullable NSArray<NSString *> *)templatesAvailable { [store sdl_setObject:templatesAvailable forName:SDLNameTemplatesAvailable]; } -- (nullable NSMutableArray<NSString *> *)templatesAvailable { +- (nullable NSArray<NSString *> *)templatesAvailable { return [store sdl_objectForName:SDLNameTemplatesAvailable]; } diff --git a/SmartDeviceLink/SDLEncodedSyncPData.h b/SmartDeviceLink/SDLEncodedSyncPData.h index 5d32ced74..2d2c8fe3d 100644 --- a/SmartDeviceLink/SDLEncodedSyncPData.h +++ b/SmartDeviceLink/SDLEncodedSyncPData.h @@ -8,7 +8,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLEncodedSyncPData : SDLRPCRequest -@property (strong, nonatomic) NSMutableArray<NSString *> *data; +@property (strong, nonatomic) NSArray<NSString *> *data; @end diff --git a/SmartDeviceLink/SDLEncodedSyncPData.m b/SmartDeviceLink/SDLEncodedSyncPData.m index 39873052f..3f9838509 100644 --- a/SmartDeviceLink/SDLEncodedSyncPData.m +++ b/SmartDeviceLink/SDLEncodedSyncPData.m @@ -17,11 +17,11 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setData:(NSMutableArray<NSString *> *)data { +- (void)setData:(NSArray<NSString *> *)data { [parameters sdl_setObject:data forName:SDLNameData]; } -- (NSMutableArray<NSString *> *)data { +- (NSArray<NSString *> *)data { return [parameters sdl_objectForName:SDLNameData]; } diff --git a/SmartDeviceLink/SDLGetDTCsResponse.h b/SmartDeviceLink/SDLGetDTCsResponse.h index 7368b42f2..dd87f377f 100644 --- a/SmartDeviceLink/SDLGetDTCsResponse.h +++ b/SmartDeviceLink/SDLGetDTCsResponse.h @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLGetDTCsResponse : SDLRPCResponse @property (strong, nonatomic) NSNumber<SDLInt> *ecuHeader; -@property (strong, nonatomic) NSMutableArray<NSString *> *dtc; +@property (strong, nonatomic) NSArray<NSString *> *dtc; @end diff --git a/SmartDeviceLink/SDLGetDTCsResponse.m b/SmartDeviceLink/SDLGetDTCsResponse.m index f1ead9716..c2bf974b5 100644 --- a/SmartDeviceLink/SDLGetDTCsResponse.m +++ b/SmartDeviceLink/SDLGetDTCsResponse.m @@ -25,11 +25,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters objectForKey:SDLNameECUHeader]; } -- (void)setDtc:(NSMutableArray<NSString *> *)dtc { +- (void)setDtc:(NSArray<NSString *> *)dtc { [parameters sdl_setObject:dtc forName:SDLNameDTC]; } -- (NSMutableArray<NSString *> *)dtc { +- (NSArray<NSString *> *)dtc { return [parameters objectForKey:SDLNameDTC]; } diff --git a/SmartDeviceLink/SDLHMIPermissions.h b/SmartDeviceLink/SDLHMIPermissions.h index a37f867e6..ca6f855a1 100644 --- a/SmartDeviceLink/SDLHMIPermissions.h +++ b/SmartDeviceLink/SDLHMIPermissions.h @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN * * Required, Array of SDLHMILevel, Array size 0 - 100 */ -@property (strong, nonatomic) NSMutableArray<SDLHMILevel> *allowed; +@property (strong, nonatomic) NSArray<SDLHMILevel> *allowed; /** * @abstract a set of all HMI levels that are prohibited for this given RPC @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN * * Required, Array of SDLHMILevel, Array size 0 - 100 */ -@property (strong, nonatomic) NSMutableArray<SDLHMILevel> *userDisallowed; +@property (strong, nonatomic) NSArray<SDLHMILevel> *userDisallowed; @end diff --git a/SmartDeviceLink/SDLHMIPermissions.m b/SmartDeviceLink/SDLHMIPermissions.m index 620c9ca6f..96d947aa5 100644 --- a/SmartDeviceLink/SDLHMIPermissions.m +++ b/SmartDeviceLink/SDLHMIPermissions.m @@ -11,20 +11,20 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLHMIPermissions -- (void)setAllowed:(NSMutableArray<SDLHMILevel> *)allowed { +- (void)setAllowed:(NSArray<SDLHMILevel> *)allowed { [store sdl_setObject:allowed forName:SDLNameAllowed]; } -- (NSMutableArray<SDLHMILevel> *)allowed { - return [store sdl_enumsForName:SDLNameAllowed]; +- (NSArray<SDLHMILevel> *)allowed { + return [store sdl_objectForName:SDLNameAllowed]; } -- (void)setUserDisallowed:(NSMutableArray<SDLHMILevel> *)userDisallowed { +- (void)setUserDisallowed:(NSArray<SDLHMILevel> *)userDisallowed { [store sdl_setObject:userDisallowed forName:SDLNameUserDisallowed]; } -- (NSMutableArray<SDLHMILevel> *)userDisallowed { - return [store sdl_enumsForName:SDLNameUserDisallowed]; +- (NSArray<SDLHMILevel> *)userDisallowed { + return [store sdl_objectForName:SDLNameUserDisallowed]; } @end diff --git a/SmartDeviceLink/SDLImageField.h b/SmartDeviceLink/SDLImageField.h index 429e77343..f9ec61950 100644 --- a/SmartDeviceLink/SDLImageField.h +++ b/SmartDeviceLink/SDLImageField.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLImageField : SDLRPCStruct @property (strong, nonatomic) SDLImageFieldName name; -@property (strong, nonatomic) NSMutableArray<SDLFileType> *imageTypeSupported; +@property (strong, nonatomic) NSArray<SDLFileType> *imageTypeSupported; @property (nullable, strong, nonatomic) SDLImageResolution *imageResolution; @end diff --git a/SmartDeviceLink/SDLImageField.m b/SmartDeviceLink/SDLImageField.m index dfa223b3c..d25b6e213 100644 --- a/SmartDeviceLink/SDLImageField.m +++ b/SmartDeviceLink/SDLImageField.m @@ -20,12 +20,12 @@ NS_ASSUME_NONNULL_BEGIN return [store sdl_objectForName:SDLNameName]; } -- (void)setImageTypeSupported:(NSMutableArray<SDLFileType> *)imageTypeSupported { +- (void)setImageTypeSupported:(NSArray<SDLFileType> *)imageTypeSupported { [store sdl_setObject:imageTypeSupported forName:SDLNameImageTypeSupported]; } -- (NSMutableArray<SDLFileType> *)imageTypeSupported { - return [store sdl_enumsForName:SDLNameImageTypeSupported]; +- (NSArray<SDLFileType> *)imageTypeSupported { + return [store sdl_objectForName:SDLNameImageTypeSupported]; } - (void)setImageResolution:(nullable SDLImageResolution *)imageResolution { diff --git a/SmartDeviceLink/SDLKeyboardProperties.h b/SmartDeviceLink/SDLKeyboardProperties.h index 576053bd9..30927710f 100644 --- a/SmartDeviceLink/SDLKeyboardProperties.h +++ b/SmartDeviceLink/SDLKeyboardProperties.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nullable, strong, nonatomic) SDLLanguage language; @property (nullable, strong, nonatomic) SDLKeyboardLayout keyboardLayout; @property (nullable, strong, nonatomic) SDLKeypressMode keypressMode; -@property (nullable, strong, nonatomic) NSMutableArray<NSString *> *limitedCharacterList; +@property (nullable, strong, nonatomic) NSArray<NSString *> *limitedCharacterList; @property (nullable, strong, nonatomic) NSString *autoCompleteText; @end diff --git a/SmartDeviceLink/SDLKeyboardProperties.m b/SmartDeviceLink/SDLKeyboardProperties.m index 90899cf17..3c79612f8 100644 --- a/SmartDeviceLink/SDLKeyboardProperties.m +++ b/SmartDeviceLink/SDLKeyboardProperties.m @@ -49,11 +49,11 @@ NS_ASSUME_NONNULL_BEGIN return [store sdl_objectForName:SDLNameKeypressMode]; } -- (void)setLimitedCharacterList:(nullable NSMutableArray<NSString *> *)limitedCharacterList { +- (void)setLimitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList { [store sdl_setObject:limitedCharacterList forName:SDLNameLimitedCharacterList]; } -- (nullable NSMutableArray<NSString *> *)limitedCharacterList { +- (nullable NSArray<NSString *> *)limitedCharacterList { return [store sdl_objectForName:SDLNameLimitedCharacterList]; } diff --git a/SmartDeviceLink/SDLLifecycleManager.h b/SmartDeviceLink/SDLLifecycleManager.h index 23002df19..7d7c3d2e1 100644 --- a/SmartDeviceLink/SDLLifecycleManager.h +++ b/SmartDeviceLink/SDLLifecycleManager.h @@ -36,8 +36,10 @@ NS_ASSUME_NONNULL_BEGIN typedef NSString SDLLifecycleState; -extern SDLLifecycleState *const SDLLifecycleStateDisconnected; -extern SDLLifecycleState *const SDLLifecycleStateTransportConnected; +extern SDLLifecycleState *const SDLLifecycleStateStopped; +extern SDLLifecycleState *const SDLLifecycleStateStarted; +extern SDLLifecycleState *const SDLLifecycleStateReconnecting; +extern SDLLifecycleState *const SDLLifecycleStateConnected; extern SDLLifecycleState *const SDLLifecycleStateRegistered; extern SDLLifecycleState *const SDLLifecycleStateSettingUpManagers; extern SDLLifecycleState *const SDLLifecycleStatePostManagerProcessing; @@ -65,13 +67,13 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error); // Deprecated internal proxy object #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" -@property (strong, nonatomic, readonly, nullable) SDLProxy *proxy; +@property (strong, nonatomic, nullable) SDLProxy *proxy; #pragma clang diagnostic pop -@property (assign, nonatomic, readonly) UInt16 lastCorrelationId; +@property (assign, nonatomic) UInt16 lastCorrelationId; @property (copy, nonatomic, readonly) SDLLifecycleState *lifecycleState; -@property (copy, nonatomic, readonly, nullable) SDLHMILevel hmiLevel; -@property (strong, nonatomic, readonly, nullable) SDLRegisterAppInterfaceResponse *registerResponse; +@property (copy, nonatomic, nullable) SDLHMILevel hmiLevel; +@property (strong, nonatomic, nullable) SDLRegisterAppInterfaceResponse *registerResponse; #pragma mark Lifecycle diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index 4675a30a2..f8a851cf6 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -18,7 +18,6 @@ #import "SDLError.h" #import "SDLFile.h" #import "SDLFileManager.h" -#import "SDLHMILevel.h" #import "SDLLifecycleConfiguration.h" #import "SDLLockScreenConfiguration.h" #import "SDLLockScreenManager.h" @@ -43,8 +42,10 @@ NS_ASSUME_NONNULL_BEGIN -SDLLifecycleState *const SDLLifecycleStateDisconnected = @"TransportDisconnected"; -SDLLifecycleState *const SDLLifecycleStateTransportConnected = @"TransportConnected"; +SDLLifecycleState *const SDLLifecycleStateStopped = @"Stopped"; +SDLLifecycleState *const SDLLifecycleStateStarted = @"Started"; +SDLLifecycleState *const SDLLifecycleStateReconnecting = @"Reconnecting"; +SDLLifecycleState *const SDLLifecycleStateConnected = @"Connected"; SDLLifecycleState *const SDLLifecycleStateRegistered = @"Registered"; SDLLifecycleState *const SDLLifecycleStateSettingUpManagers = @"SettingUpManagers"; SDLLifecycleState *const SDLLifecycleStatePostManagerProcessing = @"PostManagerProcessing"; @@ -56,20 +57,11 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; @interface SDLLifecycleManager () <SDLConnectionManagerType> // Readonly public properties -@property (copy, nonatomic, readwrite, nullable) SDLHMILevel hmiLevel; @property (copy, nonatomic, readwrite) SDLConfiguration *configuration; -@property (assign, nonatomic, readwrite) UInt16 lastCorrelationId; -@property (strong, nonatomic, readwrite, nullable) SDLRegisterAppInterfaceResponse *registerResponse; @property (strong, nonatomic, readwrite) SDLNotificationDispatcher *notificationDispatcher; @property (strong, nonatomic, readwrite) SDLResponseDispatcher *responseDispatcher; @property (strong, nonatomic, readwrite) SDLStateMachine *lifecycleStateMachine; -// Deprecated internal proxy object -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -@property (strong, nonatomic, readwrite, nullable) SDLProxy *proxy; -#pragma clang diagnostic pop - // Private properties @property (copy, nonatomic) SDLManagerReadyBlock readyHandler; @@ -95,7 +87,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; _delegate = delegate; // Private properties - _lifecycleStateMachine = [[SDLStateMachine alloc] initWithTarget:self initialState:SDLLifecycleStateDisconnected states:[self.class sdl_stateTransitionDictionary]]; + _lifecycleStateMachine = [[SDLStateMachine alloc] initWithTarget:self initialState:SDLLifecycleStateStopped states:[self.class sdl_stateTransitionDictionary]]; _lastCorrelationId = 0; _notificationDispatcher = [[SDLNotificationDispatcher alloc] init]; _responseDispatcher = [[SDLResponseDispatcher alloc] initWithNotificationDispatcher:_notificationDispatcher]; @@ -117,25 +109,14 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; - (void)startWithReadyHandler:(SDLManagerReadyBlock)readyHandler { self.readyHandler = [readyHandler copy]; - // Set up our logging capabilities based on the config - [self.class sdl_updateLoggingWithFlags:self.configuration.lifecycleConfig.logFlags]; - -// Start up the internal proxy object -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (self.configuration.lifecycleConfig.tcpDebugMode) { - self.proxy = [SDLProxyFactory buildSDLProxyWithListener:self.notificationDispatcher tcpIPAddress:self.configuration.lifecycleConfig.tcpDebugIPAddress tcpPort:[@(self.configuration.lifecycleConfig.tcpDebugPort) stringValue]]; - } else { - self.proxy = [SDLProxyFactory buildSDLProxyWithListener:self.notificationDispatcher]; - } -#pragma clang diagnostic pop + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateStarted]; } - (void)stop { if ([self.lifecycleStateMachine isCurrentState:SDLLifecycleStateReady]) { [self.lifecycleStateMachine transitionToState:SDLLifecycleStateUnregistering]; } else { - [self.lifecycleStateMachine transitionToState:SDLLifecycleStateDisconnected]; + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped]; } } @@ -155,17 +136,42 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; + (NSDictionary<SDLState *, SDLAllowableStateTransitions *> *)sdl_stateTransitionDictionary { return @{ - SDLLifecycleStateDisconnected: @[SDLLifecycleStateTransportConnected], - SDLLifecycleStateTransportConnected: @[SDLLifecycleStateDisconnected, SDLLifecycleStateRegistered], - SDLLifecycleStateRegistered: @[SDLLifecycleStateDisconnected, SDLLifecycleStateSettingUpManagers], - SDLLifecycleStateSettingUpManagers: @[SDLLifecycleStateDisconnected, SDLLifecycleStatePostManagerProcessing], - SDLLifecycleStatePostManagerProcessing: @[SDLLifecycleStateDisconnected, SDLLifecycleStateReady], - SDLLifecycleStateUnregistering: @[SDLLifecycleStateDisconnected], - SDLLifecycleStateReady: @[SDLLifecycleStateUnregistering, SDLLifecycleStateDisconnected] + SDLLifecycleStateStopped: @[SDLLifecycleStateStarted], + SDLLifecycleStateStarted : @[SDLLifecycleStateConnected, SDLLifecycleStateStopped, SDLLifecycleStateReconnecting], + SDLLifecycleStateReconnecting: @[SDLLifecycleStateStarted], + SDLLifecycleStateConnected: @[SDLLifecycleStateStopped, SDLLifecycleStateReconnecting, SDLLifecycleStateRegistered], + SDLLifecycleStateRegistered: @[SDLLifecycleStateStopped, SDLLifecycleStateReconnecting, SDLLifecycleStateSettingUpManagers], + SDLLifecycleStateSettingUpManagers: @[SDLLifecycleStateStopped, SDLLifecycleStateReconnecting, SDLLifecycleStatePostManagerProcessing], + SDLLifecycleStatePostManagerProcessing: @[SDLLifecycleStateStopped, SDLLifecycleStateReconnecting, SDLLifecycleStateReady], + SDLLifecycleStateUnregistering: @[SDLLifecycleStateStopped], + SDLLifecycleStateReady: @[SDLLifecycleStateUnregistering, SDLLifecycleStateStopped, SDLLifecycleStateReconnecting] }; } -- (void)didEnterStateTransportDisconnected { +- (void)didEnterStateStarted { + // Set up our logging capabilities based on the config + [self.class sdl_updateLoggingWithFlags:self.configuration.lifecycleConfig.logFlags]; + + // Start up the internal proxy object +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + if (self.configuration.lifecycleConfig.tcpDebugMode) { + self.proxy = [SDLProxyFactory buildSDLProxyWithListener:self.notificationDispatcher tcpIPAddress:self.configuration.lifecycleConfig.tcpDebugIPAddress tcpPort:[@(self.configuration.lifecycleConfig.tcpDebugPort) stringValue]]; + } else { + self.proxy = [SDLProxyFactory buildSDLProxyWithListener:self.notificationDispatcher]; + } +#pragma clang diagnostic pop +} + +- (void)didEnterStateStopped { + [self sdl_stopManager:NO]; +} + +- (void)didEnterStateReconnecting { + [self sdl_stopManager:YES]; +} + +- (void)sdl_stopManager:(BOOL)shouldRestart { [self.fileManager stop]; [self.permissionManager stop]; [self.lockScreenManager stop]; @@ -177,12 +183,20 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; [SDLDebugTool logInfo:@"Stopping Proxy"]; self.proxy = nil; - [self.delegate managerDidDisconnect]; - [self startWithReadyHandler:self.readyHandler]; // Start up again to start watching for new connections + // Due to a race condition internally with EAStream, we cannot immediately attempt to restart the proxy, as we will randomly crash. + // Apple Bug ID #30059457 + __weak typeof(self) weakSelf = self; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [weakSelf.delegate managerDidDisconnect]; + + if (shouldRestart) { + [weakSelf.lifecycleStateMachine transitionToState:SDLLifecycleStateStarted]; + } + }); } -- (void)didEnterStateTransportConnected { +- (void)didEnterStateConnected { // If we have security managers, add them to the proxy if (self.configuration.lifecycleConfig.securityManagers != nil) { [self.proxy addSecurityManagers:self.configuration.lifecycleConfig.securityManagers forAppId:self.configuration.lifecycleConfig.appId]; @@ -195,9 +209,11 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; __weak typeof(self) weakSelf = self; [self sdl_sendRequest:regRequest withResponseHandler:^(__kindof SDLRPCRequest *_Nullable request, __kindof SDLRPCResponse *_Nullable response, NSError *_Nullable error) { + // If the success BOOL is NO or we received an error at this point, we failed. Call the ready handler and transition to the DISCONNECTED state. if (error != nil || ![response.success boolValue]) { [SDLDebugTool logFormat:@"Failed to register the app. Error: %@, Response: %@", error, response]; - [weakSelf.lifecycleStateMachine transitionToState:SDLLifecycleStateDisconnected]; + weakSelf.readyHandler(NO, error); + [weakSelf.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped]; return; } @@ -256,32 +272,15 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; - (void)didEnterStateReady { SDLResult registerResult = self.registerResponse.resultCode; NSString *registerInfo = self.registerResponse.info; - - BOOL success = NO; NSError *startError = nil; - - if ([registerResult isEqualToString:SDLResultWarnings] || [registerResult isEqualToString:SDLResultResumeFailed]) { - // We succeeded, but with warnings + // If the resultCode isn't success, we got a warning. Errors were handled in `didEnterStateConnected`. + if (![registerResult isEqualToString:SDLResultSuccess]) { startError = [NSError sdl_lifecycle_startedWithBadResult:registerResult info:registerInfo]; - success = YES; - } else if (![registerResult isEqualToString:SDLResultSuccess]) { - // We did not succeed in registering - startError = [NSError sdl_lifecycle_failedWithBadResult:registerResult info:registerInfo]; - success = NO; - } else { - // We succeeded - success = YES; - } - - // Notify the block, send the notification if we succeeded. - self.readyHandler(success, startError); - - if (!success) { - [self.lifecycleStateMachine transitionToState:SDLLifecycleStateReady]; - return; } + // If we got to this point, we succeeded, send the error if there was a warning. + self.readyHandler(YES, startError); [self.notificationDispatcher postNotificationName:SDLDidBecomeReady infoObject:nil]; // Send the hmi level going from NONE to whatever we're at now (could still be NONE) @@ -298,7 +297,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; [SDLDebugTool logFormat:@"SDL Error unregistering, we are going to hard disconnect: %@, response: %@", error, response]; } - [weakSelf.lifecycleStateMachine transitionToState:SDLLifecycleStateDisconnected]; + [weakSelf.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped]; }]; } @@ -366,7 +365,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; } - (void)sdl_sendRequest:(SDLRPCRequest *)request withResponseHandler:(nullable SDLResponseHandler)handler { - // We will allow things to be sent in a "SDLLifeCycleStateTransportConnected" state in the private method, but block it in the public method sendRequest:withCompletionHandler: so that the lifecycle manager can complete its setup without being bothered by developer error + // We will allow things to be sent in a "SDLLifeCycleStateConnected" state in the private method, but block it in the public method sendRequest:withCompletionHandler: so that the lifecycle manager can complete its setup without being bothered by developer error NSParameterAssert(request != nil); @@ -396,7 +395,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; return @(++self.lastCorrelationId); } -+ (BOOL)sdl_checkNotification:(NSNotification *)notification containsKindOfClass:(Class) class { ++ (BOOL)sdl_checkNotification:(NSNotification *)notification containsKindOfClass:(Class)class { NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:class], @"A notification was sent with an unanticipated object"); if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:class]) { return NO; @@ -423,11 +422,15 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; #pragma mark SDL notification observers - (void)transportDidConnect { - [self.lifecycleStateMachine transitionToState:SDLLifecycleStateTransportConnected]; + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateConnected]; } - (void)transportDidDisconnect { - [self.lifecycleStateMachine transitionToState:SDLLifecycleStateDisconnected]; + if (self.lifecycleState == SDLLifecycleStateUnregistering || self.lifecycleState == SDLLifecycleStateStopped) { + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped]; + } else { + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateReconnecting]; + } } - (void)hmiStatusDidChange:(SDLRPCNotificationNotification *)notification { @@ -454,7 +457,13 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; SDLOnAppInterfaceUnregistered *appUnregisteredNotification = notification.notification; [SDLDebugTool logFormat:@"Remote Device forced unregistration for reason: %@", appUnregisteredNotification.reason]; - [self.lifecycleStateMachine transitionToState:SDLLifecycleStateDisconnected]; + if ([self.lifecycleStateMachine isCurrentState:SDLLifecycleStateUnregistering]) { + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped]; + } else if ([self.lifecycleStateMachine isCurrentState:SDLLifecycleStateStopped]) { + return; + } else { + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateReconnecting]; + } } @end diff --git a/SmartDeviceLink/SDLListFilesResponse.h b/SmartDeviceLink/SDLListFilesResponse.h index c07d617fe..4acb007ec 100644 --- a/SmartDeviceLink/SDLListFilesResponse.h +++ b/SmartDeviceLink/SDLListFilesResponse.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLListFilesResponse : SDLRPCResponse -@property (nullable, strong, nonatomic) NSMutableArray<NSString *> *filenames; +@property (nullable, strong, nonatomic) NSArray<NSString *> *filenames; @property (strong, nonatomic) NSNumber<SDLInt> *spaceAvailable; @end diff --git a/SmartDeviceLink/SDLListFilesResponse.m b/SmartDeviceLink/SDLListFilesResponse.m index e803a83b5..56e3f0ede 100644 --- a/SmartDeviceLink/SDLListFilesResponse.m +++ b/SmartDeviceLink/SDLListFilesResponse.m @@ -17,11 +17,11 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setFilenames:(nullable NSMutableArray<NSString *> *)filenames { +- (void)setFilenames:(nullable NSArray<NSString *> *)filenames { [parameters sdl_setObject:filenames forName:SDLNameFilenames]; } -- (nullable NSMutableArray<NSString *> *)filenames { +- (nullable NSArray<NSString *> *)filenames { return [parameters objectForKey:SDLNameFilenames]; } diff --git a/SmartDeviceLink/SDLLockScreenViewController.m b/SmartDeviceLink/SDLLockScreenViewController.m index 88bd4ff74..73659eaf6 100644 --- a/SmartDeviceLink/SDLLockScreenViewController.m +++ b/SmartDeviceLink/SDLLockScreenViewController.m @@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN } - (UIStatusBarStyle)preferredStatusBarStyle { - BOOL useWhiteIcon = [self.class shouldUseWhiteForegroundForBackgroundColor:self.backgroundColor]; + BOOL useWhiteIcon = [self.class sdl_shouldUseWhiteForegroundForBackgroundColor:self.backgroundColor]; return useWhiteIcon ? UIStatusBarStyleLightContent : UIStatusBarStyleDefault; } @@ -71,15 +71,18 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Layout - (void)sdl_layoutViews { - BOOL useWhiteIcon = [self.class shouldUseWhiteForegroundForBackgroundColor:self.backgroundColor]; + UIColor *iconColor = [self.class sdl_accentColorBasedOnColor:self.backgroundColor]; - UIImage *sdlLogo = [self.class sdl_logoImageWithColor:useWhiteIcon]; - self.sdlIconImageView.image = sdlLogo; + self.sdlIconImageView.image = [self.class sdl_imageWithName:@"sdl_logo_black"]; + self.sdlIconImageView.tintColor = iconColor; - self.arrowUpImageView.image = [self.class sdl_arrowUpImageWithColor:useWhiteIcon]; - self.arrowDownImageView.image = [self.class sdl_arrowDownImageWithColor:useWhiteIcon]; - - self.lockedLabel.textColor = useWhiteIcon ? [UIColor whiteColor] : [UIColor blackColor]; + 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.lockedLabel.textColor = iconColor; if (self.vehicleIcon != nil && self.appIcon != nil) { [self sdl_setVehicleAndAppIconsLayout]; @@ -106,7 +109,8 @@ NS_ASSUME_NONNULL_BEGIN self.primaryVehicleIconImageView.image = self.vehicleIcon; self.backupImageView.image = nil; - + self.backupImageView.tintColor = nil; + self.arrowUpImageView.alpha = 1.0; self.arrowDownImageView.alpha = 1.0; @@ -118,7 +122,8 @@ NS_ASSUME_NONNULL_BEGIN self.primaryVehicleIconImageView.image = nil; self.backupImageView.image = self.appIcon; - + self.backupImageView.tintColor = nil; + self.arrowUpImageView.alpha = 0.0; self.arrowDownImageView.alpha = 0.0; @@ -130,7 +135,8 @@ NS_ASSUME_NONNULL_BEGIN self.primaryVehicleIconImageView.image = nil; self.backupImageView.image = self.vehicleIcon; - + self.backupImageView.tintColor = nil; + self.arrowUpImageView.alpha = 0.0; self.arrowDownImageView.alpha = 0.0; @@ -142,6 +148,7 @@ NS_ASSUME_NONNULL_BEGIN self.primaryVehicleIconImageView.image = nil; self.backupImageView.image = self.sdlIconImageView.image; + self.backupImageView.tintColor = [self.class sdl_accentColorBasedOnColor:self.backgroundColor]; self.arrowUpImageView.alpha = 0.0; self.arrowDownImageView.alpha = 0.0; @@ -152,20 +159,12 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Private Image -// TODO: (Joel F.)[2016-08-22] When moved to iOS 7+, use `imageWithRenderingMode:` -+ (UIImage *)sdl_logoImageWithColor:(BOOL)white { - return [self sdl_imageWithName:[NSString stringWithFormat:@"sdl_logo_%@", white ? @"white" : @"black"]]; -} - -+ (UIImage *)sdl_arrowUpImageWithColor:(BOOL)white { - return [self sdl_imageWithName:[NSString stringWithFormat:@"lock_arrow_up_%@", white ? @"white" : @"black"]]; -} - -+ (UIImage *)sdl_arrowDownImageWithColor:(BOOL)white { - return [self sdl_imageWithName:[NSString stringWithFormat:@"lock_arrow_down_%@", white ? @"white" : @"black"]]; ++ (UIColor *)sdl_accentColorBasedOnColor:(UIColor *)backgroundColor { + return [self sdl_shouldUseWhiteForegroundForBackgroundColor:backgroundColor] ? [UIColor whiteColor] : [UIColor blackColor]; } + (UIImage *)sdl_imageWithName:(NSString *)name { + UIImage* image = nil; if (SDL_SYSTEM_VERSION_LESS_THAN(@"8.0")) { NSString *bundlePath = [[NSBundle sdlBundle] bundlePath]; NSInteger deviceScale = [[UIScreen mainScreen] scale]; @@ -173,13 +172,15 @@ NS_ASSUME_NONNULL_BEGIN NSString *fileName = [NSString stringWithFormat:@"%@%li.png", name, (long)deviceScale]; NSString *fullPath = [NSString stringWithFormat:@"%@/%@", bundlePath, fileName]; NSData *imageData = [NSData dataWithContentsOfFile:fullPath]; - return [UIImage imageWithData:imageData]; + image = [UIImage imageWithData:imageData]; } else { - return [UIImage imageNamed:name inBundle:[NSBundle sdlBundle] compatibleWithTraitCollection:nil]; + image = [UIImage imageNamed:name inBundle:[NSBundle sdlBundle] compatibleWithTraitCollection:nil]; } + + return [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; } -+ (BOOL)shouldUseWhiteForegroundForBackgroundColor:(UIColor *)backgroundColor { ++ (BOOL)sdl_shouldUseWhiteForegroundForBackgroundColor:(UIColor *)backgroundColor { CGFloat red, green, blue; [backgroundColor getRed:&red green:&green blue:&blue alpha:nil]; diff --git a/SmartDeviceLink/SDLManager.h b/SmartDeviceLink/SDLManager.h index 64d1748bb..e42f1cd19 100644 --- a/SmartDeviceLink/SDLManager.h +++ b/SmartDeviceLink/SDLManager.h @@ -94,6 +94,8 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error); /** * Stop the manager, it will disconnect if needed and no longer look for a connection. You probably don't need to call this method ever. + * + * If you do call this method, you must wait for SDLManagerDelegate's managerDidDisconnect callback to call startWithReadyHandler:. */ - (void)stop; diff --git a/SmartDeviceLink/SDLNames.h b/SmartDeviceLink/SDLNames.h index 10cc8c0f3..70a1ae973 100644 --- a/SmartDeviceLink/SDLNames.h +++ b/SmartDeviceLink/SDLNames.h @@ -97,6 +97,7 @@ extern SDLName const SDLNameDriverBeltDeployed; extern SDLName const SDLNameDriverBraking; extern SDLName const SDLNameDriverBuckleBelted; extern SDLName const SDLNameDriverCurtainAirbagDeployed; +extern SDLName const SDLNameDriverDistractionStatus; extern SDLName const SDLNameDriverDoorAjar; extern SDLName const SDLNameDriverKneeAirbagDeployed; extern SDLName const SDLNameDriverSideAirbagDeployed; @@ -256,6 +257,7 @@ extern SDLName const SDLNameOnHashChange; extern SDLName const SDLNameOnHMIStatus; extern SDLName const SDLNameOnKeyboardInput; extern SDLName const SDLNameOnLanguageChange; +extern SDLName const SDLNameOnLockScreenStatus; extern SDLName const SDLNameOnPermissionsChange; extern SDLName const SDLNameOnScreenPresetsAvailable; extern SDLName const SDLNameOnSyncPData; @@ -420,6 +422,7 @@ extern SDLName const SDLNameUpDownAvailable; extern SDLName const SDLNameURL; extern SDLName const SDLNameURLUppercase; extern SDLName const SDLNameUserDisallowed; +extern SDLName const SDLNameUserSelected; extern SDLName const SDLNameUTCDay; extern SDLName const SDLNameUTCHours; extern SDLName const SDLNameUTCMinutes; diff --git a/SmartDeviceLink/SDLNames.m b/SmartDeviceLink/SDLNames.m index c33df5b44..b1bbb7364 100644 --- a/SmartDeviceLink/SDLNames.m +++ b/SmartDeviceLink/SDLNames.m @@ -94,6 +94,7 @@ SDLName const SDLNameDriverBeltDeployed = @"driverBeltDeployed"; SDLName const SDLNameDriverBraking = @"driverBraking"; SDLName const SDLNameDriverBuckleBelted = @"driverBuckleBelted"; SDLName const SDLNameDriverCurtainAirbagDeployed = @"driverCurtainAirbagDeployed"; +SDLName const SDLNameDriverDistractionStatus = @"driverDistractionStatus"; SDLName const SDLNameDriverDoorAjar = @"driverDoorAjar"; SDLName const SDLNameDriverKneeAirbagDeployed = @"driverKneeAirbagDeployed"; SDLName const SDLNameDriverSideAirbagDeployed = @"driverSideAirbagDeployed"; @@ -141,6 +142,7 @@ SDLName const SDLNameHighBeamsOn = @"highBeamsOn"; SDLName const SDLNameHMIDisplayLanguage = @"hmiDisplayLanguage"; SDLName const SDLNameHMIDisplayLanguageDesired = @"hmiDisplayLanguageDesired"; SDLName const SDLNameHMILevel = @"hmiLevel"; +SDLName const SDLNameHMILevelLowercase = @"hmilevel"; SDLName const SDLNameHMIPermissions = @"hmiPermissions"; SDLName const SDLNameHMICapabilities = @"hmiCapabilities"; SDLName const SDLNameHMIZoneCapabilities = @"hmiZoneCapabilities"; @@ -253,6 +255,7 @@ SDLName const SDLNameOnHashChange = @"OnHashChange"; SDLName const SDLNameOnHMIStatus = @"OnHMIStatus"; SDLName const SDLNameOnKeyboardInput = @"OnKeyboardInput"; SDLName const SDLNameOnLanguageChange = @"OnLanguageChange"; +SDLName const SDLNameOnLockScreenStatus = @"OnLockScreenStatus"; SDLName const SDLNameOnPermissionsChange = @"OnPermissionsChange"; SDLName const SDLNameOnScreenPresetsAvailable = @"onScreenPresetsAvailable"; SDLName const SDLNameOnSyncPData = @"OnSyncPData"; @@ -418,6 +421,7 @@ SDLName const SDLNameUpDownAvailable = @"upDownAvailable"; SDLName const SDLNameURL = @"url"; SDLName const SDLNameURLUppercase = @"URL"; SDLName const SDLNameUserDisallowed = @"userDisallowed"; +SDLName const SDLNameUserSelected = @"userSelected"; SDLName const SDLNameUTCDay = @"utcDay"; SDLName const SDLNameUTCHours = @"utcHours"; SDLName const SDLNameUTCMinutes = @"utcMinutes"; diff --git a/SmartDeviceLink/SDLOnEncodedSyncPData.h b/SmartDeviceLink/SDLOnEncodedSyncPData.h index 9bcbdae45..4694cf798 100644 --- a/SmartDeviceLink/SDLOnEncodedSyncPData.h +++ b/SmartDeviceLink/SDLOnEncodedSyncPData.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLOnEncodedSyncPData : SDLRPCNotification -@property (strong, nonatomic) NSMutableArray<NSString *> *data; +@property (strong, nonatomic) NSArray<NSString *> *data; @property (nullable, strong, nonatomic) NSString *URL; @property (nullable, strong, nonatomic) NSNumber<SDLInt> *Timeout; diff --git a/SmartDeviceLink/SDLOnEncodedSyncPData.m b/SmartDeviceLink/SDLOnEncodedSyncPData.m index 3a8eefe78..d9796b4cb 100644 --- a/SmartDeviceLink/SDLOnEncodedSyncPData.m +++ b/SmartDeviceLink/SDLOnEncodedSyncPData.m @@ -16,11 +16,11 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setData:(NSMutableArray<NSString *> *)data { +- (void)setData:(NSArray<NSString *> *)data { [parameters sdl_setObject:data forName:SDLNameData]; } -- (NSMutableArray<NSString *> *)data { +- (NSArray<NSString *> *)data { return [parameters sdl_objectForName:SDLNameData]; } diff --git a/SmartDeviceLink/SDLOnLockScreenStatus.m b/SmartDeviceLink/SDLOnLockScreenStatus.m index 77b8c5848..d2007956e 100644 --- a/SmartDeviceLink/SDLOnLockScreenStatus.m +++ b/SmartDeviceLink/SDLOnLockScreenStatus.m @@ -8,47 +8,48 @@ #import "NSMutableDictionary+Store.h" #import "SDLHMILevel.h" #import "SDLLockScreenStatus.h" +#import "SDLNames.h" NS_ASSUME_NONNULL_BEGIN @implementation SDLOnLockScreenStatus - (instancetype)init { - if (self = [super initWithName:@"OnLockScreenStatus"]) { + if (self = [super initWithName:SDLNameOnLockScreenStatus]) { } return self; } - (void)setLockScreenStatus:(SDLLockScreenStatus)lockScreenStatus { - [parameters sdl_setObject:lockScreenStatus forName:@"OnLockScreenStatus"]; + [parameters sdl_setObject:lockScreenStatus forName:SDLNameOnLockScreenStatus]; } - (SDLLockScreenStatus)lockScreenStatus { - return [parameters sdl_objectForName:@"OnLockScreenStatus"]; + return [parameters sdl_objectForName:SDLNameOnLockScreenStatus]; } - (void)setHmiLevel:(SDLHMILevel)hmiLevel { - [parameters sdl_setObject:hmiLevel forName:@"hmilevel"]; + [parameters sdl_setObject:hmiLevel forName:SDLNameHMILevel]; } - (SDLHMILevel)hmiLevel { - return [parameters sdl_objectForName:@"hmilevel"]; + return [parameters sdl_objectForName:SDLNameHMILevel]; } - (void)setUserSelected:(NSNumber<SDLBool> *)userSelected { - [parameters sdl_setObject:userSelected forName:@"userselected"]; + [parameters sdl_setObject:userSelected forName:SDLNameUserSelected]; } - (NSNumber<SDLBool> *)userSelected { - return [parameters sdl_objectForName:@"userselected"]; + return [parameters sdl_objectForName:SDLNameUserSelected]; } - (void)setDriverDistractionStatus:(NSNumber<SDLBool> *)driverDistractionStatus { - [parameters sdl_setObject:driverDistractionStatus forName:@"driverdistractionstatus"]; + [parameters sdl_setObject:driverDistractionStatus forName:SDLNameDriverDistractionStatus]; } - (NSNumber<SDLBool> *)driverDistractionStatus { - return [parameters sdl_objectForName:@"driverdistractionstatus"]; + return [parameters sdl_objectForName:SDLNameDriverDistractionStatus]; } @end diff --git a/SmartDeviceLink/SDLOnPermissionsChange.h b/SmartDeviceLink/SDLOnPermissionsChange.h index daec5ec66..007a5e736 100644 --- a/SmartDeviceLink/SDLOnPermissionsChange.h +++ b/SmartDeviceLink/SDLOnPermissionsChange.h @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN * * @see SDLPermissionItem */ -@property (strong, nonatomic) NSMutableArray<SDLPermissionItem *> *permissionItem; +@property (strong, nonatomic) NSArray<SDLPermissionItem *> *permissionItem; @end diff --git a/SmartDeviceLink/SDLOnPermissionsChange.m b/SmartDeviceLink/SDLOnPermissionsChange.m index d6350f2b2..da908698a 100644 --- a/SmartDeviceLink/SDLOnPermissionsChange.m +++ b/SmartDeviceLink/SDLOnPermissionsChange.m @@ -17,21 +17,12 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setPermissionItem:(NSMutableArray<SDLPermissionItem *> *)permissionItem { +- (void)setPermissionItem:(NSArray<SDLPermissionItem *> *)permissionItem { [parameters sdl_setObject:permissionItem forName:SDLNamePermissionItem]; } -- (NSMutableArray<SDLPermissionItem *> *)permissionItem { - NSMutableArray<SDLPermissionItem *> *array = [parameters sdl_objectForName:SDLNamePermissionItem]; - if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLPermissionItem.class]) { - return array; - } else { - NSMutableArray<SDLPermissionItem *> *newList = [NSMutableArray arrayWithCapacity:[array count]]; - for (NSDictionary<NSString *, id> *dict in array) { - [newList addObject:[[SDLPermissionItem alloc] initWithDictionary:(NSDictionary *)dict]]; - } - return newList; - } +- (NSArray<SDLPermissionItem *> *)permissionItem { + return [parameters sdl_objectsForName:SDLNamePermissionItem ofClass:SDLPermissionItem.class]; } @end diff --git a/SmartDeviceLink/SDLOnTouchEvent.h b/SmartDeviceLink/SDLOnTouchEvent.h index 21b3e1c5b..f9fa91907 100644 --- a/SmartDeviceLink/SDLOnTouchEvent.h +++ b/SmartDeviceLink/SDLOnTouchEvent.h @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLOnTouchEvent : SDLRPCNotification @property (strong, nonatomic) SDLTouchType type; -@property (strong, nonatomic) NSMutableArray<SDLTouchEvent *> *event; +@property (strong, nonatomic) NSArray<SDLTouchEvent *> *event; @end diff --git a/SmartDeviceLink/SDLOnTouchEvent.m b/SmartDeviceLink/SDLOnTouchEvent.m index e0fc56bb5..08cb844c1 100644 --- a/SmartDeviceLink/SDLOnTouchEvent.m +++ b/SmartDeviceLink/SDLOnTouchEvent.m @@ -26,21 +26,12 @@ NS_ASSUME_NONNULL_BEGIN return (SDLTouchType)obj; } -- (void)setEvent:(NSMutableArray<SDLTouchEvent *> *)event { +- (void)setEvent:(NSArray<SDLTouchEvent *> *)event { [parameters sdl_setObject:event forName:SDLNameEvent]; } -- (NSMutableArray<SDLTouchEvent *> *)event { - NSMutableArray<SDLTouchEvent *> *array = [parameters sdl_objectForName:SDLNameEvent]; - if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLTouchEvent.class]) { - return array; - } else { - NSMutableArray<SDLTouchEvent *> *newList = [NSMutableArray arrayWithCapacity:[array count]]; - for (NSDictionary<NSString *, id> *dict in array) { - [newList addObject:[[SDLTouchEvent alloc] initWithDictionary:(NSDictionary *)dict]]; - } - return newList; - } +- (NSArray<SDLTouchEvent *> *)event { + return [parameters sdl_objectsForName:SDLNameEvent ofClass:SDLTouchEvent.class]; } @end diff --git a/SmartDeviceLink/SDLParameterPermissions.h b/SmartDeviceLink/SDLParameterPermissions.h index c2356665a..0a1bdcc00 100644 --- a/SmartDeviceLink/SDLParameterPermissions.h +++ b/SmartDeviceLink/SDLParameterPermissions.h @@ -19,13 +19,13 @@ NS_ASSUME_NONNULL_BEGIN * * Required, Array of String, max String length = 100, Array size 0 - 100 */ -@property (strong, nonatomic) NSMutableArray<NSString *> *allowed; +@property (strong, nonatomic) NSArray<NSString *> *allowed; /** * @abstract A set of all parameters that are prohibited for this given RPC. * * Required, Array of String, max String length = 100, Array size 0 - 100 */ -@property (strong, nonatomic) NSMutableArray<NSString *> *userDisallowed; +@property (strong, nonatomic) NSArray<NSString *> *userDisallowed; @end diff --git a/SmartDeviceLink/SDLParameterPermissions.m b/SmartDeviceLink/SDLParameterPermissions.m index 9f1db88e0..bcc2f7047 100644 --- a/SmartDeviceLink/SDLParameterPermissions.m +++ b/SmartDeviceLink/SDLParameterPermissions.m @@ -11,19 +11,19 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLParameterPermissions -- (void)setAllowed:(NSMutableArray<NSString *> *)allowed { +- (void)setAllowed:(NSArray<NSString *> *)allowed { [store sdl_setObject:allowed forName:SDLNameAllowed]; } -- (NSMutableArray<NSString *> *)allowed { +- (NSArray<NSString *> *)allowed { return [store sdl_objectForName:SDLNameAllowed]; } -- (void)setUserDisallowed:(NSMutableArray<NSString *> *)userDisallowed { +- (void)setUserDisallowed:(NSArray<NSString *> *)userDisallowed { [store sdl_setObject:userDisallowed forName:SDLNameUserDisallowed]; } -- (NSMutableArray<NSString *> *)userDisallowed { +- (NSArray<NSString *> *)userDisallowed { return [store sdl_objectForName:SDLNameUserDisallowed]; } diff --git a/SmartDeviceLink/SDLPerformAudioPassThru.h b/SmartDeviceLink/SDLPerformAudioPassThru.h index a48a44cbb..bd8ca6a4c 100644 --- a/SmartDeviceLink/SDLPerformAudioPassThru.h +++ b/SmartDeviceLink/SDLPerformAudioPassThru.h @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN * <li>Array Maxsize: 100</li> * </ul> */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLTTSChunk *> *initialPrompt; +@property (nullable, strong, nonatomic) NSArray<SDLTTSChunk *> *initialPrompt; /** * @abstract a line of text displayed during audio capture * @discussion audioPassThruDisplayText1 diff --git a/SmartDeviceLink/SDLPerformAudioPassThru.m b/SmartDeviceLink/SDLPerformAudioPassThru.m index d137400f3..06611af6b 100644 --- a/SmartDeviceLink/SDLPerformAudioPassThru.m +++ b/SmartDeviceLink/SDLPerformAudioPassThru.m @@ -46,11 +46,11 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setInitialPrompt:(nullable NSMutableArray<SDLTTSChunk *> *)initialPrompt { +- (void)setInitialPrompt:(nullable NSArray<SDLTTSChunk *> *)initialPrompt { [parameters sdl_setObject:initialPrompt forName:SDLNameInitialPrompt]; } -- (nullable NSMutableArray<SDLTTSChunk *> *)initialPrompt { +- (nullable NSArray<SDLTTSChunk *> *)initialPrompt { return [parameters sdl_objectsForName:SDLNameInitialPrompt ofClass:SDLTTSChunk.class]; } diff --git a/SmartDeviceLink/SDLPerformInteraction.h b/SmartDeviceLink/SDLPerformInteraction.h index 4c61a9fd4..c8d27e22a 100644 --- a/SmartDeviceLink/SDLPerformInteraction.h +++ b/SmartDeviceLink/SDLPerformInteraction.h @@ -57,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN * @abstract An array of one or more TTSChunks that, taken together, specify * what is to be spoken to the user at the start of an interaction */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLTTSChunk *> *initialPrompt; +@property (nullable, strong, nonatomic) NSArray<SDLTTSChunk *> *initialPrompt; /** * @abstract The Indicates mode that indicate how user selects interaction * choice. User can choose either by voice (VR_ONLY), by visual selection @@ -68,17 +68,17 @@ NS_ASSUME_NONNULL_BEGIN * @abstract A Vector<Integer> value representing an Array of one or more Choice * Set IDs */ -@property (strong, nonatomic) NSMutableArray<NSNumber<SDLInt> *> *interactionChoiceSetIDList; +@property (strong, nonatomic) NSArray<NSNumber<SDLInt> *> *interactionChoiceSetIDList; /** * @abstract A Vector<TTSChunk> which taken together, specify the help phrase to * be spoken when the user says "help" during the VR session */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLTTSChunk *> *helpPrompt; +@property (nullable, strong, nonatomic) NSArray<SDLTTSChunk *> *helpPrompt; /** * @abstract An array of TTSChunks which, taken together, specify the phrase to * be spoken when the listen times out during the VR session */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLTTSChunk *> *timeoutPrompt; +@property (nullable, strong, nonatomic) NSArray<SDLTTSChunk *> *timeoutPrompt; /** * @abstract An Integer value representing the amount of time, in milliseconds, * SDL will wait for the user to make a choice (VR or Menu) @@ -89,7 +89,7 @@ NS_ASSUME_NONNULL_BEGIN * display on-screen during Perform Interaction * @since SmartDeviceLink 2.0 */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLVRHelpItem *> *vrHelp; +@property (nullable, strong, nonatomic) NSArray<SDLVRHelpItem *> *vrHelp; @property (nullable, strong, nonatomic) SDLLayoutMode interactionLayout; @end diff --git a/SmartDeviceLink/SDLPerformInteraction.m b/SmartDeviceLink/SDLPerformInteraction.m index 708902eb1..b5208e914 100644 --- a/SmartDeviceLink/SDLPerformInteraction.m +++ b/SmartDeviceLink/SDLPerformInteraction.m @@ -51,9 +51,9 @@ NS_ASSUME_NONNULL_BEGIN } - (instancetype)initWithInitialPrompt:(nullable NSString *)initialPrompt initialText:(NSString *)initialText interactionChoiceSetIDList:(NSArray<NSNumber<SDLUInt> *> *)interactionChoiceSetIDList helpPrompt:(nullable NSString *)helpPrompt timeoutPrompt:(nullable NSString *)timeoutPrompt interactionMode:(SDLInteractionMode)interactionMode timeout:(UInt32)timeout vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp { - NSMutableArray *initialChunks = [SDLTTSChunk textChunksFromString:initialPrompt]; - NSMutableArray *helpChunks = [SDLTTSChunk textChunksFromString:helpPrompt]; - NSMutableArray *timeoutChunks = [SDLTTSChunk textChunksFromString:timeoutPrompt]; + NSArray *initialChunks = [SDLTTSChunk textChunksFromString:initialPrompt]; + NSArray *helpChunks = [SDLTTSChunk textChunksFromString:helpPrompt]; + NSArray *timeoutChunks = [SDLTTSChunk textChunksFromString:timeoutPrompt]; return [self initWithInitialChunks:initialChunks initialText:initialText interactionChoiceSetIDList:interactionChoiceSetIDList helpChunks:helpChunks timeoutChunks:timeoutChunks interactionMode:interactionMode timeout:timeout vrHelp:vrHelp]; } @@ -98,11 +98,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameInitialText]; } -- (void)setInitialPrompt:(nullable NSMutableArray<SDLTTSChunk *> *)initialPrompt { +- (void)setInitialPrompt:(nullable NSArray<SDLTTSChunk *> *)initialPrompt { [parameters sdl_setObject:initialPrompt forName:SDLNameInitialPrompt]; } -- (nullable NSMutableArray<SDLTTSChunk *> *)initialPrompt { +- (nullable NSArray<SDLTTSChunk *> *)initialPrompt { return [parameters sdl_objectsForName:SDLNameInitialPrompt ofClass:SDLTTSChunk.class]; } @@ -114,27 +114,27 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameInteractionMode]; } -- (void)setInteractionChoiceSetIDList:(NSMutableArray<NSNumber<SDLInt> *> *)interactionChoiceSetIDList { +- (void)setInteractionChoiceSetIDList:(NSArray<NSNumber<SDLInt> *> *)interactionChoiceSetIDList { [parameters sdl_setObject:interactionChoiceSetIDList forName:SDLNameInteractionChoiceSetIdList]; } -- (NSMutableArray<NSNumber<SDLInt> *> *)interactionChoiceSetIDList { +- (NSArray<NSNumber<SDLInt> *> *)interactionChoiceSetIDList { return [parameters sdl_objectForName:SDLNameInteractionChoiceSetIdList]; } -- (void)setHelpPrompt:(nullable NSMutableArray<SDLTTSChunk *> *)helpPrompt { +- (void)setHelpPrompt:(nullable NSArray<SDLTTSChunk *> *)helpPrompt { [parameters sdl_setObject:helpPrompt forName:SDLNameHelpPrompt]; } -- (nullable NSMutableArray<SDLTTSChunk *> *)helpPrompt { +- (nullable NSArray<SDLTTSChunk *> *)helpPrompt { return [parameters sdl_objectsForName:SDLNameHelpPrompt ofClass:SDLTTSChunk.class]; } -- (void)setTimeoutPrompt:(nullable NSMutableArray<SDLTTSChunk *> *)timeoutPrompt { +- (void)setTimeoutPrompt:(nullable NSArray<SDLTTSChunk *> *)timeoutPrompt { [parameters sdl_setObject:timeoutPrompt forName:SDLNameTimeoutPrompt]; } -- (nullable NSMutableArray<SDLTTSChunk *> *)timeoutPrompt { +- (nullable NSArray<SDLTTSChunk *> *)timeoutPrompt { return [parameters sdl_objectsForName:SDLNameTimeoutPrompt ofClass:SDLTTSChunk.class]; } @@ -146,11 +146,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameTimeout]; } -- (void)setVrHelp:(nullable NSMutableArray<SDLVRHelpItem *> *)vrHelp { +- (void)setVrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp { [parameters sdl_setObject:vrHelp forName:SDLNameVRHelp]; } -- (nullable NSMutableArray<SDLVRHelpItem *> *)vrHelp { +- (nullable NSArray<SDLVRHelpItem *> *)vrHelp { return [parameters sdl_objectsForName:SDLNameVRHelp ofClass:SDLVRHelpItem.class]; } diff --git a/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink/SDLProxy.m index 250c888d0..afa0675fb 100644 --- a/SmartDeviceLink/SDLProxy.m +++ b/SmartDeviceLink/SDLProxy.m @@ -38,7 +38,6 @@ #import "SDLSystemContext.h" #import "SDLSystemRequest.h" #import "SDLTimer.h" -#import "SDLURLSession.h" #import "SDLVehicleType.h" NS_ASSUME_NONNULL_BEGIN @@ -52,6 +51,7 @@ NSString *const SDLProxyVersion = @"4.5.1"; const float startSessionTime = 10.0; const float notifyProxyClosedDelay = 0.1; const int POLICIES_CORRELATION_ID = 65535; +static float DefaultConnectionTimeout = 45.0; @interface SDLProxy () { SDLLockScreenStatusManager *_lsm; @@ -62,6 +62,7 @@ const int POLICIES_CORRELATION_ID = 65535; @property (nullable, nonatomic, strong, readwrite) SDLStreamingMediaManager *streamingMediaManager; @property (nullable, nonatomic, strong) SDLDisplayCapabilities *displayCapabilities; @property (nonatomic, strong) NSMutableDictionary<SDLVehicleMake *, Class> *securityManagers; +@property (nonatomic, strong) NSURLSession* urlSession; @end @@ -86,6 +87,14 @@ const int POLICIES_CORRELATION_ID = 65535; [SDLDebugTool logInfo:@"SDLProxy initWithTransport"]; [[EAAccessoryManager sharedAccessoryManager] registerForLocalNotifications]; + + NSURLSessionConfiguration* configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; + configuration.timeoutIntervalForRequest = DefaultConnectionTimeout; + configuration.timeoutIntervalForResource = DefaultConnectionTimeout; + configuration.requestCachePolicy = NSURLRequestUseProtocolCachePolicy; + + _urlSession = [NSURLSession sessionWithConfiguration:configuration]; + } return self; @@ -98,9 +107,9 @@ const int POLICIES_CORRELATION_ID = 65535; [[NSNotificationCenter defaultCenter] removeObserver:self]; [[EAAccessoryManager sharedAccessoryManager] unregisterForLocalNotifications]; - - [[SDLURLSession defaultSession] cancelAllTasks]; - + + [_urlSession invalidateAndCancel]; + [SDLDebugTool logInfo:@"SDLProxy Dealloc" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:_debugConsoleGroupName]; } @@ -509,17 +518,17 @@ const int POLICIES_CORRELATION_ID = 65535; } - (void)handleSystemRequestLockScreenIconURL:(SDLOnSystemRequest *)request { - [[SDLURLSession defaultSession] dataFromURL:[NSURL URLWithString:request.url] - completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - if (error != nil) { - NSString *logMessage = [NSString stringWithFormat:@"OnSystemRequest failure (HTTP response), download task failed: %@", error.localizedDescription]; - [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - return; - } - - UIImage *icon = [UIImage imageWithData:data]; - [self invokeMethodOnDelegates:@selector(onReceivedLockScreenIcon:) withObject:icon]; - }]; + [self sdl_sendDataTaskWithURL:[NSURL URLWithString:request.url] + completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + if (error != nil) { + NSString *logMessage = [NSString stringWithFormat:@"OnSystemRequest failure (HTTP response), download task failed: %@", error.localizedDescription]; + [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; + return; + } + + UIImage *icon = [UIImage imageWithData:data]; + [self invokeMethodOnDelegates:@selector(onReceivedLockScreenIcon:) withObject:icon]; + }]; } - (void)sdl_handleSystemRequestHTTP:(SDLOnSystemRequest *)request { @@ -613,7 +622,7 @@ const int POLICIES_CORRELATION_ID = 65535; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; // Create the upload task - [[SDLURLSession defaultSession] uploadWithURLRequest:request data:data completionHandler:completionHandler]; + [self sdl_sendUploadRequest:request withData:data completionHandler:completionHandler]; } /** @@ -649,9 +658,26 @@ const int POLICIES_CORRELATION_ID = 65535; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; // Create the upload task - [[SDLURLSession defaultSession] uploadWithURLRequest:request data:bodyData completionHandler:completionHandler]; + [self sdl_sendUploadRequest:request withData:bodyData completionHandler:completionHandler]; } +- (void)sdl_sendUploadRequest:(NSURLRequest*)request withData:(NSData*)data completionHandler:(URLSessionTaskCompletionHandler)completionHandler { + NSMutableURLRequest* mutableRequest = [request mutableCopy]; + + if ([mutableRequest.URL.scheme isEqualToString:@"http"]) { + mutableRequest.URL = [NSURL URLWithString:[mutableRequest.URL.absoluteString stringByReplacingCharactersInRange:NSMakeRange(0, 4) withString:@"https"]]; + } + + [[self.urlSession uploadTaskWithRequest:request fromData:data completionHandler:completionHandler] resume]; +} + +- (void)sdl_sendDataTaskWithURL:(NSURL*)url completionHandler:(URLSessionTaskCompletionHandler)completionHandler { + if ([url.scheme isEqualToString:@"http"]) { + url = [NSURL URLWithString:[url.absoluteString stringByReplacingCharactersInRange:NSMakeRange(0, 4) withString:@"https"]]; + } + + [[self.urlSession dataTaskWithURL:url completionHandler:completionHandler] resume]; +} #pragma mark - Delegate management @@ -704,11 +730,11 @@ const int POLICIES_CORRELATION_ID = 65535; } // Send the HTTP Request - [[SDLURLSession defaultSession] uploadWithURLRequest:request - data:data - completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + [[self.urlSession uploadTaskWithRequest:request + fromData:data + completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { [self syncPDataNetworkRequestCompleteWithData:data response:response error:error]; - }]; + }] resume]; [SDLDebugTool logInfo:@"OnEncodedSyncPData (HTTP request)" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; } diff --git a/SmartDeviceLink/SDLReadDID.h b/SmartDeviceLink/SDLReadDID.h index d275f694e..153ea6a59 100644 --- a/SmartDeviceLink/SDLReadDID.h +++ b/SmartDeviceLink/SDLReadDID.h @@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN * <li>ArrayMin:0; ArrayMax:1000</li> * </ul> */ -@property (strong, nonatomic) NSMutableArray<NSNumber<SDLInt> *> *didLocation; +@property (strong, nonatomic) NSArray<NSNumber<SDLInt> *> *didLocation; @end diff --git a/SmartDeviceLink/SDLReadDID.m b/SmartDeviceLink/SDLReadDID.m index 5c491825e..9e2a906fd 100644 --- a/SmartDeviceLink/SDLReadDID.m +++ b/SmartDeviceLink/SDLReadDID.m @@ -37,11 +37,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameECUName]; } -- (void)setDidLocation:(NSMutableArray<NSNumber<SDLInt> *> *)didLocation { +- (void)setDidLocation:(NSArray<NSNumber<SDLInt> *> *)didLocation { [parameters sdl_setObject:didLocation forName:SDLNameDIDLocation]; } -- (NSMutableArray<NSNumber<SDLInt> *> *)didLocation { +- (NSArray<NSNumber<SDLInt> *> *)didLocation { return [parameters sdl_objectForName:SDLNameDIDLocation]; } diff --git a/SmartDeviceLink/SDLReadDIDResponse.h b/SmartDeviceLink/SDLReadDIDResponse.h index 7fcd0ed9c..850940944 100644 --- a/SmartDeviceLink/SDLReadDIDResponse.h +++ b/SmartDeviceLink/SDLReadDIDResponse.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLReadDIDResponse : SDLRPCResponse -@property (nullable, strong, nonatomic) NSMutableArray<SDLDIDResult *> *didResult; +@property (nullable, strong, nonatomic) NSArray<SDLDIDResult *> *didResult; @end diff --git a/SmartDeviceLink/SDLReadDIDResponse.m b/SmartDeviceLink/SDLReadDIDResponse.m index a0f71b20e..5b3901950 100644 --- a/SmartDeviceLink/SDLReadDIDResponse.m +++ b/SmartDeviceLink/SDLReadDIDResponse.m @@ -18,11 +18,11 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setDidResult:(nullable NSMutableArray<SDLDIDResult *> *)didResult { +- (void)setDidResult:(nullable NSArray<SDLDIDResult *> *)didResult { [parameters sdl_setObject:didResult forName:SDLNameDIDResult]; } -- (nullable NSMutableArray<SDLDIDResult *> *)didResult { +- (nullable NSArray<SDLDIDResult *> *)didResult { return [parameters sdl_objectsForName:SDLNameDIDResult ofClass:SDLDIDResult.class]; } diff --git a/SmartDeviceLink/SDLRegisterAppInterface.h b/SmartDeviceLink/SDLRegisterAppInterface.h index a8b6fdc37..6201dfbfe 100644 --- a/SmartDeviceLink/SDLRegisterAppInterface.h +++ b/SmartDeviceLink/SDLRegisterAppInterface.h @@ -130,7 +130,7 @@ NS_ASSUME_NONNULL_BEGIN * @since SDL 2.0 * @see SDLTTSChunk */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLTTSChunk *> *ttsName; +@property (nullable, strong, nonatomic) NSArray<SDLTTSChunk *> *ttsName; /** * @abstract A String representing an abbreviated version of the mobile application's name (if necessary) that will be displayed on the media screen @@ -148,7 +148,7 @@ NS_ASSUME_NONNULL_BEGIN * * Optional, Array of Strings, Array length 1 - 100, Max String length 40 */ -@property (nullable, strong, nonatomic) NSMutableArray<NSString *> *vrSynonyms; +@property (nullable, strong, nonatomic) NSArray<NSString *> *vrSynonyms; /** * @abstract Indicates if the application is a media or a non-media application. @@ -187,7 +187,7 @@ NS_ASSUME_NONNULL_BEGIN * @since SDL 2.0 * @see SDLAppHMIType */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLAppHMIType> *appHMIType; +@property (nullable, strong, nonatomic) NSArray<SDLAppHMIType> *appHMIType; /** * @abstract ID used to uniquely identify current state of all app data that can persist through connection cycles (e.g. ignition cycles). diff --git a/SmartDeviceLink/SDLRegisterAppInterface.m b/SmartDeviceLink/SDLRegisterAppInterface.m index acf94b418..7cf17ba86 100644 --- a/SmartDeviceLink/SDLRegisterAppInterface.m +++ b/SmartDeviceLink/SDLRegisterAppInterface.m @@ -56,7 +56,7 @@ NS_ASSUME_NONNULL_BEGIN self.isMediaApplication = @(isMediaApp); if (appType != nil) { - self.appHMIType = [NSMutableArray arrayWithObject:appType]; + self.appHMIType = [NSArray arrayWithObject:appType]; } self.ngnMediaScreenAppName = shortAppName; @@ -94,11 +94,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameAppName]; } -- (void)setTtsName:(nullable NSMutableArray<SDLTTSChunk *> *)ttsName { +- (void)setTtsName:(nullable NSArray<SDLTTSChunk *> *)ttsName { [parameters sdl_setObject:ttsName forName:SDLNameTTSName]; } -- (nullable NSMutableArray<SDLTTSChunk *> *)ttsName { +- (nullable NSArray<SDLTTSChunk *> *)ttsName { return [parameters sdl_objectsForName:SDLNameTTSName ofClass:SDLTTSChunk.class]; } @@ -110,11 +110,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameNGNMediaScreenAppName]; } -- (void)setVrSynonyms:(nullable NSMutableArray<NSString *> *)vrSynonyms { +- (void)setVrSynonyms:(nullable NSArray<NSString *> *)vrSynonyms { [parameters sdl_setObject:vrSynonyms forName:SDLNameVRSynonyms]; } -- (nullable NSMutableArray<NSString *> *)vrSynonyms { +- (nullable NSArray<NSString *> *)vrSynonyms { return [parameters sdl_objectForName:SDLNameVRSynonyms]; } @@ -142,12 +142,12 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameHMIDisplayLanguageDesired]; } -- (void)setAppHMIType:(nullable NSMutableArray<SDLAppHMIType> *)appHMIType { +- (void)setAppHMIType:(nullable NSArray<SDLAppHMIType> *)appHMIType { [parameters sdl_setObject:appHMIType forName:SDLNameAppHMIType]; } -- (nullable NSMutableArray<SDLAppHMIType> *)appHMIType { - return [parameters sdl_enumsForName:SDLNameAppHMIType]; +- (nullable NSArray<SDLAppHMIType> *)appHMIType { + return [parameters sdl_objectForName:SDLNameAppHMIType]; } - (void)setHashID:(nullable NSString *)hashID { diff --git a/SmartDeviceLink/SDLRegisterAppInterfaceResponse.h b/SmartDeviceLink/SDLRegisterAppInterfaceResponse.h index 32dc5e40c..1c19d75e4 100644 --- a/SmartDeviceLink/SDLRegisterAppInterfaceResponse.h +++ b/SmartDeviceLink/SDLRegisterAppInterfaceResponse.h @@ -68,7 +68,7 @@ NS_ASSUME_NONNULL_BEGIN * * Optional, Array of length 1 - 100, of SDLButtonCapabilities */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLButtonCapabilities *> *buttonCapabilities; +@property (nullable, strong, nonatomic) NSArray<SDLButtonCapabilities *> *buttonCapabilities; /** * If returned, the platform supports on-screen SoftButtons @@ -77,7 +77,7 @@ NS_ASSUME_NONNULL_BEGIN * * Optional, Array of length 1 - 100, of SDLSoftButtonCapabilities */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLSoftButtonCapabilities *> *softButtonCapabilities; +@property (nullable, strong, nonatomic) NSArray<SDLSoftButtonCapabilities *> *softButtonCapabilities; /** * If returned, the platform supports custom on-screen Presets @@ -93,35 +93,35 @@ NS_ASSUME_NONNULL_BEGIN * * Optional, Array of length 1 - 100, of SDLHMIZoneCapabilities */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLHMIZoneCapabilities> *hmiZoneCapabilities; +@property (nullable, strong, nonatomic) NSArray<SDLHMIZoneCapabilities> *hmiZoneCapabilities; /** * @see SDLSpeechCapabilities * * Optional, Array of length 1 - 100, of SDLSpeechCapabilities */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLSpeechCapabilities> *speechCapabilities; +@property (nullable, strong, nonatomic) NSArray<SDLSpeechCapabilities> *speechCapabilities; /** * @see SDLPrerecordedSpeech * * Optional, Array of length 1 - 100, of SDLPrerecordedSpeech */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLPrerecordedSpeech> *prerecordedSpeech; +@property (nullable, strong, nonatomic) NSArray<SDLPrerecordedSpeech> *prerecordedSpeech; /** * @see SDLVRCapabilities * * Optional, Array of length 1 - 100, of SDLVRCapabilities */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLVRCapabilities> *vrCapabilities; +@property (nullable, strong, nonatomic) NSArray<SDLVRCapabilities> *vrCapabilities; /** * @see SDLAudioPassThruCapabilities * * Optional, Array of length 1 - 100, of SDLAudioPassThruCapabilities */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLAudioPassThruCapabilities *> *audioPassThruCapabilities; +@property (nullable, strong, nonatomic) NSArray<SDLAudioPassThruCapabilities *> *audioPassThruCapabilities; /** * Specifies the vehicle's type @@ -137,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN * * Optional, Array of length 1 - 100, Integer 0 - 255 */ -@property (nullable, strong, nonatomic) NSMutableArray<NSNumber<SDLInt> *> *supportedDiagModes; +@property (nullable, strong, nonatomic) NSArray<NSNumber<SDLInt> *> *supportedDiagModes; /** * @see SDLHMICapabilities diff --git a/SmartDeviceLink/SDLRegisterAppInterfaceResponse.m b/SmartDeviceLink/SDLRegisterAppInterfaceResponse.m index e26c64431..0ba2d53d6 100644 --- a/SmartDeviceLink/SDLRegisterAppInterfaceResponse.m +++ b/SmartDeviceLink/SDLRegisterAppInterfaceResponse.m @@ -57,19 +57,19 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameDisplayCapabilities ofClass:SDLDisplayCapabilities.class]; } -- (void)setButtonCapabilities:(nullable NSMutableArray<SDLButtonCapabilities *> *)buttonCapabilities { +- (void)setButtonCapabilities:(nullable NSArray<SDLButtonCapabilities *> *)buttonCapabilities { [parameters sdl_setObject:buttonCapabilities forName:SDLNameButtonCapabilities]; } -- (nullable NSMutableArray<SDLButtonCapabilities *> *)buttonCapabilities { +- (nullable NSArray<SDLButtonCapabilities *> *)buttonCapabilities { return [parameters sdl_objectsForName:SDLNameButtonCapabilities ofClass:SDLButtonCapabilities.class]; } -- (void)setSoftButtonCapabilities:(nullable NSMutableArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities { +- (void)setSoftButtonCapabilities:(nullable NSArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities { [parameters sdl_setObject:softButtonCapabilities forName:SDLNameSoftButtonCapabilities]; } -- (nullable NSMutableArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities { +- (nullable NSArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities { return [parameters sdl_objectsForName:SDLNameSoftButtonCapabilities ofClass:SDLSoftButtonCapabilities.class]; } @@ -81,43 +81,43 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNamePresetBankCapabilities ofClass:SDLPresetBankCapabilities.class]; } -- (void)setHmiZoneCapabilities:(nullable NSMutableArray<SDLHMIZoneCapabilities> *)hmiZoneCapabilities { +- (void)setHmiZoneCapabilities:(nullable NSArray<SDLHMIZoneCapabilities> *)hmiZoneCapabilities { [parameters sdl_setObject:hmiZoneCapabilities forName:SDLNameHMIZoneCapabilities]; } -- (nullable NSMutableArray<SDLHMIZoneCapabilities> *)hmiZoneCapabilities { +- (nullable NSArray<SDLHMIZoneCapabilities> *)hmiZoneCapabilities { return [parameters sdl_objectForName:SDLNameHMIZoneCapabilities]; } -- (void)setSpeechCapabilities:(nullable NSMutableArray<SDLSpeechCapabilities> *)speechCapabilities { +- (void)setSpeechCapabilities:(nullable NSArray<SDLSpeechCapabilities> *)speechCapabilities { [parameters sdl_setObject:speechCapabilities forName:SDLNameSpeechCapabilities]; } -- (nullable NSMutableArray<SDLSpeechCapabilities> *)speechCapabilities { +- (nullable NSArray<SDLSpeechCapabilities> *)speechCapabilities { return [parameters sdl_objectForName:SDLNameSpeechCapabilities]; } -- (void)setPrerecordedSpeech:(nullable NSMutableArray<SDLPrerecordedSpeech> *)prerecordedSpeech { +- (void)setPrerecordedSpeech:(nullable NSArray<SDLPrerecordedSpeech> *)prerecordedSpeech { [parameters sdl_setObject:prerecordedSpeech forName:SDLNamePrerecordedSpeech]; } -- (nullable NSMutableArray<SDLPrerecordedSpeech> *)prerecordedSpeech { +- (nullable NSArray<SDLPrerecordedSpeech> *)prerecordedSpeech { return [parameters sdl_objectForName:SDLNamePrerecordedSpeech]; } -- (void)setVrCapabilities:(nullable NSMutableArray<SDLVRCapabilities> *)vrCapabilities { +- (void)setVrCapabilities:(nullable NSArray<SDLVRCapabilities> *)vrCapabilities { [parameters sdl_setObject:vrCapabilities forName:SDLNameVRCapabilities]; } -- (nullable NSMutableArray<SDLVRCapabilities> *)vrCapabilities { +- (nullable NSArray<SDLVRCapabilities> *)vrCapabilities { return [parameters sdl_objectForName:SDLNameVRCapabilities]; } -- (void)setAudioPassThruCapabilities:(nullable NSMutableArray<SDLAudioPassThruCapabilities *> *)audioPassThruCapabilities { +- (void)setAudioPassThruCapabilities:(nullable NSArray<SDLAudioPassThruCapabilities *> *)audioPassThruCapabilities { [parameters sdl_setObject:audioPassThruCapabilities forName:SDLNameAudioPassThruCapabilities]; } -- (nullable NSMutableArray<SDLAudioPassThruCapabilities *> *)audioPassThruCapabilities { +- (nullable NSArray<SDLAudioPassThruCapabilities *> *)audioPassThruCapabilities { return [parameters sdl_objectsForName:SDLNameAudioPassThruCapabilities ofClass:SDLAudioPassThruCapabilities.class]; } @@ -129,11 +129,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameVehicleType ofClass:SDLVehicleType.class]; } -- (void)setSupportedDiagModes:(nullable NSMutableArray<NSNumber<SDLInt> *> *)supportedDiagModes { +- (void)setSupportedDiagModes:(nullable NSArray<NSNumber<SDLInt> *> *)supportedDiagModes { [parameters sdl_setObject:supportedDiagModes forName:SDLNameSupportedDiagnosticModes]; } -- (nullable NSMutableArray<NSNumber<SDLInt> *> *)supportedDiagModes { +- (nullable NSArray<NSNumber<SDLInt> *> *)supportedDiagModes { return [parameters sdl_objectForName:SDLNameSupportedDiagnosticModes]; } diff --git a/SmartDeviceLink/SDLResetGlobalProperties.h b/SmartDeviceLink/SDLResetGlobalProperties.h index 7c842e5c1..1b77b8edc 100644 --- a/SmartDeviceLink/SDLResetGlobalProperties.h +++ b/SmartDeviceLink/SDLResetGlobalProperties.h @@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN * @abstract An array of one or more GlobalProperty enumeration elements * indicating which global properties to reset to their default value */ -@property (strong, nonatomic) NSMutableArray<SDLGlobalProperty> *properties; +@property (strong, nonatomic) NSArray<SDLGlobalProperty> *properties; @end diff --git a/SmartDeviceLink/SDLResetGlobalProperties.m b/SmartDeviceLink/SDLResetGlobalProperties.m index 8c7b317b4..21242cbab 100644 --- a/SmartDeviceLink/SDLResetGlobalProperties.m +++ b/SmartDeviceLink/SDLResetGlobalProperties.m @@ -29,12 +29,12 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setProperties:(NSMutableArray<SDLGlobalProperty> *)properties { +- (void)setProperties:(NSArray<SDLGlobalProperty> *)properties { [parameters sdl_setObject:properties forName:SDLNameProperties]; } -- (NSMutableArray<SDLGlobalProperty> *)properties { - return [parameters sdl_enumsForName:SDLNameProperties]; +- (NSArray<SDLGlobalProperty> *)properties { + return [parameters sdl_objectForName:SDLNameProperties]; } @end diff --git a/SmartDeviceLink/SDLResponseDispatcher.m b/SmartDeviceLink/SDLResponseDispatcher.m index a1fbd9303..f6e07ea1e 100644 --- a/SmartDeviceLink/SDLResponseDispatcher.m +++ b/SmartDeviceLink/SDLResponseDispatcher.m @@ -115,7 +115,7 @@ NS_ASSUME_NONNULL_BEGIN [self.customButtonHandlerMap removeAllObjects]; } -- (void)sdl_addToCustomButtonHandlerMap:(NSMutableArray<SDLSoftButton *> *)softButtons { +- (void)sdl_addToCustomButtonHandlerMap:(NSArray<SDLSoftButton *> *)softButtons { for (SDLSoftButton *sb in softButtons) { if (!sb.softButtonID) { @throw [NSException sdl_missingIdException]; diff --git a/SmartDeviceLink/SDLScrollableMessage.h b/SmartDeviceLink/SDLScrollableMessage.h index 87ed0be98..a74aa5c27 100644 --- a/SmartDeviceLink/SDLScrollableMessage.h +++ b/SmartDeviceLink/SDLScrollableMessage.h @@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN * <p> * <b>Notes: </b>Minsize=0, Maxsize=8 */ -@property (nullable, strong, nonatomic) NSMutableArray<SDLSoftButton *> *softButtons; +@property (nullable, strong, nonatomic) NSArray<SDLSoftButton *> *softButtons; @end diff --git a/SmartDeviceLink/SDLScrollableMessage.m b/SmartDeviceLink/SDLScrollableMessage.m index f156e5453..f9c92c796 100644 --- a/SmartDeviceLink/SDLScrollableMessage.m +++ b/SmartDeviceLink/SDLScrollableMessage.m @@ -57,11 +57,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameTimeout]; } -- (void)setSoftButtons:(nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (void)setSoftButtons:(nullable NSArray<SDLSoftButton *> *)softButtons { [parameters sdl_setObject:softButtons forName:SDLNameSoftButtons]; } -- (nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (nullable NSArray<SDLSoftButton *> *)softButtons { return [parameters sdl_objectsForName:SDLNameSoftButtons ofClass:SDLSoftButton.class]; } diff --git a/SmartDeviceLink/SDLSetDisplayLayoutResponse.h b/SmartDeviceLink/SDLSetDisplayLayoutResponse.h index edacb17ed..e1e88138d 100644 --- a/SmartDeviceLink/SDLSetDisplayLayoutResponse.h +++ b/SmartDeviceLink/SDLSetDisplayLayoutResponse.h @@ -19,8 +19,8 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLSetDisplayLayoutResponse : SDLRPCResponse @property (nullable, strong, nonatomic) SDLDisplayCapabilities *displayCapabilities; -@property (nullable, strong, nonatomic) NSMutableArray<SDLButtonCapabilities *> *buttonCapabilities; -@property (nullable, strong, nonatomic) NSMutableArray<SDLSoftButtonCapabilities *> *softButtonCapabilities; +@property (nullable, strong, nonatomic) NSArray<SDLButtonCapabilities *> *buttonCapabilities; +@property (nullable, strong, nonatomic) NSArray<SDLSoftButtonCapabilities *> *softButtonCapabilities; @property (nullable, strong, nonatomic) SDLPresetBankCapabilities *presetBankCapabilities; @end diff --git a/SmartDeviceLink/SDLSetDisplayLayoutResponse.m b/SmartDeviceLink/SDLSetDisplayLayoutResponse.m index 2d1795413..c37086684 100644 --- a/SmartDeviceLink/SDLSetDisplayLayoutResponse.m +++ b/SmartDeviceLink/SDLSetDisplayLayoutResponse.m @@ -29,19 +29,19 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameDisplayCapabilities ofClass:SDLDisplayCapabilities.class]; } -- (void)setButtonCapabilities:(nullable NSMutableArray<SDLButtonCapabilities *> *)buttonCapabilities { +- (void)setButtonCapabilities:(nullable NSArray<SDLButtonCapabilities *> *)buttonCapabilities { [parameters sdl_setObject:buttonCapabilities forName:SDLNameButtonCapabilities]; } -- (nullable NSMutableArray<SDLButtonCapabilities *> *)buttonCapabilities { +- (nullable NSArray<SDLButtonCapabilities *> *)buttonCapabilities { return [parameters sdl_objectsForName:SDLNameButtonCapabilities ofClass:SDLButtonCapabilities.class]; } -- (void)setSoftButtonCapabilities:(nullable NSMutableArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities { +- (void)setSoftButtonCapabilities:(nullable NSArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities { [parameters sdl_setObject:softButtonCapabilities forName:SDLNameSoftButtonCapabilities]; } -- (nullable NSMutableArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities { +- (nullable NSArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities { return [parameters sdl_objectsForName:SDLNameSoftButtonCapabilities ofClass:SDLSoftButtonCapabilities.class]; } diff --git a/SmartDeviceLink/SDLSetGlobalProperties.h b/SmartDeviceLink/SDLSetGlobalProperties.h index 95c803bae..f6ac19b36 100644 --- a/SmartDeviceLink/SDLSetGlobalProperties.h +++ b/SmartDeviceLink/SDLSetGlobalProperties.h @@ -42,14 +42,14 @@ NS_ASSUME_NONNULL_BEGIN * <li>Only optional it timeoutPrompt has been specified</li> * </ul> */ -@property (strong, nonatomic, nullable) NSMutableArray<SDLTTSChunk *> *helpPrompt; +@property (strong, nonatomic, nullable) NSArray<SDLTTSChunk *> *helpPrompt; /** * @abstract A Vector<TTSChunk> for Timeout Prompt representing Array of one or * more TTSChunk elements specifying the help prompt used in an interaction * started by PTT * */ -@property (strong, nonatomic, nullable) NSMutableArray<SDLTTSChunk *> *timeoutPrompt; +@property (strong, nonatomic, nullable) NSArray<SDLTTSChunk *> *timeoutPrompt; /** * @abstract Sets a voice recognition Help Title * @@ -86,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN * </ul> * @since SmartDeviceLink 2.0 */ -@property (strong, nonatomic, nullable) NSMutableArray<SDLVRHelpItem *> *vrHelp; +@property (strong, nonatomic, nullable) NSArray<SDLVRHelpItem *> *vrHelp; @property (strong, nonatomic, nullable) NSString *menuTitle; @property (strong, nonatomic, nullable) SDLImage *menuIcon; @property (strong, nonatomic, nullable) SDLKeyboardProperties *keyboardProperties; diff --git a/SmartDeviceLink/SDLSetGlobalProperties.m b/SmartDeviceLink/SDLSetGlobalProperties.m index 8cc46bdc1..7052bbd6a 100644 --- a/SmartDeviceLink/SDLSetGlobalProperties.m +++ b/SmartDeviceLink/SDLSetGlobalProperties.m @@ -46,19 +46,19 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setHelpPrompt:(nullable NSMutableArray<SDLTTSChunk *> *)helpPrompt { +- (void)setHelpPrompt:(nullable NSArray<SDLTTSChunk *> *)helpPrompt { [parameters sdl_setObject:helpPrompt forName:SDLNameHelpPrompt]; } -- (nullable NSMutableArray<SDLTTSChunk *> *)helpPrompt { +- (nullable NSArray<SDLTTSChunk *> *)helpPrompt { return [parameters sdl_objectsForName:SDLNameHelpPrompt ofClass:SDLTTSChunk.class]; } -- (void)setTimeoutPrompt:(nullable NSMutableArray<SDLTTSChunk *> *)timeoutPrompt { +- (void)setTimeoutPrompt:(nullable NSArray<SDLTTSChunk *> *)timeoutPrompt { [parameters sdl_setObject:timeoutPrompt forName:SDLNameTimeoutPrompt]; } -- (nullable NSMutableArray<SDLTTSChunk *> *)timeoutPrompt { +- (nullable NSArray<SDLTTSChunk *> *)timeoutPrompt { return [parameters sdl_objectsForName:SDLNameTimeoutPrompt ofClass:SDLTTSChunk.class]; } @@ -70,11 +70,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameVRHelpTitle]; } -- (void)setVrHelp:(nullable NSMutableArray<SDLVRHelpItem *> *)vrHelp { +- (void)setVrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp { [parameters sdl_setObject:vrHelp forName:SDLNameVRHelp]; } -- (nullable NSMutableArray<SDLVRHelpItem *> *)vrHelp { +- (nullable NSArray<SDLVRHelpItem *> *)vrHelp { return [parameters sdl_objectsForName:SDLNameVRHelp ofClass:SDLVRHelpItem.class]; } diff --git a/SmartDeviceLink/SDLShow.h b/SmartDeviceLink/SDLShow.h index fb6c16411..d18c52647 100644 --- a/SmartDeviceLink/SDLShow.h +++ b/SmartDeviceLink/SDLShow.h @@ -215,7 +215,7 @@ NS_ASSUME_NONNULL_BEGIN * * @since SmartDeviceLink 2.0 */ -@property (strong, nonatomic, nullable) NSMutableArray<SDLSoftButton *> *softButtons; +@property (strong, nonatomic, nullable) NSArray<SDLSoftButton *> *softButtons; /** * @abstract The Custom Presets defined by the App * @@ -229,7 +229,7 @@ NS_ASSUME_NONNULL_BEGIN * </ul> * @since SmartDeviceLink 2.0 */ -@property (strong, nonatomic, nullable) NSMutableArray<NSString *> *customPresets; +@property (strong, nonatomic, nullable) NSArray<NSString *> *customPresets; @end diff --git a/SmartDeviceLink/SDLShow.m b/SmartDeviceLink/SDLShow.m index 39977b640..a01c1f316 100644 --- a/SmartDeviceLink/SDLShow.m +++ b/SmartDeviceLink/SDLShow.m @@ -132,19 +132,19 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameSecondaryGraphic ofClass:SDLImage.class]; } -- (void)setSoftButtons:(nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (void)setSoftButtons:(nullable NSArray<SDLSoftButton *> *)softButtons { [parameters sdl_setObject:softButtons forName:SDLNameSoftButtons]; } -- (nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (nullable NSArray<SDLSoftButton *> *)softButtons { return [parameters sdl_objectsForName:SDLNameSoftButtons ofClass:SDLSoftButton.class]; } -- (void)setCustomPresets:(nullable NSMutableArray<NSString *> *)customPresets { +- (void)setCustomPresets:(nullable NSArray<NSString *> *)customPresets { [parameters sdl_setObject:customPresets forName:SDLNameCustomPresets]; } -- (nullable NSMutableArray<NSString *> *)customPresets { +- (nullable NSArray<NSString *> *)customPresets { return [parameters sdl_objectForName:SDLNameCustomPresets]; } diff --git a/SmartDeviceLink/SDLShowConstantTBT.h b/SmartDeviceLink/SDLShowConstantTBT.h index 90604befa..8d25893bc 100644 --- a/SmartDeviceLink/SDLShowConstantTBT.h +++ b/SmartDeviceLink/SDLShowConstantTBT.h @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic, nullable) NSNumber<SDLFloat> *distanceToManeuver; @property (strong, nonatomic, nullable) NSNumber<SDLFloat> *distanceToManeuverScale; @property (strong, nonatomic, nullable) NSNumber<SDLBool> *maneuverComplete; -@property (strong, nonatomic, nullable) NSMutableArray<SDLSoftButton *> *softButtons; +@property (strong, nonatomic, nullable) NSArray<SDLSoftButton *> *softButtons; @end diff --git a/SmartDeviceLink/SDLShowConstantTBT.m b/SmartDeviceLink/SDLShowConstantTBT.m index f410b85af..f4565d923 100644 --- a/SmartDeviceLink/SDLShowConstantTBT.m +++ b/SmartDeviceLink/SDLShowConstantTBT.m @@ -120,11 +120,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameManeuverComplete]; } -- (void)setSoftButtons:(nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (void)setSoftButtons:(nullable NSArray<SDLSoftButton *> *)softButtons { [parameters sdl_setObject:softButtons forName:SDLNameSoftButtons]; } -- (nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (nullable NSArray<SDLSoftButton *> *)softButtons { return [parameters sdl_objectsForName:SDLNameSoftButtons ofClass:SDLSoftButton.class]; } diff --git a/SmartDeviceLink/SDLSlider.h b/SmartDeviceLink/SDLSlider.h index 31a312bd7..fa1dc7acc 100644 --- a/SmartDeviceLink/SDLSlider.h +++ b/SmartDeviceLink/SDLSlider.h @@ -56,7 +56,7 @@ NS_ASSUME_NONNULL_BEGIN * * Optional, Array of Strings, Array length 1 - 26, Max string length 500 chars */ -@property (strong, nonatomic, nullable) NSMutableArray<NSString *> *sliderFooter; +@property (strong, nonatomic, nullable) NSArray<NSString *> *sliderFooter; /** * @abstract An App defined timeout diff --git a/SmartDeviceLink/SDLSlider.m b/SmartDeviceLink/SDLSlider.m index 702ca2531..cf2f9519c 100644 --- a/SmartDeviceLink/SDLSlider.m +++ b/SmartDeviceLink/SDLSlider.m @@ -77,11 +77,11 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameSliderHeader]; } -- (void)setSliderFooter:(nullable NSMutableArray<NSString *> *)sliderFooter { +- (void)setSliderFooter:(nullable NSArray<NSString *> *)sliderFooter { [parameters sdl_setObject:sliderFooter forName:SDLNameSliderFooter]; } -- (nullable NSMutableArray<NSString *> *)sliderFooter { +- (nullable NSArray<NSString *> *)sliderFooter { return [parameters sdl_objectForName:SDLNameSliderFooter]; } diff --git a/SmartDeviceLink/SDLSpeak.h b/SmartDeviceLink/SDLSpeak.h index 528c3f133..33046a8eb 100644 --- a/SmartDeviceLink/SDLSpeak.h +++ b/SmartDeviceLink/SDLSpeak.h @@ -56,7 +56,7 @@ NS_ASSUME_NONNULL_BEGIN * * @see SDLTTSChunk */ -@property (strong, nonatomic) NSMutableArray<SDLTTSChunk *> *ttsChunks; +@property (strong, nonatomic) NSArray<SDLTTSChunk *> *ttsChunks; @end diff --git a/SmartDeviceLink/SDLSpeak.m b/SmartDeviceLink/SDLSpeak.m index 774947831..35516ff43 100644 --- a/SmartDeviceLink/SDLSpeak.m +++ b/SmartDeviceLink/SDLSpeak.m @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN } - (instancetype)initWithTTS:(NSString *)ttsText { - NSMutableArray *ttsChunks = [SDLTTSChunk textChunksFromString:ttsText]; + NSArray *ttsChunks = [SDLTTSChunk textChunksFromString:ttsText]; return [self initWithTTSChunks:ttsChunks]; } @@ -34,11 +34,11 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setTtsChunks:(NSMutableArray<SDLTTSChunk *> *)ttsChunks { +- (void)setTtsChunks:(NSArray<SDLTTSChunk *> *)ttsChunks { [parameters sdl_setObject:ttsChunks forName:SDLNameTTSChunks]; } -- (NSMutableArray<SDLTTSChunk *> *)ttsChunks { +- (NSArray<SDLTTSChunk *> *)ttsChunks { return [parameters sdl_objectsForName:SDLNameTTSChunks ofClass:SDLTTSChunk.class]; } diff --git a/SmartDeviceLink/SDLStateMachine.h b/SmartDeviceLink/SDLStateMachine.h index 3690261f9..fa3b3093b 100644 --- a/SmartDeviceLink/SDLStateMachine.h +++ b/SmartDeviceLink/SDLStateMachine.h @@ -88,7 +88,7 @@ extern SDLStateMachineTransitionFormat const SDLStateMachineTransitionFormatDidE * * @param state The state to set to */ -- (void)setToState:(SDLState *)state; +- (void)setToState:(SDLState *)state fromOldState:(nullable SDLState *)oldState callEnterTransition:(BOOL)shouldCall; /** * Return whether or not the current state is the passed state diff --git a/SmartDeviceLink/SDLStateMachine.m b/SmartDeviceLink/SDLStateMachine.m index 126f0e55b..ab5c54689 100644 --- a/SmartDeviceLink/SDLStateMachine.m +++ b/SmartDeviceLink/SDLStateMachine.m @@ -109,12 +109,25 @@ SDLStateMachineTransitionFormat const SDLStateMachineTransitionFormatDidEnter = #pragma mark - Helpers -- (void)setToState:(SDLState *)state { +- (void)setToState:(SDLState *)state fromOldState:(nullable SDLState *)oldState callEnterTransition:(BOOL)shouldCall { if (![self.states.allKeys containsObject:state]) { return; } - self.currentState = state; + if (oldState != nil && shouldCall) { + self.currentState = oldState; + [self transitionToState:state]; + } else if (shouldCall) { + SEL didEnter = NSSelectorFromString([NSString stringWithFormat:SDLStateMachineTransitionFormatDidEnter, state]); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + if ([self.target respondsToSelector:didEnter]) { + [self.target performSelector:didEnter]; +#pragma clang diagnostic pop + } + } else { + self.currentState = state; + } } /** @@ -139,4 +152,4 @@ SDLStateMachineTransitionFormat const SDLStateMachineTransitionFormatDidEnter = @end -NS_ASSUME_NONNULL_END
\ No newline at end of file +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLTTSChunk.h b/SmartDeviceLink/SDLTTSChunk.h index ad7690ef0..6d97aceae 100644 --- a/SmartDeviceLink/SDLTTSChunk.h +++ b/SmartDeviceLink/SDLTTSChunk.h @@ -43,15 +43,15 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithText:(NSString *)text type:(SDLSpeechCapabilities)type; -+ (NSMutableArray<SDLTTSChunk *> *)textChunksFromString:(NSString *)string; ++ (NSArray<SDLTTSChunk *> *)textChunksFromString:(NSString *)string; -+ (NSMutableArray<SDLTTSChunk *> *)sapiChunksFromString:(NSString *)string; ++ (NSArray<SDLTTSChunk *> *)sapiChunksFromString:(NSString *)string; -+ (NSMutableArray<SDLTTSChunk *> *)lhPlusChunksFromString:(NSString *)string; ++ (NSArray<SDLTTSChunk *> *)lhPlusChunksFromString:(NSString *)string; -+ (NSMutableArray<SDLTTSChunk *> *)prerecordedChunksFromString:(NSString *)string; ++ (NSArray<SDLTTSChunk *> *)prerecordedChunksFromString:(NSString *)string; -+ (NSMutableArray<SDLTTSChunk *> *)silenceChunks; ++ (NSArray<SDLTTSChunk *> *)silenceChunks; /** diff --git a/SmartDeviceLink/SDLTTSChunk.m b/SmartDeviceLink/SDLTTSChunk.m index 6be3153fb..e553d6342 100644 --- a/SmartDeviceLink/SDLTTSChunk.m +++ b/SmartDeviceLink/SDLTTSChunk.m @@ -22,32 +22,32 @@ NS_ASSUME_NONNULL_BEGIN return self; } -+ (NSMutableArray<SDLTTSChunk *> *)textChunksFromString:(NSString *)string { ++ (NSArray<SDLTTSChunk *> *)textChunksFromString:(NSString *)string { return [self sdl_chunksFromString:string type:SDLSpeechCapabilitiesText]; } -+ (NSMutableArray<SDLTTSChunk *> *)sapiChunksFromString:(NSString *)string { ++ (NSArray<SDLTTSChunk *> *)sapiChunksFromString:(NSString *)string { return [self sdl_chunksFromString:string type:SDLSpeechCapabilitiesSAPIPhonemes]; } -+ (NSMutableArray<SDLTTSChunk *> *)lhPlusChunksFromString:(NSString *)string { ++ (NSArray<SDLTTSChunk *> *)lhPlusChunksFromString:(NSString *)string { return [self sdl_chunksFromString:string type:SDLSpeechCapabilitiesLHPlusPhonemes]; } -+ (NSMutableArray<SDLTTSChunk *> *)prerecordedChunksFromString:(NSString *)string { ++ (NSArray<SDLTTSChunk *> *)prerecordedChunksFromString:(NSString *)string { return [self sdl_chunksFromString:string type:SDLSpeechCapabilitiesPrerecorded]; } -+ (NSMutableArray<SDLTTSChunk *> *)silenceChunks { ++ (NSArray<SDLTTSChunk *> *)silenceChunks { return [self sdl_chunksFromString:nil type:SDLSpeechCapabilitiesSilence]; } -+ (nullable NSMutableArray<SDLTTSChunk *> *)sdl_chunksFromString:(nullable NSString *)string type:(SDLSpeechCapabilities)type { ++ (nullable NSArray<SDLTTSChunk *> *)sdl_chunksFromString:(nullable NSString *)string type:(SDLSpeechCapabilities)type { if (string.length == 0) { return nil; } - return [NSMutableArray arrayWithObject:[[[self class] alloc] initWithText:string type:type]]; + return [NSArray arrayWithObject:[[[self class] alloc] initWithText:string type:type]]; } - (void)setText:(NSString *)text { diff --git a/SmartDeviceLink/SDLTouchEvent.h b/SmartDeviceLink/SDLTouchEvent.h index 353b0a625..56a6dc6d5 100644 --- a/SmartDeviceLink/SDLTouchEvent.h +++ b/SmartDeviceLink/SDLTouchEvent.h @@ -30,12 +30,12 @@ NS_ASSUME_NONNULL_BEGIN Mandatory, array size 1-1000, contains <NSNumber> size 0-5000000000 */ -@property (strong, nonatomic) NSMutableArray<NSNumber<SDLInt> *> *timeStamp; +@property (strong, nonatomic) NSArray<NSNumber<SDLInt> *> *timeStamp; /** * Mandatory, array size 1-1000, contains SDLTouchCoord */ -@property (strong, nonatomic) NSMutableArray<SDLTouchCoord *> *coord; +@property (strong, nonatomic) NSArray<SDLTouchCoord *> *coord; @end diff --git a/SmartDeviceLink/SDLTouchEvent.m b/SmartDeviceLink/SDLTouchEvent.m index 69616940b..7ff82b3c7 100644 --- a/SmartDeviceLink/SDLTouchEvent.m +++ b/SmartDeviceLink/SDLTouchEvent.m @@ -20,19 +20,19 @@ NS_ASSUME_NONNULL_BEGIN return [store sdl_objectForName:SDLNameId]; } -- (void)setTimeStamp:(NSMutableArray<NSNumber<SDLInt> *> *)timeStamp { +- (void)setTimeStamp:(NSArray<NSNumber<SDLInt> *> *)timeStamp { [store sdl_setObject:timeStamp forName:SDLNameTimestamp]; } -- (NSMutableArray<NSNumber<SDLInt> *> *)timeStamp { +- (NSArray<NSNumber<SDLInt> *> *)timeStamp { return [store sdl_objectForName:SDLNameTimestamp]; } -- (void)setCoord:(NSMutableArray<SDLTouchCoord *> *)coord { +- (void)setCoord:(NSArray<SDLTouchCoord *> *)coord { [store sdl_setObject:coord forName:SDLNameCoordinate]; } -- (NSMutableArray<SDLTouchCoord *> *)coord { +- (NSArray<SDLTouchCoord *> *)coord { return [store sdl_objectsForName:SDLNameCoordinate ofClass:SDLTouchCoord.class]; } diff --git a/SmartDeviceLink/SDLURLRequestTask.h b/SmartDeviceLink/SDLURLRequestTask.h deleted file mode 100644 index 8745f8519..000000000 --- a/SmartDeviceLink/SDLURLRequestTask.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// SDLURLRequestTask.h -// SmartDeviceLink-iOS -// -// Created by Joel Fischer on 8/17/15. -// Copyright (c) 2015 smartdevicelink. All rights reserved. -// - -#import <Foundation/Foundation.h> - -@class SDLURLRequestTask; -@class SDLURLSession; - - -typedef void (^SDLURLConnectionRequestCompletionHandler)(NSData *__nullable data, NSURLResponse *__nullable response, NSError *__nullable error); - -typedef NS_ENUM(NSUInteger, SDLURLRequestTaskState) { - SDLURLRequestTaskStateRunning, - SDLURLRequestTaskStateCompleted -}; - - -NS_ASSUME_NONNULL_BEGIN - -@protocol SDLURLRequestTaskDelegate <NSObject> - -- (void)taskDidFinish:(SDLURLRequestTask *)task; - -@end - - -@interface SDLURLRequestTask : NSObject - -@property (weak, nonatomic) id<SDLURLRequestTaskDelegate> delegate; -@property (assign, nonatomic) SDLURLRequestTaskState state; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithURLRequest:(NSURLRequest *)request completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler NS_DESIGNATED_INITIALIZER; - -+ (instancetype)taskWithURLRequest:(NSURLRequest *)request completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler; - -- (void)cancel; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLURLRequestTask.m b/SmartDeviceLink/SDLURLRequestTask.m deleted file mode 100644 index d1895ac10..000000000 --- a/SmartDeviceLink/SDLURLRequestTask.m +++ /dev/null @@ -1,110 +0,0 @@ -// -// SDLURLRequestTask.m -// SmartDeviceLink-iOS -// -// Created by Joel Fischer on 8/17/15. -// Copyright (c) 2015 smartdevicelink. All rights reserved. -// - -#import "SDLURLRequestTask.h" - -#import "SDLURLSession.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SDLURLRequestTask () <NSURLConnectionDelegate, NSURLConnectionDataDelegate> - -@property (strong, nonatomic) NSURLConnection *connection; -@property (strong, nonatomic, nullable) NSURLResponse *response; -@property (copy, nonatomic) SDLURLConnectionRequestCompletionHandler completionHandler; -@property (strong, nonatomic) NSMutableData *mutableData; - -@end - - -@implementation SDLURLRequestTask - -#pragma mark - Lifecycle - -- (instancetype)init { - NSAssert(NO, @"use initWithURLRequest:completionHandler instead"); - return nil; -} - -- (instancetype)initWithURLRequest:(NSURLRequest *)request completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler { - self = [super init]; - if (!self) { - return nil; - } - - _connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:NO]; - [_connection scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; - [_connection start]; - - _completionHandler = completionHandler; - - _mutableData = [NSMutableData data]; - _response = nil; - _state = SDLURLRequestTaskStateRunning; - - return self; -} - -+ (instancetype)taskWithURLRequest:(NSURLRequest *)request completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler { - return [[self alloc] initWithURLRequest:request completionHandler:completionHandler]; -} - -- (void)dealloc { - [_connection cancel]; -} - - -#pragma mark - Data Methods - -- (void)sdl_addData:(NSData *)data { - [self.mutableData appendData:data]; -} - - -#pragma mark - Cancel - -- (void)cancel { - [self.connection cancel]; - [self connection:self.connection didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:kCFURLErrorCancelled userInfo:nil]]; -} - - -#pragma mark - NSURLConnectionDelegate - -- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { - dispatch_async(dispatch_get_main_queue(), ^{ - self.completionHandler(nil, self.response, error); - - self.state = SDLURLRequestTaskStateCompleted; - [self.delegate taskDidFinish:self]; - }); -} - - -#pragma mark - NSURLConnectionDataDelegate - -- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { - [self sdl_addData:data]; -} - -- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { - self.response = response; -} - -- (void)connectionDidFinishLoading:(NSURLConnection *)connection { - dispatch_async(dispatch_get_main_queue(), ^{ - self.completionHandler([self.mutableData copy], self.response, nil); - - self.state = SDLURLRequestTaskStateCompleted; - [self.delegate taskDidFinish:self]; - }); -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLURLSession.h b/SmartDeviceLink/SDLURLSession.h deleted file mode 100644 index 0d2a22e28..000000000 --- a/SmartDeviceLink/SDLURLSession.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// SDLURLConnection.h -// SmartDeviceLink-iOS -// -// Created by Joel Fischer on 8/17/15. -// Copyright (c) 2015 smartdevicelink. All rights reserved. -// - -#import <Foundation/Foundation.h> - - -typedef void (^SDLURLConnectionRequestCompletionHandler)(NSData *__nullable data, NSURLResponse *__nullable response, NSError *__nullable error); - - -NS_ASSUME_NONNULL_BEGIN - -@interface SDLURLSession : NSObject - -@property (assign, nonatomic) NSURLRequestCachePolicy cachePolicy; - -/** - * If any task is started with a request that is at the default timeout (60.0 sec), it will be altered to this connection timeout (by default 45.0 sec). - */ -@property (assign, nonatomic) NSTimeInterval connectionTimeout; - -/** - * Get the default session, a singleton. - * - * @return The default session - */ -+ (instancetype)defaultSession; - -/** - * Retrieves data from a specified URL. Default settings for timeout and cache policy will be used. - * - * @param url An NSURLRequest will be assembled for this URL - * @param completionHandler The completion handler that will be called when the request is complete - */ -- (void)dataFromURL:(NSURL *)url completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler; - -/** - * Starts a URL request using data supplied. - * - * @param request An NSURLRequest that provides the URL, cache policy, request method, etc. The HTTPBody data in this request will be ignored - * @param data The data to be uploaded over HTTP - * @param completionHandler The completion handler that will be called when the request is complete - */ -- (void)uploadWithURLRequest:(NSURLRequest *)request data:(NSData *)data completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler; - -/** - * Tells all pending requests to cancel - */ -- (void)cancelAllTasks; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLURLSession.m b/SmartDeviceLink/SDLURLSession.m deleted file mode 100644 index 373ce7d44..000000000 --- a/SmartDeviceLink/SDLURLSession.m +++ /dev/null @@ -1,113 +0,0 @@ -// -// SDLURLConnection.m -// SmartDeviceLink-iOS -// -// Created by Joel Fischer on 8/17/15. -// Copyright (c) 2015 smartdevicelink. All rights reserved. -// - -#import "SDLURLSession.h" - -#import "SDLURLRequestTask.h" - - -NS_ASSUME_NONNULL_BEGIN - -static float DefaultConnectionTimeout = 45.0; - - -@interface SDLURLSession () <SDLURLRequestTaskDelegate> - -@property (strong, nonatomic) NSMutableSet<SDLURLRequestTask *> *activeTasks; - -@end - - -@implementation SDLURLSession - - -#pragma mark - Lifecycle - -+ (instancetype)defaultSession { - static SDLURLSession *sharedSession = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedSession = [[self alloc] init]; - }); - - return sharedSession; -} - -- (void)dealloc { - for (SDLURLRequestTask *task in self.activeTasks) { - [task cancel]; - } -} - -- (instancetype)init { - self = [super init]; - if (!self) { - return nil; - } - - _cachePolicy = NSURLRequestUseProtocolCachePolicy; - _connectionTimeout = DefaultConnectionTimeout; - - _activeTasks = [NSMutableSet set]; - - return self; -} - - -#pragma mark - URL Request Methods - -- (void)dataFromURL:(NSURL *)url completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler { - // Apple no longer allows HTTP URLs without a special exception as of Jan. 2017 - if ([url.scheme isEqualToString:@"http"]) { - url = [NSURL URLWithString:[url.absoluteString stringByReplacingCharactersInRange:NSMakeRange(0, 4) withString:@"https"]]; - } - - NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:self.cachePolicy timeoutInterval:self.connectionTimeout]; - - SDLURLRequestTask *task = [[SDLURLRequestTask alloc] initWithURLRequest:request completionHandler:completionHandler]; - task.delegate = self; - - [self.activeTasks addObject:task]; -} - -- (void)uploadWithURLRequest:(NSURLRequest *)request data:(NSData *)data completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler { - NSURL *url = request.URL; - if ([url.scheme isEqualToString:@"http"]) { - url = [NSURL URLWithString:[url.absoluteString stringByReplacingCharactersInRange:NSMakeRange(0, 4) withString:@"https"]]; - } - - NSMutableURLRequest *mutableRequest = [request mutableCopy]; - mutableRequest.URL = url; - mutableRequest.HTTPBody = data; - mutableRequest.HTTPMethod = @"POST"; - - SDLURLRequestTask *task = [[SDLURLRequestTask alloc] initWithURLRequest:mutableRequest completionHandler:completionHandler]; - task.delegate = self; - - [self.activeTasks addObject:task]; -} - - -#pragma mark - Cancel Methods - -- (void)cancelAllTasks { - for (SDLURLRequestTask *task in self.activeTasks) { - [task cancel]; - } -} - - -#pragma mark - SDLURLRequestTaskDelegate - -- (void)taskDidFinish:(SDLURLRequestTask *)task { - [self.activeTasks removeObject:task]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLUpdateTurnList.h b/SmartDeviceLink/SDLUpdateTurnList.h index 63a3473aa..96d54a55a 100644 --- a/SmartDeviceLink/SDLUpdateTurnList.h +++ b/SmartDeviceLink/SDLUpdateTurnList.h @@ -22,12 +22,12 @@ NS_ASSUME_NONNULL_BEGIN /** * Optional, SDLTurn, 1 - 100 entries */ -@property (strong, nonatomic, nullable) NSMutableArray<SDLTurn *> *turnList; +@property (strong, nonatomic, nullable) NSArray<SDLTurn *> *turnList; /** * Required, SDLSoftButton, 0 - 1 Entries */ -@property (strong, nonatomic, nullable) NSMutableArray<SDLSoftButton *> *softButtons; +@property (strong, nonatomic, nullable) NSArray<SDLSoftButton *> *softButtons; @end diff --git a/SmartDeviceLink/SDLUpdateTurnList.m b/SmartDeviceLink/SDLUpdateTurnList.m index 59b332505..b6361f666 100644 --- a/SmartDeviceLink/SDLUpdateTurnList.m +++ b/SmartDeviceLink/SDLUpdateTurnList.m @@ -31,19 +31,19 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (void)setTurnList:(nullable NSMutableArray<SDLTurn *> *)turnList { +- (void)setTurnList:(nullable NSArray<SDLTurn *> *)turnList { [parameters sdl_setObject:turnList forName:SDLNameTurnList]; } -- (nullable NSMutableArray<SDLTurn *> *)turnList { +- (nullable NSArray<SDLTurn *> *)turnList { return [parameters sdl_objectsForName:SDLNameTurnList ofClass:SDLTurn.class]; } -- (void)setSoftButtons:(nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (void)setSoftButtons:(nullable NSArray<SDLSoftButton *> *)softButtons { [parameters sdl_setObject:softButtons forName:SDLNameSoftButtons]; } -- (nullable NSMutableArray<SDLSoftButton *> *)softButtons { +- (nullable NSArray<SDLSoftButton *> *)softButtons { return [parameters sdl_objectsForName:SDLNameSoftButtons ofClass:SDLSoftButton.class]; } diff --git a/SmartDeviceLink/SmartDeviceLink.h b/SmartDeviceLink/SmartDeviceLink.h index 9a9f7f0f2..9ca9975b4 100644 --- a/SmartDeviceLink/SmartDeviceLink.h +++ b/SmartDeviceLink/SmartDeviceLink.h @@ -306,7 +306,6 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLPermissionManager.h" // Utilities -#import "NSMutableDictionary+Store.h" #import "NSNumber+NumberType.h" #import "SDLErrorConstants.h" #import "SDLNotificationConstants.h" diff --git a/SmartDeviceLink/iOS 7 Assets/lock_arrow_down/white/lock_arrow_down_white.png b/SmartDeviceLink/iOS 7 Assets/lock_arrow_down/white/lock_arrow_down_white.png Binary files differdeleted file mode 100644 index 07e620d05..000000000 --- a/SmartDeviceLink/iOS 7 Assets/lock_arrow_down/white/lock_arrow_down_white.png +++ /dev/null diff --git a/SmartDeviceLink/iOS 7 Assets/lock_arrow_down/white/lock_arrow_down_white@2x.png b/SmartDeviceLink/iOS 7 Assets/lock_arrow_down/white/lock_arrow_down_white@2x.png Binary files differdeleted file mode 100644 index 57fa8120f..000000000 --- a/SmartDeviceLink/iOS 7 Assets/lock_arrow_down/white/lock_arrow_down_white@2x.png +++ /dev/null diff --git a/SmartDeviceLink/iOS 7 Assets/lock_arrow_down/white/lock_arrow_down_white@3x.png b/SmartDeviceLink/iOS 7 Assets/lock_arrow_down/white/lock_arrow_down_white@3x.png Binary files differdeleted file mode 100644 index b354c1a13..000000000 --- a/SmartDeviceLink/iOS 7 Assets/lock_arrow_down/white/lock_arrow_down_white@3x.png +++ /dev/null diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLFileManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLFileManagerSpec.m index fa955718b..b0ecb8bb9 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLFileManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLFileManagerSpec.m @@ -94,7 +94,7 @@ describe(@"SDLFileManager", ^{ testListFilesResponse = [[SDLListFilesResponse alloc] init]; testListFilesResponse.success = @YES; testListFilesResponse.spaceAvailable = @(initialSpaceAvailable); - testListFilesResponse.filenames = [NSMutableArray arrayWithArray:[testInitialFileNames allObjects]]; + testListFilesResponse.filenames = [NSArray arrayWithArray:[testInitialFileNames allObjects]]; [testConnectionManager respondToLastRequestWithResponse:testListFilesResponse]; }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m index e0ed18b7b..8b0a276d4 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m @@ -21,6 +21,7 @@ #import "SDLProxyFactory.h" #import "SDLRegisterAppInterface.h" #import "SDLRegisterAppInterfaceResponse.h" +#import "SDLResult.h" #import "SDLShow.h" #import "SDLStateMachine.h" #import "SDLTextAlignment.h" @@ -82,7 +83,7 @@ describe(@"a lifecycle manager", ^{ it(@"should initialize properties", ^{ expect(testManager.configuration).to(equal(testConfig)); expect(testManager.delegate).to(equal(managerDelegateMock)); // TODO: Broken on OCMock 3.3.1 & Swift 3 Quick / Nimble - expect(testManager.lifecycleState).to(match(SDLLifecycleStateDisconnected)); + expect(testManager.lifecycleState).to(match(SDLLifecycleStateStopped)); expect(@(testManager.lastCorrelationId)).to(equal(@0)); expect(testManager.fileManager).toNot(beNil()); expect(testManager.permissionManager).toNot(beNil()); @@ -151,18 +152,28 @@ describe(@"a lifecycle manager", ^{ }); it(@"should do nothing", ^{ - expect(testManager.lifecycleState).to(match(SDLLifecycleStateDisconnected)); + expect(testManager.lifecycleState).to(match(SDLLifecycleStateStopped)); + expect(testManager.lifecycleState).toEventuallyNot(match(SDLLifecycleStateStarted)); }); }); describe(@"when started", ^{ + __block BOOL readyHandlerSuccess = NO; + __block NSError *readyHandlerError = nil; + beforeEach(^{ - [testManager startWithReadyHandler:^(BOOL success, NSError * _Nullable error) {}]; + readyHandlerSuccess = NO; + readyHandlerError = nil; + + [testManager startWithReadyHandler:^(BOOL success, NSError * _Nullable error) { + readyHandlerSuccess = success; + readyHandlerError = error; + }]; }); it(@"should initialize the proxy property", ^{ expect(testManager.proxy).toNot(beNil()); - expect(testManager.lifecycleState).to(match(SDLLifecycleStateDisconnected)); + expect(testManager.lifecycleState).to(match(SDLLifecycleStateStarted)); }); describe(@"after receiving a connect notification", ^{ @@ -176,7 +187,7 @@ describe(@"a lifecycle manager", ^{ it(@"should send a register app interface request and be in the connected state", ^{ OCMVerifyAllWithDelay(proxyMock, 0.5); - expect(testManager.lifecycleState).to(match(SDLLifecycleStateTransportConnected)); + expect(testManager.lifecycleState).to(match(SDLLifecycleStateConnected)); }); itBehavesLike(@"unable to send an RPC", ^{ return @{ @"manager": testManager }; }); @@ -187,8 +198,8 @@ describe(@"a lifecycle manager", ^{ [NSThread sleepForTimeInterval:0.1]; }); - it(@"should be in the disconnect state", ^{ - expect(testManager.lifecycleState).to(match(SDLLifecycleStateDisconnected)); + it(@"should be in the started state", ^{ + expect(testManager.lifecycleState).to(match(SDLLifecycleStateStarted)); }); }); @@ -197,15 +208,15 @@ describe(@"a lifecycle manager", ^{ [testManager stop]; }); - it(@"should simply disconnect", ^{ - expect(testManager.lifecycleState).to(match(SDLLifecycleStateDisconnected)); + it(@"should simply stop", ^{ + expect(testManager.lifecycleState).to(match(SDLLifecycleStateStopped)); }); }); }); describe(@"in the connected state", ^{ beforeEach(^{ - [testManager.lifecycleStateMachine setToState:SDLLifecycleStateTransportConnected]; + [testManager.lifecycleStateMachine setToState:SDLLifecycleStateConnected fromOldState:nil callEnterTransition:NO]; }); describe(@"after receiving a register app interface response", ^{ @@ -237,8 +248,8 @@ describe(@"a lifecycle manager", ^{ [testManager.notificationDispatcher postNotificationName:SDLTransportDidDisconnect infoObject:nil]; }); - it(@"should enter the disconnect state", ^{ - expect(testManager.lifecycleState).toEventually(match(SDLLifecycleStateDisconnected)); + it(@"should enter the started state", ^{ + expect(testManager.lifecycleState).toEventually(match(SDLLifecycleStateStarted)); }); }); @@ -247,15 +258,46 @@ describe(@"a lifecycle manager", ^{ [testManager stop]; }); - it(@"should enter the disconnect state", ^{ - expect(testManager.lifecycleState).to(match(SDLLifecycleStateDisconnected)); + it(@"should enter the stopped state", ^{ + expect(testManager.lifecycleState).to(match(SDLLifecycleStateStopped)); + }); + }); + }); + + describe(@"transitioning to the ready state", ^{ + context(@"when the register response is a success", ^{ + it(@"should call the ready handler with success", ^{ + SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init]; + response.resultCode = SDLResultSuccess; + testManager.registerResponse = response; + + [testManager.lifecycleStateMachine setToState:SDLLifecycleStateReady fromOldState:nil callEnterTransition:YES]; + + expect(@(readyHandlerSuccess)).to(equal(@YES)); + expect(readyHandlerError).to(beNil()); + }); + }); + + context(@"when the register response is a warning", ^{ + it(@"should call the ready handler with success but error", ^{ + SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init]; + response.resultCode = SDLResultWarnings; + response.info = @"some info"; + testManager.registerResponse = response; + + [testManager.lifecycleStateMachine setToState:SDLLifecycleStateReady fromOldState:nil callEnterTransition:YES]; + + expect(@(readyHandlerSuccess)).to(equal(@YES)); + expect(readyHandlerError).toNot(beNil()); + expect(@(readyHandlerError.code)).to(equal(@(SDLManagerErrorRegistrationFailed))); + expect(readyHandlerError.userInfo[NSLocalizedFailureReasonErrorKey]).to(match(response.info)); }); }); }); describe(@"in the ready state", ^{ beforeEach(^{ - [testManager.lifecycleStateMachine setToState:SDLLifecycleStateReady]; + [testManager.lifecycleStateMachine setToState:SDLLifecycleStateReady fromOldState:nil callEnterTransition:NO]; }); it(@"can send an RPC", ^{ @@ -292,8 +334,8 @@ describe(@"a lifecycle manager", ^{ [testManager.notificationDispatcher postRPCResponseNotification:SDLDidReceiveUnregisterAppInterfaceResponse response:testUnregisterResponse]; }); - it(@"should disconnect", ^{ - expect(testManager.lifecycleState).toEventually(match(SDLLifecycleStateDisconnected)); + it(@"should stop", ^{ + expect(testManager.lifecycleState).toEventually(match(SDLLifecycleStateStopped)); }); }); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLListFilesOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLListFilesOperationSpec.m index 5047d54ce..bb45a0374 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLListFilesOperationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLListFilesOperationSpec.m @@ -45,11 +45,11 @@ describe(@"List Files Operation", ^{ context(@"when a good response comes back", ^{ __block SDLListFilesResponse *goodResponse = nil; __block NSNumber *responseSpaceAvailable = nil; - __block NSMutableArray<NSString *> *responseFileNames = nil; + __block NSArray<NSString *> *responseFileNames = nil; beforeEach(^{ responseSpaceAvailable = @(11212512); - responseFileNames = [NSMutableArray arrayWithArray:@[@"test1", @"test2"]]; + responseFileNames = @[@"test1", @"test2"]; goodResponse = [[SDLListFilesResponse alloc] init]; goodResponse.success = @YES; @@ -76,14 +76,14 @@ describe(@"List Files Operation", ^{ context(@"when a bad response comes back", ^{ __block SDLListFilesResponse *badResponse = nil; __block NSNumber *responseSpaceAvailable = nil; - __block NSMutableArray<NSString *> *responseFileNames = nil; + __block NSArray<NSString *> *responseFileNames = nil; __block NSString *responseErrorDescription = nil; __block NSString *responseErrorReason = nil; beforeEach(^{ responseSpaceAvailable = @(0); - responseFileNames = [NSMutableArray arrayWithArray:@[]]; + responseFileNames = @[]; responseErrorDescription = @"some description"; responseErrorReason = @"some reason"; diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m index a565194d3..eeecebf6c 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m @@ -55,18 +55,18 @@ describe(@"SDLPermissionsManager", ^{ // Permission states testHMIPermissionsAllAllowed = [[SDLHMIPermissions alloc] init]; - testHMIPermissionsAllAllowed.allowed = [NSMutableArray arrayWithArray:@[SDLHMILevelBackground, SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelNone]]; + testHMIPermissionsAllAllowed.allowed = @[SDLHMILevelBackground, SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelNone]; testHMIPermissionsAllDisallowed = [[SDLHMIPermissions alloc] init]; - testHMIPermissionsAllDisallowed.userDisallowed = [NSMutableArray arrayWithArray:@[SDLHMILevelBackground, SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelNone]]; + testHMIPermissionsAllDisallowed.userDisallowed = @[SDLHMILevelBackground, SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelNone]; testHMIPermissionsFullLimitedAllowed = [[SDLHMIPermissions alloc] init]; - testHMIPermissionsFullLimitedAllowed.allowed = [NSMutableArray arrayWithArray:@[SDLHMILevelFull, SDLHMILevelLimited]]; - testHMIPermissionsFullLimitedAllowed.userDisallowed = [NSMutableArray arrayWithArray:@[SDLHMILevelBackground, SDLHMILevelNone]]; + testHMIPermissionsFullLimitedAllowed.allowed = @[SDLHMILevelFull, SDLHMILevelLimited]; + testHMIPermissionsFullLimitedAllowed.userDisallowed = @[SDLHMILevelBackground, SDLHMILevelNone]; testHMIPermissionsFullLimitedBackgroundAllowed = [[SDLHMIPermissions alloc] init]; - testHMIPermissionsFullLimitedBackgroundAllowed.allowed = [NSMutableArray arrayWithArray:@[SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelBackground]]; - testHMIPermissionsFullLimitedBackgroundAllowed.userDisallowed = [NSMutableArray arrayWithArray:@[SDLHMILevelNone]]; + testHMIPermissionsFullLimitedBackgroundAllowed.allowed = @[SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelBackground]; + testHMIPermissionsFullLimitedBackgroundAllowed.userDisallowed = @[SDLHMILevelNone]; // Assemble Permissions SDLParameterPermissions *testParameterPermissions = [[SDLParameterPermissions alloc] init]; @@ -103,7 +103,7 @@ describe(@"SDLPermissionsManager", ^{ // Create OnPermissionsChange object testPermissionsChange = [[SDLOnPermissionsChange alloc] init]; - testPermissionsChange.permissionItem = [NSMutableArray arrayWithArray:@[testPermissionAllAllowed, testPermissionAllDisallowed, testPermissionFullLimitedAllowed, testPermissionFullLimitedBackgroundAllowed]]; + testPermissionsChange.permissionItem = @[testPermissionAllAllowed, testPermissionAllDisallowed, testPermissionFullLimitedAllowed, testPermissionFullLimitedBackgroundAllowed]; // Permission Notifications testPermissionsNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangePermissionsNotification object:nil rpcNotification:testPermissionsChange]; @@ -391,8 +391,8 @@ describe(@"SDLPermissionsManager", ^{ // Create a permission update disallowing our current HMI level for the observed permission SDLParameterPermissions *testParameterPermissions = [[SDLParameterPermissions alloc] init]; SDLHMIPermissions *testHMIPermissionsUpdated = [[SDLHMIPermissions alloc] init]; - testHMIPermissionsUpdated.allowed = [NSMutableArray arrayWithArray:@[SDLHMILevelBackground, SDLHMILevelFull]]; - testHMIPermissionsUpdated.userDisallowed = [NSMutableArray arrayWithArray:@[SDLHMILevelLimited, SDLHMILevelNone]]; + testHMIPermissionsUpdated.allowed = @[SDLHMILevelBackground, SDLHMILevelFull]; + testHMIPermissionsUpdated.userDisallowed = @[SDLHMILevelLimited, SDLHMILevelNone]; testPermissionUpdated = [[SDLPermissionItem alloc] init]; testPermissionUpdated.rpcName = testRPCNameAllAllowed; @@ -400,7 +400,7 @@ describe(@"SDLPermissionsManager", ^{ testPermissionUpdated.parameterPermissions = testParameterPermissions; testPermissionChangeUpdate = [[SDLOnPermissionsChange alloc] init]; - testPermissionChangeUpdate.permissionItem = [NSMutableArray arrayWithObject:testPermissionUpdated]; + testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated]; // Send the permission update NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}]; @@ -459,8 +459,8 @@ describe(@"SDLPermissionsManager", ^{ // Create a permission update allowing our current HMI level for the observed permission SDLParameterPermissions *testParameterPermissions = [[SDLParameterPermissions alloc] init]; SDLHMIPermissions *testHMIPermissionsUpdated = [[SDLHMIPermissions alloc] init]; - testHMIPermissionsUpdated.allowed = [NSMutableArray arrayWithArray:@[SDLHMILevelLimited, SDLHMILevelNone, SDLHMILevelBackground, SDLHMILevelFull]]; - testHMIPermissionsUpdated.userDisallowed = [NSMutableArray arrayWithArray:@[]]; + testHMIPermissionsUpdated.allowed = @[SDLHMILevelLimited, SDLHMILevelNone, SDLHMILevelBackground, SDLHMILevelFull]; + testHMIPermissionsUpdated.userDisallowed = @[]; testPermissionUpdated = [[SDLPermissionItem alloc] init]; testPermissionUpdated.rpcName = testRPCNameAllDisallowed; @@ -468,7 +468,7 @@ describe(@"SDLPermissionsManager", ^{ testPermissionUpdated.parameterPermissions = testParameterPermissions; testPermissionChangeUpdate = [[SDLOnPermissionsChange alloc] init]; - testPermissionChangeUpdate.permissionItem = [NSMutableArray arrayWithObject:testPermissionUpdated]; + testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated]; // Send the permission update NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}]; @@ -502,8 +502,8 @@ describe(@"SDLPermissionsManager", ^{ // Create a permission update disallowing our current HMI level for the observed permission SDLParameterPermissions *testParameterPermissions = [[SDLParameterPermissions alloc] init]; SDLHMIPermissions *testHMIPermissionsUpdated = [[SDLHMIPermissions alloc] init]; - testHMIPermissionsUpdated.allowed = [NSMutableArray arrayWithArray:@[]]; - testHMIPermissionsUpdated.userDisallowed = [NSMutableArray arrayWithArray:@[SDLHMILevelBackground, SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelNone]]; + testHMIPermissionsUpdated.allowed = @[]; + testHMIPermissionsUpdated.userDisallowed = @[SDLHMILevelBackground, SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelNone]; testPermissionUpdated = [[SDLPermissionItem alloc] init]; testPermissionUpdated.rpcName = testRPCNameAllAllowed; @@ -511,7 +511,7 @@ describe(@"SDLPermissionsManager", ^{ testPermissionUpdated.parameterPermissions = testParameterPermissions; testPermissionChangeUpdate = [[SDLOnPermissionsChange alloc] init]; - testPermissionChangeUpdate.permissionItem = [NSMutableArray arrayWithObject:testPermissionUpdated]; + testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated]; // Send the permission update NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}]; @@ -565,8 +565,8 @@ describe(@"SDLPermissionsManager", ^{ // Create a permission update disallowing our current HMI level for the observed permission SDLParameterPermissions *testParameterPermissions = [[SDLParameterPermissions alloc] init]; SDLHMIPermissions *testHMIPermissionsUpdated = [[SDLHMIPermissions alloc] init]; - testHMIPermissionsUpdated.allowed = [NSMutableArray arrayWithArray:@[]]; - testHMIPermissionsUpdated.userDisallowed = [NSMutableArray arrayWithArray:@[SDLHMILevelBackground, SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelNone]]; + testHMIPermissionsUpdated.allowed = @[]; + testHMIPermissionsUpdated.userDisallowed = @[SDLHMILevelBackground, SDLHMILevelFull, SDLHMILevelLimited, SDLHMILevelNone]; testPermissionUpdated = [[SDLPermissionItem alloc] init]; testPermissionUpdated.rpcName = testRPCNameAllAllowed; @@ -574,7 +574,7 @@ describe(@"SDLPermissionsManager", ^{ testPermissionUpdated.parameterPermissions = testParameterPermissions; testPermissionChangeUpdate = [[SDLOnPermissionsChange alloc] init]; - testPermissionChangeUpdate.permissionItem = [NSMutableArray arrayWithObject:testPermissionUpdated]; + testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated]; // Send the permission update NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}]; @@ -599,8 +599,8 @@ describe(@"SDLPermissionsManager", ^{ // Create a permission update disallowing our current HMI level for the observed permission SDLParameterPermissions *testParameterPermissions = [[SDLParameterPermissions alloc] init]; SDLHMIPermissions *testHMIPermissionsUpdated = [[SDLHMIPermissions alloc] init]; - testHMIPermissionsUpdated.allowed = [NSMutableArray arrayWithArray:@[SDLHMILevelLimited, SDLHMILevelBackground]]; - testHMIPermissionsUpdated.userDisallowed = [NSMutableArray arrayWithArray:@[SDLHMILevelFull, SDLHMILevelNone]]; + testHMIPermissionsUpdated.allowed = @[SDLHMILevelLimited, SDLHMILevelBackground]; + testHMIPermissionsUpdated.userDisallowed = @[SDLHMILevelFull, SDLHMILevelNone]; testPermissionUpdated = [[SDLPermissionItem alloc] init]; testPermissionUpdated.rpcName = testRPCNameAllAllowed; @@ -608,7 +608,7 @@ describe(@"SDLPermissionsManager", ^{ testPermissionUpdated.parameterPermissions = testParameterPermissions; testPermissionChangeUpdate = [[SDLOnPermissionsChange alloc] init]; - testPermissionChangeUpdate.permissionItem = [NSMutableArray arrayWithObject:testPermissionUpdated]; + testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated]; // Send the permission update NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}]; diff --git a/SmartDeviceLinkTests/Info.plist b/SmartDeviceLinkTests/Info.plist index ba72822e8..7c292c70a 100644 --- a/SmartDeviceLinkTests/Info.plist +++ b/SmartDeviceLinkTests/Info.plist @@ -9,7 +9,7 @@ <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>7.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> diff --git a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnLockScreenStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnLockScreenStatusSpec.m index 1cff1434c..c2e64ef3a 100644 --- a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnLockScreenStatusSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnLockScreenStatusSpec.m @@ -33,10 +33,10 @@ describe(@"Getter/Setter Tests", ^ { it(@"Should get correctly when initialized", ^ { NSMutableDictionary* dict = [@{SDLNameNotification: @{SDLNameParameters: - @{@"driverdistractionstatus":@NO, - @"userselected":@3, + @{@"driverDistractionStatus":@NO, + @"userSelected":@3, @"OnLockScreenStatus":SDLLockScreenStatusRequired, - @"hmilevel":SDLHMILevelNone}, + @"hmiLevel":SDLHMILevelNone}, SDLNameOperationName:@"OnLockScreenStatus"}} mutableCopy]; SDLOnLockScreenStatus* testNotification = [[SDLOnLockScreenStatus alloc] initWithDictionary:dict]; diff --git a/SmartDeviceLinkTests/UtilitiesSpecs/HTTP Connection/SDLURLRequestTaskSpec.m b/SmartDeviceLinkTests/UtilitiesSpecs/HTTP Connection/SDLURLRequestTaskSpec.m deleted file mode 100644 index d78ff0c7f..000000000 --- a/SmartDeviceLinkTests/UtilitiesSpecs/HTTP Connection/SDLURLRequestTaskSpec.m +++ /dev/null @@ -1,140 +0,0 @@ -#import <Quick/Quick.h> -#import <Nimble/Nimble.h> -#import <OHHTTPStubs/OHHTTPStubs.h> - -#import "SDLURLRequestTask.h" - - -QuickSpecBegin(SDLURLRequestTaskSpec) - -describe(@"a url request task", ^{ - __block SDLURLRequestTask *testTask = nil; - - describe(@"when the server returns correct data", ^{ - NSData *testData = [@"someData" dataUsingEncoding:NSUTF8StringEncoding]; - - __block NSData *testReturnData = nil; - __block NSURLResponse *testReturnResponse = nil; - __block NSError *testReturnError = nil; - - beforeEach(^{ - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { - return [request.URL.host isEqualToString:@"www.faketest.com"]; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { - return [[OHHTTPStubsResponse responseWithData:testData statusCode:200 headers:nil] requestTime:0.5 responseTime:0]; - }]; - - NSURLRequest *someURLRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.faketest.com"]]; - - testTask = [[SDLURLRequestTask alloc] initWithURLRequest:someURLRequest completionHandler:^void(NSData *data, NSURLResponse *response, NSError *error) { - testReturnData = data; - testReturnResponse = response; - testReturnError = error; - }]; - }); - - afterEach(^{ - testTask = nil; - [OHHTTPStubs removeAllStubs]; - }); - - it(@"should return data", ^{ - expect(testReturnData).toEventually(equal(testData)); - }); - - it(@"should return a response", ^{ - expect(testReturnResponse).toEventuallyNot(beNil()); - }); - - it(@"should not return an error", ^{ - expect(testReturnError).toEventually(beNil()); - }); - }); - - describe(@"when the connection fails because there is no internet", ^{ - NSError *someNetworkError = [NSError errorWithDomain:NSURLErrorDomain code:kCFURLErrorNotConnectedToInternet userInfo:nil]; - - __block NSData *testReturnData = nil; - __block NSURLResponse *testReturnResponse = nil; - __block NSError *testReturnError = nil; - - beforeEach(^{ - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { - return [request.URL.host isEqualToString:@"www.faketest.com"]; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { - return [OHHTTPStubsResponse responseWithError:someNetworkError]; - }]; - - NSURLRequest *someURLRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.faketest.com"]]; - - testTask = [[SDLURLRequestTask alloc] initWithURLRequest:someURLRequest completionHandler:^void(NSData *data, NSURLResponse *response, NSError *error) { - testReturnData = data; - testReturnResponse = response; - testReturnError = error; - }]; - }); - - afterEach(^{ - testTask = nil; - [OHHTTPStubs removeAllStubs]; - }); - - it(@"should return nil data", ^{ - expect(testReturnData).toEventually(beNil()); - }); - - it(@"should return a nil response", ^{ - expect(testReturnResponse).toEventually(beNil()); - }); - - it(@"should return an error", ^{ - expect(@(testReturnError.code)).toEventually(equal(@(someNetworkError.code))); - }); - }); - - describe(@"when the connection fails because it was cancelled", ^{ - NSData *testData = [@"testData" dataUsingEncoding:NSUTF8StringEncoding]; - - __block NSData *testReturnData = nil; - __block NSURLResponse *testReturnResponse = nil; - __block NSError *testReturnError = nil; - - beforeEach(^{ - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { - return [request.URL.host isEqualToString:@"www.faketest.com"]; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { - return [[OHHTTPStubsResponse responseWithData:testData statusCode:200 headers:nil] requestTime:0.25 responseTime:0.25]; - }]; - - NSURLRequest *someURLRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.faketest.com"]]; - - - testTask = [[SDLURLRequestTask alloc] initWithURLRequest:someURLRequest completionHandler:^void(NSData *data, NSURLResponse *response, NSError *error) { - testReturnData = data; - testReturnResponse = response; - testReturnError = error; - }]; - - [testTask cancel]; - }); - - afterEach(^{ - testTask = nil; - [OHHTTPStubs removeAllStubs]; - }); - - it(@"should return nil data", ^{ - expect(testReturnData).toEventually(beNil()); - }); - - it(@"should return a nil response", ^{ - expect(testReturnResponse).toEventually(beNil()); - }); - - it(@"should return an error", ^{ - expect(@(testReturnError.code)).toEventually(equal(@(kCFURLErrorCancelled))); - }); - }); -}); - -QuickSpecEnd diff --git a/SmartDeviceLinkTests/UtilitiesSpecs/HTTP Connection/SDLURLSessionSpec.m b/SmartDeviceLinkTests/UtilitiesSpecs/HTTP Connection/SDLURLSessionSpec.m deleted file mode 100644 index 73d12e6aa..000000000 --- a/SmartDeviceLinkTests/UtilitiesSpecs/HTTP Connection/SDLURLSessionSpec.m +++ /dev/null @@ -1,201 +0,0 @@ -#import <Quick/Quick.h> -#import <Nimble/Nimble.h> -#import <OHHTTPStubs/OHHTTPStubs.h> - -#import "SDLURLSession.h" - -QuickSpecBegin(SDLURLSessionSpec) - -describe(@"the url session", ^{ - __block SDLURLSession *testSession = nil; - - describe(@"attempting to get good data", ^{ - context(@"from an https address", ^{ - context(@"uploading data", ^{ - NSData *testData = [@"testData" dataUsingEncoding:NSUTF8StringEncoding]; - NSArray<NSString *> *someJSONObject = @[@"one", @"two"]; - NSData *testJSONData = [NSJSONSerialization dataWithJSONObject:someJSONObject options:0 error:nil]; - - __block NSData *testReturnData = nil; - __block NSURLResponse *testReturnResponse = nil; - __block NSError *testReturnError = nil; - __block NSArray<id> *testReturnJSONObject = nil; - - beforeEach(^{ - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { - if ([request.URL.host isEqualToString:@"www.faketest.com"]) { - testReturnJSONObject = [NSJSONSerialization JSONObjectWithData:request.HTTPBody options:0 error:nil]; - return YES; - } - - return NO; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { - return [[OHHTTPStubsResponse responseWithData:testData statusCode:200 headers:nil] requestTime:0.5 responseTime:0]; - }]; - - testSession = [[SDLURLSession alloc] init]; - NSURLRequest *someURLRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.faketest.com"]]; - - [testSession uploadWithURLRequest:someURLRequest data:testJSONData completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - testReturnData = data; - testReturnResponse = response; - testReturnError = error; - }]; - }); - - afterEach(^{ - testSession = nil; - [OHHTTPStubs removeAllStubs]; - }); - - it(@"should have correct data", ^{ - expect(testReturnJSONObject).toEventually(equal(someJSONObject)); - expect(testReturnData).toEventually(equal(testData)); - expect(testReturnResponse).toEventuallyNot(beNil()); - expect(testReturnError).toEventually(beNil()); - }); - }); - - context(@"downloading data", ^{ - NSData *testData = [@"someData" dataUsingEncoding:NSUTF8StringEncoding]; - - __block NSData *testReturnData = nil; - __block NSURLResponse *testReturnResponse = nil; - __block NSError *testReturnError = nil; - - beforeEach(^{ - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { - return [request.URL.host isEqualToString:@"www.faketest.com"]; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { - return [[OHHTTPStubsResponse responseWithData:testData statusCode:200 headers:nil] requestTime:0.5 responseTime:0]; - }]; - - testSession = [[SDLURLSession alloc] init]; - [testSession dataFromURL:[NSURL URLWithString:@"https://www.faketest.com"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - testReturnData = data; - testReturnResponse = response; - testReturnError = error; - }]; - }); - - afterEach(^{ - testSession = nil; - [OHHTTPStubs removeAllStubs]; - }); - - it(@"should return correct info", ^{ - expect(testReturnData).toEventually(equal(testData)); - expect(testReturnResponse).toEventuallyNot(beNil()); - expect(testReturnError).toEventually(beNil()); - }); - }); - }); - - context(@"from an http address", ^{ - NSData *testData = [@"testData" dataUsingEncoding:NSUTF8StringEncoding]; - NSArray<NSString *> *someJSONObject = @[@"one", @"two"]; - NSData *testJSONData = [NSJSONSerialization dataWithJSONObject:someJSONObject options:0 error:nil]; - - __block NSString *testURLRequestComponent = nil; - - beforeEach(^{ - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { - if ([request.URL.host isEqualToString:@"www.faketest.com"]) { - testURLRequestComponent = request.URL.scheme; - return YES; - } - - return NO; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { - return [[OHHTTPStubsResponse responseWithData:testData statusCode:200 headers:request.allHTTPHeaderFields] requestTime:0.5 responseTime:0]; - }]; - - testSession = [[SDLURLSession alloc] init]; - NSURLRequest *someURLRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.faketest.com"]]; - - [testSession uploadWithURLRequest:someURLRequest data:testJSONData completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {}]; - }); - - afterEach(^{ - testSession = nil; - [OHHTTPStubs removeAllStubs]; - }); - - it(@"should have called the HTTPS URL instead", ^{ - expect(testURLRequestComponent).toEventually(match(@"https")); - }); - }); - }); - - describe(@"when the connection fails because there is no internet", ^{ - NSError *someNetworkError = [NSError errorWithDomain:NSURLErrorDomain code:kCFURLErrorNotConnectedToInternet userInfo:nil]; - - __block NSData *testReturnData = nil; - __block NSURLResponse *testReturnResponse = nil; - __block NSError *testReturnError = nil; - - beforeEach(^{ - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { - return [request.URL.host isEqualToString:@"www.faketest.com"]; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { - return [OHHTTPStubsResponse responseWithError:someNetworkError]; - }]; - - testSession = [[SDLURLSession alloc] init]; - [testSession dataFromURL:[NSURL URLWithString:@"http://www.faketest.com"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - testReturnData = data; - testReturnResponse = response; - testReturnError = error; - }]; - }); - - afterEach(^{ - testSession = nil; - [OHHTTPStubs removeAllStubs]; - }); - - it(@"should return nil data", ^{ - expect(testReturnData).toEventually(beNil()); - expect(testReturnResponse).toEventually(beNil()); - expect(@(testReturnError.code)).toEventually(equal(@(someNetworkError.code))); - }); - }); - - describe(@"when the connection fails because it was cancelled", ^{ - NSData *testData = [@"testData" dataUsingEncoding:NSUTF8StringEncoding]; - - __block NSData *testReturnData = nil; - __block NSURLResponse *testReturnResponse = nil; - __block NSError *testReturnError = nil; - - beforeEach(^{ - [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { - return [request.URL.host isEqualToString:@"www.faketest.com"]; - } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { - return [[OHHTTPStubsResponse responseWithData:testData statusCode:200 headers:nil] requestTime:0.25 responseTime:0.25]; - }]; - - testSession = [[SDLURLSession alloc] init]; - [testSession dataFromURL:[NSURL URLWithString:@"http://www.faketest.com"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - testReturnData = data; - testReturnResponse = response; - testReturnError = error; - }]; - - [testSession cancelAllTasks]; - }); - - afterEach(^{ - testSession = nil; - [OHHTTPStubs removeAllStubs]; - }); - - it(@"should return nil data", ^{ - expect(testReturnData).toEventually(beNil()); - expect(testReturnResponse).toEventually(beNil()); - expect(@(testReturnError.code)).toEventually(equal(@(kCFURLErrorCancelled))); - }); - }); -}); - -QuickSpecEnd diff --git a/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLPinchGestureSpec.m b/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLPinchGestureSpec.m index 99293ac8c..370b7876d 100644 --- a/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLPinchGestureSpec.m +++ b/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLPinchGestureSpec.m @@ -46,8 +46,8 @@ describe(@"SDLPinchGesture Tests", ^{ SDLTouchEvent* firstTouchEvent = [[SDLTouchEvent alloc] init]; firstTouchEvent.touchEventId = @0; - firstTouchEvent.coord = [NSMutableArray arrayWithObject:firstCoord]; - firstTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(timeStamp)]; + firstTouchEvent.coord = [NSArray arrayWithObject:firstCoord]; + firstTouchEvent.timeStamp = [NSArray arrayWithObject:@(timeStamp)]; SDLTouch* firstTouch = [[SDLTouch alloc] initWithTouchEvent:firstTouchEvent]; @@ -57,8 +57,8 @@ describe(@"SDLPinchGesture Tests", ^{ SDLTouchEvent* secondTouchEvent = [[SDLTouchEvent alloc] init]; secondTouchEvent.touchEventId = @1; - secondTouchEvent.coord = [NSMutableArray arrayWithObject:secondCoord]; - secondTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(secondTimeStamp)]; + secondTouchEvent.coord = [NSArray arrayWithObject:secondCoord]; + secondTouchEvent.timeStamp = [NSArray arrayWithObject:@(secondTimeStamp)]; SDLTouch* secondTouch = [[SDLTouch alloc] initWithTouchEvent:secondTouchEvent]; @@ -103,8 +103,8 @@ describe(@"SDLPinchGesture Tests", ^{ SDLTouchEvent* firstTouchEvent = [[SDLTouchEvent alloc] init]; firstTouchEvent.touchEventId = @0; - firstTouchEvent.coord = [NSMutableArray arrayWithObject:firstCoord]; - firstTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(timeStamp)]; + firstTouchEvent.coord = [NSArray arrayWithObject:firstCoord]; + firstTouchEvent.timeStamp = [NSArray arrayWithObject:@(timeStamp)]; SDLTouch* firstTouch = [[SDLTouch alloc] initWithTouchEvent:firstTouchEvent]; @@ -114,8 +114,8 @@ describe(@"SDLPinchGesture Tests", ^{ SDLTouchEvent* secondTouchEvent = [[SDLTouchEvent alloc] init]; secondTouchEvent.touchEventId = @1; - secondTouchEvent.coord = [NSMutableArray arrayWithObject:secondCoord]; - secondTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(secondTimeStamp)]; + secondTouchEvent.coord = [NSArray arrayWithObject:secondCoord]; + secondTouchEvent.timeStamp = [NSArray arrayWithObject:@(secondTimeStamp)]; SDLTouch* secondTouch = [[SDLTouch alloc] initWithTouchEvent:secondTouchEvent]; @@ -128,13 +128,13 @@ describe(@"SDLPinchGesture Tests", ^{ SDLTouchEvent* newFirstTouchEvent = [[SDLTouchEvent alloc] init]; newFirstTouchEvent.touchEventId = @0; - newFirstTouchEvent.coord = [NSMutableArray arrayWithObject:newCoord]; - newFirstTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(newTimeStamp)]; + newFirstTouchEvent.coord = [NSArray arrayWithObject:newCoord]; + newFirstTouchEvent.timeStamp = [NSArray arrayWithObject:@(newTimeStamp)]; SDLTouchEvent* newSecondTouchEvent = [[SDLTouchEvent alloc] init]; newSecondTouchEvent.touchEventId = @1; - newSecondTouchEvent.coord = [NSMutableArray arrayWithObject:newCoord]; - newSecondTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(newTimeStamp)]; + newSecondTouchEvent.coord = [NSArray arrayWithObject:newCoord]; + newSecondTouchEvent.timeStamp = [NSArray arrayWithObject:@(newTimeStamp)]; newFirstTouch = [[SDLTouch alloc] initWithTouchEvent:newFirstTouchEvent]; newSecondTouch = [[SDLTouch alloc] initWithTouchEvent:newSecondTouchEvent]; @@ -179,4 +179,4 @@ describe(@"SDLPinchGesture Tests", ^{ }); }); -QuickSpecEnd
\ No newline at end of file +QuickSpecEnd diff --git a/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLTouchManagerSpec.m b/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLTouchManagerSpec.m index 730922b36..acc51197b 100644 --- a/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLTouchManagerSpec.m +++ b/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLTouchManagerSpec.m @@ -177,16 +177,16 @@ describe(@"SDLTouchManager Tests", ^{ SDLTouchEvent* touchEvent = [[SDLTouchEvent alloc] init]; touchEvent.touchEventId = @0; - touchEvent.coord = [NSMutableArray arrayWithObject:firstTouchCoord]; - touchEvent.timeStamp = [NSMutableArray arrayWithObject:@(firstTouchTimeStamp)]; + touchEvent.coord = [NSArray arrayWithObject:firstTouchCoord]; + touchEvent.timeStamp = [NSArray arrayWithObject:@(firstTouchTimeStamp)]; firstOnTouchEventStart = [[SDLOnTouchEvent alloc] init]; firstOnTouchEventStart.type = SDLTouchTypeBegin; - firstOnTouchEventStart.event = [NSMutableArray arrayWithObject:touchEvent]; + firstOnTouchEventStart.event = [NSArray arrayWithObject:touchEvent]; firstOnTouchEventEnd = [[SDLOnTouchEvent alloc] init]; firstOnTouchEventEnd.type = SDLTouchTypeEnd; - firstOnTouchEventEnd.event = [NSMutableArray arrayWithObject:touchEvent]; + firstOnTouchEventEnd.event = [NSArray arrayWithObject:touchEvent]; }); describe(@"when receiving a single tap", ^{ @@ -237,7 +237,7 @@ describe(@"SDLTouchManager Tests", ^{ secondTouchEvent = [[SDLTouchEvent alloc] init]; secondTouchEvent.touchEventId = @0; NSUInteger secondTouchTimeStamp = firstTouchTimeStamp + (touchManager.tapTimeThreshold - 0.1) * 1000; - secondTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(secondTouchTimeStamp)]; + secondTouchEvent.timeStamp = [NSArray arrayWithObject:@(secondTouchTimeStamp)]; }); context(@"near the same point", ^{ @@ -246,11 +246,11 @@ describe(@"SDLTouchManager Tests", ^{ touchCoord.x = @(firstTouchCoord.x.floatValue + touchManager.tapDistanceThreshold); touchCoord.y = @(firstTouchCoord.y.floatValue + touchManager.tapDistanceThreshold); - secondTouchEvent.coord = [NSMutableArray arrayWithObject:touchCoord]; + secondTouchEvent.coord = [NSArray arrayWithObject:touchCoord]; - secondOnTouchEventStart.event = [NSMutableArray arrayWithObject:secondTouchEvent]; + secondOnTouchEventStart.event = [NSArray arrayWithObject:secondTouchEvent]; - secondOnTouchEventEnd.event = [NSMutableArray arrayWithObject:secondTouchEvent]; + secondOnTouchEventEnd.event = [NSArray arrayWithObject:secondTouchEvent]; averagePoint = CGPointMake((firstTouchCoord.x.floatValue + touchCoord.x.floatValue) / 2.0f, (firstTouchCoord.y.floatValue + touchCoord.y.floatValue) / 2.0f); @@ -291,11 +291,11 @@ describe(@"SDLTouchManager Tests", ^{ touchCoord.x = @(firstTouchCoord.x.floatValue + touchManager.tapDistanceThreshold + 1); touchCoord.y = @(firstTouchCoord.y.floatValue + touchManager.tapDistanceThreshold + 1); - secondTouchEvent.coord = [NSMutableArray arrayWithObject:touchCoord]; + secondTouchEvent.coord = [NSArray arrayWithObject:touchCoord]; - secondOnTouchEventStart.event = [NSMutableArray arrayWithObject:secondTouchEvent]; + secondOnTouchEventStart.event = [NSArray arrayWithObject:secondTouchEvent]; - secondOnTouchEventEnd.event = [NSMutableArray arrayWithObject:secondTouchEvent]; + secondOnTouchEventEnd.event = [NSArray arrayWithObject:secondTouchEvent]; }); it(@"should should not issue delegate callbacks", ^{ @@ -343,11 +343,11 @@ describe(@"SDLTouchManager Tests", ^{ NSUInteger panStartTimeStamp = ([[NSDate date] timeIntervalSince1970] * 1000) + movementTimeThresholdOffset; SDLTouchEvent* panStartTouchEvent = [[SDLTouchEvent alloc] init]; - panStartTouchEvent.coord = [NSMutableArray arrayWithObject:panStartTouchCoord]; - panStartTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(panStartTimeStamp)]; + panStartTouchEvent.coord = [NSArray arrayWithObject:panStartTouchCoord]; + panStartTouchEvent.timeStamp = [NSArray arrayWithObject:@(panStartTimeStamp)]; panStartOnTouchEvent = [[SDLOnTouchEvent alloc] init]; - panStartOnTouchEvent.event = [NSMutableArray arrayWithObject:panStartTouchEvent]; + panStartOnTouchEvent.event = [NSArray arrayWithObject:panStartTouchEvent]; panStartOnTouchEvent.type = SDLTouchTypeBegin; // Finger Move @@ -360,11 +360,11 @@ describe(@"SDLTouchManager Tests", ^{ NSUInteger panMoveTimeStamp = panStartTimeStamp + movementTimeThresholdOffset; SDLTouchEvent* panMoveTouchEvent = [[SDLTouchEvent alloc] init]; - panMoveTouchEvent.coord = [NSMutableArray arrayWithObject:panMoveTouchCoord]; - panMoveTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(panMoveTimeStamp)]; + panMoveTouchEvent.coord = [NSArray arrayWithObject:panMoveTouchCoord]; + panMoveTouchEvent.timeStamp = [NSArray arrayWithObject:@(panMoveTimeStamp)]; panMoveOnTouchEvent = [[SDLOnTouchEvent alloc] init]; - panMoveOnTouchEvent.event = [NSMutableArray arrayWithObject:panMoveTouchEvent]; + panMoveOnTouchEvent.event = [NSArray arrayWithObject:panMoveTouchEvent]; panMoveOnTouchEvent.type = SDLTouchTypeMove; // Finger Move @@ -377,11 +377,11 @@ describe(@"SDLTouchManager Tests", ^{ NSUInteger panSecondMoveTimeStamp = panMoveTimeStamp + movementTimeThresholdOffset; SDLTouchEvent* panSecondMoveTouchEvent = [[SDLTouchEvent alloc] init]; - panSecondMoveTouchEvent.coord = [NSMutableArray arrayWithObject:panSecondMoveTouchCoord]; - panSecondMoveTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(panSecondMoveTimeStamp)]; + panSecondMoveTouchEvent.coord = [NSArray arrayWithObject:panSecondMoveTouchCoord]; + panSecondMoveTouchEvent.timeStamp = [NSArray arrayWithObject:@(panSecondMoveTimeStamp)]; panSecondMoveOnTouchEvent = [[SDLOnTouchEvent alloc] init]; - panSecondMoveOnTouchEvent.event = [NSMutableArray arrayWithObject:panSecondMoveTouchEvent]; + panSecondMoveOnTouchEvent.event = [NSArray arrayWithObject:panSecondMoveTouchEvent]; panSecondMoveOnTouchEvent.type = SDLTouchTypeMove; // Finger End @@ -394,11 +394,11 @@ describe(@"SDLTouchManager Tests", ^{ NSUInteger panEndTimeStamp = panSecondMoveTimeStamp + movementTimeThresholdOffset; SDLTouchEvent* panEndTouchEvent = [[SDLTouchEvent alloc] init]; - panEndTouchEvent.coord = [NSMutableArray arrayWithObject:panEndTouchCoord]; - panEndTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(panEndTimeStamp)]; + panEndTouchEvent.coord = [NSArray arrayWithObject:panEndTouchCoord]; + panEndTouchEvent.timeStamp = [NSArray arrayWithObject:@(panEndTimeStamp)]; panEndOnTouchEvent = [[SDLOnTouchEvent alloc] init]; - panEndOnTouchEvent.event = [NSMutableArray arrayWithObject:panEndTouchEvent]; + panEndOnTouchEvent.event = [NSArray arrayWithObject:panEndTouchEvent]; panEndOnTouchEvent.type = SDLTouchTypeEnd; }); @@ -479,11 +479,11 @@ describe(@"SDLTouchManager Tests", ^{ NSUInteger firstFingerTimeStamp = [[NSDate date] timeIntervalSince1970] * 1000; SDLTouchEvent* firstFingerTouchEvent = [[SDLTouchEvent alloc] init]; - firstFingerTouchEvent.coord = [NSMutableArray arrayWithObject:firstFingerTouchCoord]; - firstFingerTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(firstFingerTimeStamp)]; + firstFingerTouchEvent.coord = [NSArray arrayWithObject:firstFingerTouchCoord]; + firstFingerTouchEvent.timeStamp = [NSArray arrayWithObject:@(firstFingerTimeStamp)]; pinchStartFirstFingerOnTouchEvent = [[SDLOnTouchEvent alloc] init]; - pinchStartFirstFingerOnTouchEvent.event = [NSMutableArray arrayWithObject:firstFingerTouchEvent]; + pinchStartFirstFingerOnTouchEvent.event = [NSArray arrayWithObject:firstFingerTouchEvent]; pinchStartFirstFingerOnTouchEvent.type = SDLTouchTypeBegin; // Second finger touch down @@ -495,11 +495,11 @@ describe(@"SDLTouchManager Tests", ^{ SDLTouchEvent* secondFingerTouchEvent = [[SDLTouchEvent alloc] init]; secondFingerTouchEvent.touchEventId = @1; - secondFingerTouchEvent.coord = [NSMutableArray arrayWithObject:secondFingerTouchCoord]; - secondFingerTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(secondFingerTimeStamp)]; + secondFingerTouchEvent.coord = [NSArray arrayWithObject:secondFingerTouchCoord]; + secondFingerTouchEvent.timeStamp = [NSArray arrayWithObject:@(secondFingerTimeStamp)]; pinchStartSecondFingerOnTouchEvent = [[SDLOnTouchEvent alloc] init]; - pinchStartSecondFingerOnTouchEvent.event = [NSMutableArray arrayWithObject:secondFingerTouchEvent]; + pinchStartSecondFingerOnTouchEvent.event = [NSArray arrayWithObject:secondFingerTouchEvent]; pinchStartSecondFingerOnTouchEvent.type = SDLTouchTypeBegin; pinchStartCenter = CGPointMake((firstFingerTouchCoord.x.floatValue + secondFingerTouchCoord.x.floatValue) / 2.0f, @@ -517,11 +517,11 @@ describe(@"SDLTouchManager Tests", ^{ SDLTouchEvent* secondFingerMoveTouchEvent = [[SDLTouchEvent alloc] init]; secondFingerMoveTouchEvent.touchEventId = @1; - secondFingerMoveTouchEvent.coord = [NSMutableArray arrayWithObject:secondFingerMoveTouchCoord]; - secondFingerMoveTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(secondFingerMoveTimeStamp)]; + secondFingerMoveTouchEvent.coord = [NSArray arrayWithObject:secondFingerMoveTouchCoord]; + secondFingerMoveTouchEvent.timeStamp = [NSArray arrayWithObject:@(secondFingerMoveTimeStamp)]; pinchMoveSecondFingerOnTouchEvent = [[SDLOnTouchEvent alloc] init]; - pinchMoveSecondFingerOnTouchEvent.event = [NSMutableArray arrayWithObject:secondFingerMoveTouchEvent]; + pinchMoveSecondFingerOnTouchEvent.event = [NSArray arrayWithObject:secondFingerMoveTouchEvent]; pinchMoveSecondFingerOnTouchEvent.type = SDLTouchTypeMove; pinchMoveCenter = CGPointMake((firstFingerTouchCoord.x.floatValue + secondFingerMoveTouchCoord.x.floatValue) / 2.0f, @@ -539,11 +539,11 @@ describe(@"SDLTouchManager Tests", ^{ SDLTouchEvent* secondFingerEndTouchEvent = [[SDLTouchEvent alloc] init]; secondFingerEndTouchEvent.touchEventId = @1; - secondFingerEndTouchEvent.coord = [NSMutableArray arrayWithObject:secondFingerEndTouchCoord]; - secondFingerEndTouchEvent.timeStamp = [NSMutableArray arrayWithObject:@(secondFingerEndTimeStamp)]; + secondFingerEndTouchEvent.coord = [NSArray arrayWithObject:secondFingerEndTouchCoord]; + secondFingerEndTouchEvent.timeStamp = [NSArray arrayWithObject:@(secondFingerEndTimeStamp)]; pinchEndSecondFingerOnTouchEvent = [[SDLOnTouchEvent alloc] init]; - pinchEndSecondFingerOnTouchEvent.event = [NSMutableArray arrayWithObject:secondFingerEndTouchEvent]; + pinchEndSecondFingerOnTouchEvent.event = [NSArray arrayWithObject:secondFingerEndTouchEvent]; pinchEndSecondFingerOnTouchEvent.type = SDLTouchTypeEnd; pinchEndCenter = CGPointMake((firstFingerTouchCoord.x.floatValue + secondFingerEndTouchCoord.x.floatValue) / 2.0f, diff --git a/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLTouchSpec.m b/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLTouchSpec.m index c629cd72e..29973ffcb 100644 --- a/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLTouchSpec.m +++ b/SmartDeviceLinkTests/UtilitiesSpecs/Touches/SDLTouchSpec.m @@ -48,8 +48,8 @@ describe(@"SDLTouch Tests", ^{ SDLTouchEvent* touchEvent = [[SDLTouchEvent alloc] init]; touchEvent.touchEventId = @0; - touchEvent.coord = [NSMutableArray arrayWithObject:coord]; - touchEvent.timeStamp = [NSMutableArray arrayWithObject:@(timeStamp)]; + touchEvent.coord = [NSArray arrayWithObject:coord]; + touchEvent.timeStamp = [NSArray arrayWithObject:@(timeStamp)]; touch = [[SDLTouch alloc] initWithTouchEvent:touchEvent]; }); @@ -81,8 +81,8 @@ describe(@"SDLTouch Tests", ^{ SDLTouchEvent* touchEvent = [[SDLTouchEvent alloc] init]; touchEvent.touchEventId = @1; - touchEvent.coord = [NSMutableArray arrayWithObject:coord]; - touchEvent.timeStamp = [NSMutableArray arrayWithObject:@(timeStamp)]; + touchEvent.coord = [NSArray arrayWithObject:coord]; + touchEvent.timeStamp = [NSArray arrayWithObject:@(timeStamp)]; touch = [[SDLTouch alloc] initWithTouchEvent:touchEvent]; }); @@ -104,4 +104,4 @@ describe(@"SDLTouch Tests", ^{ }); }); -QuickSpecEnd
\ No newline at end of file +QuickSpecEnd diff --git a/SmartDeviceLink_Example/Base.lproj/ConnectionIAPTableViewController.storyboard b/SmartDeviceLink_Example/Base.lproj/ConnectionIAPTableViewController.storyboard index 335364997..d8a88f6de 100644 --- a/SmartDeviceLink_Example/Base.lproj/ConnectionIAPTableViewController.storyboard +++ b/SmartDeviceLink_Example/Base.lproj/ConnectionIAPTableViewController.storyboard @@ -1,8 +1,13 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="J12-ul-Tx1"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="J12-ul-Tx1"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> <capability name="Constraints to layout margins" minToolsVersion="6.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--ConnectionIAP Table View Controller--> @@ -10,22 +15,24 @@ <objects> <tableViewController id="J12-ul-Tx1" customClass="ConnectionIAPTableViewController" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="MzB-GZ-Ook"> - <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/> + <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <sections> <tableViewSection id="Qz3-D9-j37"> <cells> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2sd-U1-9xV"> + <rect key="frame" x="0.0" y="35" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2sd-U1-9xV" id="EhZ-2E-WQ5"> + <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <subviews> - <button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rjq-vZ-OjB"> - <rect key="frame" x="0.0" y="0.0" width="600" height="44"/> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rjq-vZ-OjB"> + <rect key="frame" x="8" y="0.0" width="359" height="44"/> <fontDescription key="fontDescription" type="system" pointSize="23"/> <state key="normal" title="Connect"> - <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </state> <connections> <action selector="connectButtonWasPressed:" destination="J12-ul-Tx1" eventType="touchUpInside" id="95T-fc-kXs"/> @@ -35,8 +42,8 @@ <constraints> <constraint firstItem="rjq-vZ-OjB" firstAttribute="top" secondItem="EhZ-2E-WQ5" secondAttribute="top" id="8GY-v0-41a"/> <constraint firstAttribute="bottom" secondItem="rjq-vZ-OjB" secondAttribute="bottom" id="FKB-JG-o5G"/> - <constraint firstAttribute="trailingMargin" secondItem="rjq-vZ-OjB" secondAttribute="trailing" constant="-8" id="ISQ-6b-S34"/> - <constraint firstItem="rjq-vZ-OjB" firstAttribute="leading" secondItem="EhZ-2E-WQ5" secondAttribute="leadingMargin" constant="-8" id="PiJ-h3-NOR"/> + <constraint firstAttribute="trailingMargin" secondItem="rjq-vZ-OjB" secondAttribute="trailing" id="ISQ-6b-S34"/> + <constraint firstItem="rjq-vZ-OjB" firstAttribute="leading" secondItem="EhZ-2E-WQ5" secondAttribute="leadingMargin" id="PiJ-h3-NOR"/> </constraints> </tableViewCellContentView> </tableViewCell> diff --git a/SmartDeviceLink_Example/Base.lproj/ConnectionTCPTableViewController.storyboard b/SmartDeviceLink_Example/Base.lproj/ConnectionTCPTableViewController.storyboard index 231cff68b..63324d6de 100644 --- a/SmartDeviceLink_Example/Base.lproj/ConnectionTCPTableViewController.storyboard +++ b/SmartDeviceLink_Example/Base.lproj/ConnectionTCPTableViewController.storyboard @@ -1,31 +1,35 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="l5Q-ZP-1BO"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="l5Q-ZP-1BO"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> <capability name="Constraints to layout margins" minToolsVersion="6.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--ConnectionTCP Table View Controller--> <scene sceneID="geJ-kX-PTm"> <objects> <tableViewController id="l5Q-ZP-1BO" customClass="ConnectionTCPTableViewController" sceneMemberID="viewController"> - <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" showsSelectionImmediatelyOnTouchBegin="NO" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="7ZH-AV-Zyf"> - <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> + <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="7ZH-AV-Zyf"> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/> + <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <sections> <tableViewSection headerTitle="TCP Server" id="bF6-yi-Ial"> <cells> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="pbJ-oz-jNt"> - <rect key="frame" x="0.0" y="50" width="600" height="44"/> + <rect key="frame" x="0.0" y="56" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pbJ-oz-jNt" id="B7X-yY-lwJ"> - <rect key="frame" x="0.0" y="0.0" width="600" height="43"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> <autoresizingMask key="autoresizingMask"/> <subviews> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="IP Address" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="xqM-s4-9RV"> - <rect key="frame" x="8" y="0.0" width="584" height="44"/> + <rect key="frame" x="8" y="0.0" width="359" height="44"/> <constraints> <constraint firstAttribute="height" constant="44" id="5Pw-mh-x83"/> </constraints> @@ -41,14 +45,14 @@ </tableViewCellContentView> </tableViewCell> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="C5b-fS-v3d"> - <rect key="frame" x="0.0" y="94" width="600" height="44"/> + <rect key="frame" x="0.0" y="100" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="C5b-fS-v3d" id="ZD4-xA-og5"> - <rect key="frame" x="0.0" y="0.0" width="600" height="43"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> <autoresizingMask key="autoresizingMask"/> <subviews> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Port" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hsI-ld-8xY"> - <rect key="frame" x="8" y="0.0" width="584" height="44"/> + <rect key="frame" x="8" y="0.0" width="359" height="44"/> <constraints> <constraint firstAttribute="height" constant="44" id="FpG-5e-MHT"/> </constraints> @@ -68,17 +72,17 @@ <tableViewSection headerTitle="" id="rgl-Lm-uDH"> <cells> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="ybX-Eh-Hbx"> - <rect key="frame" x="0.0" y="158" width="600" height="44"/> + <rect key="frame" x="0.0" y="164" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ybX-Eh-Hbx" id="uI9-fK-205"> - <rect key="frame" x="0.0" y="0.0" width="600" height="43"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="t37-4W-6F4"> - <rect key="frame" x="0.0" y="0.0" width="600" height="43"/> + <rect key="frame" x="8" y="0.0" width="359" height="43"/> <fontDescription key="fontDescription" type="system" pointSize="23"/> <state key="normal" title="Connect"> - <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </state> <connections> <action selector="connectButtonWasPressed:" destination="l5Q-ZP-1BO" eventType="touchUpInside" id="tgb-10-M4m"/> @@ -87,9 +91,9 @@ </subviews> <constraints> <constraint firstItem="t37-4W-6F4" firstAttribute="top" secondItem="uI9-fK-205" secondAttribute="top" id="IfU-4k-EXx"/> - <constraint firstItem="t37-4W-6F4" firstAttribute="leading" secondItem="uI9-fK-205" secondAttribute="leadingMargin" constant="-8" id="cc3-uk-9fL"/> + <constraint firstItem="t37-4W-6F4" firstAttribute="leading" secondItem="uI9-fK-205" secondAttribute="leadingMargin" id="cc3-uk-9fL"/> <constraint firstAttribute="bottom" secondItem="t37-4W-6F4" secondAttribute="bottom" id="hnD-4g-xvT"/> - <constraint firstAttribute="trailingMargin" secondItem="t37-4W-6F4" secondAttribute="trailing" constant="-8" id="j4p-fi-0LP"/> + <constraint firstAttribute="trailingMargin" secondItem="t37-4W-6F4" secondAttribute="trailing" id="j4p-fi-0LP"/> </constraints> </tableViewCellContentView> </tableViewCell> diff --git a/SmartDeviceLink_Example/Classes/ConnectionIAPTableViewController.m b/SmartDeviceLink_Example/Classes/ConnectionIAPTableViewController.m index 0b0a785cc..17ee2ae19 100644 --- a/SmartDeviceLink_Example/Classes/ConnectionIAPTableViewController.m +++ b/SmartDeviceLink_Example/Classes/ConnectionIAPTableViewController.m @@ -73,7 +73,7 @@ - (void)proxyManagerDidChangeState:(ProxyState)newState { UIColor* newColor = nil; NSString* newTitle = nil; - + switch (newState) { case ProxyStateStopped: { newColor = [UIColor redColor]; @@ -89,11 +89,11 @@ } break; default: break; } - - if (newColor && newTitle) { + + if (newColor || newTitle) { dispatch_async(dispatch_get_main_queue(), ^{ - self.connectTableViewCell.backgroundColor = newColor; - self.connectButton.titleLabel.text = newTitle; + [self.connectTableViewCell setBackgroundColor:newColor]; + [self.connectButton setTitle:newTitle forState:UIControlStateNormal]; }); } } diff --git a/SmartDeviceLink_Example/Classes/ConnectionTCPTableViewController.m b/SmartDeviceLink_Example/Classes/ConnectionTCPTableViewController.m index 330e87287..7861bb321 100644 --- a/SmartDeviceLink_Example/Classes/ConnectionTCPTableViewController.m +++ b/SmartDeviceLink_Example/Classes/ConnectionTCPTableViewController.m @@ -122,10 +122,10 @@ default: break; } - if (newColor && newTitle) { + if (newColor || newTitle) { dispatch_async(dispatch_get_main_queue(), ^{ - self.connectTableViewCell.backgroundColor = newColor; - self.connectButton.titleLabel.text = newTitle; + [self.connectTableViewCell setBackgroundColor:newColor]; + [self.connectButton setTitle:newTitle forState:UIControlStateNormal]; }); } } diff --git a/SmartDeviceLink_Example/Classes/ProxyManager.m b/SmartDeviceLink_Example/Classes/ProxyManager.m index 17fcc1687..d0fef72d1 100644 --- a/SmartDeviceLink_Example/Classes/ProxyManager.m +++ b/SmartDeviceLink_Example/Classes/ProxyManager.m @@ -15,6 +15,8 @@ NSString *const SDLAppId = @"9999"; NSString *const PointingSoftButtonArtworkName = @"PointingSoftButtonIcon"; NSString *const MainGraphicArtworkName = @"MainArtwork"; +BOOL const ShouldRestartOnDisconnect = NO; + typedef NS_ENUM(NSUInteger, SDLHMIFirstState) { SDLHMIFirstStateNone, SDLHMIFirstStateNonNone, @@ -94,11 +96,12 @@ NS_ASSUME_NONNULL_BEGIN if (!success) { NSLog(@"SDL errored starting up: %@", error); [weakSelf sdlex_updateProxyState:ProxyStateStopped]; - } else { - [weakSelf sdlex_updateProxyState:ProxyStateConnected]; + return; } + + [weakSelf sdlex_updateProxyState:ProxyStateConnected]; - [self setupPermissionsCallbacks]; + [weakSelf setupPermissionsCallbacks]; if ([weakSelf.sdlManager.hmiLevel isEqualToString:SDLHMILevelFull]) { [weakSelf showInitialData]; @@ -107,6 +110,7 @@ NS_ASSUME_NONNULL_BEGIN } - (void)reset { + [self sdlex_updateProxyState:ProxyStateStopped]; [self.sdlManager stop]; } @@ -176,7 +180,7 @@ NS_ASSUME_NONNULL_BEGIN commandMenuParams.menuName = commandName; SDLAddCommand *speakNameCommand = [[SDLAddCommand alloc] init]; - speakNameCommand.vrCommands = [NSMutableArray arrayWithObject:commandName]; + speakNameCommand.vrCommands = @[commandName]; speakNameCommand.menuParams = commandMenuParams; speakNameCommand.cmdID = @0; @@ -194,7 +198,7 @@ NS_ASSUME_NONNULL_BEGIN commandMenuParams.menuName = commandName; SDLAddCommand *performInteractionCommand = [[SDLAddCommand alloc] init]; - performInteractionCommand.vrCommands = [NSMutableArray arrayWithObject:commandName]; + performInteractionCommand.vrCommands = @[commandName]; performInteractionCommand.menuParams = commandMenuParams; performInteractionCommand.cmdID = @1; @@ -236,9 +240,9 @@ NS_ASSUME_NONNULL_BEGIN SDLChoice *theOnlyChoice = [[SDLChoice alloc] init]; theOnlyChoice.choiceID = @0; theOnlyChoice.menuName = theOnlyChoiceName; - theOnlyChoice.vrCommands = [NSMutableArray arrayWithObject:theOnlyChoiceName]; + theOnlyChoice.vrCommands = @[theOnlyChoiceName]; - createInteractionSet.choiceSet = [NSMutableArray arrayWithArray:@[theOnlyChoice]]; + createInteractionSet.choiceSet = @[theOnlyChoice]; return createInteractionSet; } @@ -248,7 +252,7 @@ NS_ASSUME_NONNULL_BEGIN performOnlyChoiceInteraction.initialText = @"Choose the only one! You have 5 seconds..."; performOnlyChoiceInteraction.initialPrompt = [SDLTTSChunk textChunksFromString:@"Choose it"]; performOnlyChoiceInteraction.interactionMode = SDLInteractionModeBoth; - performOnlyChoiceInteraction.interactionChoiceSetIDList = [NSMutableArray arrayWithObject:@0]; + performOnlyChoiceInteraction.interactionChoiceSetIDList = @[@0]; performOnlyChoiceInteraction.helpPrompt = [SDLTTSChunk textChunksFromString:@"Do it"]; performOnlyChoiceInteraction.timeoutPrompt = [SDLTTSChunk textChunksFromString:@"Too late"]; performOnlyChoiceInteraction.timeout = @5000; @@ -354,6 +358,9 @@ NS_ASSUME_NONNULL_BEGIN self.firstTimeState = SDLHMIFirstStateNone; self.initialShowState = SDLHMIInitialShowStateNone; _state = ProxyStateStopped; + if (ShouldRestartOnDisconnect) { + [self startManager]; + } } - (void)hmiLevel:(SDLHMILevel)oldLevel didChangeToLevel:(SDLHMILevel)newLevel { diff --git a/SmartDeviceLink_Example/Info.plist b/SmartDeviceLink_Example/Info.plist index 9a5a675b4..7191e361c 100644 --- a/SmartDeviceLink_Example/Info.plist +++ b/SmartDeviceLink_Example/Info.plist @@ -9,7 +9,7 @@ <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>7.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> |