Skip to content

Instantly share code, notes, and snippets.

@jjthrash
Created February 17, 2010 15:39
Show Gist options
  • Save jjthrash/306722 to your computer and use it in GitHub Desktop.
Save jjthrash/306722 to your computer and use it in GitHub Desktop.
diff --git a/Airship/StoreFront/UAInventory.m b/Airship/StoreFront/UAInventory.m
index 92563d0..9088f85 100644
--- a/Airship/StoreFront/UAInventory.m
+++ b/Airship/StoreFront/UAInventory.m
@@ -55,9 +55,13 @@
return productList;
}
+- (NSArray*)sortedKeys {
+ return [[productList allKeys] sortedArrayUsingSelector:@selector(compare:)];
+}
+
- (void)removeProduct:(NSString*)productId {
[productList removeObjectForKey: productId];
- [keys setArray: [productList allKeys]];
+ [keys setArray: self.sortedKeys];
}
- (UAProduct*)productWithIdentifier:(NSString*)productId {
@@ -66,7 +70,7 @@
- (void)addProduct:(UAProduct*)product {
[productList setObject: product forKey: product.productIdentifier];
- [keys setArray: [productList allKeys]];
+ [keys setArray: self.sortedKeys];
}
- (int)count {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment