mirror of
https://github.com/defold/extension-iap
synced 2025-09-27 17:12:18 +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};
|
||||
product.ident = strdup([p.productIdentifier UTF8String]);
|
||||
if (p.localizedTitle) {
|
||||
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.price = p.price.floatValue;
|
||||
|
||||
@@ -233,6 +245,7 @@ static void CopyTransaction(SKPaymentTransaction* transaction, IAPTransaction* o
|
||||
}
|
||||
|
||||
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
|
||||
[dateFormatter setLocale: [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
|
||||
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];
|
||||
|
||||
out->ident = strdup([transaction.payment.productIdentifier UTF8String]);
|
||||
|
@@ -17,6 +17,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@@ -155,10 +156,24 @@ public class IapGooglePlay implements Handler.Callback {
|
||||
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() {
|
||||
// NOTE: We must create Handler lazily as construction of
|
||||
// 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)
|
||||
return;
|
||||
|
||||
|
@@ -11,7 +11,7 @@ height = 1136
|
||||
[android]
|
||||
input_method = HiddenInputField
|
||||
package = com.defold.extension.iap
|
||||
version_code = 3
|
||||
version_code = 5
|
||||
|
||||
[project]
|
||||
title = extension-iap
|
||||
|
@@ -12,6 +12,7 @@ local items = {
|
||||
SUBSCRIPTION,
|
||||
}
|
||||
|
||||
-- mapping between product id and button name
|
||||
local item_buttons = {
|
||||
[GOLDBARS_SMALL] = "goldbars_small",
|
||||
[GOLDBARS_MEDIUM] = "goldbars_medium",
|
||||
|
Reference in New Issue
Block a user