This commit is contained in:
Bryce Covert
2017-09-25 11:28:48 -07:00
parent 9a7c1078a2
commit 850a0a945d
30 changed files with 287 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -0,0 +1,116 @@
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "icon-large20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "icon-large20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "icon-large40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "icon-large40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "icon-large20x20.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "icon-large20x20@2x-1.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "29x29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "29x29@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "icon-large40x40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "icon-large40x40@2x-1.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "icon-large76x76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "icon-large76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "1024x1024.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,55 @@
(ns advent.ios
(:require [advent.iap :as iap])
(:import [org.robovm.apple.storekit SKProductsResponse SKProduct SKMutablePayment SKPaymentQueue SKPaymentTransactionState]))
(def product (atom nil))
(defn products-did-receive-response [request ^SKProductsResponse response]
(reset! iap/can-purchase? true)
(reset! product (first (seq (.toArray (.getProducts response))))))
(defn products-did-fail [request error]
)
(defn products-did-finish [request]
)
(defn start-purchase []
(try
(.addPayment (SKPaymentQueue/getDefaultQueue)
(doto (SKMutablePayment. @product)
(.setQuantity 1)))
(catch Exception e
(println e))))
(defn updated-transactions [queue, transactions]
(let [purchased-states #{SKPaymentTransactionState/Purchased SKPaymentTransactionState/Restored}
finished-states #{SKPaymentTransactionState/Purchased SKPaymentTransactionState/Restored SKPaymentTransactionState/Failed SKPaymentTransactionState/Deferred}
is-finished (->> transactions
.toArray
seq
(every? #(finished-states (.getTransactionState %))))
has-purchased (->> transactions
.toArray
seq
(filter #(purchased-states (.getTransactionState %)))
(map #(-> % (.getPayment) (.getProductIdentifier)))
(filter #(= % "fullgame"))
seq)]
(when is-finished
(iap/set-purchase-pref (if has-purchased true false))
(doseq [^SKPaymentTransaction trans (->> transactions .toArray seq)]
(.finishTransaction (SKPaymentQueue/getDefaultQueue) trans)))))
(defn updated-downloads [queue, downloads]
(println "updated downloads" downloads))
(defn restore-completed-transactions-finished [queue]
(println "transactions finished"))
(defn restore-completed-transactions-failed [queue, error]
(println "transactions failed"))
(defn removed-transactions [queue, transactions]
(println "transactions removed" transactions))

View File

@@ -0,0 +1,33 @@
package advent.core;
import java.util.*;
import clojure.lang.RT;
import clojure.lang.Symbol;
import clojure.lang.IFn;
import com.badlogic.gdx.*;
import com.badlogic.gdx.backends.iosrobovm.*;
import org.robovm.apple.foundation.*;
import org.robovm.apple.uikit.UIApplication;
import org.robovm.apple.glkit.GLKViewDrawableColorFormat;
import org.robovm.apple.glkit.GLKViewDrawableDepthFormat;
import org.robovm.apple.storekit.*;
public class ProductDelegate extends SKProductsRequestDelegateAdapter {
@Override
public void didReceiveResponse(SKProductsRequest request, SKProductsResponse response) {
((IFn) RT.var("advent.ios", "products-did-receive-response").deref()).invoke(request, response);
}
@Override
public void didFail(SKRequest request, NSError error) {
((IFn) RT.var("advent.ios", "products-did-fail").deref()).invoke(request, error);
}
@Override
public void didFinish(SKRequest request) {
((IFn) RT.var("advent.ios", "products-did-finish").deref()).invoke(request);
}
}

View File

@@ -0,0 +1,43 @@
package advent.core;
import java.util.*;
import clojure.lang.RT;
import clojure.lang.Symbol;
import clojure.lang.IFn;
import com.badlogic.gdx.*;
import com.badlogic.gdx.backends.iosrobovm.*;
import org.robovm.apple.foundation.*;
import org.robovm.apple.uikit.UIApplication;
import org.robovm.apple.glkit.GLKViewDrawableColorFormat;
import org.robovm.apple.glkit.GLKViewDrawableDepthFormat;
import org.robovm.apple.storekit.*;
public class TransactionObserver extends SKPaymentTransactionObserverAdapter {
@Override
public void updatedTransactions(SKPaymentQueue queue, NSArray<SKPaymentTransaction> transactions) {
((IFn) RT.var("advent.ios", "updated-transactions").deref()).invoke(queue, transactions);
}
@Override
public void updatedDownloads(SKPaymentQueue queue, NSArray<SKDownload> downloads) {
((IFn) RT.var("advent.ios", "updated-downloads").deref()).invoke(queue, downloads);
}
@Override
public void restoreCompletedTransactionsFinished(SKPaymentQueue queue) {
((IFn) RT.var("advent.ios", "restore-completed-transactions-finished").deref()).invoke(queue);
}
@Override
public void restoreCompletedTransactionsFailed(SKPaymentQueue queue, NSError error) {
((IFn) RT.var("advent.ios", "restore-completed-transactions-failed").deref()).invoke(queue, error);
}
@Override
public void removedTransactions(SKPaymentQueue queue, NSArray<SKPaymentTransaction> transactions) {
((IFn) RT.var("advent.ios", "removed-transactions").deref()).invoke(queue, transactions);
}
}