KMDDeDupeDictionaries is an iOS Library to track if dictionaries are duplicated within a given timeout period. This can be useful for example in discarding duplicate remote notifications by examining the dictionaries sent from the server.
This libary supports overriding the default storage type (PList) with custom storage such as SQLLite or NSUserDefaults. Simply conform to KMDDDStorageType and set StorageType to be custom on the manager.
Note: This library is an initial version, as such has not been extensively tested yet (nor does it include tests as yet). Library is very much subject to change.
-
Pod install.
-
Setup a manager. A manager requires a storage type (default will use PLists), a unique identifier (in case you wish to have more than one tracker) and a timeout after which old entries will be pruned
[[KMDDDManager sharedDictionaryManager] setStoreType:KMDDDStoreTypeDefault identifier:@"NotificationManager" timeout:60*60*24];
-
Check a dictionary is a duplicate
[[KMDDDManager sharedDictionaryManager] checkDictionaryisDuplicate:userInfo];
OR use convenience method added to NSDictionary
[userInfo isDuplicated]
-
Track a dictionary
[[KMDDDManager sharedDictionaryManager] manageDictionary:userInfo];
OR use convenience method added to NSDictionary
[userInfo trackDuplicate]
No dependancies, though please note this library uses CommonCrypto to generate MD5 hashes and may need to be considered as part of US Export Licence law.
KMDDeDupeDictionaries is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "KMDDeDupeDictionaries"
Ian Outterside, ian@komododigital.co.uk
KMDDeDupeDictionaries is available under the MIT license. See the LICENSE file for more info.