confetti 0.7.1 → 0.7.2

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- confetti (0.7.1)
4
+ confetti (0.7.2)
5
5
  mustache (~> 0.11.2)
6
6
 
7
7
  GEM
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  package="{{ package_name }}"
4
+ android:installLocation="{{ install_location }}"
4
5
  android:versionName="{{ version }}"
5
6
  android:versionCode="{{ version_code }}">
6
7
 
@@ -18,7 +19,7 @@
18
19
  {{/ permissions }}
19
20
 
20
21
  <application android:icon="@drawable/icon" android:label="@string/app_name"
21
- android:debuggable="true">
22
+ android:debuggable="true" android:hardwareAccelerated="true">
22
23
  <activity android:name=".{{ class_name }}"
23
24
  android:screenOrientation="{{ app_orientation }}"
24
25
  android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
@@ -32,6 +33,6 @@
32
33
  </intent-filter>
33
34
  </activity>
34
35
  </application>
35
- <uses-sdk android:minSdkVersion="2" />
36
+ <uses-sdk android:minSdkVersion="{{ min_sdk_version }}" {{ max_sdk_version_attribute }}/>
36
37
 
37
38
  </manifest>
@@ -3,6 +3,8 @@ module Confetti
3
3
  class AndroidManifest < Base
4
4
  include JavaChecks
5
5
 
6
+ DEFAULT_MIN_SDK = "7"
7
+
6
8
  GAP_PERMISSIONS_MAP = {
7
9
  "camera" => %w{CAMERA},
8
10
  "notification" => %w{VIBRATE},
@@ -66,6 +68,34 @@ module Confetti
66
68
  permissions.sort!
67
69
  permissions.map { |f| { :name => f } }
68
70
  end
71
+
72
+ def install_location
73
+ valid_choices = %w(internalOnly auto preferExternal)
74
+ choice = @config.preference("android-installLocation").to_s
75
+
76
+ valid_choices.include?(choice) ? choice : "internalOnly"
77
+ end
78
+
79
+ def min_sdk_version
80
+ choice = @config.preference("android-minSdkVersion").to_s
81
+
82
+ int_value?(choice) ? choice : DEFAULT_MIN_SDK
83
+ end
84
+
85
+ def max_sdk_version_attribute
86
+ choice = @config.preference("android-maxSdkVersion")
87
+
88
+ if int_value?(choice)
89
+ "android:maxSdkVersion=\"#{ choice }\""
90
+ end
91
+ end
92
+
93
+ def int_value? val
94
+ return if val.nil?
95
+
96
+ integer = /^\d+$/
97
+ val.to_s.match(integer)
98
+ end
69
99
  end
70
100
  end
71
101
  end
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  package="com.app.bare"
4
+ android:installLocation="internalOnly"
4
5
  android:versionName="1.0.0"
5
6
  android:versionCode="1">
6
7
 
@@ -14,7 +15,7 @@
14
15
 
15
16
  <uses-permission android:name="android.permission.INTERNET" />
16
17
  <application android:icon="@drawable/icon" android:label="@string/app_name"
17
- android:debuggable="true">
18
+ android:debuggable="true" android:hardwareAccelerated="true">
18
19
  <activity android:name=".ConfettiBareApp"
19
20
  android:screenOrientation="unspecified"
20
21
  android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
@@ -28,6 +29,6 @@
28
29
  </intent-filter>
29
30
  </activity>
30
31
  </application>
31
- <uses-sdk android:minSdkVersion="2" />
32
+ <uses-sdk android:minSdkVersion="7" />
32
33
 
33
34
  </manifest>
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  package="com.alunny.confetti"
4
+ android:installLocation="internalOnly"
4
5
  android:versionName="1.0.0"
5
6
  android:versionCode="1">
6
7
 
@@ -19,7 +20,7 @@
19
20
  <uses-permission android:name="android.permission.CAMERA" />
20
21
  <uses-permission android:name="android.permission.VIBRATE" />
21
22
  <application android:icon="@drawable/icon" android:label="@string/app_name"
22
- android:debuggable="true">
23
+ android:debuggable="true" android:hardwareAccelerated="true">
23
24
  <activity android:name=".ConfettiSampleApp"
24
25
  android:screenOrientation="unspecified"
25
26
  android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
@@ -33,6 +34,6 @@
33
34
  </intent-filter>
34
35
  </activity>
35
36
  </application>
36
- <uses-sdk android:minSdkVersion="2" />
37
+ <uses-sdk android:minSdkVersion="7" />
37
38
 
38
39
  </manifest>
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  package="com.whoever.awesome.app"
4
+ android:installLocation="internalOnly"
4
5
  android:versionName="0.0.1"
5
6
  android:versionCode="1">
6
7
 
@@ -18,7 +19,7 @@
18
19
  <uses-permission android:name="android.permission.RECORD_AUDIO" />
19
20
  <uses-permission android:name="android.permission.RECORD_VIDEO" />
20
21
  <application android:icon="@drawable/icon" android:label="@string/app_name"
21
- android:debuggable="true">
22
+ android:debuggable="true" android:hardwareAccelerated="true">
22
23
  <activity android:name=".AwesomeApp"
23
24
  android:screenOrientation="unspecified"
24
25
  android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
@@ -32,6 +33,6 @@
32
33
  </intent-filter>
33
34
  </activity>
34
35
  </application>
35
- <uses-sdk android:minSdkVersion="2" />
36
+ <uses-sdk android:minSdkVersion="7" />
36
37
 
37
38
  </manifest>
@@ -146,4 +146,94 @@ describe Confetti::Template::AndroidManifest do
146
146
  @template.app_orientation.should == "unspecified"
147
147
  end
148
148
  end
149
+
150
+ describe "#install_location" do
151
+ before do
152
+ @config = Confetti::Config.new
153
+ @template = @template_class.new(@config)
154
+ end
155
+
156
+ it "should default to 'internalOnly' do" do
157
+ @template.install_location.should == "internalOnly"
158
+ end
159
+
160
+ describe "when set" do
161
+ before do
162
+ @install_pref = Confetti::Config::Preference.new "android-installLocation"
163
+ @config.preference_set << @install_pref
164
+ end
165
+
166
+ it "should use 'auto' when set to 'auto'" do
167
+ @install_pref.value = "auto"
168
+ @template.install_location.should == "auto"
169
+ end
170
+
171
+ it "should use 'preferExternal' when set to 'preferExternal'" do
172
+ @install_pref.value = "preferExternal"
173
+ @template.install_location.should == "preferExternal"
174
+ end
175
+
176
+ it "should use 'internalOnly' otherwise" do
177
+ @install_pref.value = "wherever"
178
+ @template.install_location.should == "internalOnly"
179
+ end
180
+ end
181
+ end
182
+
183
+ describe "#min_sdk_version" do
184
+ before do
185
+ @config = Confetti::Config.new
186
+ @template = @template_class.new(@config)
187
+ @default = @template_class::DEFAULT_MIN_SDK
188
+ end
189
+
190
+ it "should default to the current default" do
191
+ @template.min_sdk_version.should == @default
192
+ end
193
+
194
+ describe "when set" do
195
+ before do
196
+ @sdk_pref = Confetti::Config::Preference.new "android-minSdkVersion"
197
+ @config.preference_set << @sdk_pref
198
+ end
199
+
200
+ it "should return that number" do
201
+ @sdk_pref.value = "12"
202
+ @template.min_sdk_version.should == "12"
203
+ end
204
+
205
+ it "should be nil if not a number" do
206
+ @sdk_pref.value = "twelve"
207
+ @template.min_sdk_version.should == @default
208
+ end
209
+ end
210
+ end
211
+
212
+ describe "#max_sdk_version_attribute" do
213
+ before do
214
+ @config = Confetti::Config.new
215
+ @template = @template_class.new(@config)
216
+ end
217
+
218
+ it "should default to nil" do
219
+ @template.max_sdk_version_attribute.should be_nil
220
+ end
221
+
222
+ describe "when set" do
223
+ before do
224
+ @sdk_pref = Confetti::Config::Preference.new "android-maxSdkVersion"
225
+ @config.preference_set << @sdk_pref
226
+ end
227
+
228
+ it "should return that number" do
229
+ @sdk_pref.value = "12"
230
+ @template.max_sdk_version_attribute.should == 'android:maxSdkVersion="12"'
231
+ end
232
+
233
+ it "should be nil if not a number" do
234
+ @sdk_pref.value = "twelve"
235
+ @template.max_sdk_version_attribute.should be_nil
236
+ end
237
+ end
238
+ end
149
239
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 1
9
- version: 0.7.1
8
+ - 2
9
+ version: 0.7.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andrew Lunny