diff --git a/android/AndroidManifest.template.xml b/android/AndroidManifest.template.xml
index c9c79ae7..dd381957 100644
--- a/android/AndroidManifest.template.xml
+++ b/android/AndroidManifest.template.xml
@@ -14,7 +14,7 @@
android:icon="@drawable/ic_launcher"
android:hardwareAccelerated="true"
android:largeHeap="true"
- android:label="TicksTales">
+ android:label="Tick's Tales">
@@ -22,7 +22,9 @@
-
+
diff --git a/android/project.clj b/android/project.clj
index fd7dca00..634d8c10 100644
--- a/android/project.clj
+++ b/android/project.clj
@@ -1,4 +1,4 @@
-(defproject advent "1.3.2-SNAPSHOT"
+(defproject advent "1.3.16-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[com.badlogicgames.gdx/gdx "1.9.3" :use-resources true]
@@ -36,10 +36,10 @@
{;; Specify the path to your private
;; keystore and the the alias of the
;; key you want to sign APKs with.
- ;; :keystore-path "/home/user/.android/private.keystore"
- ;; :key-alias "mykeyalias"
+ ;; :keystore-path "ticks-talkes-release.jks"
+ ;; :key-alias "ticks-tales-release"
:build-type :release
- :aot :all
+ :aot :all-with-unused
:aot-exclude-ns [cljs.core.async.macros cljs.core.impl-ioc-macros cljs.core.impl.ioc_macros]}}}
:android {;; Specify the path to the Android SDK directory either
diff --git a/android/src/java/advent/core/MainActivity.java b/android/src/java/advent/core/MainActivity.java
index 86350bfe..0f95830d 100644
--- a/android/src/java/advent/core/MainActivity.java
+++ b/android/src/java/advent/core/MainActivity.java
@@ -2,24 +2,34 @@ package advent.core;
import clojure.lang.RT;
import clojure.lang.Symbol;
+import java.util.ArrayList;
+import java.util.List;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.Game;
import com.android.billingclient.api.*;
import com.android.billingclient.api.BillingClient.BillingResponse;
+import com.android.billingclient.api.BillingClient.SkuType;
+import com.android.billingclient.api.SkuDetails.SkuDetailsResult;
+import com.android.billingclient.api.BillingFlowParams;
+import com.android.billingclient.api.BillingFlowParams.Builder;
+
+public class MainActivity extends AndroidApplication {
+ public boolean triggerPurchase() {
+ BillingFlowParams.Builder builder = new BillingFlowParams.Builder()
+ .setSku("game").setType(SkuType.INAPP);
+ int returnValue = mBillingClient.launchBillingFlow(this, builder.build());
+ return returnValue == BillingClient.BillingResponse.OK || returnValue == BillingClient.BillingResponse.ITEM_ALREADY_OWNED;
+ }
-public class MainActivity extends AndroidApplication implements PurchasesUpdatedListener {
private BillingClient mBillingClient;
- @Override
- public void onPurchasesUpdated(@BillingResponse int responseCode, java.util.List purchases) {
- System.out.println("purchases");
- }
public void onCreate (android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
RT.var("clojure.core", "require").invoke(Symbol.intern("clojure.core.async"));
RT.var("clojure.core", "require").invoke(Symbol.intern("advent.core"));
+ RT.var("clojure.core", "require").invoke(Symbol.intern("advent.android"));
} catch (Exception e) {
System.out.println("Importing failed");
e.printStackTrace();
@@ -27,14 +37,17 @@ public class MainActivity extends AndroidApplication implements PurchasesUpdated
try {
Game game = (Game) RT.var("advent.core", "advent").deref();
+ System.out.println("pre-init");
initialize(game);
- mBillingClient = new BillingClient.Builder(this).setListener(this).build();
+ System.out.println("before bill??");
+ mBillingClient = new BillingClient.Builder(this).setListener((PurchasesUpdatedListener) RT.var("advent.android", "listener").deref()).build();
System.out.println("billing??");
mBillingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(@BillingResponse int billingResponseCode) {
System.out.println("billing go");
if (billingResponseCode == BillingResponse.OK) {
+ mBillingClient.queryPurchaseHistoryAsync("inapp", ((PurchaseHistoryResponseListener) RT.var("advent.android", "history-listener").deref()));
System.out.println("billing ok");
// The billing client is ready. You can query purchases here.
}
diff --git a/desktop/src-common/advent/core.clj b/desktop/src-common/advent/core.clj
index 460d807d..f8920298 100644
--- a/desktop/src-common/advent/core.clj
+++ b/desktop/src-common/advent/core.clj
@@ -19,8 +19,9 @@
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
[com.badlogic.gdx.graphics.g2d TextureRegion]
[com.badlogic.gdx Gdx Application]
- [java.io FileOutputStream File PrintStream])
- )
+ [java.io FileOutputStream File PrintStream]))
+
+(def has-purchased? (atom false))
(defonce am (asset-manager))
diff --git a/desktop/src-common/advent/screens/rooms/dream.clj b/desktop/src-common/advent/screens/rooms/dream.clj
index af1404b8..8879a92d 100644
--- a/desktop/src-common/advent/screens/rooms/dream.clj
+++ b/desktop/src-common/advent/screens/rooms/dream.clj
@@ -17,7 +17,8 @@
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all])
- (:import [com.badlogic.gdx.graphics Color]))
+ (:import [com.badlogic.gdx.graphics Color]
+ [com.badlogic.gdx Application Gdx]))
(println "loading " *ns*)
@@ -377,8 +378,15 @@
:label "Pit of destiny"
:cursor :look
:script (actions/get-script entities
- (actions/walk-to entities :ego [154 41])
- (actions/talk entities :ego "Wow! That's a long way down."))
+ (println "billing purchased before" @@(resolve 'advent.core/has-purchased?))
+
+ (when-not @@(resolve 'advent.core/has-purchased?)
+ (.triggerPurchase (Gdx/app))
+ (a/