summaryrefslogtreecommitdiff
path: root/platform/iphone
diff options
context:
space:
mode:
Diffstat (limited to 'platform/iphone')
-rw-r--r--platform/iphone/app_delegate.mm30
-rw-r--r--platform/iphone/detect.py6
-rw-r--r--platform/iphone/game_center.mm46
-rwxr-xr-xplatform/iphone/gl_view.mm54
-rw-r--r--platform/iphone/icloud.mm84
-rw-r--r--platform/iphone/in_app_store.mm28
6 files changed, 124 insertions, 124 deletions
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index a3af8ff163..dab75e08c8 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -100,7 +100,7 @@ static int frame_count = 0;
int backingHeight;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
+
OS::VideoMode vm;
vm.fullscreen = true;
@@ -118,7 +118,7 @@ static int frame_count = 0;
NSString *documentsDirectory = [paths objectAtIndex:0];
//NSString *documentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
OSIPhone::get_singleton()->set_data_dir(String::utf8([documentsDirectory UTF8String]));
-
+
NSString *locale_code = [[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2];
OSIPhone::get_singleton()->set_locale(String::utf8([locale_code UTF8String]));
@@ -218,7 +218,7 @@ static int frame_count = 0;
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
// disable idle timer
//application.idleTimerDisabled = YES;
-
+
//Create a full-screen window
window = [[UIWindow alloc] initWithFrame:rect];
//window.autoresizesSubviews = YES;
@@ -236,9 +236,9 @@ static int frame_count = 0;
int backingHeight;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
+
iphone_main(backingWidth, backingHeight, gargc, gargv);
-
+
view_controller = [[ViewController alloc] init];
view_controller.view = glView;
window.rootViewController = view_controller;
@@ -248,7 +248,7 @@ static int frame_count = 0;
printf("cadisaplylink: %d", glView.useCADisplayLink);
glView.animationInterval = 1.0 / kRenderingFrequency;
[glView startAnimation];
-
+
//Show the window
[window makeKeyAndVisible];
@@ -261,9 +261,9 @@ static int frame_count = 0;
//OSIPhone::screen_width = rect.size.width - rect.origin.x;
//OSIPhone::screen_height = rect.size.height - rect.origin.y;
-
+
mainViewController = view_controller;
-
+
#ifdef MODULE_GAME_ANALYTICS_ENABLED
printf("********************* didFinishLaunchingWithOptions\n");
if(!Globals::get_singleton()->has("mobileapptracker/advertiser_id"))
@@ -274,24 +274,24 @@ static int frame_count = 0;
{
return;
}
-
+
String adid = GLOBAL_DEF("mobileapptracker/advertiser_id","");
String convkey = GLOBAL_DEF("mobileapptracker/conversion_key","");
-
+
NSString * advertiser_id = [NSString stringWithUTF8String:adid.utf8().get_data()];
NSString * conversion_key = [NSString stringWithUTF8String:convkey.utf8().get_data()];
-
+
// Account Configuration info - must be set
[MobileAppTracker initializeWithMATAdvertiserId:advertiser_id
MATConversionKey:conversion_key];
-
+
// Used to pass us the IFA, enables highly accurate 1-to-1 attribution.
// Required for many advertising networks.
[MobileAppTracker setAppleAdvertisingIdentifier:[[ASIdentifierManager sharedManager] advertisingIdentifier]
advertisingTrackingEnabled:[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]];
-
+
#endif
-
+
};
- (void)applicationWillTerminate:(UIApplication*)application {
@@ -389,7 +389,7 @@ static int frame_count = 0;
[PFPush handlePush:userInfo];
NSDictionary *aps = [userInfo objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
+
NSLog(@"Push Notification Payload (app active) %@", aps);
[defaults setObject:aps forKey:@"notificationInfo"];
[defaults synchronize];
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 9472f05e16..c3ee098350 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -108,7 +108,7 @@ def configure(env):
if env['store_kit'] == 'yes':
env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'StoreKit'])
-
+
if env['icloud'] == 'yes':
env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
@@ -117,7 +117,7 @@ def configure(env):
if (env["target"]=="release"):
env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math
- env.Append(LINKFLAGS=['-O3']) #
+ env.Append(LINKFLAGS=['-O3']) #
elif env["target"] == "release_debug":
env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED'])
@@ -151,7 +151,7 @@ def configure(env):
env.Append(CPPFLAGS=['-fno-exceptions'])
#env['neon_enabled']=True
env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
-
+
import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index 3756b58699..a5b90514da 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -94,10 +94,10 @@ Error GameCenter::connect() {
ret["error_description"] = [error.localizedDescription UTF8String];
GameCenter::get_singleton()->connected = false;
};
-
+
pending_events.push_back(ret);
};
-
+
});
return OK;
@@ -156,7 +156,7 @@ Error GameCenter::award_achievement(Variant p_params) {
if (params.has("show_completion_banner")) {
achievement.showsCompletionBanner = params["show_completion_banner"] ? YES : NO;
}
-
+
[GKAchievement reportAchievements:@[achievement] withCompletionHandler:^(NSError *error) {
Dictionary ret;
@@ -189,30 +189,30 @@ void GameCenter::request_achievement_descriptions() {
IntArray maximum_points;
Array hidden;
Array replayable;
-
+
for (int i=0; i<[descriptions count]; i++) {
GKAchievementDescription* description = [descriptions objectAtIndex:i];
-
+
const char* str = [description.identifier UTF8String];
names.push_back(String::utf8(str != NULL ? str : ""));
-
+
str = [description.title UTF8String];
titles.push_back(String::utf8(str != NULL ? str : ""));
-
+
str = [description.unachievedDescription UTF8String];
unachieved_descriptions.push_back(String::utf8(str != NULL ? str : ""));
-
+
str = [description.achievedDescription UTF8String];
achieved_descriptions.push_back(String::utf8(str != NULL ? str : ""));
-
+
maximum_points.push_back(description.maximumPoints);
-
+
hidden.push_back(description.hidden == YES);
-
+
replayable.push_back(description.replayable == YES);
}
-
+
ret["names"] = names;
ret["titles"] = titles;
ret["unachieved_descriptions"] = unachieved_descriptions;
@@ -220,7 +220,7 @@ void GameCenter::request_achievement_descriptions() {
ret["maximum_points"] = maximum_points;
ret["hidden"] = hidden;
ret["replayable"] = replayable;
-
+
} else {
ret["result"] = "error";
ret["error_code"] = error.code;
@@ -241,19 +241,19 @@ void GameCenter::request_achievements() {
ret["result"] = "ok";
StringArray names;
RealArray percentages;
-
+
for (int i=0; i<[achievements count]; i++) {
GKAchievement* achievement = [achievements objectAtIndex:i];
const char* str = [achievement.identifier UTF8String];
names.push_back(String::utf8(str != NULL ? str : ""));
-
+
percentages.push_back(achievement.percentComplete);
}
-
+
ret["names"] = names;
ret["progress"] = percentages;
-
+
} else {
ret["result"] = "error";
ret["error_code"] = error.code;
@@ -275,7 +275,7 @@ void GameCenter::reset_achievements() {
ret["result"] = "error";
ret["error_code"] = error.code;
};
-
+
pending_events.push_back(ret);
}];
};
@@ -311,7 +311,7 @@ Error GameCenter::show_game_center(Variant p_params) {
ViewController *root_controller=(ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
ERR_FAIL_COND_V(!root_controller, FAILED);
-
+
controller.gameCenterDelegate = root_controller;
controller.viewState = view_state;
if (view_state == GKGameCenterViewControllerStateLeaderboards) {
@@ -322,14 +322,14 @@ Error GameCenter::show_game_center(Variant p_params) {
controller.leaderboardIdentifier = name_str;
}
}
-
+
[root_controller presentViewController: controller animated: YES completion:nil];
-
- return OK;
+
+ return OK;
};
void GameCenter::game_center_closed() {
-
+
Dictionary ret;
ret["type"] = "show_game_center";
ret["result"] = "ok";
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index 94fbb9e174..607352ab0b 100755
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -107,7 +107,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
{
NSString* language = [[track locale] localeIdentifier];
NSLog(@"subtitle lang: %@", language);
-
+
if ([language isEqualToString:[NSString stringWithUTF8String:p_audio_track.utf8()]])
{
AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters];
@@ -132,7 +132,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
{
NSString* language = [[track locale] localeIdentifier];
NSLog(@"subtitle lang: %@", language);
-
+
if ([language isEqualToString:[NSString stringWithUTF8String:p_subtitle_track.utf8()]])
{
[_instance.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup: subtitlesGroup];
@@ -147,7 +147,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
bool _is_video_playing() {
if (_instance.avPlayer.error) {
- printf("Error during playback\n");
+ printf("Error during playback\n");
}
return (_instance.avPlayer.rate > 0 && !_instance.avPlayer.error);
}
@@ -257,7 +257,7 @@ static void clear_touches() {
if((self = [super initWithCoder:coder]))
{
self = [self initGLES];
- }
+ }
return self;
}
@@ -265,14 +265,14 @@ static void clear_touches() {
{
// Get our backing layer
CAEAGLLayer *eaglLayer = (CAEAGLLayer*) self.layer;
-
+
// Configure it so that it is opaque, does not retain the contents of the backbuffer when displayed, and uses RGBA8888 color.
eaglLayer.opaque = YES;
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
nil];
-
+
// Create our EAGLContext, and if successful make it current and create our framebuffer.
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
@@ -281,7 +281,7 @@ static void clear_touches() {
[self release];
return nil;
}
-
+
// Default the animation interval to 1/60th of a second.
animationInterval = 1.0 / 60.0;
return self;
@@ -327,17 +327,17 @@ static void clear_touches() {
glGenFramebuffersOES(1, &viewFramebuffer);
glGenRenderbuffersOES(1, &viewRenderbuffer);
-
+
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
// This call associates the storage for the current render buffer with the EAGLDrawable (our CAEAGLLayer)
// allowing us to draw into a buffer that will later be rendered to screen whereever the layer is (which corresponds with our view).
[context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>)self.layer];
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);
-
+
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
+
// For this sample, we also need a depth buffer, so we'll create and attach one via another renderbuffer.
glGenRenderbuffersOES(1, &depthRenderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
@@ -371,7 +371,7 @@ static void clear_touches() {
viewFramebuffer = 0;
glDeleteRenderbuffersOES(1, &viewRenderbuffer);
viewRenderbuffer = 0;
-
+
if(depthRenderbuffer)
{
glDeleteRenderbuffersOES(1, &depthRenderbuffer);
@@ -461,21 +461,21 @@ static void clear_touches() {
// Make sure that you are drawing to the current context
[EAGLContext setCurrentContext:context];
-
+
// If our drawing delegate needs to have the view setup, then call -setupView: and flag that it won't need to be called again.
if(!delegateSetup)
{
[delegate setupView:self];
delegateSetup = YES;
}
-
+
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
[delegate drawView:self];
-
+
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
-
+
#ifdef DEBUG_ENABLED
GLenum err = glGetError();
if(err)
@@ -487,9 +487,9 @@ static void clear_touches() {
{
NSArray* tlist = [[event allTouches] allObjects];
for (unsigned int i=0; i< [tlist count]; i++) {
-
+
if ( [touches containsObject:[tlist objectAtIndex:i]] ) {
-
+
UITouch* touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseBegan)
continue;
@@ -506,9 +506,9 @@ static void clear_touches() {
NSArray* tlist = [[event allTouches] allObjects];
for (unsigned int i=0; i< [tlist count]; i++) {
-
+
if ( [touches containsObject:[tlist objectAtIndex:i]] ) {
-
+
UITouch* touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseMoved)
continue;
@@ -527,9 +527,9 @@ static void clear_touches() {
{
NSArray* tlist = [[event allTouches] allObjects];
for (unsigned int i=0; i< [tlist count]; i++) {
-
+
if ( [touches containsObject:[tlist objectAtIndex:i]] ) {
-
+
UITouch* touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseEnded)
continue;
@@ -543,7 +543,7 @@ static void clear_touches() {
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
-
+
OSIPhone::get_singleton()->touches_cancelled();
clear_touches();
};
@@ -652,12 +652,12 @@ static void clear_touches() {
- (void)dealloc
{
[self stopAnimation];
-
+
if([EAGLContext currentContext] == context)
{
[EAGLContext setCurrentContext:nil];
}
-
+
[context release];
context = nil;
@@ -673,8 +673,8 @@ static void clear_touches() {
video_found_error = true;
}
- if(_instance.avPlayer.status == AVPlayerStatusReadyToPlay &&
- _instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay &&
+ if(_instance.avPlayer.status == AVPlayerStatusReadyToPlay &&
+ _instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay &&
CMTIME_COMPARE_INLINE(video_current_time, ==, kCMTimeZero)) {
//NSLog(@"time: %@", video_current_time);
@@ -703,7 +703,7 @@ static void clear_touches() {
/*
- (void)moviePlayBackDidFinish:(NSNotification*)notification {
-
+
NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
switch ([reason intValue]) {
diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm
index 449670667f..0b3efe41fc 100644
--- a/platform/iphone/icloud.mm
+++ b/platform/iphone/icloud.mm
@@ -49,7 +49,7 @@ void ICloud::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_key_value"),&ICloud::get_key_value);
ObjectTypeDB::bind_method(_MD("synchronize_key_values"),&ICloud::synchronize_key_values);
ObjectTypeDB::bind_method(_MD("get_all_key_values"),&ICloud::get_all_key_values);
-
+
ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&ICloud::get_pending_event_count);
ObjectTypeDB::bind_method(_MD("pop_pending_event"),&ICloud::pop_pending_event);
};
@@ -83,7 +83,7 @@ Variant nsobject_to_variant(NSObject* object) {
if ([data length] > 0) {
ret.resize([data length]);
{
- ByteArray::Write w = ret.write();
+ ByteArray::Write w = ret.write();
copymem(w.ptr(), [data bytes], [data length]);
}
}
@@ -101,14 +101,14 @@ Variant nsobject_to_variant(NSObject* object) {
else if ([object isKindOfClass:[NSDictionary class]]) {
Dictionary result;
NSDictionary* dic = (NSDictionary*)object;
-
-
+
+
NSArray* keys = [dic allKeys];
int count = [keys count];
for (int i=0; i < count; ++i) {
NSObject* k = [ keys objectAtIndex:i];
NSObject* v = [dic objectForKey:k];
-
+
result[nsobject_to_variant(k)] = nsobject_to_variant(v);
}
return result;
@@ -121,29 +121,29 @@ Variant nsobject_to_variant(NSObject* object) {
NSNumber* num = (NSNumber*)object;
if(strcmp([num objCType], @encode(BOOL)) == 0) {
return Variant((int)[num boolValue]);
- }
+ }
else if(strcmp([num objCType], @encode(char)) == 0) {
return Variant((int)[num charValue]);
- }
+ }
else if(strcmp([num objCType], @encode(int)) == 0) {
return Variant([num intValue]);
- }
+ }
else if(strcmp([num objCType], @encode(unsigned int)) == 0) {
return Variant((int)[num unsignedIntValue]);
- }
+ }
else if(strcmp([num objCType], @encode(long long)) == 0) {
return Variant((int)[num longValue]);
- }
+ }
else if(strcmp([num objCType], @encode(float)) == 0) {
return Variant([num floatValue]);
- }
+ }
else if(strcmp([num objCType], @encode(double)) == 0) {
return Variant((float)[num doubleValue]);
}
}
else if ([object isKindOfClass:[NSDate class]]) {
//this is a type that icloud supports...but how did you submit it in the first place?
- //I guess this is a type that *might* show up, if you were, say, trying to make your game
+ //I guess this is a type that *might* show up, if you were, say, trying to make your game
//compatible with existing cloud data written by another engine's version of your game
WARN_PRINT("NSDate unsupported, returning null Variant")
return Variant();
@@ -177,13 +177,13 @@ NSObject* variant_to_nsobject(Variant v) {
for (unsigned int i = 0; i < keys.size(); ++i) {
NSString* key = [[[NSString alloc] initWithUTF8String:((String)(keys[i])).utf8().get_data()] autorelease];
NSObject* value = variant_to_nsobject(dic[keys[i]]);
-
+
if (key == NULL || value == NULL) {
return NULL;
}
-
+
[result setObject:value forKey:key];
- }
+ }
return result;
}
else if (v.get_type() == Variant::ARRAY) {
@@ -213,13 +213,13 @@ NSObject* variant_to_nsobject(Variant v) {
Error ICloud::remove_key(Variant p_param) {
String param = p_param;
NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease];
-
+
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
-
+
if (![[store dictionaryRepresentation] objectForKey:key]) {
return ERR_INVALID_PARAMETER;
}
-
+
[store removeObjectForKey:key];
return OK;
}
@@ -228,26 +228,26 @@ Error ICloud::remove_key(Variant p_param) {
Variant ICloud::set_key_values(Variant p_params) {
Dictionary params = p_params;
Array keys = params.keys();
-
+
Array error_keys;
-
+
for (unsigned int i = 0; i < keys.size(); ++i) {
String variant_key = keys[i];
Variant variant_value = params[variant_key];
-
+
NSString* key = [[[NSString alloc] initWithUTF8String:variant_key.utf8().get_data()] autorelease];
if (key == NULL) {
error_keys.push_back(variant_key);
continue;
}
-
+
NSObject* value = variant_to_nsobject(variant_value);
-
+
if (value == NULL) {
error_keys.push_back(variant_key);
continue;
}
-
+
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
[store setObject:value forKey:key];
}
@@ -257,37 +257,37 @@ Variant ICloud::set_key_values(Variant p_params) {
Variant ICloud::get_key_value(Variant p_param) {
String param = p_param;
-
+
NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease];
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
-
+
if (![[store dictionaryRepresentation] objectForKey:key]) {
return Variant();
}
-
+
Variant result = nsobject_to_variant([[store dictionaryRepresentation] objectForKey:key]);
-
+
return result;
}
Variant ICloud::get_all_key_values() {
Dictionary result;
-
+
NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
NSDictionary* store_dictionary = [store dictionaryRepresentation];
-
+
NSArray* keys = [store_dictionary allKeys];
int count = [keys count];
for (int i=0; i < count; ++i) {
NSString* k = [ keys objectAtIndex:i];
NSObject* v = [store_dictionary objectForKey:k];
-
+
const char* str = [k UTF8String];
if (str != NULL) {
result[String::utf8(str)] = nsobject_to_variant(v);
}
}
-
+
return result;
}
@@ -320,7 +320,7 @@ ICloud::ICloud() {
ERR_FAIL_COND(instance != NULL);
instance = this;
//connected = false;
-
+
[
//[NSNotificationCenter defaultCenter] addObserverForName: @"notify"
[NSNotificationCenter defaultCenter] addObserverForName: NSUbiquitousKeyValueStoreDidChangeExternallyNotification
@@ -337,7 +337,7 @@ ICloud::ICloud() {
//Array result_values;
Dictionary keyValues;
String reason = "";
-
+
if (change == NSUbiquitousKeyValueStoreServerChange) {
reason = "server";
}
@@ -350,27 +350,27 @@ ICloud::ICloud() {
else if (change == NSUbiquitousKeyValueStoreAccountChange) {
reason = "account";
}
-
+
ret["reason"] = reason;
-
-
+
+
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
-
+
NSArray * keys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey];
for (NSString* key in keys) {
const char* str = [key UTF8String];
if (str == NULL) {
continue;
}
-
+
NSObject* object = [store objectForKey:key];
-
+
//figure out what kind of object it is
Variant value = nsobject_to_variant(object);
-
+
keyValues[String::utf8(str)] = value;
}
-
+
ret["changed_values"] = keyValues;
pending_events.push_back(ret);
}
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index fec007b7b6..a2efe2711b 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -179,35 +179,35 @@ Error InAppStore::request_product_info(Variant p_params) {
ret["result"] = "ok";
ret["product_id"] = pid;
ret["transaction_id"] = transactionId;
-
+
NSData* receipt = nil;
int sdk_version = 6;
-
+
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0){
-
+
NSURL *receiptFileURL = nil;
NSBundle *bundle = [NSBundle mainBundle];
if ([bundle respondsToSelector:@selector(appStoreReceiptURL)]) {
-
+
// Get the transaction receipt file path location in the app bundle.
receiptFileURL = [bundle appStoreReceiptURL];
-
+
// Read in the contents of the transaction file.
receipt = [NSData dataWithContentsOfURL:receiptFileURL];
sdk_version = 7;
-
+
} else {
// Fall back to deprecated transaction receipt,
// which is still available in iOS 7.
-
+
// Use SKPaymentTransaction's transactionReceipt.
receipt = transaction.transactionReceipt;
}
-
+
}else{
receipt = transaction.transactionReceipt;
}
-
+
NSString* receipt_to_send = nil;
if (receipt != nil)
{
@@ -217,16 +217,16 @@ Error InAppStore::request_product_info(Variant p_params) {
receipt_ret["receipt"] = String::utf8(receipt_to_send != nil ? [receipt_to_send UTF8String] : "");
receipt_ret["sdk"] = sdk_version;
ret["receipt"] = receipt_ret;
-
+
InAppStore::get_singleton()->_post_event(ret);
-
+
if (auto_finish_transactions){
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}
else{
[pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier];
}
-
+
#ifdef MODULE_FUSEBOXX_ENABLED
printf("Registering transaction on Fuseboxx!\n");
[FuseSDK registerInAppPurchase: transaction];
@@ -251,7 +251,7 @@ Error InAppStore::request_product_info(Variant p_params) {
default:
printf("status default %i!\n", (int)transaction.transactionState);
-
+
break;
};
};
@@ -322,7 +322,7 @@ InAppStore::InAppStore() {
void InAppStore::finish_transaction(String product_id){
NSString* prod_id = [NSString stringWithCString:product_id.utf8().get_data() encoding:NSUTF8StringEncoding];
-
+
if ([pending_transactions objectForKey:prod_id]){
[[SKPaymentQueue defaultQueue] finishTransaction:[pending_transactions objectForKey:prod_id]];
[pending_transactions removeObjectForKey:prod_id];