diff --git a/extension-iap/src/iap_android.cpp b/extension-iap/src/iap_android.cpp index 9c1f15b..971055e 100644 --- a/extension-iap/src/iap_android.cpp +++ b/extension-iap/src/iap_android.cpp @@ -352,7 +352,7 @@ static void HandlePurchaseResult(const IAPCommand* cmd) if (!dmScript::SetupCallback(cmd->m_Callback)) { - dmLogError("No callback set for purchase result!"); + dmLogError("Failed to setup callback for purchase result!"); assert(top == lua_gettop(L)); return; } @@ -368,7 +368,7 @@ static void HandlePurchaseResult(const IAPCommand* cmd) IAP_PushError(L, "purchase response was null", REASON_UNSPECIFIED); } } else if (cmd->m_ResponseCode == BILLING_RESPONSE_RESULT_USER_CANCELED) { - dmLogError("User canceled purchase"); + dmLogInfo("User canceled purchase"); lua_pushnil(L); IAP_PushError(L, "user canceled purchase", REASON_USER_CANCELED); } else { @@ -389,9 +389,7 @@ static dmExtension::Result InitializeIAP(dmExtension::Params* params) dmAndroid::ThreadAttacher threadAttacher; JNIEnv* env = threadAttacher.GetEnv(); - const char* provider = dmConfigFile::GetString(params->m_ConfigFile, "android.iap_provider", "GooglePlay"); const char* class_name = "com.defold.iap.IapGooglePlay"; - jclass iap_class = dmAndroid::LoadClass(env, class_name); jclass iap_jni_class = dmAndroid::LoadClass(env, "com.defold.iap.IapJNI"); @@ -426,15 +424,16 @@ static void IAP_OnCommand(IAPCommand* cmd, void*) { switch (cmd->m_Command) { - case IAP_PRODUCT_RESULT: - HandleProductResult(cmd); - break; - case IAP_PURCHASE_RESULT: - HandlePurchaseResult(cmd); - break; + case IAP_PRODUCT_RESULT: + HandleProductResult(cmd); + break; + + case IAP_PURCHASE_RESULT: + HandlePurchaseResult(cmd); + break; - default: - assert(false); + default: + assert(false); } if (cmd->m_Data) { diff --git a/extension-iap/src/iap_ios.mm b/extension-iap/src/iap_ios.mm index 65c35c3..1323c8f 100644 --- a/extension-iap/src/iap_ios.mm +++ b/extension-iap/src/iap_ios.mm @@ -325,6 +325,7 @@ static void HandlePurchaseResult(IAPCommand* cmd) if (!dmScript::SetupCallback(cmd->m_Callback)) { + dmLogError("Failed to setup callback for purchase result"); assert(top == lua_gettop(L)); return; } diff --git a/extension-iap/src/iap_null.cpp b/extension-iap/src/iap_null.cpp index 8ccdb65..95effef 100644 --- a/extension-iap/src/iap_null.cpp +++ b/extension-iap/src/iap_null.cpp @@ -1,4 +1,4 @@ -#if !defined(DM_PLATFORM_HTML5) && !defined(DM_PLATFORM_ANDROID) && !defined(DM_PLATFORM_IOS) +#if !defined(DM_PLATFORM_ANDROID) && !defined(DM_PLATFORM_IOS) extern "C" void IAPExt() { diff --git a/extension-iap/src/iap_private.cpp b/extension-iap/src/iap_private.cpp index 45df28e..0856296 100644 --- a/extension-iap/src/iap_private.cpp +++ b/extension-iap/src/iap_private.cpp @@ -1,4 +1,4 @@ -#if defined(DM_PLATFORM_HTML5) || defined(DM_PLATFORM_ANDROID) || defined(DM_PLATFORM_IOS) +#if defined(DM_PLATFORM_ANDROID) || defined(DM_PLATFORM_IOS) #include diff --git a/extension-iap/src/iap_private.h b/extension-iap/src/iap_private.h index eb8708a..5fc1323 100644 --- a/extension-iap/src/iap_private.h +++ b/extension-iap/src/iap_private.h @@ -1,4 +1,4 @@ -#if defined(DM_PLATFORM_HTML5) || defined(DM_PLATFORM_ANDROID) || defined(DM_PLATFORM_IOS) +#if defined(DM_PLATFORM_ANDROID) || defined(DM_PLATFORM_IOS) #ifndef IAP_PRIVATE_H #define IAP_PRIVATE_H