motion-yapper 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,24 +1,9 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
|
|
3
3
|
#import "YapDatabaseViewTransaction.h"
|
|
4
|
+
#import "YapDatabaseFilteredViewTypes.h"
|
|
4
5
|
#import "YapDatabaseFilteredView.h"
|
|
5
6
|
|
|
6
|
-
#ifndef YapDatabaseViewFilteringBlockDefined
|
|
7
|
-
#define YapDatabaseViewFilteringBlockDefined 1
|
|
8
|
-
|
|
9
|
-
typedef id YapDatabaseViewFilteringBlock; // One of the YapDatabaseViewGroupingX types below.
|
|
10
|
-
|
|
11
|
-
typedef BOOL (^YapDatabaseViewFilteringWithKeyBlock) \
|
|
12
|
-
(NSString *group, NSString *collection, NSString *key);
|
|
13
|
-
typedef BOOL (^YapDatabaseViewFilteringWithObjectBlock) \
|
|
14
|
-
(NSString *group, NSString *collection, NSString *key, id object);
|
|
15
|
-
typedef BOOL (^YapDatabaseViewFilteringWithMetadataBlock)\
|
|
16
|
-
(NSString *group, NSString *collection, NSString *key, id metadata);
|
|
17
|
-
typedef BOOL (^YapDatabaseViewFilteringWithRowBlock) \
|
|
18
|
-
(NSString *group, NSString *collection, NSString *key, id object, id metadata);
|
|
19
|
-
|
|
20
|
-
#endif
|
|
21
|
-
|
|
22
7
|
|
|
23
8
|
@interface YapDatabaseFilteredViewTransaction : YapDatabaseViewTransaction
|
|
24
9
|
|
|
@@ -32,8 +17,23 @@ typedef BOOL (^YapDatabaseViewFilteringWithRowBlock) \
|
|
|
32
17
|
|
|
33
18
|
@interface YapDatabaseFilteredViewTransaction (ReadWrite)
|
|
34
19
|
|
|
20
|
+
/**
|
|
21
|
+
* This method allows you to change the filterBlock on-the-fly.
|
|
22
|
+
*
|
|
23
|
+
* When you do so, the extension will emit the smallest change-set possible.
|
|
24
|
+
* That is, it does NOT clear the view and start from scratch.
|
|
25
|
+
* Rather it performs a quick in-place update.
|
|
26
|
+
* The end result is a minimal change-set that looks nice for tableView / collectionView animations.
|
|
27
|
+
*
|
|
28
|
+
* For example, in Apple's phone app, in the Recents tab, one can switch between "all" and "missed" calls.
|
|
29
|
+
* Tapping the "missed" button smoothly animates away all non-red rows. It looks great.
|
|
30
|
+
* You can get the same effect by using a YapDatabaseFilteredView,
|
|
31
|
+
* and swapping in/out a filterBlock to allow/disallow non-missed calls.
|
|
32
|
+
*
|
|
33
|
+
* Note: You must pass a different versionTag, or this method does nothing.
|
|
34
|
+
**/
|
|
35
35
|
- (void)setFilteringBlock:(YapDatabaseViewFilteringBlock)filteringBlock
|
|
36
36
|
filteringBlockType:(YapDatabaseViewBlockType)filteringBlockType
|
|
37
|
-
|
|
37
|
+
versionTag:(NSString *)tag;
|
|
38
38
|
|
|
39
39
|
@end
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
static const int ydbLogLevel = YDB_LOG_LEVEL_WARN;
|
|
21
21
|
#endif
|
|
22
22
|
|
|
23
|
+
#define ExtKey_classVersion @"classVersion"
|
|
24
|
+
#define ExtKey_persistent @"persistent"
|
|
25
|
+
#define ExtKey_parentViewName @"parentViewName"
|
|
26
|
+
#define ExtKey_tag_deprecated @"tag"
|
|
27
|
+
#define ExtKey_versionTag @"versionTag"
|
|
23
28
|
|
|
24
29
|
@implementation YapDatabaseFilteredViewTransaction
|
|
25
30
|
|
|
@@ -35,31 +40,68 @@
|
|
|
35
40
|
**/
|
|
36
41
|
- (BOOL)createIfNeeded
|
|
37
42
|
{
|
|
43
|
+
YDBLogAutoTrace();
|
|
44
|
+
|
|
45
|
+
__unsafe_unretained YapDatabaseFilteredView *filteredView = (YapDatabaseFilteredView *)(viewConnection->view);
|
|
46
|
+
|
|
47
|
+
int classVersion = YAP_DATABASE_VIEW_CLASS_VERSION;
|
|
48
|
+
BOOL isPersistent = [self isPersistentView];
|
|
49
|
+
|
|
50
|
+
NSString *parentViewName = filteredView->parentViewName;
|
|
51
|
+
NSString *versionTag = filteredView->versionTag;
|
|
52
|
+
|
|
53
|
+
// Figure out what steps we need to take in order to register the view
|
|
54
|
+
|
|
38
55
|
BOOL needsCreateTables = NO;
|
|
39
56
|
|
|
57
|
+
BOOL oldIsPersistent = NO;
|
|
58
|
+
BOOL hasOldIsPersistent = NO;
|
|
59
|
+
|
|
60
|
+
NSString *oldParentViewName = nil;
|
|
61
|
+
NSString *oldVersionTag = nil;
|
|
62
|
+
|
|
40
63
|
// Check classVersion (the internal version number of view implementation)
|
|
41
64
|
|
|
42
|
-
int oldClassVersion =
|
|
43
|
-
|
|
65
|
+
int oldClassVersion = 0;
|
|
66
|
+
BOOL hasOldClassVersion = [self getIntValue:&oldClassVersion forExtensionKey:ExtKey_classVersion];
|
|
44
67
|
|
|
45
|
-
if (
|
|
68
|
+
if (!hasOldClassVersion)
|
|
69
|
+
{
|
|
70
|
+
needsCreateTables = YES;
|
|
71
|
+
}
|
|
72
|
+
else if (oldClassVersion != classVersion)
|
|
73
|
+
{
|
|
74
|
+
[self dropTablesForOldClassVersion:oldClassVersion];
|
|
46
75
|
needsCreateTables = YES;
|
|
76
|
+
}
|
|
47
77
|
|
|
48
78
|
// Check persistence.
|
|
49
79
|
// Need to properly transition from persistent to non-persistent, and vice-versa.
|
|
50
80
|
|
|
51
|
-
|
|
52
|
-
BOOL hasOldIsPersistent = [self getBoolValue:&oldIsPersistent forExtensionKey:@"persistent"];
|
|
53
|
-
|
|
54
|
-
BOOL isPersistent = [self isPersistentView];
|
|
55
|
-
|
|
56
|
-
if (hasOldIsPersistent && (oldIsPersistent != isPersistent))
|
|
81
|
+
if (!needsCreateTables || hasOldClassVersion)
|
|
57
82
|
{
|
|
58
|
-
[
|
|
59
|
-
dropTablesForRegisteredName:[self registeredName]
|
|
60
|
-
withTransaction:(YapDatabaseReadWriteTransaction *)databaseTransaction];
|
|
83
|
+
hasOldIsPersistent = [self getBoolValue:&oldIsPersistent forExtensionKey:ExtKey_persistent];
|
|
61
84
|
|
|
62
|
-
|
|
85
|
+
if (hasOldIsPersistent && oldIsPersistent && !isPersistent)
|
|
86
|
+
{
|
|
87
|
+
[[viewConnection->view class]
|
|
88
|
+
dropTablesForRegisteredName:[self registeredName]
|
|
89
|
+
withTransaction:(YapDatabaseReadWriteTransaction *)databaseTransaction];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!hasOldIsPersistent || (oldIsPersistent != isPersistent))
|
|
93
|
+
{
|
|
94
|
+
needsCreateTables = YES;
|
|
95
|
+
}
|
|
96
|
+
else if (!isPersistent)
|
|
97
|
+
{
|
|
98
|
+
// We always have to create & populate the tables for non-persistent views.
|
|
99
|
+
// Even when re-registering from previous app launch.
|
|
100
|
+
needsCreateTables = YES;
|
|
101
|
+
|
|
102
|
+
oldParentViewName = [self stringValueForExtensionKey:ExtKey_parentViewName];
|
|
103
|
+
oldVersionTag = [self stringValueForExtensionKey:ExtKey_versionTag];
|
|
104
|
+
}
|
|
63
105
|
}
|
|
64
106
|
|
|
65
107
|
// Create or re-populate if needed
|
|
@@ -71,34 +113,75 @@
|
|
|
71
113
|
if (![self createTables]) return NO;
|
|
72
114
|
if (![self populateView]) return NO;
|
|
73
115
|
|
|
74
|
-
|
|
116
|
+
if (!hasOldClassVersion || (oldClassVersion != classVersion)) {
|
|
117
|
+
[self setIntValue:classVersion forExtensionKey:ExtKey_classVersion];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!hasOldIsPersistent || (oldIsPersistent != isPersistent)) {
|
|
121
|
+
[self setBoolValue:isPersistent forExtensionKey:ExtKey_persistent];
|
|
122
|
+
}
|
|
75
123
|
|
|
76
|
-
[
|
|
124
|
+
if (![oldParentViewName isEqualToString:parentViewName]) {
|
|
125
|
+
[self setStringValue:parentViewName forExtensionKey:ExtKey_parentViewName];
|
|
126
|
+
}
|
|
77
127
|
|
|
78
|
-
|
|
79
|
-
|
|
128
|
+
if (![oldVersionTag isEqualToString:versionTag]) {
|
|
129
|
+
[self setStringValue:versionTag forExtensionKey:ExtKey_versionTag];
|
|
130
|
+
}
|
|
80
131
|
}
|
|
81
132
|
else
|
|
82
133
|
{
|
|
134
|
+
BOOL needsRepopulateView = NO;
|
|
135
|
+
|
|
136
|
+
// Check parentViewName.
|
|
137
|
+
// Need to re-populate if the parent changed.
|
|
138
|
+
|
|
139
|
+
oldParentViewName = [self stringValueForExtensionKey:ExtKey_parentViewName];
|
|
140
|
+
|
|
141
|
+
if (![oldParentViewName isEqualToString:parentViewName])
|
|
142
|
+
{
|
|
143
|
+
needsRepopulateView = YES;
|
|
144
|
+
}
|
|
145
|
+
|
|
83
146
|
// Check user-supplied tag.
|
|
84
147
|
// We may need to re-populate the database if the groupingBlock or sortingBlock changed.
|
|
85
148
|
|
|
86
|
-
|
|
87
|
-
(YapDatabaseFilteredView *)viewConnection->view;
|
|
149
|
+
oldVersionTag = [self stringValueForExtensionKey:ExtKey_versionTag];
|
|
88
150
|
|
|
89
|
-
NSString *
|
|
90
|
-
|
|
151
|
+
NSString *oldTag_deprecated = nil;
|
|
152
|
+
if (oldVersionTag == nil)
|
|
153
|
+
{
|
|
154
|
+
oldTag_deprecated = [self stringValueForExtensionKey:ExtKey_tag_deprecated];
|
|
155
|
+
if (oldTag_deprecated)
|
|
156
|
+
{
|
|
157
|
+
oldVersionTag = oldTag_deprecated;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
91
160
|
|
|
92
|
-
if (![
|
|
161
|
+
if (![oldVersionTag isEqualToString:versionTag])
|
|
162
|
+
{
|
|
163
|
+
needsRepopulateView = YES;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (needsRepopulateView)
|
|
93
167
|
{
|
|
94
168
|
if (![self populateView]) return NO;
|
|
95
169
|
|
|
96
|
-
[
|
|
170
|
+
if (![oldParentViewName isEqualToString:parentViewName]) {
|
|
171
|
+
[self setStringValue:parentViewName forExtensionKey:ExtKey_parentViewName];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (![oldVersionTag isEqualToString:versionTag]) {
|
|
175
|
+
[self setStringValue:versionTag forExtensionKey:ExtKey_versionTag];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (oldTag_deprecated)
|
|
179
|
+
[self removeValueForExtensionKey:ExtKey_tag_deprecated];
|
|
97
180
|
}
|
|
98
|
-
|
|
99
|
-
if (!hasOldIsPersistent)
|
|
181
|
+
else if (oldTag_deprecated)
|
|
100
182
|
{
|
|
101
|
-
[self
|
|
183
|
+
[self removeValueForExtensionKey:ExtKey_tag_deprecated];
|
|
184
|
+
[self setStringValue:versionTag forExtensionKey:ExtKey_versionTag];
|
|
102
185
|
}
|
|
103
186
|
}
|
|
104
187
|
|
|
@@ -122,16 +205,6 @@
|
|
|
122
205
|
YapDatabaseViewTransaction *parentViewTransaction =
|
|
123
206
|
[databaseTransaction ext:filteredView->parentViewName];
|
|
124
207
|
|
|
125
|
-
__unsafe_unretained YapDatabaseView *parentView = parentViewTransaction->viewConnection->view;
|
|
126
|
-
|
|
127
|
-
// Capture grouping & sorting block
|
|
128
|
-
|
|
129
|
-
filteredView->groupingBlock = parentView->groupingBlock;
|
|
130
|
-
filteredView->groupingBlockType = parentView->groupingBlockType;
|
|
131
|
-
|
|
132
|
-
filteredView->sortingBlock = parentView->sortingBlock;
|
|
133
|
-
filteredView->sortingBlockType = parentView->sortingBlockType;
|
|
134
|
-
|
|
135
208
|
// Remove everything from the database
|
|
136
209
|
|
|
137
210
|
[self removeAllRowids];
|
|
@@ -155,19 +228,15 @@
|
|
|
155
228
|
[parentViewTransaction enumerateRowidsInGroup:group
|
|
156
229
|
usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
|
|
157
230
|
{
|
|
158
|
-
|
|
159
|
-
NSString *collection = nil;
|
|
160
|
-
[databaseTransaction getKey:&key collection:&collection forRowid:rowid];
|
|
231
|
+
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
|
|
161
232
|
|
|
162
|
-
if (filterBlock(group, collection, key))
|
|
233
|
+
if (filterBlock(group, ck.collection, ck.key))
|
|
163
234
|
{
|
|
164
|
-
YapCollectionKey *collectionKey = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
165
|
-
|
|
166
235
|
if (filteredIndex == 0)
|
|
167
|
-
[self insertRowid:rowid collectionKey:
|
|
236
|
+
[self insertRowid:rowid collectionKey:ck inNewGroup:group];
|
|
168
237
|
else
|
|
169
|
-
[self insertRowid:rowid collectionKey:
|
|
170
|
-
|
|
238
|
+
[self insertRowid:rowid collectionKey:ck inGroup:group atIndex:filteredIndex
|
|
239
|
+
withExistingPageKey:nil];
|
|
171
240
|
filteredIndex++;
|
|
172
241
|
}
|
|
173
242
|
}];
|
|
@@ -185,20 +254,17 @@
|
|
|
185
254
|
[parentViewTransaction enumerateRowidsInGroup:group
|
|
186
255
|
usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
|
|
187
256
|
{
|
|
188
|
-
|
|
189
|
-
NSString *collection = nil;
|
|
257
|
+
YapCollectionKey *ck = nil;
|
|
190
258
|
id object = nil;
|
|
191
|
-
[databaseTransaction
|
|
259
|
+
[databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
|
|
192
260
|
|
|
193
|
-
if (filterBlock(group, collection, key, object))
|
|
261
|
+
if (filterBlock(group, ck.collection, ck.key, object))
|
|
194
262
|
{
|
|
195
|
-
YapCollectionKey *collectionKey = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
196
|
-
|
|
197
263
|
if (filteredIndex == 0)
|
|
198
|
-
[self insertRowid:rowid collectionKey:
|
|
264
|
+
[self insertRowid:rowid collectionKey:ck inNewGroup:group];
|
|
199
265
|
else
|
|
200
|
-
[self insertRowid:rowid collectionKey:
|
|
201
|
-
|
|
266
|
+
[self insertRowid:rowid collectionKey:ck inGroup:group atIndex:filteredIndex
|
|
267
|
+
withExistingPageKey:nil];
|
|
202
268
|
filteredIndex++;
|
|
203
269
|
}
|
|
204
270
|
}];
|
|
@@ -216,20 +282,17 @@
|
|
|
216
282
|
[parentViewTransaction enumerateRowidsInGroup:group
|
|
217
283
|
usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
|
|
218
284
|
{
|
|
219
|
-
|
|
220
|
-
NSString *collection = nil;
|
|
285
|
+
YapCollectionKey *ck = nil;
|
|
221
286
|
id metadata = nil;
|
|
222
|
-
[databaseTransaction
|
|
287
|
+
[databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
|
|
223
288
|
|
|
224
|
-
if (filterBlock(group, collection, key, metadata))
|
|
289
|
+
if (filterBlock(group, ck.collection, ck.key, metadata))
|
|
225
290
|
{
|
|
226
|
-
YapCollectionKey *collectionKey = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
227
|
-
|
|
228
291
|
if (filteredIndex == 0)
|
|
229
|
-
[self insertRowid:rowid collectionKey:
|
|
292
|
+
[self insertRowid:rowid collectionKey:ck inNewGroup:group];
|
|
230
293
|
else
|
|
231
|
-
[self insertRowid:rowid collectionKey:
|
|
232
|
-
|
|
294
|
+
[self insertRowid:rowid collectionKey:ck inGroup:group atIndex:filteredIndex
|
|
295
|
+
withExistingPageKey:nil];
|
|
233
296
|
filteredIndex++;
|
|
234
297
|
}
|
|
235
298
|
}];
|
|
@@ -247,26 +310,22 @@
|
|
|
247
310
|
[parentViewTransaction enumerateRowidsInGroup:group
|
|
248
311
|
usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
|
|
249
312
|
{
|
|
250
|
-
|
|
251
|
-
NSString *collection = nil;
|
|
313
|
+
YapCollectionKey *ck = nil;
|
|
252
314
|
id object = nil;
|
|
253
315
|
id metadata = nil;
|
|
254
316
|
|
|
255
|
-
[databaseTransaction
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
forRowid:rowid];
|
|
317
|
+
[databaseTransaction getCollectionKey:&ck
|
|
318
|
+
object:&object
|
|
319
|
+
metadata:&metadata
|
|
320
|
+
forRowid:rowid];
|
|
260
321
|
|
|
261
|
-
if (filterBlock(group, collection, key, object, metadata))
|
|
322
|
+
if (filterBlock(group, ck.collection, ck.key, object, metadata))
|
|
262
323
|
{
|
|
263
|
-
YapCollectionKey *collectionKey = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
264
|
-
|
|
265
324
|
if (filteredIndex == 0)
|
|
266
|
-
[self insertRowid:rowid collectionKey:
|
|
325
|
+
[self insertRowid:rowid collectionKey:ck inNewGroup:group];
|
|
267
326
|
else
|
|
268
|
-
[self insertRowid:rowid collectionKey:
|
|
269
|
-
|
|
327
|
+
[self insertRowid:rowid collectionKey:ck inGroup:group atIndex:filteredIndex
|
|
328
|
+
withExistingPageKey:nil];
|
|
270
329
|
filteredIndex++;
|
|
271
330
|
}
|
|
272
331
|
}];
|
|
@@ -280,7 +339,7 @@
|
|
|
280
339
|
#pragma mark Logic
|
|
281
340
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
282
341
|
|
|
283
|
-
- (void)
|
|
342
|
+
- (void)repopulateView
|
|
284
343
|
{
|
|
285
344
|
YDBLogAutoTrace();
|
|
286
345
|
|
|
@@ -320,11 +379,9 @@
|
|
|
320
379
|
[parentViewTransaction enumerateRowidsInGroup:group
|
|
321
380
|
usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
|
|
322
381
|
{
|
|
323
|
-
|
|
324
|
-
NSString *collection = nil;
|
|
325
|
-
[databaseTransaction getKey:&key collection:&collection forRowid:rowid];
|
|
382
|
+
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
|
|
326
383
|
|
|
327
|
-
if (filterBlock(group, collection, key))
|
|
384
|
+
if (filterBlock(group, ck.collection, ck.key))
|
|
328
385
|
{
|
|
329
386
|
if (existing && (existingRowid == rowid))
|
|
330
387
|
{
|
|
@@ -339,8 +396,6 @@
|
|
|
339
396
|
// The row was not previously in the view (disallowed by previous filter),
|
|
340
397
|
// but is now in the view (allowed by new filter).
|
|
341
398
|
|
|
342
|
-
YapCollectionKey *ck = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
343
|
-
|
|
344
399
|
if (index == 0 && ([viewConnection->group_pagesMetadata_dict objectForKey:group] == nil))
|
|
345
400
|
[self insertRowid:rowid collectionKey:ck inNewGroup:group];
|
|
346
401
|
else
|
|
@@ -356,8 +411,6 @@
|
|
|
356
411
|
// The row was previously in the view (allowed by previous filter),
|
|
357
412
|
// but is no longer in the view (disallowed by new filter).
|
|
358
413
|
|
|
359
|
-
YapCollectionKey *ck = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
360
|
-
|
|
361
414
|
[self removeRowid:rowid collectionKey:ck atIndex:index inGroup:group];
|
|
362
415
|
existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
|
|
363
416
|
}
|
|
@@ -387,12 +440,11 @@
|
|
|
387
440
|
[parentViewTransaction enumerateRowidsInGroup:group
|
|
388
441
|
usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
|
|
389
442
|
{
|
|
390
|
-
|
|
391
|
-
NSString *collection = nil;
|
|
443
|
+
YapCollectionKey *ck = nil;
|
|
392
444
|
id object = nil;
|
|
393
|
-
[databaseTransaction
|
|
445
|
+
[databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
|
|
394
446
|
|
|
395
|
-
if (filterBlock(group, collection, key, object))
|
|
447
|
+
if (filterBlock(group, ck.collection, ck.key, object))
|
|
396
448
|
{
|
|
397
449
|
if (existing && (existingRowid == rowid))
|
|
398
450
|
{
|
|
@@ -407,8 +459,6 @@
|
|
|
407
459
|
// The row was not previously in the view (disallowed by previous filter),
|
|
408
460
|
// but is now in the view (allowed by new filter).
|
|
409
461
|
|
|
410
|
-
YapCollectionKey *ck = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
411
|
-
|
|
412
462
|
if (index == 0 && ([viewConnection->group_pagesMetadata_dict objectForKey:group] == nil))
|
|
413
463
|
[self insertRowid:rowid collectionKey:ck inNewGroup:group];
|
|
414
464
|
else
|
|
@@ -424,8 +474,6 @@
|
|
|
424
474
|
// The row was previously in the view (allowed by previous filter),
|
|
425
475
|
// but is no longer in the view (disallowed by new filter).
|
|
426
476
|
|
|
427
|
-
YapCollectionKey *ck = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
428
|
-
|
|
429
477
|
[self removeRowid:rowid collectionKey:ck atIndex:index inGroup:group];
|
|
430
478
|
existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
|
|
431
479
|
}
|
|
@@ -455,12 +503,11 @@
|
|
|
455
503
|
[parentViewTransaction enumerateRowidsInGroup:group
|
|
456
504
|
usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
|
|
457
505
|
{
|
|
458
|
-
|
|
459
|
-
NSString *collection = nil;
|
|
506
|
+
YapCollectionKey *ck = nil;
|
|
460
507
|
id metadata = nil;
|
|
461
|
-
[databaseTransaction
|
|
508
|
+
[databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
|
|
462
509
|
|
|
463
|
-
if (filterBlock(group, collection, key, metadata))
|
|
510
|
+
if (filterBlock(group, ck.collection, ck.key, metadata))
|
|
464
511
|
{
|
|
465
512
|
if (existing && (existingRowid == rowid))
|
|
466
513
|
{
|
|
@@ -475,8 +522,6 @@
|
|
|
475
522
|
// The row was not previously in the view (disallowed by previous filter),
|
|
476
523
|
// but is now in the view (allowed by new filter).
|
|
477
524
|
|
|
478
|
-
YapCollectionKey *ck = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
479
|
-
|
|
480
525
|
if (index == 0 && ([viewConnection->group_pagesMetadata_dict objectForKey:group] == nil))
|
|
481
526
|
[self insertRowid:rowid collectionKey:ck inNewGroup:group];
|
|
482
527
|
else
|
|
@@ -492,8 +537,6 @@
|
|
|
492
537
|
// The row was previously in the view (allowed by previous filter),
|
|
493
538
|
// but is no longer in the view (disallowed by new filter).
|
|
494
539
|
|
|
495
|
-
YapCollectionKey *ck = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
496
|
-
|
|
497
540
|
[self removeRowid:rowid collectionKey:ck atIndex:index inGroup:group];
|
|
498
541
|
existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
|
|
499
542
|
}
|
|
@@ -523,18 +566,16 @@
|
|
|
523
566
|
[parentViewTransaction enumerateRowidsInGroup:group
|
|
524
567
|
usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
|
|
525
568
|
{
|
|
526
|
-
|
|
527
|
-
NSString *collection = nil;
|
|
569
|
+
YapCollectionKey *ck = nil;
|
|
528
570
|
id object = nil;
|
|
529
571
|
id metadata = nil;
|
|
530
572
|
|
|
531
|
-
[databaseTransaction
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
forRowid:rowid];
|
|
573
|
+
[databaseTransaction getCollectionKey:&ck
|
|
574
|
+
object:&object
|
|
575
|
+
metadata:&metadata
|
|
576
|
+
forRowid:rowid];
|
|
536
577
|
|
|
537
|
-
if (filterBlock(group, collection, key, object, metadata))
|
|
578
|
+
if (filterBlock(group, ck.collection, ck.key, object, metadata))
|
|
538
579
|
{
|
|
539
580
|
if (existing && (existingRowid == rowid))
|
|
540
581
|
{
|
|
@@ -549,8 +590,6 @@
|
|
|
549
590
|
// The row was not previously in the view (disallowed by previous filter),
|
|
550
591
|
// but is now in the view (allowed by new filter).
|
|
551
592
|
|
|
552
|
-
YapCollectionKey *ck = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
553
|
-
|
|
554
593
|
if (index == 0 && ([viewConnection->group_pagesMetadata_dict objectForKey:group] == nil))
|
|
555
594
|
[self insertRowid:rowid collectionKey:ck inNewGroup:group];
|
|
556
595
|
else
|
|
@@ -566,8 +605,6 @@
|
|
|
566
605
|
// The row was previously in the view (allowed by previous filter),
|
|
567
606
|
// but is no longer in the view (disallowed by new filter).
|
|
568
607
|
|
|
569
|
-
YapCollectionKey *ck = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
570
|
-
|
|
571
608
|
[self removeRowid:rowid collectionKey:ck atIndex:index inGroup:group];
|
|
572
609
|
existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
|
|
573
610
|
}
|
|
@@ -592,8 +629,7 @@
|
|
|
592
629
|
* This method overrides the version in YapDatabaseViewTransaction.
|
|
593
630
|
**/
|
|
594
631
|
- (void)handleInsertObject:(id)object
|
|
595
|
-
|
|
596
|
-
inCollection:(NSString *)collection
|
|
632
|
+
forCollectionKey:(YapCollectionKey *)collectionKey
|
|
597
633
|
withMetadata:(id)metadata
|
|
598
634
|
rowid:(int64_t)rowid
|
|
599
635
|
{
|
|
@@ -602,6 +638,9 @@
|
|
|
602
638
|
__unsafe_unretained YapDatabaseFilteredView *filteredView =
|
|
603
639
|
(YapDatabaseFilteredView *)viewConnection->view;
|
|
604
640
|
|
|
641
|
+
__unsafe_unretained NSString *collection = collectionKey.collection;
|
|
642
|
+
__unsafe_unretained NSString *key = collectionKey.key;
|
|
643
|
+
|
|
605
644
|
// Instead of going to the groupingBlock,
|
|
606
645
|
// just ask the parentViewTransaction what the last group was.
|
|
607
646
|
|
|
@@ -656,7 +695,6 @@
|
|
|
656
695
|
{
|
|
657
696
|
// This was an insert operation, so we know the key wasn't already in the view.
|
|
658
697
|
|
|
659
|
-
YapCollectionKey *collectionKey = [[YapCollectionKey alloc] initWithCollection:collection key:key];
|
|
660
698
|
int flags = (YapDatabaseViewChangedObject | YapDatabaseViewChangedMetadata);
|
|
661
699
|
|
|
662
700
|
[self insertRowid:rowid
|
|
@@ -684,8 +722,7 @@
|
|
|
684
722
|
* This method overrides the version in YapDatabaseViewTransaction.
|
|
685
723
|
**/
|
|
686
724
|
- (void)handleUpdateObject:(id)object
|
|
687
|
-
|
|
688
|
-
inCollection:(NSString *)collection
|
|
725
|
+
forCollectionKey:(YapCollectionKey *)collectionKey
|
|
689
726
|
withMetadata:(id)metadata
|
|
690
727
|
rowid:(int64_t)rowid
|
|
691
728
|
{
|
|
@@ -694,7 +731,8 @@
|
|
|
694
731
|
__unsafe_unretained YapDatabaseFilteredView *filteredView =
|
|
695
732
|
(YapDatabaseFilteredView *)viewConnection->view;
|
|
696
733
|
|
|
697
|
-
|
|
734
|
+
__unsafe_unretained NSString *collection = collectionKey.collection;
|
|
735
|
+
__unsafe_unretained NSString *key = collectionKey.key;
|
|
698
736
|
|
|
699
737
|
// Instead of going to the groupingBlock,
|
|
700
738
|
// just ask the parentViewTransaction what the last group was.
|
|
@@ -782,17 +820,156 @@
|
|
|
782
820
|
* This method is invoked by a YapDatabaseReadWriteTransaction as a post-operation-hook.
|
|
783
821
|
* This method overrides the version in YapDatabaseViewTransaction.
|
|
784
822
|
**/
|
|
785
|
-
- (void)
|
|
786
|
-
forKey:(NSString *)key
|
|
787
|
-
inCollection:(NSString *)collection
|
|
788
|
-
withRowid:(int64_t)rowid
|
|
823
|
+
- (void)handleReplaceObject:(id)object forCollectionKey:(YapCollectionKey *)collectionKey withRowid:(int64_t)rowid
|
|
789
824
|
{
|
|
790
825
|
YDBLogAutoTrace();
|
|
791
826
|
|
|
792
827
|
__unsafe_unretained YapDatabaseFilteredView *filteredView =
|
|
793
828
|
(YapDatabaseFilteredView *)viewConnection->view;
|
|
794
829
|
|
|
795
|
-
|
|
830
|
+
__unsafe_unretained NSString *collection = collectionKey.collection;
|
|
831
|
+
__unsafe_unretained NSString *key = collectionKey.key;
|
|
832
|
+
|
|
833
|
+
BOOL groupMayHaveChanged = filteredView->groupingBlockType == YapDatabaseViewBlockTypeWithRow ||
|
|
834
|
+
filteredView->groupingBlockType == YapDatabaseViewBlockTypeWithObject;
|
|
835
|
+
|
|
836
|
+
BOOL sortMayHaveChanged = filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithRow ||
|
|
837
|
+
filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithObject;
|
|
838
|
+
|
|
839
|
+
// Instead of going to the groupingBlock,
|
|
840
|
+
// just ask the parentViewTransaction what the last group was.
|
|
841
|
+
|
|
842
|
+
YapDatabaseViewTransaction *parentViewTransaction =
|
|
843
|
+
[databaseTransaction ext:filteredView->parentViewName];
|
|
844
|
+
|
|
845
|
+
NSString *group = parentViewTransaction->lastHandledGroup;
|
|
846
|
+
|
|
847
|
+
if (group == nil)
|
|
848
|
+
{
|
|
849
|
+
// Not included in parentView.
|
|
850
|
+
|
|
851
|
+
if (groupMayHaveChanged)
|
|
852
|
+
{
|
|
853
|
+
// Remove key from view (if needed).
|
|
854
|
+
// This was an update operation, so the key may have previously been in the view.
|
|
855
|
+
|
|
856
|
+
[self removeRowid:rowid collectionKey:collectionKey];
|
|
857
|
+
}
|
|
858
|
+
else
|
|
859
|
+
{
|
|
860
|
+
// The group hasn't changed.
|
|
861
|
+
// Thus it wasn't previously in view, and still isn't in the view.
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
lastHandledGroup = nil;
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
BOOL filterMayHaveChanged = filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow ||
|
|
869
|
+
filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithObject;
|
|
870
|
+
|
|
871
|
+
if (!groupMayHaveChanged && !sortMayHaveChanged && !filterMayHaveChanged)
|
|
872
|
+
{
|
|
873
|
+
// Nothing has changed that could possibly affect the view.
|
|
874
|
+
// Just note the touch.
|
|
875
|
+
|
|
876
|
+
int flags = YapDatabaseViewChangedObject;
|
|
877
|
+
|
|
878
|
+
NSString *pageKey = [self pageKeyForRowid:rowid];
|
|
879
|
+
NSUInteger existingIndex = [self indexForRowid:rowid inGroup:group withPageKey:pageKey];
|
|
880
|
+
|
|
881
|
+
[viewConnection->changes addObject:
|
|
882
|
+
[YapDatabaseViewRowChange updateKey:collectionKey changes:flags inGroup:group atIndex:existingIndex]];
|
|
883
|
+
|
|
884
|
+
lastHandledGroup = group;
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// Ask filter block if we should add key to view.
|
|
889
|
+
|
|
890
|
+
BOOL passesFilter;
|
|
891
|
+
id metadata = nil;
|
|
892
|
+
|
|
893
|
+
if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithKey)
|
|
894
|
+
{
|
|
895
|
+
YapDatabaseViewFilteringWithKeyBlock filterBlock =
|
|
896
|
+
(YapDatabaseViewFilteringWithKeyBlock)filteredView->filteringBlock;
|
|
897
|
+
|
|
898
|
+
passesFilter = filterBlock(group, collection, key);
|
|
899
|
+
}
|
|
900
|
+
else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithObject)
|
|
901
|
+
{
|
|
902
|
+
YapDatabaseViewFilteringWithObjectBlock filterBlock =
|
|
903
|
+
(YapDatabaseViewFilteringWithObjectBlock)filteredView->filteringBlock;
|
|
904
|
+
|
|
905
|
+
passesFilter = filterBlock(group, collection, key, object);
|
|
906
|
+
}
|
|
907
|
+
else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithMetadata)
|
|
908
|
+
{
|
|
909
|
+
YapDatabaseViewFilteringWithMetadataBlock filterBlock =
|
|
910
|
+
(YapDatabaseViewFilteringWithMetadataBlock)filteredView->filteringBlock;
|
|
911
|
+
|
|
912
|
+
metadata = [databaseTransaction metadataForCollectionKey:collectionKey withRowid:rowid];
|
|
913
|
+
passesFilter = filterBlock(group, collection, key, metadata);
|
|
914
|
+
}
|
|
915
|
+
else // if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow)
|
|
916
|
+
{
|
|
917
|
+
YapDatabaseViewFilteringWithRowBlock filterBlock =
|
|
918
|
+
(YapDatabaseViewFilteringWithRowBlock)filteredView->filteringBlock;
|
|
919
|
+
|
|
920
|
+
metadata = [databaseTransaction metadataForCollectionKey:collectionKey withRowid:rowid];
|
|
921
|
+
passesFilter = filterBlock(group, collection, key, object, metadata);
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
if (passesFilter)
|
|
925
|
+
{
|
|
926
|
+
// Add key to view (or update position).
|
|
927
|
+
// This was an update operation, so the key may have previously been in the view.
|
|
928
|
+
|
|
929
|
+
int flags = (YapDatabaseViewChangedObject | YapDatabaseViewChangedMetadata);
|
|
930
|
+
|
|
931
|
+
BOOL sortingBlockNeedsMetadata = filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithRow ||
|
|
932
|
+
filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithMetadata;
|
|
933
|
+
if (sortingBlockNeedsMetadata && metadata == nil)
|
|
934
|
+
{
|
|
935
|
+
metadata = [databaseTransaction metadataForCollectionKey:collectionKey withRowid:rowid];
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
[self insertRowid:rowid
|
|
939
|
+
collectionKey:collectionKey
|
|
940
|
+
object:object
|
|
941
|
+
metadata:metadata
|
|
942
|
+
inGroup:group
|
|
943
|
+
withChanges:flags
|
|
944
|
+
isNew:NO];
|
|
945
|
+
|
|
946
|
+
lastHandledGroup = group;
|
|
947
|
+
}
|
|
948
|
+
else
|
|
949
|
+
{
|
|
950
|
+
// Filtered from this view.
|
|
951
|
+
// Remove key from view (if needed).
|
|
952
|
+
// This was an update operation, so the key may have previously been in the view.
|
|
953
|
+
|
|
954
|
+
[self removeRowid:rowid collectionKey:collectionKey];
|
|
955
|
+
lastHandledGroup = nil;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* YapDatabase extension hook.
|
|
961
|
+
* This method is invoked by a YapDatabaseReadWriteTransaction as a post-operation-hook.
|
|
962
|
+
* This method overrides the version in YapDatabaseViewTransaction.
|
|
963
|
+
**/
|
|
964
|
+
- (void)handleReplaceMetadata:(id)metadata forCollectionKey:(YapCollectionKey *)collectionKey withRowid:(int64_t)rowid
|
|
965
|
+
{
|
|
966
|
+
YDBLogAutoTrace();
|
|
967
|
+
|
|
968
|
+
__unsafe_unretained YapDatabaseFilteredView *filteredView =
|
|
969
|
+
(YapDatabaseFilteredView *)viewConnection->view;
|
|
970
|
+
|
|
971
|
+
__unsafe_unretained NSString *collection = collectionKey.collection;
|
|
972
|
+
__unsafe_unretained NSString *key = collectionKey.key;
|
|
796
973
|
|
|
797
974
|
BOOL groupMayHaveChanged = filteredView->groupingBlockType == YapDatabaseViewBlockTypeWithRow ||
|
|
798
975
|
filteredView->groupingBlockType == YapDatabaseViewBlockTypeWithMetadata;
|
|
@@ -866,7 +1043,7 @@
|
|
|
866
1043
|
YapDatabaseViewFilteringWithObjectBlock filterBlock =
|
|
867
1044
|
(YapDatabaseViewFilteringWithObjectBlock)filteredView->filteringBlock;
|
|
868
1045
|
|
|
869
|
-
object = [databaseTransaction
|
|
1046
|
+
object = [databaseTransaction objectForCollectionKey:collectionKey withRowid:rowid];
|
|
870
1047
|
passesFilter = filterBlock(group, collection, key, object);
|
|
871
1048
|
}
|
|
872
1049
|
else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithMetadata)
|
|
@@ -881,7 +1058,7 @@
|
|
|
881
1058
|
YapDatabaseViewFilteringWithRowBlock filterBlock =
|
|
882
1059
|
(YapDatabaseViewFilteringWithRowBlock)filteredView->filteringBlock;
|
|
883
1060
|
|
|
884
|
-
object = [databaseTransaction
|
|
1061
|
+
object = [databaseTransaction objectForCollectionKey:collectionKey withRowid:rowid];
|
|
885
1062
|
passesFilter = filterBlock(group, collection, key, object, metadata);
|
|
886
1063
|
}
|
|
887
1064
|
|
|
@@ -892,10 +1069,11 @@
|
|
|
892
1069
|
|
|
893
1070
|
int flags = (YapDatabaseViewChangedObject | YapDatabaseViewChangedMetadata);
|
|
894
1071
|
|
|
895
|
-
BOOL sortingBlockNeedsObject =
|
|
1072
|
+
BOOL sortingBlockNeedsObject = filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithRow ||
|
|
1073
|
+
filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithObject;
|
|
896
1074
|
if (sortingBlockNeedsObject && object == nil)
|
|
897
1075
|
{
|
|
898
|
-
object = [databaseTransaction
|
|
1076
|
+
object = [databaseTransaction objectForCollectionKey:collectionKey withRowid:rowid];
|
|
899
1077
|
}
|
|
900
1078
|
|
|
901
1079
|
[self insertRowid:rowid
|
|
@@ -923,6 +1101,67 @@
|
|
|
923
1101
|
/// All other hook methods are handled by superclass (YapDatabaseViewTransaction).
|
|
924
1102
|
///
|
|
925
1103
|
|
|
1104
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
1105
|
+
#pragma mark YapDatabaseViewDependency Protocol
|
|
1106
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* This method is invoked if our parentView repopulates.
|
|
1110
|
+
* For example:
|
|
1111
|
+
*
|
|
1112
|
+
* - The parentView is a YapDatabaseView, and the groupingBlock and/or sortingBlock was changed.
|
|
1113
|
+
* - The parentView is a YapDatabaseFilteredView, and the filterBlock was changed.
|
|
1114
|
+
* - The parentView of the parentView was changed...
|
|
1115
|
+
*
|
|
1116
|
+
* When this happens, there has likely been a significant change in the content of the parentView,
|
|
1117
|
+
* and a full repopulate is required on our part.
|
|
1118
|
+
**/
|
|
1119
|
+
- (void)viewDidRepopulate:(NSString *)parentViewName
|
|
1120
|
+
{
|
|
1121
|
+
YDBLogAutoTrace();
|
|
1122
|
+
|
|
1123
|
+
if (!databaseTransaction->isReadWriteTransaction)
|
|
1124
|
+
{
|
|
1125
|
+
YDBLogWarn(@"%@ - Method only allowed in readWrite transaction", THIS_METHOD);
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
__unsafe_unretained YapDatabaseFilteredView *filteredView =
|
|
1130
|
+
(YapDatabaseFilteredView *)viewConnection->view;
|
|
1131
|
+
|
|
1132
|
+
if (![parentViewName isEqualToString:filteredView->parentViewName])
|
|
1133
|
+
{
|
|
1134
|
+
YDBLogWarn(@"%@ - Method inappropriately invoked. Doesn't match parentViewName.", THIS_METHOD);
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
// The parentView has significantly changed.
|
|
1139
|
+
// We need to repopulate.
|
|
1140
|
+
|
|
1141
|
+
[self repopulateView];
|
|
1142
|
+
|
|
1143
|
+
// Propogate the notification onward to any extensions dependent upon this one.
|
|
1144
|
+
|
|
1145
|
+
__unsafe_unretained NSString *registeredName = [self registeredName];
|
|
1146
|
+
__unsafe_unretained NSDictionary *extensionDependencies = databaseTransaction->connection->extensionDependencies;
|
|
1147
|
+
|
|
1148
|
+
[extensionDependencies enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop){
|
|
1149
|
+
|
|
1150
|
+
__unsafe_unretained NSString *extName = (NSString *)key;
|
|
1151
|
+
__unsafe_unretained NSSet *extDependencies = (NSSet *)obj;
|
|
1152
|
+
|
|
1153
|
+
if ([extDependencies containsObject:registeredName])
|
|
1154
|
+
{
|
|
1155
|
+
YapDatabaseExtensionTransaction *extTransaction = [databaseTransaction ext:extName];
|
|
1156
|
+
|
|
1157
|
+
if ([extTransaction respondsToSelector:@selector(viewDidRepopulate:)])
|
|
1158
|
+
{
|
|
1159
|
+
[(id <YapDatabaseViewDependency>)extTransaction viewDidRepopulate:registeredName];
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}];
|
|
1163
|
+
}
|
|
1164
|
+
|
|
926
1165
|
@end
|
|
927
1166
|
|
|
928
1167
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -933,11 +1172,19 @@
|
|
|
933
1172
|
|
|
934
1173
|
- (void)setFilteringBlock:(YapDatabaseViewFilteringBlock)inFilteringBlock
|
|
935
1174
|
filteringBlockType:(YapDatabaseViewBlockType)inFilteringBlockType
|
|
936
|
-
|
|
1175
|
+
versionTag:(NSString *)inVersionTag
|
|
937
1176
|
|
|
938
1177
|
{
|
|
939
1178
|
YDBLogAutoTrace();
|
|
940
1179
|
|
|
1180
|
+
NSAssert(inFilteringBlock != NULL, @"Invalid filteringBlock");
|
|
1181
|
+
|
|
1182
|
+
NSAssert(inFilteringBlockType == YapDatabaseViewBlockTypeWithKey ||
|
|
1183
|
+
inFilteringBlockType == YapDatabaseViewBlockTypeWithObject ||
|
|
1184
|
+
inFilteringBlockType == YapDatabaseViewBlockTypeWithMetadata ||
|
|
1185
|
+
inFilteringBlockType == YapDatabaseViewBlockTypeWithRow,
|
|
1186
|
+
@"Invalid filteringBlockType");
|
|
1187
|
+
|
|
941
1188
|
if (!databaseTransaction->isReadWriteTransaction)
|
|
942
1189
|
{
|
|
943
1190
|
YDBLogWarn(@"%@ - Method only allowed in readWrite transaction", THIS_METHOD);
|
|
@@ -947,20 +1194,42 @@
|
|
|
947
1194
|
__unsafe_unretained YapDatabaseFilteredView *filteredView =
|
|
948
1195
|
(YapDatabaseFilteredView *)viewConnection->view;
|
|
949
1196
|
|
|
950
|
-
NSString *
|
|
1197
|
+
NSString *newVersionTag = inVersionTag ? [inVersionTag copy] : @"";
|
|
951
1198
|
|
|
952
|
-
if ([filteredView->
|
|
1199
|
+
if ([filteredView->versionTag isEqualToString:newVersionTag])
|
|
953
1200
|
{
|
|
954
|
-
YDBLogWarn(@"%@ -
|
|
1201
|
+
YDBLogWarn(@"%@ - versionTag didn't change, so not updating view", THIS_METHOD);
|
|
955
1202
|
return;
|
|
956
1203
|
}
|
|
957
1204
|
|
|
958
1205
|
filteredView->filteringBlock = inFilteringBlock;
|
|
959
1206
|
filteredView->filteringBlockType = inFilteringBlockType;
|
|
960
1207
|
|
|
961
|
-
filteredView->
|
|
1208
|
+
filteredView->versionTag = newVersionTag;
|
|
1209
|
+
|
|
1210
|
+
[self repopulateView];
|
|
1211
|
+
[self setStringValue:newVersionTag forExtensionKey:ExtKey_versionTag];
|
|
1212
|
+
|
|
1213
|
+
// Notify any extensions dependent upon this one that we repopulated.
|
|
962
1214
|
|
|
963
|
-
[self
|
|
1215
|
+
NSString *registeredName = [self registeredName];
|
|
1216
|
+
NSDictionary *extensionDependencies = databaseTransaction->connection->extensionDependencies;
|
|
1217
|
+
|
|
1218
|
+
[extensionDependencies enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop){
|
|
1219
|
+
|
|
1220
|
+
__unsafe_unretained NSString *extName = (NSString *)key;
|
|
1221
|
+
__unsafe_unretained NSSet *extDependencies = (NSSet *)obj;
|
|
1222
|
+
|
|
1223
|
+
if ([extDependencies containsObject:registeredName])
|
|
1224
|
+
{
|
|
1225
|
+
YapDatabaseExtensionTransaction *extTransaction = [databaseTransaction ext:extName];
|
|
1226
|
+
|
|
1227
|
+
if ([extTransaction respondsToSelector:@selector(viewDidRepopulate:)])
|
|
1228
|
+
{
|
|
1229
|
+
[(id <YapDatabaseViewDependency>)extTransaction viewDidRepopulate:registeredName];
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}];
|
|
964
1233
|
}
|
|
965
1234
|
|
|
966
1235
|
@end
|