Ignite Tools
Shared/Airship/Library/SubscriptionLib/UASubscriptionInventory.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 <Foundation/Foundation.h>
00027 
00028 #import "UAObservable.h"
00029 
00030 @class UAProductInventory;
00031 @class UAContentInventory;
00032 @class UASubscriptionProduct;
00033 @class UASubscriptionContent;
00034 @class UASubscription;
00035 @class UASubscriptionDownloadManager;
00036 
00037 @class SKPaymentTransaction;
00038 
00039 
00044 @interface UASubscriptionInventory : UAObservable {
00045   @private
00046     NSMutableArray *subscriptions;
00047     NSMutableArray *userSubscriptions;
00048     NSMutableDictionary *subscriptionDict;
00049     NSArray *userPurchasingInfo;
00050 
00051     UAProductInventory *products;
00052     UAContentInventory *contents;
00053 
00054     BOOL userPurchasingInfoLoaded;
00055     BOOL productsLoaded;
00056     BOOL contentsLoaded;
00057     BOOL hasLoaded;
00058 
00059     BOOL hasActiveSubscriptions;
00060     NSDate *serverDate;
00061 }
00062 
00066 
00068 @property (nonatomic, assign, readonly) BOOL hasLoaded;
00069 
00071 @property (nonatomic, retain, readonly) NSMutableArray *userSubscriptions;
00072 
00074 @property (nonatomic, retain, readonly) NSMutableArray *subscriptions;
00075 
00080 @property (nonatomic, retain) NSDate *serverDate;
00081 
00085 
00087 - (void)loadInventory;
00088 
00090 - (void)loadProducts;
00091 
00093 - (void)loadPurchases;
00094 
00098 
00104 - (void)purchase:(UASubscriptionProduct *)product;
00105 
00111 - (void)download:(UASubscriptionContent *)content;
00112 
00116 
00117 - (UASubscriptionContent *)contentForKey:(NSString *)contentKey;
00118 - (UASubscription *)subscriptionForKey:(NSString *)subscriptionKey;
00119 - (UASubscription *)subscriptionForProduct:(UASubscriptionProduct *)product;
00120 - (UASubscription *)subscriptionForContent:(UASubscriptionContent *)content;
00121 - (BOOL)containsProduct:(NSString *)productID;
00122 - (UASubscriptionProduct *)productForKey:(NSString *)productKey;
00123 
00124 //Private
00125 - (void)subscriptionTransctionDidComplete:(SKPaymentTransaction *)transaction;
00126 
00127 - (void)productInventoryUpdated;
00128 - (void)contentInventoryUpdated;
00129 
00130 - (void)setUserPurchaseInfo:(NSDictionary *)purchaseInfo;
00131 
00132 @end
 All Classes Functions Variables Properties