| 1 | /* |
| 2 | Copyright 2017-2017 Michalis Kamburelis. |
| 3 | |
| 4 | This file is part of "Castle Game Engine". |
| 5 | |
| 6 | "Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 | included in the "Castle Game Engine" distribution, |
| 8 | for details about the copyright. |
| 9 | |
| 10 | "Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | |
| 14 | ---------------------------------------------------------------------------- |
| 15 | */ |
| 16 | |
| 17 | #import <StoreKit/StoreKit.h> |
| 18 | |
| 19 | /* Information about the product available for purchase. |
| 20 | Used by in-app purchases and (TODO) analytics services. |
| 21 | */ |
| 22 | @interface AvailableProduct : NSObject |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | /* Unique product identifier. */ |
| 27 | @property (nonatomic, retain) NSString* id; |
| 28 | |
| 29 | /* Product category. Used (TODO) only by analytics for now. */ |
| 30 | @property (nonatomic, retain) NSString* category; |
| 31 | |
| 32 | /* Title (from the AppStore, localized). nil if not known yet. */ |
| 33 | @property (nonatomic, retain) NSString* title; |
| 34 | |
| 35 | /* Description (from the AppStore, localized). nil if not known yet. |
| 36 | Called productDescription, not description, since NSObject |
| 37 | already includes "description". */ |
| 38 | @property (nonatomic, retain) NSString* productDescription; |
| 39 | |
| 40 | /* Price (from the AppStore, localized). nil if not known yet. */ |
| 41 | @property (nonatomic, retain) NSString* price; |
| 42 | |
| 43 | /* Complete SKProduct (from the AppStore) describing this. nil if not known yet. */ |
| 44 | @property (nonatomic, retain) SKProduct* skProduct; |
| 45 | |
| 46 | /* Price currency, to be passed to analytics. |
| 47 | This is taken from NSNumberFormatter.currencyCode: |
| 48 | https://developer.apple.com/documentation/foundation/nsnumberformatter/1410463-currencycode?language=objc |
| 49 | It is usually a 3-letter code. |
| 50 | nil if not known yet. |
| 51 | */ |
| 52 | @property (nonatomic, retain) NSString* priceCurrencyCode; |
| 53 | |
| 54 | /* Price amount in micros, to be passed to analytics. |
| 55 | |
| 56 | This is expressed as a string, as it seems the Objective-C doesn't have |
| 57 | a "long" type to hold this information precisely? |
| 58 | At least, for some reason, they use NSDecimalNumber and NSDecimalString |
| 59 | in their in-app-purchases API. |
| 60 | It seems they have 8-byte integer (like Pascal Int64) but only on 64-bit runtime? |
| 61 | https://useyourloaf.com/blog/format-string-issue-using-nsinteger/ |
| 62 | */ |
| 63 | @property (nonatomic, retain) NSString* priceAmountMicros; |
| 64 | |
| 65 | /* Price amount in cents (100 cents is one unit), to be passed to analytics. |
| 66 | 0 if not known yet. |
| 67 | */ |
| 68 | @property (nonatomic) NSInteger priceAmountCents; |
| 69 | |
| 70 | @end |