Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
  • 4 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
View
2  Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- confetti (0.7.1)
+ confetti (0.7.2)
mustache (~> 0.11.2)
GEM
View
5 lib/confetti/templates/android_manifest.mustache
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="{{ package_name }}"
+ android:installLocation="{{ install_location }}"
android:versionName="{{ version }}"
android:versionCode="{{ version_code }}">
@@ -18,7 +19,7 @@
{{/ permissions }}
<application android:icon="@drawable/icon" android:label="@string/app_name"
- android:debuggable="true">
+ android:debuggable="true" android:hardwareAccelerated="true">
<activity android:name=".{{ class_name }}"
android:screenOrientation="{{ app_orientation }}"
android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
@@ -32,6 +33,6 @@
</intent-filter>
</activity>
</application>
- <uses-sdk android:minSdkVersion="2" />
+ <uses-sdk android:minSdkVersion="{{ min_sdk_version }}" {{ max_sdk_version_attribute }}/>
</manifest>
View
30 lib/confetti/templates/android_manifest.rb
@@ -3,6 +3,8 @@ module Template
class AndroidManifest < Base
include JavaChecks
+ DEFAULT_MIN_SDK = "7"
+
GAP_PERMISSIONS_MAP = {
"camera" => %w{CAMERA},
"notification" => %w{VIBRATE},
@@ -66,6 +68,34 @@ def permissions
permissions.sort!
permissions.map { |f| { :name => f } }
end
+
+ def install_location
+ valid_choices = %w(internalOnly auto preferExternal)
+ choice = @config.preference("android-installLocation").to_s
+
+ valid_choices.include?(choice) ? choice : "internalOnly"
+ end
+
+ def min_sdk_version
+ choice = @config.preference("android-minSdkVersion").to_s
+
+ int_value?(choice) ? choice : DEFAULT_MIN_SDK
+ end
+
+ def max_sdk_version_attribute
+ choice = @config.preference("android-maxSdkVersion")
+
+ if int_value?(choice)
+ "android:maxSdkVersion=\"#{ choice }\""
+ end
+ end
+
+ def int_value? val
+ return if val.nil?
+
+ integer = /^\d+$/
+ val.to_s.match(integer)
+ end
end
end
end
View
2  lib/confetti/version.rb
@@ -1,3 +1,3 @@
module Confetti
- VERSION = "0.7.1"
+ VERSION = "0.7.2"
end
View
5 spec/fixtures/android/AndroidManifest_bare.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.bare"
+ android:installLocation="internalOnly"
android:versionName="1.0.0"
android:versionCode="1">
@@ -14,7 +15,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="@drawable/icon" android:label="@string/app_name"
- android:debuggable="true">
+ android:debuggable="true" android:hardwareAccelerated="true">
<activity android:name=".ConfettiBareApp"
android:screenOrientation="unspecified"
android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
@@ -28,6 +29,6 @@
</intent-filter>
</activity>
</application>
- <uses-sdk android:minSdkVersion="2" />
+ <uses-sdk android:minSdkVersion="7" />
</manifest>
View
5 spec/fixtures/android/AndroidManifest_expected.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.alunny.confetti"
+ android:installLocation="internalOnly"
android:versionName="1.0.0"
android:versionCode="1">
@@ -19,7 +20,7 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<application android:icon="@drawable/icon" android:label="@string/app_name"
- android:debuggable="true">
+ android:debuggable="true" android:hardwareAccelerated="true">
<activity android:name=".ConfettiSampleApp"
android:screenOrientation="unspecified"
android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
@@ -33,6 +34,6 @@
</intent-filter>
</activity>
</application>
- <uses-sdk android:minSdkVersion="2" />
+ <uses-sdk android:minSdkVersion="7" />
</manifest>
View
5 spec/fixtures/android/android_manifest_spec.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.whoever.awesome.app"
+ android:installLocation="internalOnly"
android:versionName="0.0.1"
android:versionCode="1">
@@ -18,7 +19,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<application android:icon="@drawable/icon" android:label="@string/app_name"
- android:debuggable="true">
+ android:debuggable="true" android:hardwareAccelerated="true">
<activity android:name=".AwesomeApp"
android:screenOrientation="unspecified"
android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
@@ -32,6 +33,6 @@
</intent-filter>
</activity>
</application>
- <uses-sdk android:minSdkVersion="2" />
+ <uses-sdk android:minSdkVersion="7" />
</manifest>
View
90 spec/templates/android_manifest_spec.rb
@@ -146,4 +146,94 @@
@template.app_orientation.should == "unspecified"
end
end
+
+ describe "#install_location" do
+ before do
+ @config = Confetti::Config.new
+ @template = @template_class.new(@config)
+ end
+
+ it "should default to 'internalOnly' do" do
+ @template.install_location.should == "internalOnly"
+ end
+
+ describe "when set" do
+ before do
+ @install_pref = Confetti::Config::Preference.new "android-installLocation"
+ @config.preference_set << @install_pref
+ end
+
+ it "should use 'auto' when set to 'auto'" do
+ @install_pref.value = "auto"
+ @template.install_location.should == "auto"
+ end
+
+ it "should use 'preferExternal' when set to 'preferExternal'" do
+ @install_pref.value = "preferExternal"
+ @template.install_location.should == "preferExternal"
+ end
+
+ it "should use 'internalOnly' otherwise" do
+ @install_pref.value = "wherever"
+ @template.install_location.should == "internalOnly"
+ end
+ end
+ end
+
+ describe "#min_sdk_version" do
+ before do
+ @config = Confetti::Config.new
+ @template = @template_class.new(@config)
+ @default = @template_class::DEFAULT_MIN_SDK
+ end
+
+ it "should default to the current default" do
+ @template.min_sdk_version.should == @default
+ end
+
+ describe "when set" do
+ before do
+ @sdk_pref = Confetti::Config::Preference.new "android-minSdkVersion"
+ @config.preference_set << @sdk_pref
+ end
+
+ it "should return that number" do
+ @sdk_pref.value = "12"
+ @template.min_sdk_version.should == "12"
+ end
+
+ it "should be nil if not a number" do
+ @sdk_pref.value = "twelve"
+ @template.min_sdk_version.should == @default
+ end
+ end
+ end
+
+ describe "#max_sdk_version_attribute" do
+ before do
+ @config = Confetti::Config.new
+ @template = @template_class.new(@config)
+ end
+
+ it "should default to nil" do
+ @template.max_sdk_version_attribute.should be_nil
+ end
+
+ describe "when set" do
+ before do
+ @sdk_pref = Confetti::Config::Preference.new "android-maxSdkVersion"
+ @config.preference_set << @sdk_pref
+ end
+
+ it "should return that number" do
+ @sdk_pref.value = "12"
+ @template.max_sdk_version_attribute.should == 'android:maxSdkVersion="12"'
+ end
+
+ it "should be nil if not a number" do
+ @sdk_pref.value = "twelve"
+ @template.max_sdk_version_attribute.should be_nil
+ end
+ end
+ end
end

No commit comments for this range

Something went wrong with that request. Please try again.