mirror of
https://github.com/defold/extension-iap
synced 2025-09-28 09:32:19 +02:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f1d53948e9 | ||
|
607b4a117e | ||
|
38656e973c | ||
|
4efe0c2a25 | ||
|
3fb09c3b95 | ||
|
2843080690 | ||
|
1c017cf4ed | ||
|
eda78dda4f |
@@ -119,8 +119,20 @@ static void IAP_FreeTransaction(IAPTransaction* transaction)
|
|||||||
|
|
||||||
IAPProduct product = {0};
|
IAPProduct product = {0};
|
||||||
product.ident = strdup([p.productIdentifier UTF8String]);
|
product.ident = strdup([p.productIdentifier UTF8String]);
|
||||||
product.title = strdup([p.localizedTitle UTF8String]);
|
if (p.localizedTitle) {
|
||||||
product.description = strdup([p.localizedDescription UTF8String]);
|
product.title = strdup([p.localizedTitle UTF8String]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dmLogWarning("Product %s has no localizedTitle", [p.productIdentifier UTF8String]);
|
||||||
|
product.title = "";
|
||||||
|
}
|
||||||
|
if (p.localizedDescription) {
|
||||||
|
product.description = strdup([p.localizedDescription UTF8String]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dmLogWarning("Product %s has no localizedDescription", [p.productIdentifier UTF8String]);
|
||||||
|
product.description = "";
|
||||||
|
}
|
||||||
product.currency_code = strdup([[p.priceLocale objectForKey:NSLocaleCurrencyCode] UTF8String]);
|
product.currency_code = strdup([[p.priceLocale objectForKey:NSLocaleCurrencyCode] UTF8String]);
|
||||||
product.price = p.price.floatValue;
|
product.price = p.price.floatValue;
|
||||||
|
|
||||||
@@ -233,6 +245,7 @@ static void CopyTransaction(SKPaymentTransaction* transaction, IAPTransaction* o
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
|
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
|
||||||
|
[dateFormatter setLocale: [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
|
||||||
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];
|
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];
|
||||||
|
|
||||||
out->ident = strdup([transaction.payment.productIdentifier UTF8String]);
|
out->ident = strdup([transaction.payment.productIdentifier UTF8String]);
|
||||||
|
@@ -17,6 +17,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@@ -155,10 +156,24 @@ public class IapGooglePlay implements Handler.Callback {
|
|||||||
this.autoFinishTransactions = autoFinishTransactions;
|
this.autoFinishTransactions = autoFinishTransactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isPlayStoreInstalled(Context context){
|
||||||
|
try {
|
||||||
|
context.getPackageManager().getPackageInfo("com.android.vending", 0);
|
||||||
|
return true;
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
// NOTE: We must create Handler lazily as construction of
|
// NOTE: We must create Handler lazily as construction of
|
||||||
// handlers must be in the context of a "looper" on Android
|
// handlers must be in the context of a "looper" on Android
|
||||||
|
|
||||||
|
if (!isPlayStoreInstalled(activity)) {
|
||||||
|
Log.e(TAG, "Unable to find Google Play Store (com.android.vending)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.initialized)
|
if (this.initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@ height = 1136
|
|||||||
[android]
|
[android]
|
||||||
input_method = HiddenInputField
|
input_method = HiddenInputField
|
||||||
package = com.defold.extension.iap
|
package = com.defold.extension.iap
|
||||||
version_code = 3
|
version_code = 5
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
title = extension-iap
|
title = extension-iap
|
||||||
|
@@ -12,6 +12,7 @@ local items = {
|
|||||||
SUBSCRIPTION,
|
SUBSCRIPTION,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- mapping between product id and button name
|
||||||
local item_buttons = {
|
local item_buttons = {
|
||||||
[GOLDBARS_SMALL] = "goldbars_small",
|
[GOLDBARS_SMALL] = "goldbars_small",
|
||||||
[GOLDBARS_MEDIUM] = "goldbars_medium",
|
[GOLDBARS_MEDIUM] = "goldbars_medium",
|
||||||
|
Reference in New Issue
Block a user