motion-paddle 1.0.0 → 1.1.0
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 +72 -2
- data/lib/motion-paddle/paddle_setup.rb +55 -0
- data/lib/motion-paddle/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95fb281027ac232a348ea83b014a35620e4e339c
|
4
|
+
data.tar.gz: 6c09d0fa17dfb0427696f9b6375368d7ced6cdd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc6480925611af3d6aa9f92686da9021fbb51617484805df7d74f054329c4e576db1db208c32a6713394e6eabed1acc2a17e35be5ec01e30b9047ba6de303f86
|
7
|
+
data.tar.gz: e1d91430da12bd747fe75a47e216cc5d9cb4fe1326c8713a9bedc7911c43dfd086ac2f0c1fc2b533d3e4fd1f75402e96c07aecf474439825d72f44cfa26171c7
|
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# motion-paddle
|
2
|
+
[](http://badge.fury.io/rb/motion-paddle)
|
2
3
|
|
3
4
|
Paddle for vendors: <https://vendors.paddle.com>
|
5
|
+
|
4
6
|
You will have to vendor the Paddle framework yourself because I can't get the gem to bundle it properly.
|
5
|
-
|
7
|
+
|
8
|
+
You can see the gem in use in my MemoryTamer app <https://github.com/henderea/MemoryTamer>.
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
@@ -20,7 +23,74 @@ Or install it yourself as:
|
|
20
23
|
|
21
24
|
## Usage
|
22
25
|
|
23
|
-
|
26
|
+
###In Rakefile:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
Motion::Project::App.setup do |app|
|
30
|
+
#...
|
31
|
+
app.paddle do
|
32
|
+
set :product_id, 'product_id'
|
33
|
+
set :vendor_id, 'vendor_id'
|
34
|
+
set :api_key, 'api_key'
|
35
|
+
set :current_price, 'current_price'
|
36
|
+
set :dev_name, 'dev_name'
|
37
|
+
set :currency, 'currency'
|
38
|
+
set :image, 'image'
|
39
|
+
set :product_name, 'product_name'
|
40
|
+
set :trial_duration, 'trial_duration'
|
41
|
+
set :trial_text, 'trial_text'
|
42
|
+
set :product_image, 'product_image'
|
43
|
+
set :time_trial, true
|
44
|
+
end
|
45
|
+
# you have to vendor Paddle.framework yourself
|
46
|
+
app.embedded_frameworks << 'vendor/Paddle.framework'
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
### In app_delegate.rb
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
def applicationDidFinishLaunching(notification)
|
54
|
+
MotionPaddle.setup(window = nil) { |action, note|
|
55
|
+
if MotionPaddle.activated?
|
56
|
+
NSLog "activated with license code #{MotionPaddle.activated_license_code} and email #{MotionPaddle.activated_email}"
|
57
|
+
else
|
58
|
+
NSLog "not activated"
|
59
|
+
end
|
60
|
+
if action == :activated
|
61
|
+
do_something_on_activated
|
62
|
+
elsif action == :continue
|
63
|
+
do_something_on_continue
|
64
|
+
end
|
65
|
+
}
|
66
|
+
MotionPaddle.listen(:deactivated) { |action, deactivated, deactivateMessage|
|
67
|
+
if deactivated
|
68
|
+
NSLog 'deactivated license'
|
69
|
+
MotionPaddle.show_licensing
|
70
|
+
else
|
71
|
+
NSLog "failed to deactivate license: #{deactivateMessage}"
|
72
|
+
end
|
73
|
+
}
|
74
|
+
MotionPaddle.listen(:error) { |action, nsError|
|
75
|
+
do_something_with_error
|
76
|
+
}
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
###Other `MotionPaddle` methods not in the above example
|
81
|
+
|
82
|
+
* `MotionPaddle.enabled?` - true if Paddle framework is included
|
83
|
+
* `MotionPaddle.paddle_instance` - shared `Paddle` instance, typically not needed
|
84
|
+
* `MotionPaddle.time_trial?` - defaults to value from Rakefile
|
85
|
+
* `MotionPaddle.time_trial=` - override the `time_trial` value from the Rakefile
|
86
|
+
* `MotionPaddle.can_force_exit?` - gets the Paddle framework setting for whether the app is shut down normally or force exited
|
87
|
+
* `MotionPaddle.can_force_exit=` - set the above value
|
88
|
+
* `MotionPaddle.will_show_licensing_window?` - get the Paddle framework setting for whether the app will show the licensing window right away or wait until `MotionPaddle.show_licensing` is called
|
89
|
+
* `MotionPaddle.will_show_licensing_window=` - set the above value
|
90
|
+
* `MotionPaddle.trial_days_left` - get the number of days left in the trial
|
91
|
+
* `MotionPaddle.deactivate_license` - deactivate the license
|
92
|
+
|
93
|
+
**NOTE:** some methods offer a version that uses the spelling "licen**c**e". This is the name used for the methods in the Paddle framework, so I included this spelling as an option. The `will_show_licensing_window` methods are the only ones with it spelled with an "s" in the Paddle framework, and they do not have the "c" version in `MotionPaddle`.
|
24
94
|
|
25
95
|
## Contributing
|
26
96
|
|
@@ -8,6 +8,10 @@ class MotionPaddle
|
|
8
8
|
Paddle.sharedInstance
|
9
9
|
end
|
10
10
|
|
11
|
+
def psk_instance
|
12
|
+
PaddleStoreKit.sharedInstance
|
13
|
+
end
|
14
|
+
|
11
15
|
def product_id
|
12
16
|
self.plist['product_id']
|
13
17
|
end
|
@@ -78,6 +82,14 @@ class MotionPaddle
|
|
78
82
|
paddle_instance.setWillShowLicensingWindow(will_show_licensing_window)
|
79
83
|
end
|
80
84
|
|
85
|
+
def psk_valid_receipts
|
86
|
+
psk_instance.validReceipts
|
87
|
+
end
|
88
|
+
|
89
|
+
def psk_receipt_for_product_id(product_id)
|
90
|
+
psk_instance.receiptForProductId(product_id)
|
91
|
+
end
|
92
|
+
|
81
93
|
def setup(window = nil, &block)
|
82
94
|
return unless enabled?
|
83
95
|
return unless self.plist
|
@@ -109,6 +121,34 @@ class MotionPaddle
|
|
109
121
|
}
|
110
122
|
end
|
111
123
|
|
124
|
+
def psk_show(product_ids = nil, &block)
|
125
|
+
return unless enabled?
|
126
|
+
psk = psk_instance
|
127
|
+
psk.setDelegate(self)
|
128
|
+
if product_ids && !product_ids.empty?
|
129
|
+
psk.showStoreViewForProductIds(product_ids)
|
130
|
+
else
|
131
|
+
psk.showStoreView
|
132
|
+
end
|
133
|
+
listen(:psk_purchase, &block)
|
134
|
+
end
|
135
|
+
|
136
|
+
def psk_show_product(product_id, &block)
|
137
|
+
return unless enabled?
|
138
|
+
psk = psk_instance
|
139
|
+
psk.setDelegate(self)
|
140
|
+
psk.showProduct(product_id)
|
141
|
+
listen(:psk_purchase, &block)
|
142
|
+
end
|
143
|
+
|
144
|
+
def psk_purchase_product(product_id, &block)
|
145
|
+
return unless enabled?
|
146
|
+
psk = psk_instance
|
147
|
+
psk.setDelegate(self)
|
148
|
+
psk.purchaseProduct(product_id)
|
149
|
+
listen(:psk_purchase, &block)
|
150
|
+
end
|
151
|
+
|
112
152
|
def trial_days_left
|
113
153
|
paddle_instance.daysRemainingOnTrial
|
114
154
|
end
|
@@ -170,5 +210,20 @@ class MotionPaddle
|
|
170
210
|
def paddleDidFailWithError(error)
|
171
211
|
call_listeners :error, error
|
172
212
|
end
|
213
|
+
|
214
|
+
#internal
|
215
|
+
def PSKProductPurchased(transactionReceipt)
|
216
|
+
call_listeners :psk_purchase, transactionReceipt
|
217
|
+
end
|
218
|
+
|
219
|
+
#internal
|
220
|
+
def PSKDidFailWithError(error)
|
221
|
+
call_listeners :psk_error, error
|
222
|
+
end
|
223
|
+
|
224
|
+
#internal
|
225
|
+
def PSKDidCancel(error)
|
226
|
+
call_listeners :psk_cancel, error
|
227
|
+
end
|
173
228
|
end
|
174
229
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-paddle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Henderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,4 +80,3 @@ signing_key:
|
|
80
80
|
specification_version: 4
|
81
81
|
summary: A RubyMotion gem for using the Paddle framework
|
82
82
|
test_files: []
|
83
|
-
has_rdoc:
|