![]() |
Ignite Tools
|
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 00027 #import <Foundation/Foundation.h> 00028 #import <StoreKit/StoreKit.h> 00029 00030 #import "UAAsycImageView.h" 00031 #import "UAObservable.h" 00032 #import "UA_ASIProgressDelegate.h" 00033 00034 typedef enum UAProductStatus { 00035 UAProductStatusUnpurchased = 0, 00036 UAProductStatusWaiting, // transient state 00037 UAProductStatusPurchased, 00038 UAProductStatusDownloading, // transient state 00039 //UAProductStatusDecompressing, // transient state 00040 UAProductStatusInstalled, 00041 UAProductStatusHasUpdate 00042 } UAProductStatus; 00043 00044 00045 @interface UAProduct : UAObservable <NSCopying, UA_ASIProgressDelegate> { 00046 NSString *productIdentifier; 00047 NSURL *previewURL; 00048 UAAsyncImageView *preview; 00049 NSURL *iconURL; 00050 UAAsyncImageView *icon; 00051 NSURL *downloadURL; 00052 int revision; 00053 double fileSize; 00054 NSString *price; 00055 NSDecimalNumber *priceNumber; 00056 NSString *productDescription; 00057 NSString *title; 00058 NSString *receipt; 00059 SKProduct *skProduct; 00060 BOOL isFree; 00061 00062 UAProductStatus status; 00063 00064 // for downloading status 00065 float progress; 00066 SKPaymentTransaction *transaction; 00067 } 00068 00069 @property (nonatomic, retain) SKProduct *skProduct; 00070 @property (nonatomic, retain) NSString *productIdentifier; 00071 @property (nonatomic, retain) NSURL *previewURL; 00072 @property (nonatomic, retain) UAAsyncImageView *preview; 00073 @property (nonatomic, retain) NSURL *iconURL; 00074 @property (nonatomic, retain) UAAsyncImageView *icon; 00075 @property (nonatomic, retain) NSURL *downloadURL; 00076 @property (nonatomic, assign) int revision; 00077 @property (nonatomic, assign) double fileSize; 00078 @property (nonatomic, retain) NSString* price; 00079 @property (nonatomic, retain) NSDecimalNumber* priceNumber; 00080 @property (nonatomic, retain) NSString* productDescription; 00081 @property (nonatomic, retain) NSString* title; 00082 @property (nonatomic, copy) NSString* receipt; 00083 @property (nonatomic, assign) BOOL isFree; 00084 @property (nonatomic, assign) UAProductStatus status; 00085 @property (nonatomic, assign) float progress; 00086 00087 @property (nonatomic, assign) SKPaymentTransaction *transaction; 00088 00089 - (id)init; 00090 + (UAProduct *)productFromDictionary:(NSDictionary *)item; 00091 - (NSComparisonResult)compare:(UAProduct*)product; 00092 - (void)resetStatus; 00093 - (BOOL)hasUpdate; 00094 00095 - (void)setProgress:(float)_progress; 00096 00097 @end 00098 00099