motion-yapper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/.travis.yml +2 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/motion-yapper.rb +1 -0
- data/lib/yapper.rb +3 -5
- data/lib/yapper/config.rb +2 -0
- data/lib/yapper/db.rb +105 -40
- data/lib/yapper/document.rb +7 -4
- data/lib/yapper/document/callbacks.rb +0 -7
- data/lib/yapper/document/{persistance.rb → persistence.rb} +27 -21
- data/lib/yapper/document/relation.rb +29 -22
- data/lib/yapper/document/selection.rb +122 -54
- data/lib/yapper/extensions.rb +12 -24
- data/lib/yapper/settings.rb +43 -0
- data/lib/yapper/timestamps.rb +2 -0
- data/lib/yapper/version.rb +1 -1
- data/{yapper.gemspec → motion-yapper.gemspec} +0 -0
- data/spec/integration/{where_spec.rb → criteria_spec.rb} +78 -10
- data/spec/integration/db_spec.rb +70 -0
- data/spec/integration/defaults_spec.rb +37 -0
- data/spec/integration/extensions_spec.rb +14 -0
- data/spec/integration/{persistance_spec.rb → persistence_spec.rb} +0 -0
- data/spec/integration/relation_spec.rb +4 -4
- data/vendor/Podfile.lock +9 -11
- data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
- data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
- data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
- data/vendor/Pods/.build/libPods.a +0 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/{CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h → BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +51 -50
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +546 -546
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1093 -907
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +98 -65
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +873 -748
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1284 -1243
- data/vendor/Pods/{BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h → CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{ContextFilterLogFormatter.m → DDContextFilterLogFormatter.m} +70 -70
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +253 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +30 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +127 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +1 -1
- data/vendor/Pods/CocoaLumberjack/README.markdown +52 -15
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/Headers/CocoaLumberjack/{ContextFilterLogFormatter.h → DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/Headers/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +2 -0
- data/vendor/Pods/Headers/____Pods-environment.h +15 -15
- data/vendor/Pods/Manifest.lock +9 -11
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +2 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +1 -1
- data/vendor/Pods/{Pods-Acknowledgements.markdown → Pods-acknowledgements.markdown} +0 -37
- data/vendor/Pods/{Pods-Acknowledgements.plist → Pods-acknowledgements.plist} +0 -45
- data/vendor/Pods/Pods-environment.h +15 -15
- data/vendor/Pods/Pods.xcconfig +3 -3
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +2426 -3155
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
- data/vendor/Pods/YapDatabase/README.md +3 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +25 -41
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +403 -134
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +8 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +113 -62
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +25 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +25 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +129 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +802 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +408 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +5254 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +9 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +62 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +148 -45
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +15 -9
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +211 -64
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +48 -107
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +10 -7
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +13 -22
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +725 -244
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +19 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +3 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +4 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +3 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +5 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +84 -93
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +381 -209
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +587 -267
- data/vendor/Pods/{Pods.bridgesupport → build-iPhoneSimulator/Pods.bridgesupport} +633 -2557
- data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +4 -2
- metadata +80 -108
- data/Gemfile.lock +0 -63
- data/lib/yapper/attachment.rb +0 -48
- data/lib/yapper/document/attachment.rb +0 -26
- data/lib/yapper/sync.rb +0 -134
- data/lib/yapper/sync/data.rb +0 -12
- data/lib/yapper/sync/event.rb +0 -194
- data/lib/yapper/sync/queue.rb +0 -164
- data/spec/integration/all_spec.rb +0 -40
- data/spec/integration/sync_spec.rb +0 -42
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1396
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -327
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -321
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -150
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -157
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -143
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -848
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -167
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -191
- data/vendor/Pods/AFNetworking/LICENSE +0 -19
- data/vendor/Pods/AFNetworking/README.md +0 -208
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +0 -109
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +0 -251
- data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/Headers/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Headers/YapDatabase/YapCache.h +0 -90
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +0 -29
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +0 -37
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +0 -440
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -69
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +0 -158
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +0 -424
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -73
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +0 -13
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +0 -121
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +0 -36
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +0 -153
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +0 -74
- data/vendor/Pods/Headers/YapDatabase/YapNull.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapTouch.h +0 -15
- data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +0 -17
- data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +0 -5
- data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-AFNetworking-dummy.m +0 -5
- data/vendor/Pods/Pods-AFNetworking-prefix.pch +0 -17
- data/vendor/Pods/Pods-AFNetworking.xcconfig +0 -1
- data/vendor/Pods/Pods-Reachability-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-Reachability-dummy.m +0 -5
- data/vendor/Pods/Pods-Reachability-prefix.pch +0 -5
- data/vendor/Pods/Pods-Reachability.xcconfig +0 -1
- data/vendor/Pods/Reachability/LICENCE.txt +0 -24
- data/vendor/Pods/Reachability/README.md +0 -65
- data/vendor/Pods/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Reachability/Reachability.m +0 -527
@@ -1,17 +0,0 @@
|
|
1
|
-
#import "YapDatabaseViewRangeOptions.h"
|
2
|
-
|
3
|
-
/**
|
4
|
-
* This header file is PRIVATE, and is only to be used by the YapDatabaseView classes.
|
5
|
-
**/
|
6
|
-
|
7
|
-
@interface YapDatabaseViewRangeOptions ()
|
8
|
-
|
9
|
-
/**
|
10
|
-
* This method returns a copy with the pin value switched.
|
11
|
-
*
|
12
|
-
* That is, if the range was pinned to the beginning, the returned copy will be pinned to the end.
|
13
|
-
* And vice versa.
|
14
|
-
**/
|
15
|
-
- (id)copyAndReverse;
|
16
|
-
|
17
|
-
@end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
#import <Foundation/Foundation.h>
|
2
|
-
|
3
|
-
@class YapMemoryTableTransaction;
|
4
|
-
|
5
|
-
|
6
|
-
/**
|
7
|
-
* A "memory table" is a dictionary that supports versioning.
|
8
|
-
* There may be multiple values for a single key, with each value associated with a different snapshot.
|
9
|
-
*
|
10
|
-
* The memory table is accessed via a YapMemoryTableTransaction instance,
|
11
|
-
* which is itself associated with a particular timestamp. Thus the transaction is able to properly identify
|
12
|
-
* which version is appropriate for itself.
|
13
|
-
**/
|
14
|
-
@interface YapMemoryTable : NSObject
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Initializes a memory table.
|
18
|
-
*
|
19
|
-
* The keyClass is used for debugging, to ensure the proper key type is always used when accessing the table.
|
20
|
-
* The keyClass is used within NSAssert statements that typically get compiled out for release builds.
|
21
|
-
**/
|
22
|
-
- (id)initWithKeyClass:(Class)keyClass;
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Creates and returns a new connection associated with the shared cache.
|
26
|
-
**/
|
27
|
-
- (YapMemoryTableTransaction *)newReadTransactionWithSnapshot:(uint64_t)snapshot;
|
28
|
-
- (YapMemoryTableTransaction *)newReadWriteTransactionWithSnapshot:(uint64_t)snapshot;
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Invoked automatically by YapDatabase architecture.
|
32
|
-
**/
|
33
|
-
- (void)asyncCheckpoint:(int64_t)minSnapshot;
|
34
|
-
|
35
|
-
@end
|
36
|
-
|
37
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
38
|
-
#pragma mark -
|
39
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
40
|
-
|
41
|
-
@interface YapMemoryTableTransaction : NSObject
|
42
|
-
|
43
|
-
@property (nonatomic, readonly) uint64_t snapshot;
|
44
|
-
@property (nonatomic, readonly) BOOL isReadWriteTransaction;
|
45
|
-
|
46
|
-
- (id)objectForKey:(id)key;
|
47
|
-
|
48
|
-
- (void)enumerateKeysWithBlock:(void (^)(id key, BOOL *stop))block;
|
49
|
-
|
50
|
-
- (void)enumerateKeysAndObjectsWithBlock:(void (^)(id key, id obj, BOOL *stop))block;
|
51
|
-
|
52
|
-
//
|
53
|
-
// For ReadWrite transactions:
|
54
|
-
|
55
|
-
- (void)setObject:(id)object forKey:(id)key;
|
56
|
-
|
57
|
-
- (void)removeObjectForKey:(id)key;
|
58
|
-
- (void)removeObjectsForKeys:(NSArray *)keys;
|
59
|
-
|
60
|
-
- (void)removeAllObjects;
|
61
|
-
|
62
|
-
//
|
63
|
-
// Batch access / modifications
|
64
|
-
|
65
|
-
- (void)accessWithBlock:(dispatch_block_t)block;
|
66
|
-
- (void)modifyWithBlock:(dispatch_block_t)block;
|
67
|
-
|
68
|
-
//
|
69
|
-
// Transaction state
|
70
|
-
|
71
|
-
- (void)commit;
|
72
|
-
- (void)rollback;
|
73
|
-
|
74
|
-
@end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#import <Foundation/Foundation.h>
|
2
|
-
|
3
|
-
/**
|
4
|
-
* There are various situations in which we need to add a placeholder to signify a nil value.
|
5
|
-
* For example, we need to cache the fact that the metadata for a given key is nil.
|
6
|
-
*
|
7
|
-
* However, we cannot add a nil object to a dictionary.
|
8
|
-
* And we cannot use NSNull, or we prevent the user from using NSNull for their own purposes.
|
9
|
-
*
|
10
|
-
* And thus, we replicate NSNull, and use it instead.
|
11
|
-
* And now the user is free to use NSNull if needed.
|
12
|
-
**/
|
13
|
-
@interface YapNull : NSObject
|
14
|
-
|
15
|
-
+ (id)null;
|
16
|
-
|
17
|
-
@end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#import <Foundation/Foundation.h>
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Singleton class to represent the "value" for a key that was touched. (i.e. value didn't change)
|
5
|
-
*
|
6
|
-
* YapDatabase stores changesets in dictionaries, where the object represents the updated value for a key.
|
7
|
-
* When an item is touched, we use this singleton as the value to signify internally that the item didn't change.
|
8
|
-
* This allows us to act as if the item did change in most all respects,
|
9
|
-
* but internally won't cause us to flush the item from the caches.
|
10
|
-
**/
|
11
|
-
@interface YapTouch : NSObject
|
12
|
-
|
13
|
-
+ (id)touch;
|
14
|
-
|
15
|
-
@end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#ifdef __OBJC__
|
2
|
-
#import <UIKit/UIKit.h>
|
3
|
-
#endif
|
4
|
-
|
5
|
-
#import "Pods-environment.h"
|
6
|
-
#import <Availability.h>
|
7
|
-
|
8
|
-
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
9
|
-
#import <SystemConfiguration/SystemConfiguration.h>
|
10
|
-
#import <MobileCoreServices/MobileCoreServices.h>
|
11
|
-
#import <Security/Security.h>
|
12
|
-
#else
|
13
|
-
#import <SystemConfiguration/SystemConfiguration.h>
|
14
|
-
#import <CoreServices/CoreServices.h>
|
15
|
-
#import <Security/Security.h>
|
16
|
-
#endif
|
17
|
-
|
@@ -1,5 +0,0 @@
|
|
1
|
-
#include "Pods-AFNetworking.xcconfig"
|
2
|
-
GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1
|
3
|
-
HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/AFNetworking" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/CocoaLumberjack" "${PODS_ROOT}/Headers/NSData+MD5Digest" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/YapDatabase"
|
4
|
-
OTHER_LDFLAGS = -ObjC ${PODS_AFNETWORKING_OTHER_LDFLAGS}
|
5
|
-
PODS_ROOT = ${SRCROOT}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#ifdef __OBJC__
|
2
|
-
#import <UIKit/UIKit.h>
|
3
|
-
#endif
|
4
|
-
|
5
|
-
#import "Pods-environment.h"
|
6
|
-
#import <Availability.h>
|
7
|
-
|
8
|
-
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
9
|
-
#import <SystemConfiguration/SystemConfiguration.h>
|
10
|
-
#import <MobileCoreServices/MobileCoreServices.h>
|
11
|
-
#import <Security/Security.h>
|
12
|
-
#else
|
13
|
-
#import <SystemConfiguration/SystemConfiguration.h>
|
14
|
-
#import <CoreServices/CoreServices.h>
|
15
|
-
#import <Security/Security.h>
|
16
|
-
#endif
|
17
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
PODS_AFNETWORKING_OTHER_LDFLAGS = -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration
|
@@ -1,5 +0,0 @@
|
|
1
|
-
#include "Pods-Reachability.xcconfig"
|
2
|
-
GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1
|
3
|
-
HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/Reachability" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/CocoaLumberjack" "${PODS_ROOT}/Headers/NSData+MD5Digest" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/YapDatabase"
|
4
|
-
OTHER_LDFLAGS = -ObjC ${PODS_REACHABILITY_OTHER_LDFLAGS}
|
5
|
-
PODS_ROOT = ${SRCROOT}
|
@@ -1 +0,0 @@
|
|
1
|
-
PODS_REACHABILITY_OTHER_LDFLAGS = -framework SystemConfiguration
|
@@ -1,24 +0,0 @@
|
|
1
|
-
Copyright (c) 2011-2013, Tony Million.
|
2
|
-
All rights reserved.
|
3
|
-
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
5
|
-
modification, are permitted provided that the following conditions are met:
|
6
|
-
|
7
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
8
|
-
list of conditions and the following disclaimer.
|
9
|
-
|
10
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
this list of conditions and the following disclaimer in the documentation
|
12
|
-
and/or other materials provided with the distribution.
|
13
|
-
|
14
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
15
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
17
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
18
|
-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
19
|
-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
20
|
-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
21
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
22
|
-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
23
|
-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
24
|
-
POSSIBILITY OF SUCH DAMAGE.
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# Reachability
|
2
|
-
|
3
|
-
This is a drop-in replacement for Apple's `Reachability` class. It is ARC-compatible, and it uses the new GCD methods to notify of network interface changes.
|
4
|
-
|
5
|
-
In addition to the standard `NSNotification`, it supports the use of blocks for when the network becomes reachable and unreachable.
|
6
|
-
|
7
|
-
Finally, you can specify whether a WWAN connection is considered "reachable".
|
8
|
-
|
9
|
-
## Requirements
|
10
|
-
|
11
|
-
Once you have added the `.h/m` files to your project, simply:
|
12
|
-
|
13
|
-
* Go to the `Project->TARGETS->Build Phases->Link Binary With Libraries`.
|
14
|
-
* Press the plus in the lower left of the list.
|
15
|
-
* Add `SystemConfiguration.framework`.
|
16
|
-
|
17
|
-
Boom, you're done.
|
18
|
-
|
19
|
-
## Examples
|
20
|
-
|
21
|
-
### Block Example
|
22
|
-
|
23
|
-
This sample uses blocks to notify when the interface state has changed. The blocks will be called on a **BACKGROUND THREAD**, so you need to dispatch UI updates onto the main thread.
|
24
|
-
|
25
|
-
// Allocate a reachability object
|
26
|
-
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
|
27
|
-
|
28
|
-
// Set the blocks
|
29
|
-
reach.reachableBlock = ^(Reachability*reach)
|
30
|
-
{
|
31
|
-
NSLog(@"REACHABLE!");
|
32
|
-
};
|
33
|
-
|
34
|
-
reach.unreachableBlock = ^(Reachability*reach)
|
35
|
-
{
|
36
|
-
NSLog(@"UNREACHABLE!");
|
37
|
-
};
|
38
|
-
|
39
|
-
// Start the notifier, which will cause the reachability object to retain itself!
|
40
|
-
[reach startNotifier];
|
41
|
-
|
42
|
-
### `NSNotification` Example
|
43
|
-
|
44
|
-
This sample will use `NSNotification`s to notify when the interface has changed. They will be delivered on the **MAIN THREAD**, so you *can* do UI updates from within the function.
|
45
|
-
|
46
|
-
In addition, it asks the `Reachability` object to consider the WWAN (3G/EDGE/CDMA) as a non-reachable connection (you might use this if you are writing a video streaming app, for example, to save the user's data plan).
|
47
|
-
|
48
|
-
// Allocate a reachability object
|
49
|
-
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
|
50
|
-
|
51
|
-
// Tell the reachability that we DON'T want to be reachable on 3G/EDGE/CDMA
|
52
|
-
reach.reachableOnWWAN = NO;
|
53
|
-
|
54
|
-
// Here we set up a NSNotification observer. The Reachability that caused the notification
|
55
|
-
// is passed in the object parameter
|
56
|
-
[[NSNotificationCenter defaultCenter] addObserver:self
|
57
|
-
selector:@selector(reachabilityChanged:)
|
58
|
-
name:kReachabilityChangedNotification
|
59
|
-
object:nil];
|
60
|
-
|
61
|
-
[reach startNotifier]
|
62
|
-
|
63
|
-
## Tell the world
|
64
|
-
|
65
|
-
Head over to [Projects using Reachability](https://github.com/tonymillion/Reachability/wiki/Projects-using-Reachability) and add your project for "Maximum Wins!".
|
@@ -1,109 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2011, Tony Million.
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are met:
|
7
|
-
|
8
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
9
|
-
list of conditions and the following disclaimer.
|
10
|
-
|
11
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
12
|
-
this list of conditions and the following disclaimer in the documentation
|
13
|
-
and/or other materials provided with the distribution.
|
14
|
-
|
15
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
16
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
18
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
19
|
-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
20
|
-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
21
|
-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
22
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
23
|
-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
24
|
-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
25
|
-
POSSIBILITY OF SUCH DAMAGE.
|
26
|
-
*/
|
27
|
-
|
28
|
-
#import <Foundation/Foundation.h>
|
29
|
-
#import <SystemConfiguration/SystemConfiguration.h>
|
30
|
-
|
31
|
-
#import <sys/socket.h>
|
32
|
-
#import <netinet/in.h>
|
33
|
-
#import <netinet6/in6.h>
|
34
|
-
#import <arpa/inet.h>
|
35
|
-
#import <ifaddrs.h>
|
36
|
-
#import <netdb.h>
|
37
|
-
|
38
|
-
/**
|
39
|
-
* Does ARC support GCD objects?
|
40
|
-
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
|
41
|
-
*
|
42
|
-
* @see http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
|
43
|
-
**/
|
44
|
-
#if OS_OBJECT_USE_OBJC
|
45
|
-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
|
46
|
-
#else
|
47
|
-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
|
48
|
-
#endif
|
49
|
-
|
50
|
-
/**
|
51
|
-
* Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
|
52
|
-
*
|
53
|
-
* @see http://nshipster.com/ns_enum-ns_options/
|
54
|
-
**/
|
55
|
-
#ifndef NS_ENUM
|
56
|
-
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
|
57
|
-
#endif
|
58
|
-
|
59
|
-
extern NSString *const kReachabilityChangedNotification;
|
60
|
-
|
61
|
-
typedef NS_ENUM(NSInteger, NetworkStatus) {
|
62
|
-
// Apple NetworkStatus Compatible Names.
|
63
|
-
NotReachable = 0,
|
64
|
-
ReachableViaWiFi = 2,
|
65
|
-
ReachableViaWWAN = 1
|
66
|
-
};
|
67
|
-
|
68
|
-
@class Reachability;
|
69
|
-
|
70
|
-
typedef void (^NetworkReachable)(Reachability * reachability);
|
71
|
-
typedef void (^NetworkUnreachable)(Reachability * reachability);
|
72
|
-
|
73
|
-
@interface Reachability : NSObject
|
74
|
-
|
75
|
-
@property (nonatomic, copy) NetworkReachable reachableBlock;
|
76
|
-
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
|
77
|
-
|
78
|
-
|
79
|
-
@property (nonatomic, assign) BOOL reachableOnWWAN;
|
80
|
-
|
81
|
-
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
|
82
|
-
+(Reachability*)reachabilityForInternetConnection;
|
83
|
-
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
|
84
|
-
+(Reachability*)reachabilityForLocalWiFi;
|
85
|
-
|
86
|
-
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
|
87
|
-
|
88
|
-
-(BOOL)startNotifier;
|
89
|
-
-(void)stopNotifier;
|
90
|
-
|
91
|
-
-(BOOL)isReachable;
|
92
|
-
-(BOOL)isReachableViaWWAN;
|
93
|
-
-(BOOL)isReachableViaWiFi;
|
94
|
-
|
95
|
-
// WWAN may be available, but not active until a connection has been established.
|
96
|
-
// WiFi may require a connection for VPN on Demand.
|
97
|
-
-(BOOL)isConnectionRequired; // Identical DDG variant.
|
98
|
-
-(BOOL)connectionRequired; // Apple's routine.
|
99
|
-
// Dynamic, on demand connection?
|
100
|
-
-(BOOL)isConnectionOnDemand;
|
101
|
-
// Is user intervention required?
|
102
|
-
-(BOOL)isInterventionRequired;
|
103
|
-
|
104
|
-
-(NetworkStatus)currentReachabilityStatus;
|
105
|
-
-(SCNetworkReachabilityFlags)reachabilityFlags;
|
106
|
-
-(NSString*)currentReachabilityString;
|
107
|
-
-(NSString*)currentReachabilityFlags;
|
108
|
-
|
109
|
-
@end
|
@@ -1,527 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2011, Tony Million.
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are met:
|
7
|
-
|
8
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
9
|
-
list of conditions and the following disclaimer.
|
10
|
-
|
11
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
12
|
-
this list of conditions and the following disclaimer in the documentation
|
13
|
-
and/or other materials provided with the distribution.
|
14
|
-
|
15
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
16
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
18
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
19
|
-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
20
|
-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
21
|
-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
22
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
23
|
-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
24
|
-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
25
|
-
POSSIBILITY OF SUCH DAMAGE.
|
26
|
-
*/
|
27
|
-
|
28
|
-
#import "Reachability.h"
|
29
|
-
|
30
|
-
|
31
|
-
NSString *const kReachabilityChangedNotification = @"kReachabilityChangedNotification";
|
32
|
-
|
33
|
-
@interface Reachability ()
|
34
|
-
|
35
|
-
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
|
36
|
-
|
37
|
-
|
38
|
-
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
39
|
-
@property (nonatomic, assign) dispatch_queue_t reachabilitySerialQueue;
|
40
|
-
#else
|
41
|
-
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
|
42
|
-
#endif
|
43
|
-
|
44
|
-
|
45
|
-
@property (nonatomic, strong) id reachabilityObject;
|
46
|
-
|
47
|
-
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags;
|
48
|
-
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags;
|
49
|
-
|
50
|
-
@end
|
51
|
-
|
52
|
-
static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags)
|
53
|
-
{
|
54
|
-
return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c",
|
55
|
-
#if TARGET_OS_IPHONE
|
56
|
-
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
|
57
|
-
#else
|
58
|
-
'X',
|
59
|
-
#endif
|
60
|
-
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
|
61
|
-
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
|
62
|
-
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
|
63
|
-
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
|
64
|
-
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
|
65
|
-
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
|
66
|
-
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
|
67
|
-
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
|
68
|
-
}
|
69
|
-
|
70
|
-
// Start listening for reachability notifications on the current run loop
|
71
|
-
static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
|
72
|
-
{
|
73
|
-
#pragma unused (target)
|
74
|
-
#if __has_feature(objc_arc)
|
75
|
-
Reachability *reachability = ((__bridge Reachability*)info);
|
76
|
-
#else
|
77
|
-
Reachability *reachability = ((Reachability*)info);
|
78
|
-
#endif
|
79
|
-
|
80
|
-
// We probably don't need an autoreleasepool here, as GCD docs state each queue has its own autorelease pool,
|
81
|
-
// but what the heck eh?
|
82
|
-
@autoreleasepool
|
83
|
-
{
|
84
|
-
[reachability reachabilityChanged:flags];
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
|
89
|
-
@implementation Reachability
|
90
|
-
|
91
|
-
@synthesize reachabilityRef;
|
92
|
-
@synthesize reachabilitySerialQueue;
|
93
|
-
|
94
|
-
@synthesize reachableOnWWAN;
|
95
|
-
|
96
|
-
@synthesize reachableBlock;
|
97
|
-
@synthesize unreachableBlock;
|
98
|
-
|
99
|
-
@synthesize reachabilityObject;
|
100
|
-
|
101
|
-
#pragma mark - Class Constructor Methods
|
102
|
-
|
103
|
-
+(Reachability*)reachabilityWithHostName:(NSString*)hostname
|
104
|
-
{
|
105
|
-
return [Reachability reachabilityWithHostname:hostname];
|
106
|
-
}
|
107
|
-
|
108
|
-
+(Reachability*)reachabilityWithHostname:(NSString*)hostname
|
109
|
-
{
|
110
|
-
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
|
111
|
-
if (ref)
|
112
|
-
{
|
113
|
-
id reachability = [[self alloc] initWithReachabilityRef:ref];
|
114
|
-
|
115
|
-
#if __has_feature(objc_arc)
|
116
|
-
return reachability;
|
117
|
-
#else
|
118
|
-
return [reachability autorelease];
|
119
|
-
#endif
|
120
|
-
|
121
|
-
}
|
122
|
-
|
123
|
-
return nil;
|
124
|
-
}
|
125
|
-
|
126
|
-
+(Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
|
127
|
-
{
|
128
|
-
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
|
129
|
-
if (ref)
|
130
|
-
{
|
131
|
-
id reachability = [[self alloc] initWithReachabilityRef:ref];
|
132
|
-
|
133
|
-
#if __has_feature(objc_arc)
|
134
|
-
return reachability;
|
135
|
-
#else
|
136
|
-
return [reachability autorelease];
|
137
|
-
#endif
|
138
|
-
}
|
139
|
-
|
140
|
-
return nil;
|
141
|
-
}
|
142
|
-
|
143
|
-
+(Reachability *)reachabilityForInternetConnection
|
144
|
-
{
|
145
|
-
struct sockaddr_in zeroAddress;
|
146
|
-
bzero(&zeroAddress, sizeof(zeroAddress));
|
147
|
-
zeroAddress.sin_len = sizeof(zeroAddress);
|
148
|
-
zeroAddress.sin_family = AF_INET;
|
149
|
-
|
150
|
-
return [self reachabilityWithAddress:&zeroAddress];
|
151
|
-
}
|
152
|
-
|
153
|
-
+(Reachability*)reachabilityForLocalWiFi
|
154
|
-
{
|
155
|
-
struct sockaddr_in localWifiAddress;
|
156
|
-
bzero(&localWifiAddress, sizeof(localWifiAddress));
|
157
|
-
localWifiAddress.sin_len = sizeof(localWifiAddress);
|
158
|
-
localWifiAddress.sin_family = AF_INET;
|
159
|
-
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
|
160
|
-
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
|
161
|
-
|
162
|
-
return [self reachabilityWithAddress:&localWifiAddress];
|
163
|
-
}
|
164
|
-
|
165
|
-
|
166
|
-
// Initialization methods
|
167
|
-
|
168
|
-
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref
|
169
|
-
{
|
170
|
-
self = [super init];
|
171
|
-
if (self != nil)
|
172
|
-
{
|
173
|
-
self.reachableOnWWAN = YES;
|
174
|
-
self.reachabilityRef = ref;
|
175
|
-
}
|
176
|
-
|
177
|
-
return self;
|
178
|
-
}
|
179
|
-
|
180
|
-
-(void)dealloc
|
181
|
-
{
|
182
|
-
[self stopNotifier];
|
183
|
-
|
184
|
-
if(self.reachabilityRef)
|
185
|
-
{
|
186
|
-
CFRelease(self.reachabilityRef);
|
187
|
-
self.reachabilityRef = nil;
|
188
|
-
}
|
189
|
-
|
190
|
-
self.reachableBlock = nil;
|
191
|
-
self.unreachableBlock = nil;
|
192
|
-
|
193
|
-
#if !(__has_feature(objc_arc))
|
194
|
-
[super dealloc];
|
195
|
-
#endif
|
196
|
-
|
197
|
-
|
198
|
-
}
|
199
|
-
|
200
|
-
#pragma mark - Notifier Methods
|
201
|
-
|
202
|
-
// Notifier
|
203
|
-
// NOTE: This uses GCD to trigger the blocks - they *WILL NOT* be called on THE MAIN THREAD
|
204
|
-
// - In other words DO NOT DO ANY UI UPDATES IN THE BLOCKS.
|
205
|
-
// INSTEAD USE dispatch_async(dispatch_get_main_queue(), ^{UISTUFF}) (or dispatch_sync if you want)
|
206
|
-
|
207
|
-
-(BOOL)startNotifier
|
208
|
-
{
|
209
|
-
SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL };
|
210
|
-
|
211
|
-
// this should do a retain on ourself, so as long as we're in notifier mode we shouldn't disappear out from under ourselves
|
212
|
-
// woah
|
213
|
-
self.reachabilityObject = self;
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
// First, we need to create a serial queue.
|
218
|
-
// We allocate this once for the lifetime of the notifier.
|
219
|
-
self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL);
|
220
|
-
if(!self.reachabilitySerialQueue)
|
221
|
-
{
|
222
|
-
return NO;
|
223
|
-
}
|
224
|
-
|
225
|
-
#if __has_feature(objc_arc)
|
226
|
-
context.info = (__bridge void *)self;
|
227
|
-
#else
|
228
|
-
context.info = (void *)self;
|
229
|
-
#endif
|
230
|
-
|
231
|
-
if (!SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context))
|
232
|
-
{
|
233
|
-
#ifdef DEBUG
|
234
|
-
NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError()));
|
235
|
-
#endif
|
236
|
-
|
237
|
-
// Clear out the dispatch queue
|
238
|
-
if(self.reachabilitySerialQueue)
|
239
|
-
{
|
240
|
-
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
241
|
-
dispatch_release(self.reachabilitySerialQueue);
|
242
|
-
#endif
|
243
|
-
self.reachabilitySerialQueue = nil;
|
244
|
-
}
|
245
|
-
|
246
|
-
self.reachabilityObject = nil;
|
247
|
-
|
248
|
-
return NO;
|
249
|
-
}
|
250
|
-
|
251
|
-
// Set it as our reachability queue, which will retain the queue
|
252
|
-
if(!SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue))
|
253
|
-
{
|
254
|
-
#ifdef DEBUG
|
255
|
-
NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError()));
|
256
|
-
#endif
|
257
|
-
|
258
|
-
// UH OH - FAILURE!
|
259
|
-
|
260
|
-
// First stop, any callbacks!
|
261
|
-
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
|
262
|
-
|
263
|
-
// Then clear out the dispatch queue.
|
264
|
-
if(self.reachabilitySerialQueue)
|
265
|
-
{
|
266
|
-
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
267
|
-
dispatch_release(self.reachabilitySerialQueue);
|
268
|
-
#endif
|
269
|
-
self.reachabilitySerialQueue = nil;
|
270
|
-
}
|
271
|
-
|
272
|
-
self.reachabilityObject = nil;
|
273
|
-
|
274
|
-
return NO;
|
275
|
-
}
|
276
|
-
|
277
|
-
return YES;
|
278
|
-
}
|
279
|
-
|
280
|
-
-(void)stopNotifier
|
281
|
-
{
|
282
|
-
// First stop, any callbacks!
|
283
|
-
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
|
284
|
-
|
285
|
-
// Unregister target from the GCD serial dispatch queue.
|
286
|
-
SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL);
|
287
|
-
|
288
|
-
if(self.reachabilitySerialQueue)
|
289
|
-
{
|
290
|
-
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
291
|
-
dispatch_release(self.reachabilitySerialQueue);
|
292
|
-
#endif
|
293
|
-
self.reachabilitySerialQueue = nil;
|
294
|
-
}
|
295
|
-
|
296
|
-
self.reachabilityObject = nil;
|
297
|
-
}
|
298
|
-
|
299
|
-
#pragma mark - reachability tests
|
300
|
-
|
301
|
-
// This is for the case where you flick the airplane mode;
|
302
|
-
// you end up getting something like this:
|
303
|
-
//Reachability: WR ct-----
|
304
|
-
//Reachability: -- -------
|
305
|
-
//Reachability: WR ct-----
|
306
|
-
//Reachability: -- -------
|
307
|
-
// We treat this as 4 UNREACHABLE triggers - really apple should do better than this
|
308
|
-
|
309
|
-
#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection)
|
310
|
-
|
311
|
-
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags
|
312
|
-
{
|
313
|
-
BOOL connectionUP = YES;
|
314
|
-
|
315
|
-
if(!(flags & kSCNetworkReachabilityFlagsReachable))
|
316
|
-
connectionUP = NO;
|
317
|
-
|
318
|
-
if( (flags & testcase) == testcase )
|
319
|
-
connectionUP = NO;
|
320
|
-
|
321
|
-
#if TARGET_OS_IPHONE
|
322
|
-
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
|
323
|
-
{
|
324
|
-
// We're on 3G.
|
325
|
-
if(!self.reachableOnWWAN)
|
326
|
-
{
|
327
|
-
// We don't want to connect when on 3G.
|
328
|
-
connectionUP = NO;
|
329
|
-
}
|
330
|
-
}
|
331
|
-
#endif
|
332
|
-
|
333
|
-
return connectionUP;
|
334
|
-
}
|
335
|
-
|
336
|
-
-(BOOL)isReachable
|
337
|
-
{
|
338
|
-
SCNetworkReachabilityFlags flags;
|
339
|
-
|
340
|
-
if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
|
341
|
-
return NO;
|
342
|
-
|
343
|
-
return [self isReachableWithFlags:flags];
|
344
|
-
}
|
345
|
-
|
346
|
-
-(BOOL)isReachableViaWWAN
|
347
|
-
{
|
348
|
-
#if TARGET_OS_IPHONE
|
349
|
-
|
350
|
-
SCNetworkReachabilityFlags flags = 0;
|
351
|
-
|
352
|
-
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
353
|
-
{
|
354
|
-
// Check we're REACHABLE
|
355
|
-
if(flags & kSCNetworkReachabilityFlagsReachable)
|
356
|
-
{
|
357
|
-
// Now, check we're on WWAN
|
358
|
-
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
|
359
|
-
{
|
360
|
-
return YES;
|
361
|
-
}
|
362
|
-
}
|
363
|
-
}
|
364
|
-
#endif
|
365
|
-
|
366
|
-
return NO;
|
367
|
-
}
|
368
|
-
|
369
|
-
-(BOOL)isReachableViaWiFi
|
370
|
-
{
|
371
|
-
SCNetworkReachabilityFlags flags = 0;
|
372
|
-
|
373
|
-
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
374
|
-
{
|
375
|
-
// Check we're reachable
|
376
|
-
if((flags & kSCNetworkReachabilityFlagsReachable))
|
377
|
-
{
|
378
|
-
#if TARGET_OS_IPHONE
|
379
|
-
// Check we're NOT on WWAN
|
380
|
-
if((flags & kSCNetworkReachabilityFlagsIsWWAN))
|
381
|
-
{
|
382
|
-
return NO;
|
383
|
-
}
|
384
|
-
#endif
|
385
|
-
return YES;
|
386
|
-
}
|
387
|
-
}
|
388
|
-
|
389
|
-
return NO;
|
390
|
-
}
|
391
|
-
|
392
|
-
|
393
|
-
// WWAN may be available, but not active until a connection has been established.
|
394
|
-
// WiFi may require a connection for VPN on Demand.
|
395
|
-
-(BOOL)isConnectionRequired
|
396
|
-
{
|
397
|
-
return [self connectionRequired];
|
398
|
-
}
|
399
|
-
|
400
|
-
-(BOOL)connectionRequired
|
401
|
-
{
|
402
|
-
SCNetworkReachabilityFlags flags;
|
403
|
-
|
404
|
-
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
405
|
-
{
|
406
|
-
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
|
407
|
-
}
|
408
|
-
|
409
|
-
return NO;
|
410
|
-
}
|
411
|
-
|
412
|
-
// Dynamic, on demand connection?
|
413
|
-
-(BOOL)isConnectionOnDemand
|
414
|
-
{
|
415
|
-
SCNetworkReachabilityFlags flags;
|
416
|
-
|
417
|
-
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
418
|
-
{
|
419
|
-
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
|
420
|
-
(flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)));
|
421
|
-
}
|
422
|
-
|
423
|
-
return NO;
|
424
|
-
}
|
425
|
-
|
426
|
-
// Is user intervention required?
|
427
|
-
-(BOOL)isInterventionRequired
|
428
|
-
{
|
429
|
-
SCNetworkReachabilityFlags flags;
|
430
|
-
|
431
|
-
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
432
|
-
{
|
433
|
-
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
|
434
|
-
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
|
435
|
-
}
|
436
|
-
|
437
|
-
return NO;
|
438
|
-
}
|
439
|
-
|
440
|
-
|
441
|
-
#pragma mark - reachability status stuff
|
442
|
-
|
443
|
-
-(NetworkStatus)currentReachabilityStatus
|
444
|
-
{
|
445
|
-
if([self isReachable])
|
446
|
-
{
|
447
|
-
if([self isReachableViaWiFi])
|
448
|
-
return ReachableViaWiFi;
|
449
|
-
|
450
|
-
#if TARGET_OS_IPHONE
|
451
|
-
return ReachableViaWWAN;
|
452
|
-
#endif
|
453
|
-
}
|
454
|
-
|
455
|
-
return NotReachable;
|
456
|
-
}
|
457
|
-
|
458
|
-
-(SCNetworkReachabilityFlags)reachabilityFlags
|
459
|
-
{
|
460
|
-
SCNetworkReachabilityFlags flags = 0;
|
461
|
-
|
462
|
-
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
463
|
-
{
|
464
|
-
return flags;
|
465
|
-
}
|
466
|
-
|
467
|
-
return 0;
|
468
|
-
}
|
469
|
-
|
470
|
-
-(NSString*)currentReachabilityString
|
471
|
-
{
|
472
|
-
NetworkStatus temp = [self currentReachabilityStatus];
|
473
|
-
|
474
|
-
if(temp == reachableOnWWAN)
|
475
|
-
{
|
476
|
-
// Updated for the fact that we have CDMA phones now!
|
477
|
-
return NSLocalizedString(@"Cellular", @"");
|
478
|
-
}
|
479
|
-
if (temp == ReachableViaWiFi)
|
480
|
-
{
|
481
|
-
return NSLocalizedString(@"WiFi", @"");
|
482
|
-
}
|
483
|
-
|
484
|
-
return NSLocalizedString(@"No Connection", @"");
|
485
|
-
}
|
486
|
-
|
487
|
-
-(NSString*)currentReachabilityFlags
|
488
|
-
{
|
489
|
-
return reachabilityFlags([self reachabilityFlags]);
|
490
|
-
}
|
491
|
-
|
492
|
-
#pragma mark - Callback function calls this method
|
493
|
-
|
494
|
-
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags
|
495
|
-
{
|
496
|
-
if([self isReachableWithFlags:flags])
|
497
|
-
{
|
498
|
-
if(self.reachableBlock)
|
499
|
-
{
|
500
|
-
self.reachableBlock(self);
|
501
|
-
}
|
502
|
-
}
|
503
|
-
else
|
504
|
-
{
|
505
|
-
if(self.unreachableBlock)
|
506
|
-
{
|
507
|
-
self.unreachableBlock(self);
|
508
|
-
}
|
509
|
-
}
|
510
|
-
|
511
|
-
// this makes sure the change notification happens on the MAIN THREAD
|
512
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
513
|
-
[[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification
|
514
|
-
object:self];
|
515
|
-
});
|
516
|
-
}
|
517
|
-
|
518
|
-
#pragma mark - Debug Description
|
519
|
-
|
520
|
-
- (NSString *) description;
|
521
|
-
{
|
522
|
-
NSString *description = [NSString stringWithFormat:@"<%@: %#x>",
|
523
|
-
NSStringFromClass([self class]), (unsigned int) self];
|
524
|
-
return description;
|
525
|
-
}
|
526
|
-
|
527
|
-
@end
|