Skip to content
Browse files

Formatting, Cleanup Public APIs

Move several pieces of the API to private, rename parts ot the Public
API to be more consistent with other Objective C libraries.
  • Loading branch information...
1 parent b59a67b commit cdfa72944151727ed6a5df2b059bc13577c3baa1 Alex Billingsley committed Feb 16, 2013
Showing with 613 additions and 954 deletions.
  1. +2 −2 Podfile
  2. +6 −6 Podfile.lock
  3. BIN SignalR.Client.ObjC/Default-568h@2x.png
  4. BIN SignalR.Client.ObjC/Default.png
  5. BIN SignalR.Client.ObjC/Default@2x.png
  6. +52 −12 SignalR.Client.ObjC/SignalR.Client.ObjC.xcodeproj/project.pbxproj
  7. +1 −1 SignalR.Client.ObjC/SignalR.Samples.iOS/Controllers/ChatViewController.m
  8. +3 −3 SignalR.Client.ObjC/SignalR.Samples.iOS/Controllers/ConnectionStatusViewController.m
  9. +3 −3 SignalR.Client.ObjC/SignalR.Samples.iOS/Controllers/MouseTrackingViewController.m
  10. +4 −4 SignalR.Client.ObjC/SignalR.Samples.iOS/Controllers/StreamingViewController.m
  11. +6 −6 SignalR.Client/Http/SRDefaultHttpClient.m
  12. +21 −21 SignalR.Client/Http/SRDefaultHttpHelper.m
  13. +1 −1 SignalR.Client/Http/SRDefaultHttpWebRequestWrapper.h
  14. +1 −1 SignalR.Client/Http/SRDefaultHttpWebRequestWrapper.m
  15. +1 −1 SignalR.Client/Http/SRDefaultHttpWebResponseWrapper.h
  16. +1 −1 SignalR.Client/Http/SRDefaultHttpWebResponseWrapper.m
  17. +3 −3 SignalR.Client/Http/SRHttpClient.h
  18. +9 −9 SignalR.Client/Http/SRHttpHelper.h
  19. +5 −15 SignalR.Client/Hubs/SRHubConnection.h
  20. +15 −17 SignalR.Client/Hubs/SRHubConnection.m
  21. +2 −9 SignalR.Client/Hubs/SRHubInvocation.m
  22. +4 −76 SignalR.Client/Hubs/SRHubProxy.h
  23. +18 −34 SignalR.Client/Hubs/SRHubProxy.m
  24. +80 −0 SignalR.Client/Hubs/SRHubProxyInterface.h
  25. +2 −6 SignalR.Client/Hubs/SRHubRegistrationData.m
  26. +2 −8 SignalR.Client/Hubs/SRHubResult.m
  27. +4 −4 SignalR.Client/Hubs/SRHubservable.h
  28. +3 −9 SignalR.Client/Hubs/SRHubservable.m
  29. +0 −5 SignalR.Client/Hubs/SRSubscription.m
  30. +30 −70 SignalR.Client/Infrastructure/NSObject+SRJSON.m
  31. +1 −2 SignalR.Client/Infrastructure/SRExceptionHelper.m
  32. +24 −48 SignalR.Client/Infrastructure/SRThreadSafeInvoker.m
  33. +3 −3 SignalR.Client/Infrastructure/SRVersion.h
  34. +16 −48 SignalR.Client/Infrastructure/SRVersion.m
  35. +11 −282 SignalR.Client/SRConnection.h
  36. +35 −43 SignalR.Client/SRConnection.m
  37. +43 −0 SignalR.Client/SRConnectionDelegate.h
  38. +73 −0 SignalR.Client/SRConnectionInterface.h
  39. +1 −2 SignalR.Client/SRConnectionState.h
  40. +2 −9 SignalR.Client/SRNegotiationResponse.m
  41. +3 −3 SignalR.Client/Transports/SRAutoTransport.h
  42. +13 −19 SignalR.Client/Transports/SRAutoTransport.m
  43. +11 −11 SignalR.Client/Transports/{SRClientTransport.h → SRClientTransportInterface.h}
  44. +8 −8 SignalR.Client/Transports/SRHttpBasedTransport.h
  45. +20 −26 SignalR.Client/Transports/SRHttpBasedTransport.m
  46. +4 −4 SignalR.Client/Transports/SRLongPollingTransport.h
  47. +22 −29 SignalR.Client/Transports/SRLongPollingTransport.m
  48. +3 −3 SignalR.Client/Transports/SRServerSentEventsTransport.h
  49. +16 −21 SignalR.Client/Transports/SRServerSentEventsTransport.m
  50. +0 −4 SignalR.Client/Transports/ServerSentEvents/SRChunkBuffer.h
  51. +5 −7 SignalR.Client/Transports/ServerSentEvents/SRChunkBuffer.m
  52. +18 −49 SignalR.Client/Transports/ServerSentEvents/SREventSourceStreamReader.m
  53. +1 −1 SignalR.Client/Transports/ServerSentEvents/SRSseEvent.h
  54. +1 −5 SignalR.Client/Transports/ServerSentEvents/SRSseEvent.m
View
4 Podfile
@@ -5,10 +5,10 @@ workspace 'SignalR.Client.ObjC'
target :"SignalR.Client.iOS", :exclusive => true do
platform :ios, '5.0'
- pod 'AFNetworking', '1.0.1'
+ pod 'AFNetworking', '>=1.0.0'
end
target :"SignalR.Client.OSX", :exclusive => true do
platform :osx, '10.7'
- pod 'AFNetworking', '1.0.1'
+ pod 'AFNetworking', '>=1.0.0'
end
View
12 Podfile.lock
@@ -1,12 +1,12 @@
+COCOAPODS: 0.16.2
+
DEPENDENCIES:
-- AFNetworking (= 1.0.1)
-- AFNetworking (= 1.0.1)
+- AFNetworking (>= 1.0.0)
+- AFNetworking (>= 1.0.0)
PODS:
-- AFNetworking (1.0.1)
-
-COCOAPODS: 0.14.0
+- AFNetworking (1.1.0)
SPEC CHECKSUMS:
- AFNetworking: 4c11f857c9a18d65f4257c90a1e74ac49f0ac422
+ AFNetworking: 761a418233d280c1e0580bcb76ff9cb4c3073d17
View
BIN SignalR.Client.ObjC/Default-568h@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SignalR.Client.ObjC/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SignalR.Client.ObjC/Default@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
64 SignalR.Client.ObjC/SignalR.Client.ObjC.xcodeproj/project.pbxproj
@@ -90,7 +90,7 @@
391963CE15AF22FF00DDC946 /* SREventType.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785515AF13F6009B959E /* SREventType.h */; settings = {ATTRIBUTES = (Private, ); }; };
391963CF15AF22FF00DDC946 /* SRSseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785615AF13F6009B959E /* SRSseEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
391963D015AF22FF00DDC946 /* SRAutoTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785815AF13F6009B959E /* SRAutoTransport.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 391963D215AF22FF00DDC946 /* SRClientTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785B15AF13F6009B959E /* SRClientTransport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 391963D215AF22FF00DDC946 /* SRClientTransportInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785B15AF13F6009B959E /* SRClientTransportInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };
391963D315AF22FF00DDC946 /* SRHttpBasedTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785C15AF13F6009B959E /* SRHttpBasedTransport.h */; settings = {ATTRIBUTES = (Public, ); }; };
391963D415AF22FF00DDC946 /* SRLongPollingTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785E15AF13F6009B959E /* SRLongPollingTransport.h */; settings = {ATTRIBUTES = (Public, ); }; };
391963D515AF22FF00DDC946 /* SRServerSentEventsTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920786015AF13F6009B959E /* SRServerSentEventsTransport.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -152,7 +152,7 @@
3920789C15AF13F6009B959E /* SRSseEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 3920785715AF13F6009B959E /* SRSseEvent.m */; };
3920789D15AF13F6009B959E /* SRAutoTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785815AF13F6009B959E /* SRAutoTransport.h */; settings = {ATTRIBUTES = (Public, ); }; };
3920789E15AF13F6009B959E /* SRAutoTransport.m in Sources */ = {isa = PBXBuildFile; fileRef = 3920785915AF13F6009B959E /* SRAutoTransport.m */; };
- 392078A015AF13F6009B959E /* SRClientTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785B15AF13F6009B959E /* SRClientTransport.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 392078A015AF13F6009B959E /* SRClientTransportInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785B15AF13F6009B959E /* SRClientTransportInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };
392078A115AF13F6009B959E /* SRHttpBasedTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785C15AF13F6009B959E /* SRHttpBasedTransport.h */; settings = {ATTRIBUTES = (Public, ); }; };
392078A215AF13F6009B959E /* SRHttpBasedTransport.m in Sources */ = {isa = PBXBuildFile; fileRef = 3920785D15AF13F6009B959E /* SRHttpBasedTransport.m */; };
392078A315AF13F6009B959E /* SRLongPollingTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 3920785E15AF13F6009B959E /* SRLongPollingTransport.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -199,6 +199,15 @@
39E6FD5F15C6EAFB00434098 /* NSObject+SRJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 3920783B15AF13F6009B959E /* NSObject+SRJSON.m */; };
39E6FD6115C6EAFC00434098 /* NSObject+SRJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 3920783B15AF13F6009B959E /* NSObject+SRJSON.m */; };
39E7A5DB15E532380097F395 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 39E7A5DA15E532380097F395 /* CoreGraphics.framework */; };
+ 39EBAC2F16D072C900C6F359 /* SRHubProxyInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 39EBAC2E16D067CB00C6F359 /* SRHubProxyInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 39EBAC3016D072C900C6F359 /* SRHubProxyInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 39EBAC2E16D067CB00C6F359 /* SRHubProxyInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 39EBAC3116D072E300C6F359 /* SRConnectionInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 39EBAC2816D03F1000C6F359 /* SRConnectionInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 39EBAC3216D072E400C6F359 /* SRConnectionInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 39EBAC2816D03F1000C6F359 /* SRConnectionInterface.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 39EBAC3316D072EE00C6F359 /* SRConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 39EBAC2916D03F5800C6F359 /* SRConnectionDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 39EBAC3516D0740600C6F359 /* SRConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 39EBAC2916D03F5800C6F359 /* SRConnectionDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 39EBAC3A16D07CF300C6F359 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 39EBAC3716D07CF300C6F359 /* Default-568h@2x.png */; };
+ 39EBAC3B16D07CF300C6F359 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 39EBAC3816D07CF300C6F359 /* Default.png */; };
+ 39EBAC3C16D07CF300C6F359 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 39EBAC3916D07CF300C6F359 /* Default@2x.png */; };
39EF033B15CFE8F7001C66EA /* SREventSourceStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 39EF033A15CFE8F7001C66EA /* SREventSourceStreamReaderTests.m */; };
39EF033C15CFE8F7001C66EA /* SREventSourceStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 39EF033A15CFE8F7001C66EA /* SREventSourceStreamReaderTests.m */; };
D27CBDC3D95B4241B1B76237 /* libPods-SignalR.Client.iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F9E09B8C504C4E1BBE289746 /* libPods-SignalR.Client.iOS.a */; };
@@ -221,8 +230,8 @@
3919636515AF1FBC00DDC946 /* Router.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Router.m; sourceTree = "<group>"; };
3919636E15AF205300DDC946 /* libSignalR.Client.OSX.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSignalR.Client.OSX.a; sourceTree = BUILT_PRODUCTS_DIR; };
3919637215AF205300DDC946 /* SignalR.Client.OSX-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SignalR.Client.OSX-Prefix.pch"; sourceTree = "<group>"; };
- 3919643015AF373E00DDC946 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
- 3919643215AF374900DDC946 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = "<group>"; };
+ 3919643015AF373E00DDC946 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = icon.png; path = ../icon.png; sourceTree = "<group>"; };
+ 3919643215AF374900DDC946 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = icon.icns; path = ../icon.icns; sourceTree = "<group>"; };
3920780715AF13C3009B959E /* libSignalR.Client.iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSignalR.Client.iOS.a; sourceTree = BUILT_PRODUCTS_DIR; };
3920780A15AF13C3009B959E /* Foundation.framework */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
3920780E15AF13C3009B959E /* SignalR.Client.iOS-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SignalR.Client.iOS-Prefix.pch"; sourceTree = "<group>"; };
@@ -281,7 +290,7 @@
3920785715AF13F6009B959E /* SRSseEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SRSseEvent.m; sourceTree = "<group>"; };
3920785815AF13F6009B959E /* SRAutoTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SRAutoTransport.h; sourceTree = "<group>"; };
3920785915AF13F6009B959E /* SRAutoTransport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SRAutoTransport.m; sourceTree = "<group>"; };
- 3920785B15AF13F6009B959E /* SRClientTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SRClientTransport.h; sourceTree = "<group>"; };
+ 3920785B15AF13F6009B959E /* SRClientTransportInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SRClientTransportInterface.h; sourceTree = "<group>"; };
3920785C15AF13F6009B959E /* SRHttpBasedTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SRHttpBasedTransport.h; sourceTree = "<group>"; };
3920785D15AF13F6009B959E /* SRHttpBasedTransport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SRHttpBasedTransport.m; sourceTree = "<group>"; };
3920785E15AF13F6009B959E /* SRLongPollingTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SRLongPollingTransport.h; sourceTree = "<group>"; };
@@ -329,6 +338,17 @@
39E6FD2415C6BF4000434098 /* SignalR.Client.Tests.iOS-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SignalR.Client.Tests.iOS-Prefix.pch"; sourceTree = "<group>"; };
39E6FD2B15C6BFCE00434098 /* SRJSONTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SRJSONTests.m; path = SignalR.Client.Tests/SRJSONTests.m; sourceTree = "<group>"; };
39E7A5DA15E532380097F395 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 39EBAC2816D03F1000C6F359 /* SRConnectionInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SRConnectionInterface.h; sourceTree = "<group>"; };
+ 39EBAC2916D03F5800C6F359 /* SRConnectionDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SRConnectionDelegate.h; sourceTree = "<group>"; };
+ 39EBAC2E16D067CB00C6F359 /* SRHubProxyInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SRHubProxyInterface.h; sourceTree = "<group>"; };
+ 39EBAC3616D07A0B00C6F359 /* SignalR-ObjC.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = "SignalR-ObjC.podspec"; path = "../SignalR-ObjC.podspec"; sourceTree = "<group>"; };
+ 39EBAC3716D07CF300C6F359 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; };
+ 39EBAC3816D07CF300C6F359 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = SOURCE_ROOT; };
+ 39EBAC3916D07CF300C6F359 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = SOURCE_ROOT; };
+ 39EBAC3D16D07D5000C6F359 /* ACKNOWLEDGEMENTS.md */ = {isa = PBXFileReference; lastKnownFileType = text; name = ACKNOWLEDGEMENTS.md; path = ../ACKNOWLEDGEMENTS.md; sourceTree = "<group>"; };
+ 39EBAC3E16D07D5000C6F359 /* CHANGES.md */ = {isa = PBXFileReference; lastKnownFileType = text; name = CHANGES.md; path = ../CHANGES.md; sourceTree = "<group>"; };
+ 39EBAC3F16D07D5100C6F359 /* LICENSE.md */ = {isa = PBXFileReference; lastKnownFileType = text; name = LICENSE.md; path = ../LICENSE.md; sourceTree = "<group>"; };
+ 39EBAC4016D07D5100C6F359 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = text; name = README.md; path = ../README.md; sourceTree = "<group>"; };
39EF033A15CFE8F7001C66EA /* SREventSourceStreamReaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SREventSourceStreamReaderTests.m; path = SignalR.Client.Tests/SREventSourceStreamReaderTests.m; sourceTree = "<group>"; };
E1168910CBED44F49353CF85 /* Pods-SignalR.Client.OSX.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SignalR.Client.OSX.xcconfig"; path = "../Pods/Pods-SignalR.Client.OSX.xcconfig"; sourceTree = SOURCE_ROOT; };
F9E09B8C504C4E1BBE289746 /* libPods-SignalR.Client.iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SignalR.Client.iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -402,6 +422,7 @@
3919634C15AF1EC200DDC946 /* SignalR.Samples.OSX */ = {
isa = PBXGroup;
children = (
+ 3919643215AF374900DDC946 /* icon.icns */,
3919635815AF1EC200DDC946 /* AppDelegate.h */,
3919635915AF1EC200DDC946 /* AppDelegate.m */,
3919635B15AF1EC200DDC946 /* MainMenu.xib */,
@@ -459,11 +480,12 @@
392077FC15AF13C3009B959E = {
isa = PBXGroup;
children = (
- 396D2869165ABE6C0000D19E /* MobileCoreServices.framework */,
- 396D2866165ABE4F0000D19E /* SystemConfiguration.framework */,
+ 39EBAC3D16D07D5000C6F359 /* ACKNOWLEDGEMENTS.md */,
+ 39EBAC3E16D07D5000C6F359 /* CHANGES.md */,
+ 39EBAC3F16D07D5100C6F359 /* LICENSE.md */,
+ 39EBAC4016D07D5100C6F359 /* README.md */,
396D2851165ABCD50000D19E /* Podfile */,
- 3919643215AF374900DDC946 /* icon.icns */,
- 3919643015AF373E00DDC946 /* icon.png */,
+ 39EBAC3616D07A0B00C6F359 /* SignalR-ObjC.podspec */,
3920781715AF13F6009B959E /* SignalR.Client */,
3920780C15AF13C3009B959E /* SignalR.Client.iOS */,
3919637015AF205300DDC946 /* SignalR.Client.OSX */,
@@ -496,6 +518,8 @@
3920780915AF13C3009B959E /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 396D2869165ABE6C0000D19E /* MobileCoreServices.framework */,
+ 396D2866165ABE4F0000D19E /* SystemConfiguration.framework */,
39E7A5DA15E532380097F395 /* CoreGraphics.framework */,
39E6FCED15C6BE5400434098 /* Cocoa.framework */,
39E6FCEB15C6BE4D00434098 /* SenTestingKit.framework */,
@@ -530,8 +554,10 @@
3920782515AF13F6009B959E /* Hubs */,
3920783715AF13F6009B959E /* Infrastructure */,
3920784815AF13F6009B959E /* SignalR.h */,
+ 39EBAC2816D03F1000C6F359 /* SRConnectionInterface.h */,
3920784915AF13F6009B959E /* SRConnection.h */,
3920784A15AF13F6009B959E /* SRConnection.m */,
+ 39EBAC2916D03F5800C6F359 /* SRConnectionDelegate.h */,
3920784B15AF13F6009B959E /* SRConnectionState.h */,
3920784C15AF13F6009B959E /* SRNegotiationResponse.h */,
3920784D15AF13F6009B959E /* SRNegotiationResponse.m */,
@@ -567,6 +593,7 @@
3920783215AF13F6009B959E /* SRHubs.h */,
3920782615AF13F6009B959E /* SRHubConnection.h */,
3920782715AF13F6009B959E /* SRHubConnection.m */,
+ 39EBAC2E16D067CB00C6F359 /* SRHubProxyInterface.h */,
3920782A15AF13F6009B959E /* SRHubProxy.h */,
3920782B15AF13F6009B959E /* SRHubProxy.m */,
3920782C15AF13F6009B959E /* SRHubProxyExtensions.h */,
@@ -606,9 +633,9 @@
isa = PBXGroup;
children = (
3920785015AF13F6009B959E /* ServerSentEvents */,
+ 3920785B15AF13F6009B959E /* SRClientTransportInterface.h */,
3920785815AF13F6009B959E /* SRAutoTransport.h */,
3920785915AF13F6009B959E /* SRAutoTransport.m */,
- 3920785B15AF13F6009B959E /* SRClientTransport.h */,
3920785C15AF13F6009B959E /* SRHttpBasedTransport.h */,
3920785D15AF13F6009B959E /* SRHttpBasedTransport.m */,
3920785E15AF13F6009B959E /* SRLongPollingTransport.h */,
@@ -636,6 +663,10 @@
3920792515AF1853009B959E /* SignalR.Samples.iOS */ = {
isa = PBXGroup;
children = (
+ 39EBAC3716D07CF300C6F359 /* Default-568h@2x.png */,
+ 39EBAC3816D07CF300C6F359 /* Default.png */,
+ 39EBAC3916D07CF300C6F359 /* Default@2x.png */,
+ 3919643015AF373E00DDC946 /* icon.png */,
3920794615AF1BEA009B959E /* Controllers */,
3920793115AF1854009B959E /* MainStoryboard_iPhone.storyboard */,
3920793415AF1854009B959E /* MainStoryboard_iPad.storyboard */,
@@ -753,10 +784,13 @@
391963CA15AF22FF00DDC946 /* SRNegotiationResponse.h in Headers */,
391963CB15AF22FF00DDC946 /* SRLog.h in Headers */,
391963D015AF22FF00DDC946 /* SRAutoTransport.h in Headers */,
- 391963D215AF22FF00DDC946 /* SRClientTransport.h in Headers */,
+ 391963D215AF22FF00DDC946 /* SRClientTransportInterface.h in Headers */,
391963D315AF22FF00DDC946 /* SRHttpBasedTransport.h in Headers */,
391963D415AF22FF00DDC946 /* SRLongPollingTransport.h in Headers */,
391963D515AF22FF00DDC946 /* SRServerSentEventsTransport.h in Headers */,
+ 39EBAC3016D072C900C6F359 /* SRHubProxyInterface.h in Headers */,
+ 39EBAC3216D072E400C6F359 /* SRConnectionInterface.h in Headers */,
+ 39EBAC3516D0740600C6F359 /* SRConnectionDelegate.h in Headers */,
391963AD15AF22FF00DDC946 /* SRDefaultHttpClient.h in Headers */,
391963AE15AF22FF00DDC946 /* SRDefaultHttpHelper.h in Headers */,
391963AF15AF22FF00DDC946 /* SRDefaultHttpWebRequestWrapper.h in Headers */,
@@ -783,6 +817,7 @@
3920786A15AF13F6009B959E /* SRHttpClient.h in Headers */,
3920786B15AF13F6009B959E /* SRHttpHelper.h in Headers */,
3920786C15AF13F6009B959E /* SRRequest.h in Headers */,
+ 39EBAC2F16D072C900C6F359 /* SRHubProxyInterface.h in Headers */,
3920786D15AF13F6009B959E /* SRResponse.h in Headers */,
3920787A15AF13F6009B959E /* SRHubs.h in Headers */,
3920786E15AF13F6009B959E /* SRHubConnection.h in Headers */,
@@ -801,6 +836,8 @@
3920788D15AF13F6009B959E /* SRVersion.h in Headers */,
3920788F15AF13F6009B959E /* SignalR.h in Headers */,
3920789015AF13F6009B959E /* SRConnection.h in Headers */,
+ 39EBAC3116D072E300C6F359 /* SRConnectionInterface.h in Headers */,
+ 39EBAC3316D072EE00C6F359 /* SRConnectionDelegate.h in Headers */,
3920789315AF13F6009B959E /* SRNegotiationResponse.h in Headers */,
3920789515AF13F6009B959E /* SRLog.h in Headers */,
3920789615AF13F6009B959E /* SRChunkBuffer.h in Headers */,
@@ -809,7 +846,7 @@
3920789B15AF13F6009B959E /* SRSseEvent.h in Headers */,
3920789D15AF13F6009B959E /* SRAutoTransport.h in Headers */,
3920788115AF13F6009B959E /* NSObject+SRJSON.h in Headers */,
- 392078A015AF13F6009B959E /* SRClientTransport.h in Headers */,
+ 392078A015AF13F6009B959E /* SRClientTransportInterface.h in Headers */,
392078A115AF13F6009B959E /* SRHttpBasedTransport.h in Headers */,
392078A315AF13F6009B959E /* SRLongPollingTransport.h in Headers */,
392078A515AF13F6009B959E /* SRServerSentEventsTransport.h in Headers */,
@@ -979,6 +1016,9 @@
3920793615AF1854009B959E /* MainStoryboard_iPad.storyboard in Resources */,
3919636615AF1FBC00DDC946 /* Environments.plist in Resources */,
3919643115AF373E00DDC946 /* icon.png in Resources */,
+ 39EBAC3A16D07CF300C6F359 /* Default-568h@2x.png in Resources */,
+ 39EBAC3B16D07CF300C6F359 /* Default.png in Resources */,
+ 39EBAC3C16D07CF300C6F359 /* Default@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
2 SignalR.Client.ObjC/SignalR.Samples.iOS/Controllers/ChatViewController.m
@@ -177,7 +177,7 @@ -(void)refreshRoom:(id)inRoom
[self clearMessages];
[self clearUsers];
- [hub invoke:@"GetUsers" withArgs:@[] continueWith:^(id users) {
+ [hub invoke:@"GetUsers" withArgs:@[] completionHandler:^(id users) {
for(id user in users)
{
if([user isKindOfClass:[NSDictionary class]]){
View
6 SignalR.Client.ObjC/SignalR.Samples.iOS/Controllers/ConnectionStatusViewController.m
@@ -72,7 +72,7 @@ - (void)viewDidLoad
_connection.started = ^{
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:@"Connection Opened" atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
_connection.received = ^(NSString * data){
//__strong __typeof(&*weakSelf)strongSelf = weakSelf;
@@ -82,12 +82,12 @@ - (void)viewDidLoad
_connection.closed = ^{
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:@"Connection Closed" atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
_connection.error = ^(NSError *error){
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:error.localizedDescription atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
[_connection start];
}
View
6 SignalR.Client.ObjC/SignalR.Samples.iOS/Controllers/MouseTrackingViewController.m
@@ -76,7 +76,7 @@ - (void)viewDidLoad
_connection.started = ^{
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:@"Connection Opened" atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
_connection.received = ^(NSString * data){
//__strong __typeof(&*weakSelf)strongSelf = weakSelf;
@@ -86,12 +86,12 @@ - (void)viewDidLoad
_connection.closed = ^{
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:@"Connection Closed" atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
_connection.error = ^(NSError *error){
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:error.localizedDescription atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
[_connection start];
}
View
8 SignalR.Client.ObjC/SignalR.Samples.iOS/Controllers/StreamingViewController.m
@@ -67,22 +67,22 @@ - (void)viewDidLoad
_connection.started = ^{
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:@"Connection Opened" atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
_connection.received = ^(NSString * data){
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:data atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
_connection.closed = ^{
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:@"Connection Closed" atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
_connection.error = ^(NSError *error){
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
[strongSelf.data insertObject:error.localizedDescription atIndex:0];
- [self.tableView reloadData];
+ [strongSelf.tableView reloadData];
};
[_connection start];
}
View
12 SignalR.Client/Http/SRDefaultHttpClient.m
@@ -27,7 +27,7 @@
@implementation SRDefaultHttpClient
-- (void)getAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest continueWith:(SRResponseBlock)block {
+- (void)getAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest completionHandler:(SRResponseBlock)block {
if (url == nil) {
[NSException raise:NSInvalidArgumentException format:NSLocalizedString(@"Url should be non-null",@"")];
}
@@ -38,13 +38,13 @@ - (void)getAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest
req = [[SRDefaultHttpWebRequestWrapper alloc] initWithRequest:request];
if (prepareRequest)
prepareRequest(req);
- } continueWith:^(id response) {
+ } completionHandler:^(id response) {
if (block)
block([[SRDefaultHttpWebResponseWrapper alloc] initWithRequest:req withResponse:response]);
}];
}
-- (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest continueWith:(SRResponseBlock)block {
+- (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest completionHandler:(SRResponseBlock)block {
if (url == nil) {
[NSException raise:NSInvalidArgumentException format:NSLocalizedString(@"Url should be non-null",@"")];
}
@@ -55,13 +55,13 @@ - (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest
req = [[SRDefaultHttpWebRequestWrapper alloc] initWithRequest:request];
if (prepareRequest)
prepareRequest(req);
- } continueWith:^(id response) {
+ } completionHandler:^(id response) {
if (block)
block([[SRDefaultHttpWebResponseWrapper alloc] initWithRequest:req withResponse:response]);
}];
}
-- (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest postData:(id)postData continueWith:(SRResponseBlock)block {
+- (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest postData:(id)postData completionHandler:(SRResponseBlock)block {
if (url == nil) {
[NSException raise:NSInvalidArgumentException format:NSLocalizedString(@"Url should be non-null",@"")];
}
@@ -74,7 +74,7 @@ - (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest
prepareRequest(req);
}
postData:postData
- continueWith:^(id response) { if (block) block([[SRDefaultHttpWebResponseWrapper alloc] initWithRequest:req withResponse:response]); }];
+ completionHandler:^(id response) { if (block) block([[SRDefaultHttpWebResponseWrapper alloc] initWithRequest:req withResponse:response]); }];
}
@end
View
42 SignalR.Client/Http/SRDefaultHttpHelper.m
@@ -73,7 +73,7 @@ @interface SRDefaultHttpHelper ()
* This can be used to modify properties of the POST, for example timeout or cache protocol
* @param block: A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)getInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer parameters:(id)parameters continueWith:(SRContinueWithBlock)block;
++ (void)getInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer parameters:(id)parameters completionHandler:(SRCompletionHandler)block;
#pragma mark -
#pragma mark POST Requests Implementation
@@ -88,7 +88,7 @@ + (void)getInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)reque
* This can be used to modify properties of the POST, for example timeout or cache protocol
* @param block: A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)postInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer postData:(id)postData continueWith:(SRContinueWithBlock)block;
++ (void)postInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer postData:(id)postData completionHandler:(SRCompletionHandler)block;
@end
@@ -97,23 +97,23 @@ @implementation SRDefaultHttpHelper
#pragma mark -
#pragma mark GET Requests Implementation
-+ (void)getAsync:(NSString *)url continueWith:(SRContinueWithBlock)block {
- [[self class] getAsync:url requestPreparer:nil continueWith:block];
++ (void)getAsync:(NSString *)url completionHandler:(SRCompletionHandler)block {
+ [[self class] getAsync:url requestPreparer:nil completionHandler:block];
}
-+ (void)getAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer continueWith:(SRContinueWithBlock)block {
- [[self class] getAsync:url requestPreparer:requestPreparer parameters:[[NSDictionary alloc] init] continueWith:block];
++ (void)getAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer completionHandler:(SRCompletionHandler)block {
+ [[self class] getAsync:url requestPreparer:requestPreparer parameters:[[NSDictionary alloc] init] completionHandler:block];
}
-+ (void)getAsync:(NSString *)url parameters:(id)parameters continueWith:(SRContinueWithBlock)block {
- [[self class] getAsync:url requestPreparer:nil parameters:parameters continueWith:block];
++ (void)getAsync:(NSString *)url parameters:(id)parameters completionHandler:(SRCompletionHandler)block {
+ [[self class] getAsync:url requestPreparer:nil parameters:parameters completionHandler:block];
}
-+ (void)getAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer parameters:(id)parameters continueWith:(SRContinueWithBlock)block {
- [[self class] getInternal:url requestPreparer:requestPreparer parameters:parameters continueWith:block];
++ (void)getAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer parameters:(id)parameters completionHandler:(SRCompletionHandler)block {
+ [[self class] getInternal:url requestPreparer:requestPreparer parameters:parameters completionHandler:block];
}
-+ (void)getInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer parameters:(id)parameters continueWith:(SRContinueWithBlock)block {
++ (void)getInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer parameters:(id)parameters completionHandler:(SRCompletionHandler)block {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"GET"];
[request setValue:@"Keep-Alive" forHTTPHeaderField:@"Connection"];
@@ -155,23 +155,23 @@ + (void)getInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)reque
#pragma mark -
#pragma mark POST Requests Implementation
-+ (void)postAsync:(NSString *)url continueWith:(SRContinueWithBlock)block {
- [[self class] postAsync:url requestPreparer:nil continueWith:block];
++ (void)postAsync:(NSString *)url completionHandler:(SRCompletionHandler)block {
+ [[self class] postAsync:url requestPreparer:nil completionHandler:block];
}
-+ (void)postAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer continueWith:(SRContinueWithBlock)block {
- [[self class] postAsync:url requestPreparer:requestPreparer postData:[[NSDictionary alloc] init] continueWith:block];
++ (void)postAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer completionHandler:(SRCompletionHandler)block {
+ [[self class] postAsync:url requestPreparer:requestPreparer postData:[[NSDictionary alloc] init] completionHandler:block];
}
-+ (void)postAsync:(NSString *)url postData:(id)postData continueWith:(SRContinueWithBlock)block {
- [[self class] postAsync:url requestPreparer:nil postData:postData continueWith:block];
++ (void)postAsync:(NSString *)url postData:(id)postData completionHandler:(SRCompletionHandler)block {
+ [[self class] postAsync:url requestPreparer:nil postData:postData completionHandler:block];
}
-+ (void)postAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer postData:(id)postData continueWith:(SRContinueWithBlock)block {
- [[self class] postInternal:url requestPreparer:requestPreparer postData:postData continueWith:block];
++ (void)postAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer postData:(id)postData completionHandler:(SRCompletionHandler)block {
+ [[self class] postInternal:url requestPreparer:requestPreparer postData:postData completionHandler:block];
}
-+ (void)postInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer postData:(id)postData continueWith:(SRContinueWithBlock)block {
++ (void)postInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer postData:(id)postData completionHandler:(SRCompletionHandler)block {
NSMutableArray *components = [NSMutableArray array];
for (NSString *key in [postData allKeys]) {
[components addObject:[NSString stringWithFormat:@"%@=%@",key,postData[key]]];
@@ -182,7 +182,7 @@ + (void)postInternal:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requ
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
- [request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
+ [request setValue:[NSString stringWithFormat:@"%ld", (unsigned long)[requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];
[request setTimeoutInterval:240];
if(requestPreparer != nil) {
View
2 SignalR.Client/Http/SRDefaultHttpWebRequestWrapper.h
@@ -25,6 +25,6 @@
@interface SRDefaultHttpWebRequestWrapper : NSObject <SRRequest>
-- (id)initWithRequest:(id)request;
+- (instancetype)initWithRequest:(id)request;
@end
View
2 SignalR.Client/Http/SRDefaultHttpWebRequestWrapper.m
@@ -39,7 +39,7 @@ @implementation SRDefaultHttpWebRequestWrapper
@synthesize headers = _headers;
@synthesize accept = _accept;
-- (id)initWithRequest:(id)request {
+- (instancetype)initWithRequest:(id)request {
if (self = [super init]) {
if([request isKindOfClass:[NSMutableURLRequest class]]) {
_request = request;
View
2 SignalR.Client/Http/SRDefaultHttpWebResponseWrapper.h
@@ -26,6 +26,6 @@
@interface SRDefaultHttpWebResponseWrapper : NSObject <SRResponse>
-- (id)initWithRequest:(id <SRRequest>)request withResponse:(id)response;
+- (instancetype)initWithRequest:(id <SRRequest>)request withResponse:(id)response;
@end
View
2 SignalR.Client/Http/SRDefaultHttpWebResponseWrapper.m
@@ -33,7 +33,7 @@ @implementation SRDefaultHttpWebResponseWrapper
@synthesize stream = _stream;
@synthesize error = _error;
-- (id)initWithRequest:(id <SRRequest>)request withResponse:(id)response {
+- (instancetype)initWithRequest:(id <SRRequest>)request withResponse:(id)response {
static NSString *empty = @"";
if (self = [super init]) {
View
6 SignalR.Client/Http/SRHttpClient.h
@@ -29,9 +29,9 @@ typedef void (^SRResponseBlock)(id <SRResponse> response);
@protocol SRHttpClient <NSObject>
-- (void)getAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest continueWith:(SRResponseBlock)block;
+- (void)getAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest completionHandler:(SRResponseBlock)block;
-- (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest continueWith:(SRResponseBlock)block;
-- (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest postData:(id)postData continueWith:(SRResponseBlock)block;
+- (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest completionHandler:(SRResponseBlock)block;
+- (void)postAsync:(NSString *)url requestPreparer:(SRRequestBlock)prepareRequest postData:(id)postData completionHandler:(SRResponseBlock)block;
@end
View
18 SignalR.Client/Http/SRHttpHelper.h
@@ -23,7 +23,7 @@
#import <Foundation/Foundation.h>
typedef void (^SRPrepareRequestBlock)(id request);
-typedef void (^SRContinueWithBlock)(id response);
+typedef void (^SRCompletionHandler)(id response);
/**
* `SRHttpHelper` defines a protocol used to create HttpRequest objects that are configured for the various http request methods (GET, PUT etc)
@@ -43,7 +43,7 @@ typedef void (^SRContinueWithBlock)(id response);
* @param url The url relative to the server endpoint
* @param block A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)getAsync:(NSString *)url continueWith:(SRContinueWithBlock)block;
++ (void)getAsync:(NSString *)url completionHandler:(SRCompletionHandler)block;
/**
* Creates a GET request with the specified url returns on the given block
@@ -53,7 +53,7 @@ typedef void (^SRContinueWithBlock)(id response);
* This can be used to modify properties of the POST, for example timeout or cache protocol
* @param block A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)getAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer continueWith:(SRContinueWithBlock)block;
++ (void)getAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer completionHandler:(SRCompletionHandler)block;
/**
* Creates a GET request with the specified url returns on the given block
@@ -63,7 +63,7 @@ typedef void (^SRContinueWithBlock)(id response);
* This can be used to modify properties of the POST, for example timeout or cache protocol
* @param block A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)getAsync:(NSString *)url parameters:(id)parameters continueWith:(SRContinueWithBlock)block;
++ (void)getAsync:(NSString *)url parameters:(id)parameters completionHandler:(SRCompletionHandler)block;
/**
* Creates a GET request with the specified url returns on the given block
@@ -74,7 +74,7 @@ typedef void (^SRContinueWithBlock)(id response);
* This can be used to modify properties of the POST, for example timeout or cache protocol
* @param block A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)getAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer parameters:(id)parameters continueWith:(SRContinueWithBlock)block;
++ (void)getAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer parameters:(id)parameters completionHandler:(SRCompletionHandler)block;
#pragma mark -
#pragma mark POST Requests
@@ -90,7 +90,7 @@ typedef void (^SRContinueWithBlock)(id response);
* @param url The url relative to the server endpoint
* @param block A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)postAsync:(NSString *)url continueWith:(SRContinueWithBlock)block;
++ (void)postAsync:(NSString *)url completionHandler:(SRCompletionHandler)block;
/**
* Creates a POST request with the specified url returns on the given block
@@ -101,7 +101,7 @@ typedef void (^SRContinueWithBlock)(id response);
* This can be used to modify properties of the POST, for example timeout or cache protocol
* @param block A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)postAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer continueWith:(SRContinueWithBlock)block;
++ (void)postAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer completionHandler:(SRCompletionHandler)block;
/**
* Creates a POST request with the specified url and payload returns on the given block
@@ -111,7 +111,7 @@ typedef void (^SRContinueWithBlock)(id response);
* @param postData An Object that conforms to SRSerializable to post at the url
* @param block A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)postAsync:(NSString *)url postData:(id)postData continueWith:(SRContinueWithBlock)block;
++ (void)postAsync:(NSString *)url postData:(id)postData completionHandler:(SRCompletionHandler)block;
/**
* Creates a POST request with the specified url and payload returns on the given block
@@ -123,6 +123,6 @@ typedef void (^SRContinueWithBlock)(id response);
* This can be used to modify properties of the POST, for example timeout or cache protocol
* @param block A function to be called when the post finishes. The block should handle both SUCCESS and FAILURE
*/
-+ (void)postAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer postData:(id)postData continueWith:(SRContinueWithBlock)block;
++ (void)postAsync:(NSString *)url requestPreparer:(SRPrepareRequestBlock)requestPreparer postData:(id)postData completionHandler:(SRCompletionHandler)block;
@end
View
20 SignalR.Client/Hubs/SRHubConnection.h
@@ -22,26 +22,16 @@
#import <Foundation/Foundation.h>
#import "SRConnection.h"
-
-@class SRHubProxy;
+#import "SRHubProxyInterface.h"
/**
* An `SRHubConnection` object provides an abstraction over `SRConnection` and provides support for publishing and subscribing to custom events
*/
@interface SRHubConnection : SRConnection
-///-------------------------------
-/// @name Properties
-///-------------------------------
-
-/**
- * The `NSMutableDictionary` object containing the `SRHubProxy` objects
- */
-@property (strong, nonatomic, readonly) NSMutableDictionary *hubs;
-
-- (id)initWithURLString:(NSString *)URL useDefault:(BOOL)useDefault;
-- (id)initWithURLString:(NSString *)url queryString:(NSString *)queryString useDefault:(BOOL)useDefault;
-- (id)initWithURLString:(NSString *)url query:(NSDictionary *)queryString useDefault:(BOOL)useDefault;
+- (instancetype)initWithURLString:(NSString *)URL useDefault:(BOOL)useDefault;
+- (instancetype)initWithURLString:(NSString *)url queryString:(NSString *)queryString useDefault:(BOOL)useDefault;
+- (instancetype)initWithURLString:(NSString *)url query:(NSDictionary *)queryString useDefault:(BOOL)useDefault;
/**
* Creates a client side proxy to the hub on the server side.
@@ -54,6 +44,6 @@
* @param hubName hubName the name of the hub
* @return SRHubProxy object
*/
-- (SRHubProxy *)createHubProxy:(NSString *)hubName;
+- (id <SRHubProxyInterface>)createHubProxy:(NSString *)hubName;
@end
View
32 SignalR.Client/Hubs/SRHubConnection.m
@@ -30,7 +30,9 @@
@interface SRHubConnection ()
-- (NSString *)_getUrl:(NSString *)URL useDefault:(BOOL)useDefault;
+@property (strong, nonatomic, readonly) NSMutableDictionary *hubs;
+
++ (NSString *)getUrl:(NSString *)URL useDefault:(BOOL)useDefault;
@end
@@ -39,40 +41,40 @@ @implementation SRHubConnection
#pragma mark -
#pragma mark Initialization
-- (id)initWithURLString:(NSString *)URL {
+- (instancetype)initWithURLString:(NSString *)URL {
return [self initWithURLString:URL useDefault:YES];
}
-- (id)initWithURLString:(NSString *)URL useDefault:(BOOL)useDefault {
- if (self = [super initWithURLString:[self _getUrl:URL useDefault:useDefault]]) {
+- (instancetype)initWithURLString:(NSString *)URL useDefault:(BOOL)useDefault {
+ if (self = [super initWithURLString:[[self class] getUrl:URL useDefault:useDefault]]) {
_hubs = [[NSMutableDictionary alloc] init];
}
return self;
}
-- (id)initWithURLString:(NSString *)url queryString:(NSString *)queryString {
+- (instancetype)initWithURLString:(NSString *)url queryString:(NSString *)queryString {
return [self initWithURLString:url queryString:queryString useDefault:YES];
}
-- (id)initWithURLString:(NSString *)url queryString:(NSString *)queryString useDefault:(BOOL)useDefault {
- if (self = [super initWithURLString:[self _getUrl:url useDefault:useDefault] queryString:queryString]) {
+- (instancetype)initWithURLString:(NSString *)url queryString:(NSString *)queryString useDefault:(BOOL)useDefault {
+ if (self = [super initWithURLString:[[self class] getUrl:url useDefault:useDefault] queryString:queryString]) {
_hubs = [[NSMutableDictionary alloc] init];
}
return self;
}
-- (id)initWithURLString:(NSString *)url query:(NSDictionary *)queryString {
+- (instancetype)initWithURLString:(NSString *)url query:(NSDictionary *)queryString {
return [self initWithURLString:url query:queryString useDefault:YES];
}
-- (id)initWithURLString:(NSString *)url query:(NSDictionary *)queryString useDefault:(BOOL)useDefault {
- if (self = [super initWithURLString:[self _getUrl:url useDefault:useDefault] query:queryString]) {
+- (instancetype)initWithURLString:(NSString *)url query:(NSDictionary *)queryString useDefault:(BOOL)useDefault {
+ if (self = [super initWithURLString:[[self class] getUrl:url useDefault:useDefault] query:queryString]) {
_hubs = [[NSMutableDictionary alloc] init];
}
return self;
}
-- (SRHubProxy *)createHubProxy:(NSString *)hubName {
+- (id <SRHubProxyInterface>)createHubProxy:(NSString *)hubName {
if (self.state != disconnected) {
[NSException raise:NSInternalInconsistencyException format:NSLocalizedString(@"Proxies cannot be added after the connection has been started.",@"NSInternalInconsistencyException")];
}
@@ -90,7 +92,7 @@ - (SRHubProxy *)createHubProxy:(NSString *)hubName {
#pragma mark -
#pragma mark Private
-- (NSString *)_getUrl:(NSString *)URL useDefault:(BOOL)useDefault {
++ (NSString *)getUrl:(NSString *)URL useDefault:(BOOL)useDefault {
if([URL hasSuffix:@"/"] == false) {
URL = [URL stringByAppendingString:@"/"];
}
@@ -110,7 +112,7 @@ - (NSString *)onSending {
NSMutableArray *data = [[NSMutableArray alloc] init];
for(id key in _hubs) {
SRHubRegistrationData *registration = [[SRHubRegistrationData alloc] init];
- registration.name = [_hubs[key] hubName];
+ registration.name = key;
[data addObject:registration];
}
@@ -137,8 +139,4 @@ - (void)didReceiveData:(NSString *)data {
[super didReceiveData:data];
}
-- (void)dealloc {
- _hubs = nil;
-}
-
@end
View
11 SignalR.Client/Hubs/SRHubInvocation.m
@@ -33,7 +33,7 @@ @implementation SRHubInvocation
static NSString * const kArgs = @"A";
static NSString * const kState = @"S";
-- (id) init {
+- (instancetype) init {
if (self = [super init]) {
_hub = [NSString stringWithFormat:@""];
_method = [NSString stringWithFormat:@""];
@@ -43,7 +43,7 @@ - (id) init {
return self;
}
-- (id)initWithDictionary:(NSDictionary*)dict {
+- (instancetype)initWithDictionary:(NSDictionary*)dict {
if (self = [self init]) {
self.hub = [NSString stringWithFormat:@"%@",dict[kHub]];
self.method = [NSString stringWithFormat:@"%@",dict[kMethod]];
@@ -68,11 +68,4 @@ - (NSString *)description {
return [NSString stringWithFormat:@"HubInvocation: Hub=%@ Method=%@",_hub,_method];
}
-- (void)dealloc {
- _hub = nil;
- _method = nil;
- _args = nil;
- _state = nil;
-}
-
@end
View
80 SignalR.Client/Hubs/SRHubProxy.h
@@ -21,38 +21,13 @@
//
#import <Foundation/Foundation.h>
-
-@class SRConnection;
-@class SRSubscription;
+#import "SRConnectionInterface.h"
+#import "SRHubProxyInterface.h"
/**
* An `SRHubProxy` object provides support for SignalR Hubs
*/
-@interface SRHubProxy : NSObject
-
-///-------------------------------
-/// @name Properties
-///-------------------------------
-
-/**
- * The `SRConnection` object corresponding to underlying `SRConnection`
- */
-@property (assign, nonatomic, readonly) SRConnection *connection;
-
-/**
- * The `NSString` object corresponding to the hubname
- */
-@property (strong, nonatomic, readonly) NSString *hubName;
-
-/**
- * An `NSMutableDictionary` object that manages the state of the SignalR Hub
- */
-@property (strong, nonatomic, readonly) NSMutableDictionary *state;
-
-/**
- * An `NSMutableDictionary` object that manages the `SRSubscriptions` that have been defined on the hub
- */
-@property (strong, nonatomic, readonly) NSMutableDictionary *subscriptions;
+@interface SRHubProxy : NSObject <SRHubProxyInterface>
///-------------------------------
/// @name Initializing an SRHubProxy Object
@@ -67,65 +42,18 @@
* @param hubname an `NSString` representing the hubname
* @return an `SRHubProxy` object
*/
-- (id)initWithConnection:(SRConnection *)connection hubName:(NSString *)hubname;
+- (instancetype)initWithConnection:(id <SRConnectionInterface>)connection hubName:(NSString *)hubname;
///-------------------------------
/// @name Subscription Management
///-------------------------------
/**
- * Adds a new `SRSubscription` to the hubproxy for eventName
- *
- * @param eventName the `NSString` object representing the name of the subscription event
- * @return the `SRSubscription` object created
- */
-- (SRSubscription *)subscribe:(NSString *)eventName;
-
-/**
* Invokes the `SRSubscription` object that corresponds to eventName
*
* @param eventName the `NSString` object representing the name of the subscription event
* @param args the arguments to pass as part of the invocation
*/
- (void)invokeEvent:(NSString *)eventName withArgs:(NSArray *)args;
-///-------------------------------
-/// @name State Management
-///-------------------------------
-
-/**
- * Returns the object corresponding to name in the state dictionary
- *
- * @param name the key for which to return the corresponding value.
- *
- * @return Returns the value associated with a given key.
- */
-- (id)getMember:(NSString *)name;
-
-/**
- * Adds a given key-value pair to the state dictionary.
- *
- * @param name The key for value
- * @param value The value for key.
- */
-- (void)setMember:(NSString *)name object:(id)value;
-
-/**
- * Invokes a SignalR Server Hub method with the specified method name and arguments
- * calls [self inoke:method arg:args continueWith:nil];
- *
- * @param method the `NSString` object representing the name of the server method to invoke
- * @param args the arguments to pass as part of the invocation
- */
-- (void)invoke:(NSString *)method withArgs:(NSArray *)args;
-
-/**
- * Invokes a SignalR Server Hub method with the specified method name and arguments
- *
- * @param method the `NSString` object representing the name of the server method to invoke
- * @param args the arguments to pass as part of the invocation
- * @param block the block to be called once the server method is invoked, this may be nil
- */
-- (void)invoke:(NSString *)method withArgs:(NSArray *)args continueWith:(void (^)(id response))block;
-
@end
View
52 SignalR.Client/Hubs/SRHubProxy.m
@@ -20,7 +20,6 @@
// DEALINGS IN THE SOFTWARE.
//
-#import "SRConnection.h"
#import "SRHubInvocation.h"
#import "SRHubProxy.h"
#import "SRHubResult.h"
@@ -29,18 +28,20 @@
@interface SRHubProxy ()
+@property (assign, nonatomic, readonly) id <SRConnectionInterface> connection;
+@property (strong, nonatomic, readonly) NSString *hubName;
+@property (strong, nonatomic, readonly) NSMutableDictionary *state;
+@property (strong, nonatomic, readonly) NSMutableDictionary *subscriptions;
+
+
@end
@implementation SRHubProxy
#pragma mark -
#pragma mark Initialization
-+ (SRHubProxy *)hubProxyWith:(SRConnection *)connection hubName:(NSString *)hubname {
- return [[SRHubProxy alloc] initWithConnection:connection hubName:hubname];
-}
-
-- (id)initWithConnection:(SRConnection *)connection hubName:(NSString *)hubname {
+- (instancetype)initWithConnection:(id <SRConnectionInterface>)connection hubName:(NSString *)hubname {
if (self = [super init]) {
_connection = connection;
_hubName = hubname;
@@ -75,7 +76,7 @@ - (void)invokeEvent:(NSString *)eventName withArgs:(NSArray *)args {
NSUInteger numberOfArguments = [signature numberOfArguments] - 2;
if (args.count != numberOfArguments) {
- SRLogConnection(@"Callback for event '%@' is configured with %d arguments, received %d parameters instead.",eventName, numberOfArguments, args.count);
+ SRLogConnection(@"Callback for event '%@' is configured with %ld arguments, received %ld parameters instead.",eventName, (unsigned long)numberOfArguments, (unsigned long)args.count);
}
[invocation setSelector:eventObj.selector];
@@ -102,11 +103,10 @@ - (void)setMember:(NSString *)name object:(id)value {
}
- (void)invoke:(NSString *)method withArgs:(NSArray *)args {
- [self invoke:method withArgs:args continueWith:nil];
+ [self invoke:method withArgs:args completionHandler:nil];
}
-- (void)invoke:(NSString *)method withArgs:(NSArray *)args continueWith:(void (^)(id response))block
-{
+- (void)invoke:(NSString *)method withArgs:(NSArray *)args completionHandler:(void (^)(id response))block {
if(method == nil || [method isEqualToString:@""]) {
[NSException raise:NSInvalidArgumentException format:NSLocalizedString(@"Argument method is null",@"NSInvalidArgumentException")];
}
@@ -124,17 +124,13 @@ - (void)invoke:(NSString *)method withArgs:(NSArray *)args continueWith:(void (^
hubData.state = _state;
}
- [_connection send:hubData continueWith:^(NSDictionary *response)
- {
+ [_connection send:hubData completionHandler:^(NSDictionary *response) {
SRLogConnection(@"did receive response %@",response);
- if(response)
- {
+ if(response) {
SRHubResult *hubResult = [[SRHubResult alloc] initWithDictionary:response];
- if (hubResult != nil)
- {
- if(![hubResult.error isKindOfClass:[NSNull class]] && hubResult.error != nil)
- {
+ if (hubResult != nil) {
+ if(![hubResult.error isKindOfClass:[NSNull class]] && hubResult.error != nil) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
userInfo[NSLocalizedFailureReasonErrorKey] = NSInternalInconsistencyException;
userInfo[NSLocalizedDescriptionKey] = [NSString stringWithFormat:@"%@",hubResult.error];
@@ -144,34 +140,22 @@ - (void)invoke:(NSString *)method withArgs:(NSArray *)args continueWith:(void (^
[_connection didReceiveError:error];
}
- if(![hubResult.state isKindOfClass:[NSNull class]] && hubResult.state != nil)
- {
- for (id key in hubResult.state)
- {
+ if(![hubResult.state isKindOfClass:[NSNull class]] && hubResult.state != nil) {
+ for (id key in hubResult.state) {
[self setMember:key object:(hubResult.state)[key]];
}
}
- if(block != nil)
- {
+ if(block != nil) {
block(hubResult.result);
}
}
}
}];
}
-- (NSString *)description
-{
+- (NSString *)description {
return [NSString stringWithFormat:@"HubProxy: Name=%@ State=%@ Subscriptions:%@",_hubName,_state,_subscriptions];
}
-- (void)dealloc
-{
- _connection = nil;
- _hubName = nil;
- _state = nil;
- _subscriptions = nil;
-}
-
@end
View
80 SignalR.Client/Hubs/SRHubProxyInterface.h
@@ -0,0 +1,80 @@
+//
+// SRHubProxyInterface.h
+// SignalR
+//
+// Created by Alex Billingsley on 10/31/11.
+// Copyright (c) 2011 DyKnow LLC. (http://dyknow.com/)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of
+// the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+//
+
+#import <Foundation/Foundation.h>
+
+@class SRSubscription;
+
+@protocol SRHubProxyInterface <NSObject>
+
+///-------------------------------
+/// @name State Management
+///-------------------------------
+
+/**
+ * Returns the object corresponding to name in the state dictionary
+ *
+ * @param name the key for which to return the corresponding value.
+ *
+ * @return Returns the value associated with a given key.
+ */
+- (id)getMember:(NSString *)name;
+
+/**
+ * Adds a given key-value pair to the state dictionary.
+ *
+ * @param name The key for value
+ * @param value The value for key.
+ */
+- (void)setMember:(NSString *)name object:(id)value;
+
+///-------------------------------
+/// @name Subscription Management
+///-------------------------------
+
+/**
+ * Adds a new `SRSubscription` to the hubproxy for eventName
+ *
+ * @param eventName the `NSString` object representing the name of the subscription event
+ * @return the `SRSubscription` object created
+ */
+- (SRSubscription *)subscribe:(NSString *)eventName;
+
+/**
+ * Invokes a SignalR Server Hub method with the specified method name and arguments
+ * calls [self inoke:method arg:args completionHandler];
+ *
+ * @param method the `NSString` object representing the name of the server method to invoke
+ * @param args the arguments to pass as part of the invocation
+ */
+- (void)invoke:(NSString *)method withArgs:(NSArray *)args;
+
+/**
+ * Invokes a SignalR Server Hub method with the specified method name and arguments
+ *
+ * @param method the `NSString` object representing the name of the server method to invoke
+ * @param args the arguments to pass as part of the invocation
+ * @param block the block to be called once the server method is invoked, this may be nil
+ */
+- (void)invoke:(NSString *)method withArgs:(NSArray *)args completionHandler:(void (^)(id response))block;
+
+@end
View
8 SignalR.Client/Hubs/SRHubRegistrationData.m
@@ -28,9 +28,9 @@ @interface SRHubRegistrationData ()
@implementation SRHubRegistrationData
-static NSString * const kName = @"name";
+static NSString * const kName = @"Name";
-- (id) init {
+- (instancetype) init {
if (self = [super init]) {
_name = [NSString stringWithFormat:@""];
}
@@ -49,8 +49,4 @@ - (NSString *)description {
return [NSString stringWithFormat:@"HubRegistrationData: Name=%@",_name];
}
-- (void)dealloc {
- _name = nil;
-}
-
@end
View
10 SignalR.Client/Hubs/SRHubResult.m
@@ -32,15 +32,15 @@ @implementation SRHubResult
static NSString * const kError = @"E";
static NSString * const kState = @"S";
-- (id) init {
+- (instancetype) init {
if (self = [super init]) {
_error = [NSString stringWithFormat:@""];
_state = @{};
}
return self;
}
-- (id)initWithDictionary:(NSDictionary*)dict {
+- (instancetype)initWithDictionary:(NSDictionary*)dict {
if (self = [self init]) {
self.result = dict[kResult];
self.error = dict[kError];
@@ -53,10 +53,4 @@ - (NSString *)description {
return [NSString stringWithFormat:@"HubResult: Result:%@ Error=%@ State=%@",_result,_error,_state];
}
-- (void)dealloc {
- _result = nil;
- _error = nil;
- _state = nil;
-}
-
@end
View
8 SignalR.Client/Hubs/SRHubservable.h
@@ -21,8 +21,8 @@
//
#import <Foundation/Foundation.h>
+#import "SRHubProxyInterface.h"
-@class SRHubProxy;
@class SRSubscription;
/**
@@ -42,7 +42,7 @@
/**
* An `SRHubProxy` object representing the Hub to be observed
*/
-@property (strong, nonatomic, readonly) SRHubProxy *proxy;
+@property (strong, nonatomic, readonly) id <SRHubProxyInterface> proxy;
///-------------------------------
/// @name Initializing an SRHubservable Object
@@ -59,7 +59,7 @@
* @param eventName the `NSString` object representing the name of the subscription event
* @return an `SRHubservable` object
*/
-+ (id)observe:(SRHubProxy *)proxy event:(NSString *)eventName;
++ (instancetype)observe:(id <SRHubProxyInterface>)proxy event:(NSString *)eventName;
/**
* Initializes a new `SRHubservable` object
@@ -72,7 +72,7 @@
* @param eventName the `NSString` object representing the name of the subscription event
* @return an `SRHubservable` object
*/
-- (id)initWithProxy:(SRHubProxy *)proxy eventName:(NSString *)eventName;
+- (instancetype)initWithProxy:(id <SRHubProxyInterface>)proxy eventName:(NSString *)eventName;
///-------------------------------
/// @name Adding Subscriptions
View
12 SignalR.Client/Hubs/SRHubservable.m
@@ -20,7 +20,6 @@
// DEALINGS IN THE SOFTWARE.
//
-#import "SRHubProxy.h"
#import "SRHubservable.h"
#import "SRSubscription.h"
@@ -33,11 +32,11 @@ @implementation SRHubservable
#pragma mark -
#pragma mark Initialization
-+ (id)observe:(SRHubProxy *)proxy event:(NSString *)eventName {
++ (instancetype)observe:(id <SRHubProxyInterface>)proxy event:(NSString *)eventName {
return [[SRHubservable alloc] initWithProxy:proxy eventName:eventName];
}
-- (id)initWithProxy:(SRHubProxy *)proxy eventName:(NSString *)eventName {
+- (instancetype)initWithProxy:(id <SRHubProxyInterface>)proxy eventName:(NSString *)eventName {
if (self = [super init]) {
_proxy = proxy;
_eventName = eventName;
@@ -57,9 +56,4 @@ - (NSString *)description {
return [NSString stringWithFormat:@"Hubservable: Hub:%@ Event=%@",_proxy, _eventName];
}
-- (void)dealloc {
- _proxy = nil;
- _eventName = nil;
-}
-
-@end
+@end
View
5 SignalR.Client/Hubs/SRSubscription.m
@@ -32,9 +32,4 @@ - (NSString *)description {
return [NSString stringWithFormat:@"Subscription: Object:%@ Selector=%@",_object, NSStringFromSelector(_selector)];
}
-- (void)dealloc {
- _object = nil;
- _selector = nil;
-}
-
@end
View
100 SignalR.Client/Infrastructure/NSObject+SRJSON.m
@@ -24,51 +24,39 @@
@implementation NSObject (SRJSON)
-- (id)ensureFoundationObject:(id)object
-{
- if ([object isKindOfClass:[NSDictionary class]])
- {
+- (id)ensureFoundationObject:(id)object {
+ if ([object isKindOfClass:[NSDictionary class]]) {
NSMutableDictionary *validJSONDictionary = [NSMutableDictionary dictionary];
- for (id _key in object)
- {
- if ([_key isKindOfClass:[NSString class]])
- {
+ for (id _key in object) {
+ if ([_key isKindOfClass:[NSString class]]) {
id jsonObject = [self ensureFoundationObject:object[_key]];
validJSONDictionary[_key] = jsonObject;
- }
- else
- {
+ } else {
return nil;
}
}
return validJSONDictionary;
- }
- else if ([object isKindOfClass:[NSArray class]])
- {
+ } else if ([object isKindOfClass:[NSSet class]]) {
+ return [object allObjects];
+ } else if ([object isKindOfClass:[NSArray class]]) {
NSMutableArray *validJSONArray = [NSMutableArray array];
- for (id _object in object)
- {
+ for (id _object in object) {
id jsonObject = [self ensureFoundationObject:_object];
[validJSONArray addObject:jsonObject];
}
return validJSONArray;
- }
- else if([object isKindOfClass:[NSString class]] ||
- [object isKindOfClass:[NSNumber class]] ||
- [object isKindOfClass:[NSNull class]])
- {
+ } else if([object isKindOfClass:[NSString class]] ||
+ [object isKindOfClass:[NSNumber class]] ||
+ [object isKindOfClass:[NSNull class]]) {
return object;
- }
- else
- {
+ } else {
SEL _YAJLSelector = NSSelectorFromString(@"JSON");
SEL _SBJSONSelector = NSSelectorFromString(@"proxyForJson");
SEL _NXJsonSelector = NSSelectorFromString(@"serialize");
- if (_SBJSONSelector && [object respondsToSelector:_SBJSONSelector])
- {
+ if (_SBJSONSelector && [object respondsToSelector:_SBJSONSelector]) {
NSObject *json;
__unsafe_unretained NSObject *jsonTemp = nil;
@@ -85,9 +73,7 @@ - (id)ensureFoundationObject:(id)object
if(json == nil) goto throw;
return [self ensureFoundationObject:json];
- }
- else if (_YAJLSelector && [object respondsToSelector:_YAJLSelector])
- {
+ } else if (_YAJLSelector && [object respondsToSelector:_YAJLSelector]) {
NSObject *json;
__unsafe_unretained NSObject *jsonTemp = nil;
@@ -104,9 +90,7 @@ - (id)ensureFoundationObject:(id)object
if(json == nil) goto throw;
return [self ensureFoundationObject:json];
- }
- else if (_NXJsonSelector && [object respondsToSelector:_NXJsonSelector])
- {
+ } else if (_NXJsonSelector && [object respondsToSelector:_NXJsonSelector]) {
NSObject *json;
__unsafe_unretained NSObject *jsonTemp = nil;
@@ -133,8 +117,7 @@ - (id)ensureFoundationObject:(id)object
return nil;
}
-- (NSString *)SRJSONRepresentation
-{
+- (NSString *)SRJSONRepresentation {
NSString *json;
__unsafe_unretained NSString *jsonTemp = nil;
@@ -150,8 +133,7 @@ - (NSString *)SRJSONRepresentation
id _NSJSONSerializationClass = NSClassFromString(@"NSJSONSerialization");
SEL _NSJSONSerializationSelector = NSSelectorFromString(@"dataWithJSONObject:options:error:");
- if (_JSONKitSelector && [jsonObject respondsToSelector:_JSONKitSelector])
- {
+ if (_JSONKitSelector && [jsonObject respondsToSelector:_JSONKitSelector]) {
NSMethodSignature *signature = [jsonObject methodSignatureForSelector:_JSONKitSelector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:jsonObject];
@@ -161,9 +143,7 @@ - (NSString *)SRJSONRepresentation
[invocation getReturnValue:&jsonTemp];
json = jsonTemp;
- }
- else if (_SBJSONSelector && [jsonObject respondsToSelector:_SBJSONSelector])
- {
+ } else if (_SBJSONSelector && [jsonObject respondsToSelector:_SBJSONSelector]) {
NSMethodSignature *signature = [jsonObject methodSignatureForSelector:_SBJSONSelector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:jsonObject];
@@ -173,9 +153,7 @@ - (NSString *)SRJSONRepresentation
[invocation getReturnValue:&jsonTemp];
json = jsonTemp;
- }
- else if (_YAJLSelector && [jsonObject respondsToSelector:_YAJLSelector])
- {
+ } else if (_YAJLSelector && [jsonObject respondsToSelector:_YAJLSelector]) {
NSMethodSignature *signature = [jsonObject methodSignatureForSelector:_YAJLSelector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:jsonObject];
@@ -185,9 +163,7 @@ - (NSString *)SRJSONRepresentation
[invocation getReturnValue:&jsonTemp];
json = jsonTemp;
- }
- else if (_NXJsonSerializerClass && [_NXJsonSerializerClass respondsToSelector:_NXJsonSerializerSelector])
- {
+ } else if (_NXJsonSerializerClass && [_NXJsonSerializerClass respondsToSelector:_NXJsonSerializerSelector]) {
__unsafe_unretained NSString *jsonString = jsonObject;
NSMethodSignature *signature = [_NXJsonSerializerClass methodSignatureForSelector:_NXJsonSerializerSelector];
@@ -201,9 +177,7 @@ - (NSString *)SRJSONRepresentation
[invocation getReturnValue:&jsonTemp];
json = jsonTemp;
- }
- else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector])
- {
+ } else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) {
__unsafe_unretained NSString *jsonString = jsonObject;
__unsafe_unretained NSData *JSONData = nil;
@@ -223,9 +197,7 @@ - (NSString *)SRJSONRepresentation
[invocation getReturnValue:&JSONData];
json = [[NSString alloc] initWithData:JSONData encoding:NSUTF8StringEncoding];
- }
- else
- {
+ } else {
NSDictionary *userInfo = @{NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Please either target a platform that supports NSJSONSerialization or add one of the following libraries to your project: JSONKit, SBJSON, or YAJL", nil)};
[[NSException exceptionWithName:NSInternalInconsistencyException reason:NSLocalizedString(@"No JSON generation functionality available", nil) userInfo:userInfo] raise];
}
@@ -238,8 +210,7 @@ - (NSString *)SRJSONRepresentation
@implementation NSString (SRJSON)
-- (id)SRJSONValue
-{
+- (id)SRJSONValue {
NSObject *json;
__unsafe_unretained NSObject *jsonTemp = nil;
@@ -253,8 +224,7 @@ - (id)SRJSONValue
id _NSJSONSerializationClass = NSClassFromString(@"NSJSONSerialization");
SEL _NSJSONSerializationSelector = NSSelectorFromString(@"JSONObjectWithData:options:error:");
- if (_JSONKitSelector && [self respondsToSelector:_JSONKitSelector])
- {
+ if (_JSONKitSelector && [self respondsToSelector:_JSONKitSelector]) {
NSMethodSignature *signature = [self methodSignatureForSelector:_JSONKitSelector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:self];
@@ -264,9 +234,7 @@ - (id)SRJSONValue
[invocation getReturnValue:&jsonTemp];
json = jsonTemp;
- }
- else if (_SBJSONSelector && [self respondsToSelector:_SBJSONSelector])
- {
+ } else if (_SBJSONSelector && [self respondsToSelector:_SBJSONSelector]) {
NSMethodSignature *signature = [self methodSignatureForSelector:_SBJSONSelector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:self];
@@ -276,9 +244,7 @@ - (id)SRJSONValue
[invocation getReturnValue:&jsonTemp];
json = jsonTemp;
- }
- else if (_YAJLSelector && [self respondsToSelector:_YAJLSelector])
- {
+ } else if (_YAJLSelector && [self respondsToSelector:_YAJLSelector]) {
NSMethodSignature *signature = [self methodSignatureForSelector:_YAJLSelector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setTarget:self];
@@ -288,9 +254,7 @@ - (id)SRJSONValue
[invocation getReturnValue:&jsonTemp];
json = jsonTemp;
- }
- else if (_NXJsonParserClass && [_NXJsonParserClass respondsToSelector:_NXJsonParserSelector])
- {
+ } else if (_NXJsonParserClass && [_NXJsonParserClass respondsToSelector:_NXJsonParserSelector]) {
__unsafe_unretained NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding];
__unsafe_unretained NSError *error;
@@ -308,9 +272,7 @@ - (id)SRJSONValue
[invocation getReturnValue:&jsonTemp];
json = jsonTemp;
- }
- else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector])
- {
+ } else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) {
__unsafe_unretained NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding];
NSUInteger readOptions = 0;
@@ -329,9 +291,7 @@ - (id)SRJSONValue
[invocation getReturnValue:&jsonTemp];
json = jsonTemp;
- }
- else
- {
+ } else {
NSDictionary *userInfo = @{NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Please either target a platform that supports NSJSONSerialization or add one of the following libraries to your project: JSONKit, SBJSON, or YAJL", nil)};
[[NSException exceptionWithName:NSInternalInconsistencyException reason:NSLocalizedString(@"No JSON generation functionality available", nil) userInfo:userInfo] raise];
}
View
3 SignalR.Client/Infrastructure/SRExceptionHelper.m
@@ -24,8 +24,7 @@
@implementation SRExceptionHelper
-+ (BOOL)isRequestAborted:(NSError *)error
-{
++ (BOOL)isRequestAborted:(NSError *)error {
return (error != nil && (error.code == NSURLErrorCancelled));
}
View
72 SignalR.Client/Infrastructure/SRThreadSafeInvoker.m
@@ -30,31 +30,22 @@ @interface SRThreadSafeInvoker ()
@implementation SRThreadSafeInvoker
-@synthesize invoked = _invoked;
-
-- (id)init
-{
- if (self = [super init])
- {
+- (instancetype)init {
+ if (self = [super init]) {
_invoked = @NO;
}
return self;
}
-- (BOOL)invoke
-{
+- (BOOL)invoke {
return [self invoke:^{}];
}
-- (BOOL)invoke:(action)action
-{
- @synchronized(_invoked)
- {
- if (_invoked == @NO)
- {
+- (BOOL)invoke:(action)action {
+ @synchronized(_invoked) {
+ if ([_invoked isEqual:@NO]) {
_invoked = @YES;
- if(action)
- {
+ if(action) {
action();
return YES;
}
@@ -63,15 +54,11 @@ - (BOOL)invoke:(action)action
}
}
-- (BOOL)invoke:(actionWithObject)action withObject:(id)object
-{
- @synchronized(_invoked)
- {
- if (_invoked == @NO)
- {
+- (BOOL)invoke:(actionWithObject)action withObject:(id)object {
+ @synchronized(_invoked) {
+ if ([_invoked isEqual:@NO]) {
_invoked = @YES;
- if(action)
- {
+ if(action) {
action(object);
return YES;
}
@@ -80,15 +67,11 @@ - (BOOL)invoke:(actionWithObject)action withObject:(id)object
}
}
-- (BOOL)invoke:(actionWithObject)action withBlock:(action)object;
-{
- @synchronized(_invoked)
- {
- if (_invoked == @NO)
- {
+- (BOOL)invoke:(actionWithObject)action withBlock:(action)object; {
+ @synchronized(_invoked) {
+ if ([_invoked isEqual:@NO]) {
_invoked = @YES;
- if(action)
- {
+ if(action) {
action(object);
return YES;
}
@@ -97,15 +80,11 @@ - (BOOL)invoke:(actionWithObject)action withBlock:(action)object;
}
}
-- (BOOL)invoke:(actionWithCallbackWithObject)action withCallback:(callback)callback withObject:(id)object;
-{
- @synchronized(_invoked)
- {
- if (_invoked == @NO)
- {
+- (BOOL)invoke:(actionWithCallbackWithObject)action withCallback:(callback)callback withObject:(id)object; {
+ @synchronized(_invoked) {
+ if ([_invoked isEqual:@NO]) {
_invoked = @YES;
- if(action)
- {
+ if(action) {
action(callback, object);
return YES;
}
@@ -114,20 +93,17 @@ - (BOOL)invoke:(actionWithCallbackWithObject)action withCallback:(callback)callb
}
}
-- (BOOL)invoke:(actionWithObjectWithObject)action withObject:(id)object1 withObject:(id)object2
-{
- @synchronized(_invoked)
- {
- if (_invoked == @NO)
- {
+- (BOOL)invoke:(actionWithObjectWithObject)action withObject:(id)object1 withObject:(id)object2 {
+ @synchronized(_invoked) {
+ if ([_invoked isEqual:@NO]) {
_invoked = @YES;
- if(action)
- {
+ if(action) {
action(object1,object2);
return YES;
}
}
return NO;
}
}
+
@end
View
6 SignalR.Client/Infrastructure/SRVersion.h
@@ -71,7 +71,7 @@
* @param major an `NSInteger` representing the major component of a version
* @param minor an `NSInteger` representing the minior component of a version
*/
-- (id)initWithMajor:(NSInteger)major minor:(NSInteger)minor;
+- (instancetype)initWithMajor:(NSInteger)major minor:(NSInteger)minor;
/**
* Initializes a new instance of the `SRVersion` class using the specified major, minor, and build values.
@@ -80,7 +80,7 @@
* @param minor an `NSInteger` representing the minior component of a version
* @param build an `NSInteger` representing the build component of a version
*/
-- (id)initWithMajor:(NSInteger)major minor:(NSInteger)minor build:(NSInteger)build;
+- (instancetype)initWithMajor:(NSInteger)major minor:(NSInteger)minor build:(NSInteger)build;
/**
* Initializes a new instance of the `SRVersion` class using the specified major, minor, build and revision values.
@@ -90,7 +90,7 @@
* @param build an `NSInteger` representing the build component of a version
* @param revision an `NSInteger` representing the revision component of a version
*/
-- (id)initWithMajor:(NSInteger)major minor:(NSInteger)minor build:(NSInteger)build revision:(NSInteger)revision;
+- (instancetype)initWithMajor:(NSInteger)major minor:(NSInteger)minor build:(NSInteger)build revision:(NSInteger)revision;
/**
* Tries to convert the string representation of a version number to an equivalent `SRVersion` object, and returns a value that indicates whether the conversion succeeded.
View
64 SignalR.Client/Infrastructure/SRVersion.m
@@ -28,17 +28,8 @@ @interface SRVersion ()
@implementation SRVersion
-@synthesize build = _build;
-@synthesize major = _major;
-@synthesize majorRevision = _majorRevision;
-@synthesize minor = _minor;
-@synthesize minorRevision = _minorRevision;
-@synthesize revision = _revision;
-
-- (id)init
-{
- if(self = [super init])
- {
+- (instancetype)init {
+ if(self = [super init]) {
_build = 0;
_major = 0;
_majorRevision = 0;
@@ -49,67 +40,54 @@ - (id)init
return self;
}
-- (id)initWithMajor:(NSInteger)major minor:(NSInteger)minor
-{
- if(self = [self init])
- {
+- (instancetype)initWithMajor:(NSInteger)major minor:(NSInteger)minor {
+ if(self = [self init]) {
_major = major;
_minor = minor;
- if(_major < 0 || _minor < 0)
- {
+ if(_major < 0 || _minor < 0) {
[NSException raise:NSInvalidArgumentException format:NSLocalizedString(@"Component cannot be less than 0",@"NSInvalidArgumentException")];
}
}
return self;
}
-- (id)initWithMajor:(NSInteger)major minor:(NSInteger)minor build:(NSInteger)build
-{
- if(self = [self initWithMajor:major minor:minor])
- {
+- (instancetype)initWithMajor:(NSInteger)major minor:(NSInteger)minor build:(NSInteger)build {
+ if(self = [self initWithMajor:major minor:minor]) {
_build = build;
- if(_build < 0)
- {
+ if(_build < 0) {
[NSException raise:NSInvalidArgumentException format:NSLocalizedString(@"Component cannot be less than 0",@"NSInvalidArgumentException")];
}
}
return self;
}
-- (id)initWithMajor:(NSInteger)major minor:(NSInteger)minor build:(NSInteger)build revision:(NSInteger)revision
-{
- if(self = [self initWithMajor:major minor:minor build:build])
- {
+- (instancetype)initWithMajor:(NSInteger)major minor:(NSInteger)minor build:(NSInteger)build revision:(NSInteger)revision {
+ if(self = [self initWithMajor:major minor:minor build:build]) {
_revision = revision;
- if(_revision < 0)
- {
+ if(_revision < 0) {
[NSException raise:NSInvalidArgumentException format:NSLocalizedString(@"Component cannot be less than 0",@"NSInvalidArgumentException")];
}
}
return self;
}
-+ (BOOL)tryParse:(NSString *)input forVersion:(SRVersion **)version
-{
++ (BOOL)tryParse:(NSString *)input forVersion:(SRVersion **)version {
BOOL success = YES;
- if(input == nil || [input isEqualToString:@""] == YES)
- {
+ if(input == nil || [input isEqualToString:@""] == YES) {
return NO;
}
NSArray *components = [input componentsSeparatedByString:@"."];
- if([components count] < 2 || [components count] > 4)
- {
+ if([components count] < 2 || [components count] > 4) {
return NO;
}
SRVersion *temp = [[SRVersion alloc] init];
- for (int i=0; i<[components count]; i++)
- {
+ for (int i=0; i<[components count]; i++) {
switch (i) {
case 0:
temp.major = [components[0] integerValue];
@@ -134,17 +112,7 @@ + (BOOL)tryParse:(NSString *)input forVersion:(SRVersion **)version
- (NSString *)description
{
- return [NSString stringWithFormat:@"%d.%d.%d.%d",_major,_minor,_build,_revision];
-}
-
-- (void)dealloc
-{
- _build = 0;
- _major = 0;
- _majorRevision = 0;
- _minor = 0;
- _minorRevision = 0;
- _revision = 0;
+ return [NSString stringWithFormat:@"%ld.%ld.%ld.%ld",(long)_major,(long)_minor,(long)_build,(long)_revision];
}
@end
View
293 SignalR.Client/SRConnection.h
@@ -21,69 +21,14 @@
//
#import <Foundation/Foundation.h>
-#import "SRClientTransport.h"
+#import "SRClientTransportInterface.h"
+#import "SRConnectionDelegate.h"
+#import "SRConnectionInterface.h"
#import "SRConnectionState.h"
#import "SRHttpClient.h"
-#import "SRRequest.h"
@class SRConnection;
-/**
- * The delegate of a `SRConnection` object can optionally adapt the `SRConnectionDelegate` protocol.
- * The methods of the protocol allow the delegate to receive update when events occur on the `SRConnection` object some of these event include;
- * the connection being opened, reconnected, closed and when data or an error is received.
- */
-@protocol SRConnectionDelegate<NSObject>
-@optional
-