RedAlert 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/project/alert_action.rb +1 -1
- data/lib/project/alert_controller_provider.rb +2 -2
- data/lib/project/button_templates.rb +5 -5
- data/lib/project/ios9_fix_uialertcontroller.rb +11 -0
- data/lib/project/red_alert.rb +7 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53c12366f0f82ed22925222139c6ec123b5169dc
|
4
|
+
data.tar.gz: 00c21e245ba06215cbc9109fd018451151e19b32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8028874c77283aa4cbecc8c9a994e668f6746926cd890d7e326d806b196ee1d99afb1a1771deb1f31bb53934debfb68e93b52928b05f4a8a8d7672fd866fc723
|
7
|
+
data.tar.gz: 6377249719c7dfcf656f8508b31c69a3c63fc7f710060b79cca17b20730c227c3b71ac0c940638a2641f002e0f689411360bf37bdf74b50809b17f1a1d65d81d
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[![image](http://ir_wp.s3.amazonaws.com/wp-content/uploads/sites/19/2014/09/rmq_plugin.png)](http://rubymotionquery.com)
|
3
3
|
|
4
4
|
# RedAlert
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/RedAlert.svg)](http://badge.fury.io/rb/RedAlert) [![Build Status](https://travis-ci.org/GantMan/RedAlert.svg)](https://travis-ci.org/GantMan/RedAlert) _Alerts and ActionSheets with ease_
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/RedAlert.svg)](http://badge.fury.io/rb/RedAlert) [![Build Status](https://travis-ci.org/GantMan/RedAlert.svg)](https://travis-ci.org/GantMan/RedAlert) ![Awesome](https://cdn.rawgit.com/GantMan/RedAlert/7b42a05e9b2fd1a734b9139378ea57b0858f10f3/_art/awesome.svg) _Alerts and ActionSheets with ease_
|
6
6
|
|
7
7
|
### Did you know that UIAlertView and UIActionSheet (as well as their respective delegate protocols) are deprecated in iOS 8?
|
8
8
|
|
data/lib/project/alert_action.rb
CHANGED
@@ -10,7 +10,7 @@ module RubyMotionQuery
|
|
10
10
|
|
11
11
|
def initialize(opts = {}, &block)
|
12
12
|
opts = {title: opts} if opts.is_a? String
|
13
|
-
@title = opts[:title] || NSLocalizedString("OK", nil)
|
13
|
+
@title = opts[:title] || "OK" || NSLocalizedString("OK", nil)
|
14
14
|
@tag = opts[:tag] || @title.gsub(/\s+/,"_").downcase.to_sym
|
15
15
|
@style = VALID_STYLES.include?(opts[:style]) ? opts[:style] : VALID_STYLES.first
|
16
16
|
@handler = block if block_given?
|
@@ -19,8 +19,8 @@ module RubyMotionQuery
|
|
19
19
|
if fieldset
|
20
20
|
fieldset[:fields].each_with_index do |field, index|
|
21
21
|
handler = lambda do |text_field|
|
22
|
-
text_field.placeholder = field.placeholder
|
23
|
-
text_field.secureTextEntry = field.secure_text_entry
|
22
|
+
text_field.placeholder = field.placeholder if field.placeholder.is_a? String
|
23
|
+
text_field.secureTextEntry = field.secure_text_entry if field.secure_text_entry.is_a? String
|
24
24
|
text_field.keyboardType = RubyMotionQuery::Stylers::KEYBOARD_TYPES[field.keyboard_type]
|
25
25
|
end
|
26
26
|
@alert_controller.addTextFieldWithConfigurationHandler(handler)
|
@@ -8,11 +8,11 @@ module RubyMotionQuery
|
|
8
8
|
|
9
9
|
|
10
10
|
def self.add_template_actions(template, &block)
|
11
|
-
yes = NSLocalizedString("Yes", nil)
|
12
|
-
no = NSLocalizedString("No", nil)
|
13
|
-
cancel = NSLocalizedString("Cancel", nil)
|
14
|
-
ok = NSLocalizedString("OK", nil)
|
15
|
-
delete = NSLocalizedString("Delete", nil)
|
11
|
+
yes = "Yes" #NSLocalizedString("Yes", nil)
|
12
|
+
no = "No" #NSLocalizedString("No", nil)
|
13
|
+
cancel = "Cancel" #NSLocalizedString("Cancel", nil)
|
14
|
+
ok = "OK" #NSLocalizedString("OK", nil)
|
15
|
+
delete = "Delete" #NSLocalizedString("Delete", nil)
|
16
16
|
|
17
17
|
case template
|
18
18
|
when :yes_no
|
data/lib/project/red_alert.rb
CHANGED
@@ -26,6 +26,7 @@ module RubyMotionQuery
|
|
26
26
|
NSLocalizedString("Alert!", nil)
|
27
27
|
end
|
28
28
|
|
29
|
+
|
29
30
|
opts[:style] = VALID_STYLES.include?(opts[:style]) ? opts[:style] : :alert
|
30
31
|
if opts[:style] == :sheet and rmq.device.ipad? and opts[:source].nil?
|
31
32
|
raise ArgumentError.new "Please provide a :source view to use :sheet on iPad"
|
@@ -35,6 +36,7 @@ module RubyMotionQuery
|
|
35
36
|
api = :deprecated if rmq.device.ios_at_least?(8) && opts[:api] == :deprecated
|
36
37
|
opts[:api] = api
|
37
38
|
|
39
|
+
|
38
40
|
# -----------------------------------------
|
39
41
|
# -- Who provides the alerts? -------------
|
40
42
|
# -----------------------------------------
|
@@ -75,10 +77,12 @@ module RubyMotionQuery
|
|
75
77
|
actions << add_template_actions(opts[:actions], &block)
|
76
78
|
elsif block_given?
|
77
79
|
# convert our block into the one & only action
|
78
|
-
|
80
|
+
button_text = NSLocalizedString("OK", nil) # Localized string failing
|
81
|
+
button_text = "OK"
|
82
|
+
actions << AlertAction.new(button_text, &block)
|
79
83
|
else
|
80
|
-
#
|
81
|
-
actions << [AlertAction.new
|
84
|
+
# NSLocalizedString causes crash if passed to AlertAction
|
85
|
+
actions << [AlertAction.new]
|
82
86
|
end
|
83
87
|
provider.build(actions.flatten.compact, fieldset, opts)
|
84
88
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RedAlert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gant Laborde
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_motion_query
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/project/alert_view_provider.rb
|
57
57
|
- lib/project/button_templates.rb
|
58
58
|
- lib/project/field_templates.rb
|
59
|
+
- lib/project/ios9_fix_uialertcontroller.rb
|
59
60
|
- lib/project/red_alert.rb
|
60
61
|
- lib/red_alert.rb
|
61
62
|
homepage: https://github.com/GantMan/RedAlert
|