sugarcube 3.4.2 → 3.5.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/lib/ios/sugarcube-factories/uialertcontroller.rb +17 -0
- data/lib/version.rb +1 -1
- data/spec/ios/uialertcontroller_spec.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19287c88598dd0086ec1cc07a160a663deb94f25
|
4
|
+
data.tar.gz: '085dc95c41fca4414a9df3461aa1a50bc40fb9a1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b130f44edc637cfe2c74a4d124b2019ed24ed69084c879688294135f085716b31b57bd1b541c194302b0dd8445e70866260969ef77a6008cf62259b73f95427c
|
7
|
+
data.tar.gz: ad1770a014a8635baebe718413db4636471454b08784c04256839cba88b5eb38f7b96e22b81b7c7a8ba272a0842a937b951d59e96ccf66f5f3d37d46b37004f5
|
@@ -95,6 +95,23 @@ class UIAlertController
|
|
95
95
|
})
|
96
96
|
addAction action
|
97
97
|
end
|
98
|
+
|
99
|
+
def self.prompt(controller, title, options = {}, more_options = {}, &block)
|
100
|
+
text_fields = []
|
101
|
+
|
102
|
+
alert = UIAlertController.alert(controller, title, options.merge(show: false), more_options) do |result|
|
103
|
+
next block.call(text_fields.first.text) if result == 'OK'
|
104
|
+
next block.call(nil)
|
105
|
+
end
|
106
|
+
|
107
|
+
alert.addTextFieldWithConfigurationHandler(->(s){ text_fields << s })
|
108
|
+
|
109
|
+
if options.fetch(:show, true)
|
110
|
+
controller.presentViewController(alert, animated: true, completion: nil)
|
111
|
+
end
|
112
|
+
|
113
|
+
alert
|
114
|
+
end
|
98
115
|
end
|
99
116
|
|
100
117
|
module SugarCube
|
data/lib/version.rb
CHANGED
@@ -128,5 +128,14 @@ if defined?(UIAlertControllerStyleAlert)
|
|
128
128
|
alert.actions[3].style.should == UIAlertActionStyleDefault
|
129
129
|
end
|
130
130
|
|
131
|
+
describe '.prompt' do
|
132
|
+
it 'should have text_field' do
|
133
|
+
alert = UIAlertController.prompt(controller, 'test')
|
134
|
+
wait 0.6 do
|
135
|
+
alert.textFields.count.should == 1
|
136
|
+
controller.dismissViewControllerAnimated(false, completion: nil)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
131
140
|
end
|
132
141
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugarcube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2018-12-17 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: |
|
18
18
|
== Description
|
@@ -322,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
322
|
version: '0'
|
323
323
|
requirements: []
|
324
324
|
rubyforge_project:
|
325
|
-
rubygems_version: 2.5.2
|
325
|
+
rubygems_version: 2.5.2.3
|
326
326
|
signing_key:
|
327
327
|
specification_version: 4
|
328
328
|
summary: Extensions for Ruby to make Rubymotion development more enjoyable, and hopefully
|