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,113 +0,0 @@
|
|
1
|
-
// AFImageRequestOperation.h
|
2
|
-
//
|
3
|
-
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
|
4
|
-
//
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
10
|
-
// furnished to do so, subject to the following conditions:
|
11
|
-
//
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
13
|
-
// all copies or substantial portions of the Software.
|
14
|
-
//
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
// THE SOFTWARE.
|
22
|
-
|
23
|
-
#import <Foundation/Foundation.h>
|
24
|
-
#import "AFHTTPRequestOperation.h"
|
25
|
-
|
26
|
-
#import <Availability.h>
|
27
|
-
|
28
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
29
|
-
#import <UIKit/UIKit.h>
|
30
|
-
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
31
|
-
#import <Cocoa/Cocoa.h>
|
32
|
-
#endif
|
33
|
-
|
34
|
-
/**
|
35
|
-
`AFImageRequestOperation` is a subclass of `AFHTTPRequestOperation` for downloading and processing images.
|
36
|
-
|
37
|
-
## Acceptable Content Types
|
38
|
-
|
39
|
-
By default, `AFImageRequestOperation` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage:
|
40
|
-
|
41
|
-
- `image/tiff`
|
42
|
-
- `image/jpeg`
|
43
|
-
- `image/gif`
|
44
|
-
- `image/png`
|
45
|
-
- `image/ico`
|
46
|
-
- `image/x-icon`
|
47
|
-
- `image/bmp`
|
48
|
-
- `image/x-bmp`
|
49
|
-
- `image/x-xbitmap`
|
50
|
-
- `image/x-win-bitmap`
|
51
|
-
*/
|
52
|
-
@interface AFImageRequestOperation : AFHTTPRequestOperation
|
53
|
-
|
54
|
-
/**
|
55
|
-
An image constructed from the response data. If an error occurs during the request, `nil` will be returned, and the `error` property will be set to the error.
|
56
|
-
*/
|
57
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
58
|
-
@property (readonly, nonatomic, strong) UIImage *responseImage;
|
59
|
-
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
60
|
-
@property (readonly, nonatomic, strong) NSImage *responseImage;
|
61
|
-
#endif
|
62
|
-
|
63
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
64
|
-
/**
|
65
|
-
The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance.
|
66
|
-
*/
|
67
|
-
@property (nonatomic, assign) CGFloat imageScale;
|
68
|
-
|
69
|
-
/**
|
70
|
-
Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default.
|
71
|
-
*/
|
72
|
-
@property (nonatomic, assign) BOOL automaticallyInflatesResponseImage;
|
73
|
-
#endif
|
74
|
-
|
75
|
-
/**
|
76
|
-
Creates and returns an `AFImageRequestOperation` object and sets the specified success callback.
|
77
|
-
|
78
|
-
@param urlRequest The request object to be loaded asynchronously during execution of the operation.
|
79
|
-
@param success A block object to be executed when the request finishes successfully. This block has no return value and takes a single argument, the image created from the response data of the request.
|
80
|
-
|
81
|
-
@return A new image request operation
|
82
|
-
*/
|
83
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
84
|
-
+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
85
|
-
success:(void (^)(UIImage *image))success;
|
86
|
-
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
87
|
-
+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
88
|
-
success:(void (^)(NSImage *image))success;
|
89
|
-
#endif
|
90
|
-
|
91
|
-
/**
|
92
|
-
Creates and returns an `AFImageRequestOperation` object and sets the specified success callback.
|
93
|
-
|
94
|
-
@param urlRequest The request object to be loaded asynchronously during execution of the operation.
|
95
|
-
@param imageProcessingBlock A block object to be executed after the image request finishes successfully, but before the image is returned in the `success` block. This block takes a single argument, the image loaded from the response body, and returns the processed image.
|
96
|
-
@param success A block object to be executed when the request finishes successfully, with a status code in the 2xx range, and with an acceptable content type (e.g. `image/png`). This block has no return value and takes three arguments: the request object of the operation, the response for the request, and the image created from the response data.
|
97
|
-
@param failure A block object to be executed when the request finishes unsuccessfully. This block has no return value and takes three arguments: the request object of the operation, the response for the request, and the error associated with the cause for the unsuccessful operation.
|
98
|
-
|
99
|
-
@return A new image request operation
|
100
|
-
*/
|
101
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
102
|
-
+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
103
|
-
imageProcessingBlock:(UIImage *(^)(UIImage *image))imageProcessingBlock
|
104
|
-
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
|
105
|
-
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure;
|
106
|
-
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
107
|
-
+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
108
|
-
imageProcessingBlock:(NSImage *(^)(NSImage *image))imageProcessingBlock
|
109
|
-
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success
|
110
|
-
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure;
|
111
|
-
#endif
|
112
|
-
|
113
|
-
@end
|
@@ -1,321 +0,0 @@
|
|
1
|
-
// AFImageRequestOperation.m
|
2
|
-
//
|
3
|
-
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
|
4
|
-
//
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
10
|
-
// furnished to do so, subject to the following conditions:
|
11
|
-
//
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
13
|
-
// all copies or substantial portions of the Software.
|
14
|
-
//
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
// THE SOFTWARE.
|
22
|
-
|
23
|
-
#import "AFImageRequestOperation.h"
|
24
|
-
|
25
|
-
static dispatch_queue_t image_request_operation_processing_queue() {
|
26
|
-
static dispatch_queue_t af_image_request_operation_processing_queue;
|
27
|
-
static dispatch_once_t onceToken;
|
28
|
-
dispatch_once(&onceToken, ^{
|
29
|
-
af_image_request_operation_processing_queue = dispatch_queue_create("com.alamofire.networking.image-request.processing", DISPATCH_QUEUE_CONCURRENT);
|
30
|
-
});
|
31
|
-
|
32
|
-
return af_image_request_operation_processing_queue;
|
33
|
-
}
|
34
|
-
|
35
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
36
|
-
#import <CoreGraphics/CoreGraphics.h>
|
37
|
-
|
38
|
-
static UIImage * AFImageWithDataAtScale(NSData *data, CGFloat scale) {
|
39
|
-
UIImage *image = [[UIImage alloc] initWithData:data];
|
40
|
-
|
41
|
-
return [[UIImage alloc] initWithCGImage:[image CGImage] scale:scale orientation:image.imageOrientation];
|
42
|
-
}
|
43
|
-
|
44
|
-
static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *response, NSData *data, CGFloat scale) {
|
45
|
-
if (!data || [data length] == 0) {
|
46
|
-
return nil;
|
47
|
-
}
|
48
|
-
|
49
|
-
UIImage *image = AFImageWithDataAtScale(data, scale);
|
50
|
-
if (image.images) {
|
51
|
-
return image;
|
52
|
-
}
|
53
|
-
|
54
|
-
CGImageRef imageRef = nil;
|
55
|
-
CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
|
56
|
-
|
57
|
-
if ([response.MIMEType isEqualToString:@"image/png"]) {
|
58
|
-
imageRef = CGImageCreateWithPNGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault);
|
59
|
-
} else if ([response.MIMEType isEqualToString:@"image/jpeg"]) {
|
60
|
-
imageRef = CGImageCreateWithJPEGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault);
|
61
|
-
}
|
62
|
-
|
63
|
-
if (!imageRef) {
|
64
|
-
imageRef = CGImageCreateCopy([image CGImage]);
|
65
|
-
|
66
|
-
if (!imageRef) {
|
67
|
-
CGDataProviderRelease(dataProvider);
|
68
|
-
return image;
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
CGDataProviderRelease(dataProvider);
|
73
|
-
|
74
|
-
size_t width = CGImageGetWidth(imageRef);
|
75
|
-
size_t height = CGImageGetHeight(imageRef);
|
76
|
-
size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef);
|
77
|
-
size_t bytesPerRow = 0; // CGImageGetBytesPerRow() calculates incorrectly in iOS 5.0, so defer to CGBitmapContextCreate()
|
78
|
-
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
79
|
-
CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);
|
80
|
-
|
81
|
-
if (CGColorSpaceGetNumberOfComponents(colorSpace) == 3) {
|
82
|
-
int alpha = (bitmapInfo & kCGBitmapAlphaInfoMask);
|
83
|
-
if (alpha == kCGImageAlphaNone) {
|
84
|
-
bitmapInfo &= ~kCGBitmapAlphaInfoMask;
|
85
|
-
bitmapInfo |= kCGImageAlphaNoneSkipFirst;
|
86
|
-
} else if (!(alpha == kCGImageAlphaNoneSkipFirst || alpha == kCGImageAlphaNoneSkipLast)) {
|
87
|
-
bitmapInfo &= ~kCGBitmapAlphaInfoMask;
|
88
|
-
bitmapInfo |= kCGImageAlphaPremultipliedFirst;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
CGContextRef context = CGBitmapContextCreate(NULL, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo);
|
93
|
-
|
94
|
-
CGColorSpaceRelease(colorSpace);
|
95
|
-
|
96
|
-
if (!context) {
|
97
|
-
CGImageRelease(imageRef);
|
98
|
-
|
99
|
-
return image;
|
100
|
-
}
|
101
|
-
|
102
|
-
CGRect rect = CGRectMake(0.0f, 0.0f, width, height);
|
103
|
-
CGContextDrawImage(context, rect, imageRef);
|
104
|
-
CGImageRef inflatedImageRef = CGBitmapContextCreateImage(context);
|
105
|
-
CGContextRelease(context);
|
106
|
-
|
107
|
-
UIImage *inflatedImage = [[UIImage alloc] initWithCGImage:inflatedImageRef scale:scale orientation:image.imageOrientation];
|
108
|
-
CGImageRelease(inflatedImageRef);
|
109
|
-
CGImageRelease(imageRef);
|
110
|
-
|
111
|
-
return inflatedImage;
|
112
|
-
}
|
113
|
-
#endif
|
114
|
-
|
115
|
-
@interface AFImageRequestOperation ()
|
116
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
117
|
-
@property (readwrite, nonatomic, strong) UIImage *responseImage;
|
118
|
-
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
119
|
-
@property (readwrite, nonatomic, strong) NSImage *responseImage;
|
120
|
-
#endif
|
121
|
-
@end
|
122
|
-
|
123
|
-
@implementation AFImageRequestOperation
|
124
|
-
@synthesize responseImage = _responseImage;
|
125
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
126
|
-
@synthesize imageScale = _imageScale;
|
127
|
-
#endif
|
128
|
-
|
129
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
130
|
-
+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
131
|
-
success:(void (^)(UIImage *image))success
|
132
|
-
{
|
133
|
-
return [self imageRequestOperationWithRequest:urlRequest imageProcessingBlock:nil success:^(NSURLRequest __unused *request, NSHTTPURLResponse __unused *response, UIImage *image) {
|
134
|
-
if (success) {
|
135
|
-
success(image);
|
136
|
-
}
|
137
|
-
} failure:nil];
|
138
|
-
}
|
139
|
-
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
140
|
-
+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
141
|
-
success:(void (^)(NSImage *image))success
|
142
|
-
{
|
143
|
-
return [self imageRequestOperationWithRequest:urlRequest imageProcessingBlock:nil success:^(NSURLRequest __unused *request, NSHTTPURLResponse __unused *response, NSImage *image) {
|
144
|
-
if (success) {
|
145
|
-
success(image);
|
146
|
-
}
|
147
|
-
} failure:nil];
|
148
|
-
}
|
149
|
-
#endif
|
150
|
-
|
151
|
-
|
152
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
153
|
-
+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
154
|
-
imageProcessingBlock:(UIImage *(^)(UIImage *))imageProcessingBlock
|
155
|
-
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
|
156
|
-
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure
|
157
|
-
{
|
158
|
-
AFImageRequestOperation *requestOperation = [(AFImageRequestOperation *)[self alloc] initWithRequest:urlRequest];
|
159
|
-
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
|
160
|
-
if (success) {
|
161
|
-
UIImage *image = responseObject;
|
162
|
-
if (imageProcessingBlock) {
|
163
|
-
dispatch_async(image_request_operation_processing_queue(), ^(void) {
|
164
|
-
UIImage *processedImage = imageProcessingBlock(image);
|
165
|
-
#pragma clang diagnostic push
|
166
|
-
#pragma clang diagnostic ignored "-Wgnu"
|
167
|
-
dispatch_async(operation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) {
|
168
|
-
success(operation.request, operation.response, processedImage);
|
169
|
-
});
|
170
|
-
#pragma clang diagnostic pop
|
171
|
-
});
|
172
|
-
} else {
|
173
|
-
success(operation.request, operation.response, image);
|
174
|
-
}
|
175
|
-
}
|
176
|
-
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
177
|
-
if (failure) {
|
178
|
-
failure(operation.request, operation.response, error);
|
179
|
-
}
|
180
|
-
}];
|
181
|
-
|
182
|
-
|
183
|
-
return requestOperation;
|
184
|
-
}
|
185
|
-
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
186
|
-
+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
187
|
-
imageProcessingBlock:(NSImage *(^)(NSImage *))imageProcessingBlock
|
188
|
-
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success
|
189
|
-
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure
|
190
|
-
{
|
191
|
-
AFImageRequestOperation *requestOperation = [(AFImageRequestOperation *)[self alloc] initWithRequest:urlRequest];
|
192
|
-
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
|
193
|
-
if (success) {
|
194
|
-
NSImage *image = responseObject;
|
195
|
-
if (imageProcessingBlock) {
|
196
|
-
dispatch_async(image_request_operation_processing_queue(), ^(void) {
|
197
|
-
NSImage *processedImage = imageProcessingBlock(image);
|
198
|
-
|
199
|
-
dispatch_async(operation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) {
|
200
|
-
success(operation.request, operation.response, processedImage);
|
201
|
-
});
|
202
|
-
});
|
203
|
-
} else {
|
204
|
-
success(operation.request, operation.response, image);
|
205
|
-
}
|
206
|
-
}
|
207
|
-
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
|
208
|
-
if (failure) {
|
209
|
-
failure(operation.request, operation.response, error);
|
210
|
-
}
|
211
|
-
}];
|
212
|
-
|
213
|
-
return requestOperation;
|
214
|
-
}
|
215
|
-
#endif
|
216
|
-
|
217
|
-
- (id)initWithRequest:(NSURLRequest *)urlRequest {
|
218
|
-
self = [super initWithRequest:urlRequest];
|
219
|
-
if (!self) {
|
220
|
-
return nil;
|
221
|
-
}
|
222
|
-
|
223
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
224
|
-
self.imageScale = [[UIScreen mainScreen] scale];
|
225
|
-
self.automaticallyInflatesResponseImage = YES;
|
226
|
-
#endif
|
227
|
-
|
228
|
-
return self;
|
229
|
-
}
|
230
|
-
|
231
|
-
|
232
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
233
|
-
- (UIImage *)responseImage {
|
234
|
-
if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) {
|
235
|
-
if (self.automaticallyInflatesResponseImage) {
|
236
|
-
self.responseImage = AFInflatedImageFromResponseWithDataAtScale(self.response, self.responseData, self.imageScale);
|
237
|
-
} else {
|
238
|
-
self.responseImage = AFImageWithDataAtScale(self.responseData, self.imageScale);
|
239
|
-
}
|
240
|
-
}
|
241
|
-
|
242
|
-
return _responseImage;
|
243
|
-
}
|
244
|
-
|
245
|
-
- (void)setImageScale:(CGFloat)imageScale {
|
246
|
-
#pragma clang diagnostic push
|
247
|
-
#pragma clang diagnostic ignored "-Wfloat-equal"
|
248
|
-
if (imageScale == _imageScale) {
|
249
|
-
return;
|
250
|
-
}
|
251
|
-
#pragma clang diagnostic pop
|
252
|
-
|
253
|
-
_imageScale = imageScale;
|
254
|
-
|
255
|
-
self.responseImage = nil;
|
256
|
-
}
|
257
|
-
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
258
|
-
- (NSImage *)responseImage {
|
259
|
-
if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) {
|
260
|
-
// Ensure that the image is set to it's correct pixel width and height
|
261
|
-
NSBitmapImageRep *bitimage = [[NSBitmapImageRep alloc] initWithData:self.responseData];
|
262
|
-
self.responseImage = [[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])];
|
263
|
-
[self.responseImage addRepresentation:bitimage];
|
264
|
-
}
|
265
|
-
|
266
|
-
return _responseImage;
|
267
|
-
}
|
268
|
-
#endif
|
269
|
-
|
270
|
-
#pragma mark - AFHTTPRequestOperation
|
271
|
-
|
272
|
-
+ (NSSet *)acceptableContentTypes {
|
273
|
-
return [NSSet setWithObjects:@"image/tiff", @"image/jpeg", @"image/gif", @"image/png", @"image/ico", @"image/x-icon", @"image/bmp", @"image/x-bmp", @"image/x-xbitmap", @"image/x-win-bitmap", nil];
|
274
|
-
}
|
275
|
-
|
276
|
-
+ (BOOL)canProcessRequest:(NSURLRequest *)request {
|
277
|
-
static NSSet * _acceptablePathExtension = nil;
|
278
|
-
static dispatch_once_t onceToken;
|
279
|
-
dispatch_once(&onceToken, ^{
|
280
|
-
_acceptablePathExtension = [[NSSet alloc] initWithObjects:@"tif", @"tiff", @"jpg", @"jpeg", @"gif", @"png", @"ico", @"bmp", @"cur", nil];
|
281
|
-
});
|
282
|
-
|
283
|
-
return [_acceptablePathExtension containsObject:[[request URL] pathExtension]] || [super canProcessRequest:request];
|
284
|
-
}
|
285
|
-
|
286
|
-
- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
|
287
|
-
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
|
288
|
-
{
|
289
|
-
#pragma clang diagnostic push
|
290
|
-
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
291
|
-
#pragma clang diagnostic ignored "-Wgnu"
|
292
|
-
|
293
|
-
self.completionBlock = ^ {
|
294
|
-
dispatch_async(image_request_operation_processing_queue(), ^(void) {
|
295
|
-
if (self.error) {
|
296
|
-
if (failure) {
|
297
|
-
dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{
|
298
|
-
failure(self, self.error);
|
299
|
-
});
|
300
|
-
}
|
301
|
-
} else {
|
302
|
-
if (success) {
|
303
|
-
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
304
|
-
UIImage *image = nil;
|
305
|
-
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
306
|
-
NSImage *image = nil;
|
307
|
-
#endif
|
308
|
-
|
309
|
-
image = self.responseImage;
|
310
|
-
|
311
|
-
dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{
|
312
|
-
success(self, image);
|
313
|
-
});
|
314
|
-
}
|
315
|
-
}
|
316
|
-
});
|
317
|
-
};
|
318
|
-
#pragma clang diagnostic pop
|
319
|
-
}
|
320
|
-
|
321
|
-
@end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
// AFJSONRequestOperation.h
|
2
|
-
//
|
3
|
-
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
|
4
|
-
//
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
10
|
-
// furnished to do so, subject to the following conditions:
|
11
|
-
//
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
13
|
-
// all copies or substantial portions of the Software.
|
14
|
-
//
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
// THE SOFTWARE.
|
22
|
-
|
23
|
-
#import <Foundation/Foundation.h>
|
24
|
-
#import "AFHTTPRequestOperation.h"
|
25
|
-
|
26
|
-
/**
|
27
|
-
`AFJSONRequestOperation` is a subclass of `AFHTTPRequestOperation` for downloading and working with JSON response data.
|
28
|
-
|
29
|
-
## Acceptable Content Types
|
30
|
-
|
31
|
-
By default, `AFJSONRequestOperation` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types:
|
32
|
-
|
33
|
-
- `application/json`
|
34
|
-
- `text/json`
|
35
|
-
|
36
|
-
@warning JSON parsing will use the built-in `NSJSONSerialization` class.
|
37
|
-
*/
|
38
|
-
@interface AFJSONRequestOperation : AFHTTPRequestOperation
|
39
|
-
|
40
|
-
///----------------------------
|
41
|
-
/// @name Getting Response Data
|
42
|
-
///----------------------------
|
43
|
-
|
44
|
-
/**
|
45
|
-
A JSON object constructed from the response data. If an error occurs while parsing, `nil` will be returned, and the `error` property will be set to the error.
|
46
|
-
*/
|
47
|
-
@property (readonly, nonatomic, strong) id responseJSON;
|
48
|
-
|
49
|
-
/**
|
50
|
-
Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions".
|
51
|
-
*/
|
52
|
-
@property (nonatomic, assign) NSJSONReadingOptions JSONReadingOptions;
|
53
|
-
|
54
|
-
///----------------------------------
|
55
|
-
/// @name Creating Request Operations
|
56
|
-
///----------------------------------
|
57
|
-
|
58
|
-
/**
|
59
|
-
Creates and returns an `AFJSONRequestOperation` object and sets the specified success and failure callbacks.
|
60
|
-
|
61
|
-
@param urlRequest The request object to be loaded asynchronously during execution of the operation
|
62
|
-
@param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the JSON object created from the response data of request.
|
63
|
-
@param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data as JSON. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred.
|
64
|
-
|
65
|
-
@return A new JSON request operation
|
66
|
-
*/
|
67
|
-
+ (instancetype)JSONRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
68
|
-
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id JSON))success
|
69
|
-
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON))failure;
|
70
|
-
|
71
|
-
@end
|