mirror of
https://github.com/purplecabbage/phonegap-plugins.git
synced 2026-04-24 03:00:11 -04:00
Fixes #20 - Also removed deprecated PhoneGapCommand, using PGPlugin (new in 0.9.6)
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
#import <StoreKit/StoreKit.h>
|
||||
|
||||
#ifdef PHONEGAP_FRAMEWORK
|
||||
#import <PhoneGap/PhoneGapCommand.h>
|
||||
#import <PhoneGap/PGPlugin.h>
|
||||
#else
|
||||
#import "PhoneGapCommand.h"
|
||||
#import "PGPlugin.h"
|
||||
#endif
|
||||
|
||||
#ifdef PHONEGAP_FRAMEWORK
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#import "SKProduct+LocalizedPrice.h"
|
||||
|
||||
@interface InAppPurchaseManager : PhoneGapCommand <SKPaymentTransactionObserver> {
|
||||
@interface InAppPurchaseManager : PGPlugin <SKPaymentTransactionObserver> {
|
||||
|
||||
}
|
||||
- (void) setup:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
|
||||
|
||||
8
iPhone/InAppPurchaseManager/SKProduct+LocalizedPrice.h
Normal file
8
iPhone/InAppPurchaseManager/SKProduct+LocalizedPrice.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <StoreKit/StoreKit.h>
|
||||
|
||||
@interface SKProduct (LocalizedPrice)
|
||||
|
||||
@property (nonatomic, readonly) NSString *localizedPrice;
|
||||
|
||||
@end
|
||||
16
iPhone/InAppPurchaseManager/SKProduct+LocalizedPrice.m
Normal file
16
iPhone/InAppPurchaseManager/SKProduct+LocalizedPrice.m
Normal file
@@ -0,0 +1,16 @@
|
||||
#import "SKProduct+LocalizedPrice.h"
|
||||
|
||||
@implementation SKProduct (LocalizedPrice)
|
||||
|
||||
- (NSString *)localizedPrice
|
||||
{
|
||||
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
|
||||
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
|
||||
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
|
||||
[numberFormatter setLocale:self.priceLocale];
|
||||
NSString *formattedString = [numberFormatter stringFromNumber:self.price];
|
||||
[numberFormatter release];
|
||||
return formattedString;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user