Ignite Tools
Shared/Airship/Library/StoreFrontLib/UAInventory.h
00001 /*
00002  Copyright 2009-2011 Urban Airship Inc. All rights reserved.
00003 
00004  Redistribution and use in source and binary forms, with or without
00005  modification, are permitted provided that the following conditions are met:
00006 
00007  1. Redistributions of source code must retain the above copyright notice, this
00008  list of conditions and the following disclaimer.
00009 
00010  2. Redistributions in binaryform must reproduce the above copyright notice,
00011  this list of conditions and the following disclaimer in the documentation
00012  and/or other materials provided withthe distribution.
00013 
00014  THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC ``AS IS'' AND ANY EXPRESS OR
00015  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00016  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00017  EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00018  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00019  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00020  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00021  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00022  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00023  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00024  */
00025 
00026 #import <StoreKit/StoreKit.h>
00027 #import "UA_Reachability.h"
00028 
00029 #import "UAStoreFront.h"
00030 #import "UAObservable.h"
00031 
00032 @class UA_ASIHTTPRequest;
00033 @class UAProduct;
00034 
00035 @interface UAInventory : UAObservable<SKProductsRequestDelegate> {
00036 
00037     NSMutableDictionary *products;
00038     NSMutableArray *keys;
00039     NSMutableArray *sortedProducts;
00040     NSMutableArray *updatedProducts;
00041     NSMutableArray *installedProducts;
00042 
00043     UA_Reachability *hostReach;
00044     UAInventoryStatus status;
00045     NSUInteger reloadCount;
00046 
00047     NSString *orderBy;
00048     BOOL orderAscending;
00049 
00050     NSString *purchasingProductIdentifier;
00051 }
00052 
00053 @property (nonatomic, assign) UAInventoryStatus status;
00054 @property (nonatomic, retain) NSString *orderBy;
00055 @property (nonatomic, retain) NSString *purchasingProductIdentifier;
00056 
00057 - (void)loadInventory;
00058 - (void)groupInventory;
00059 - (void)resetReloadCount;
00060 - (void)reloadInventory;
00061 
00062 
00063 - (NSArray *)productsForType:(ProductType)type;
00064 - (UAProduct*)productWithIdentifier:(NSString*)productId;
00065 - (BOOL)hasProductWithIdentifier:(NSString*)productId;
00066 - (UAProduct*)productAtIndex:(int)index;
00067 
00068 
00069 - (void)setOrderBy:(NSString *)key ascending:(BOOL)ascending;
00070 - (void)sortInventory;
00071 
00072 - (void)purchase:(NSString *)productIdentifier;
00073 - (void)updateAll;
00074 
00075 + (NSString*)localizedPrice:(SKProduct*)product;
00076 
00077 @end
 All Classes Functions Variables Properties