summaryrefslogtreecommitdiff
path: root/platform/iphone
diff options
context:
space:
mode:
Diffstat (limited to 'platform/iphone')
-rw-r--r--platform/iphone/icloud.mm2
-rw-r--r--platform/iphone/in_app_store.h1
-rw-r--r--platform/iphone/in_app_store.mm14
-rw-r--r--platform/iphone/os_iphone.cpp3
-rw-r--r--platform/iphone/platform_config.h1
5 files changed, 20 insertions, 1 deletions
diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm
index 7508a480ce..a9748bf562 100644
--- a/platform/iphone/icloud.mm
+++ b/platform/iphone/icloud.mm
@@ -131,6 +131,8 @@ Variant nsobject_to_variant(NSObject *object) {
return Variant([num floatValue]);
} else if (strcmp([num objCType], @encode(double)) == 0) {
return Variant((float)[num doubleValue]);
+ } else {
+ return Variant();
}
} else if ([object isKindOfClass:[NSDate class]]) {
//this is a type that icloud supports...but how did you submit it in the first place?
diff --git a/platform/iphone/in_app_store.h b/platform/iphone/in_app_store.h
index 7d53eaae20..353438676d 100644
--- a/platform/iphone/in_app_store.h
+++ b/platform/iphone/in_app_store.h
@@ -46,6 +46,7 @@ class InAppStore : public Object {
public:
Error request_product_info(Variant p_params);
+ Error restore_purchases();
Error purchase(Variant p_params);
int get_pending_event_count();
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index 9bb3d7d3fa..6fa189e917 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -63,6 +63,7 @@ InAppStore *InAppStore::instance = NULL;
void InAppStore::_bind_methods() {
ClassDB::bind_method(D_METHOD("request_product_info"), &InAppStore::request_product_info);
+ ClassDB::bind_method(D_METHOD("restore_purchases"), &InAppStore::restore_purchases);
ClassDB::bind_method(D_METHOD("purchase"), &InAppStore::purchase);
ClassDB::bind_method(D_METHOD("get_pending_event_count"), &InAppStore::get_pending_event_count);
@@ -153,6 +154,14 @@ Error InAppStore::request_product_info(Variant p_params) {
return OK;
};
+Error InAppStore::restore_purchases() {
+
+ printf("restoring purchases!\n");
+ [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
+
+ return OK;
+};
+
@interface TransObserver : NSObject <SKPaymentTransactionObserver> {
};
@end
@@ -236,6 +245,11 @@ Error InAppStore::request_product_info(Variant p_params) {
printf("status transaction restored!\n");
String pid = String::utf8([transaction.originalTransaction.payment.productIdentifier UTF8String]);
InAppStore::get_singleton()->_record_purchase(pid);
+ Dictionary ret;
+ ret["type"] = "restore";
+ ret["result"] = "ok";
+ ret["product_id"] = pid;
+ InAppStore::get_singleton()->_post_event(ret);
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
} break;
default: {
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index c284ab6905..c4c59431f2 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -123,7 +123,6 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
// reset this to what it should be, it will have been set to 0 after visual_server->init() is called
RasterizerStorageGLES3::system_fbo = gl_view_base_fb;
- AudioDriverManager::add_driver(&audio_driver);
AudioDriverManager::initialize(p_audio_driver);
input = memnew(InputDefault);
@@ -632,6 +631,8 @@ OSIPhone::OSIPhone(int width, int height, String p_data_dir) {
loggers.push_back(memnew(StdLogger));
#endif
_set_logger(memnew(CompositeLogger(loggers)));
+
+ AudioDriverManager::add_driver(&audio_driver);
};
OSIPhone::~OSIPhone() {
diff --git a/platform/iphone/platform_config.h b/platform/iphone/platform_config.h
index d205c7da83..d9fd61fb6e 100644
--- a/platform/iphone/platform_config.h
+++ b/platform/iphone/platform_config.h
@@ -30,6 +30,7 @@
#include <alloca.h>
+#define GLES2_INCLUDE_H <ES2/gl.h>
#define GLES3_INCLUDE_H <ES3/gl.h>
#define PLATFORM_REFCOUNT