ProMotion-iap 0.2.1.beta1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ProMotion-iap.rb +5 -3
- data/lib/ProMotion/iap.rb +8 -3
- data/lib/ProMotion/product.rb +3 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21816a8d7a6a4ef77dcff985a2720d55563b5a1c
|
4
|
+
data.tar.gz: 837d821b6607553b86cfbf19aab11fcafb89acda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c203f8c34d6698514b6746baf426ca82961efc12fb47bb61ac15b343e72975840df067e7afcda51781038a836ed66d20837ffd7f97d6b127f77a3519601eab7d
|
7
|
+
data.tar.gz: acf138018aa2c1bbcc561edf55832a726171b6e5651dda3bca39b518b7ca1626fe158e36585a767eeb5c875b79b0450aba2785c97e054c1075d818fb0fb90b9b
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[](https://travis-ci.org/clearsightstudio/ProMotion-iap)
|
5
5
|
|
6
6
|
ProMotion-iap is in-app purchase notification support for the
|
7
|
-
popular RubyMotion gem [ProMotion](https://github.com/clearsightstudio/ProMotion).
|
7
|
+
popular RubyMotion gem [ProMotion](https://github.com/clearsightstudio/ProMotion). It also works as a stand-alone gem if you are not using ProMotion.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
data/lib/ProMotion-iap.rb
CHANGED
@@ -4,9 +4,11 @@ unless defined?(Motion::Project::Config)
|
|
4
4
|
raise "ProMotion-iap must be required within a RubyMotion project."
|
5
5
|
end
|
6
6
|
|
7
|
-
Motion::Project::App.
|
7
|
+
Motion::Project::App.setup do |app|
|
8
8
|
lib_dir_path = File.dirname(File.expand_path(__FILE__))
|
9
|
-
app.files.unshift
|
10
|
-
|
9
|
+
app.files.unshift [
|
10
|
+
File.join(lib_dir_path, "ProMotion/iap.rb"),
|
11
|
+
File.join(lib_dir_path, "ProMotion/product.rb"),
|
12
|
+
]
|
11
13
|
app.frameworks << "StoreKit"
|
12
14
|
end
|
data/lib/ProMotion/iap.rb
CHANGED
@@ -47,8 +47,6 @@ module ProMotion
|
|
47
47
|
@completion_handlers ||= {}
|
48
48
|
end
|
49
49
|
|
50
|
-
# private methods
|
51
|
-
|
52
50
|
private
|
53
51
|
|
54
52
|
def iap_setup
|
@@ -124,6 +122,12 @@ module ProMotion
|
|
124
122
|
transaction.respond_to?(:payment) ? transaction.payment.productIdentifier : "all"
|
125
123
|
end
|
126
124
|
|
125
|
+
def transaction_complete?(transactions)
|
126
|
+
states = transactions.map(&:transactionState)
|
127
|
+
return true unless states.include?(SKPaymentTransactionStatePurchasing)
|
128
|
+
false
|
129
|
+
end
|
130
|
+
|
127
131
|
public
|
128
132
|
|
129
133
|
# SKProductsRequestDelegate methods
|
@@ -162,6 +166,7 @@ module ProMotion
|
|
162
166
|
end
|
163
167
|
end
|
164
168
|
end
|
169
|
+
iap_shutdown if transaction_complete?(transactions)
|
165
170
|
end
|
166
171
|
|
167
172
|
def paymentQueue(_, restoreCompletedTransactionsFailedWithError:error)
|
@@ -170,4 +175,4 @@ module ProMotion
|
|
170
175
|
|
171
176
|
end
|
172
177
|
end
|
173
|
-
::PM = ProMotion unless defined?(PM)
|
178
|
+
::PM = ProMotion unless defined?(::PM)
|
data/lib/ProMotion/product.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module ProMotion
|
2
2
|
class IAP::Product
|
3
|
-
include
|
3
|
+
include PM::IAP
|
4
4
|
|
5
5
|
attr_reader :product_id
|
6
6
|
|
@@ -20,9 +20,9 @@ module ProMotion
|
|
20
20
|
|
21
21
|
def restore(&callback)
|
22
22
|
restore_iaps(product_id) do |status, products|
|
23
|
-
|
23
|
+
product = products.is_a?(Hash) ? products : products.find{|p| p[:product_id] == product_id }
|
24
|
+
callback.call status, product
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
28
|
-
::PM = ProMotion unless defined?(PM)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ProMotion-iap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamon Holmgren
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: motion-stump
|
@@ -80,12 +80,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- - "
|
83
|
+
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: '0'
|
86
86
|
requirements: []
|
87
87
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.4.
|
88
|
+
rubygems_version: 2.4.5
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Adds in-app purchase support to ProMotion.
|