sugarcube 3.4.2 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40fbf73a4729e86be4cbfb2206e7a4eed2e513cb
4
- data.tar.gz: bd31a4f4ef0326fa17d5cbdea5fc45f250d5f670
3
+ metadata.gz: 19287c88598dd0086ec1cc07a160a663deb94f25
4
+ data.tar.gz: '085dc95c41fca4414a9df3461aa1a50bc40fb9a1'
5
5
  SHA512:
6
- metadata.gz: 6c67338b6955217169f8913cb329734b4b175124a97506c4d9cd44e23612b82487a09f43ce7a8f61e6db52a3bd1e1db3e03541a02d624e532a29b840a41779f8
7
- data.tar.gz: 41a5308e47bf580afd1ed7d8d4e7d02fe8d287f75efe383cadbd3ad6a40512248f5d92487e3255f9cf45cd6e6f8972a5acd444916fb07c70a0c61b4ea621b12b
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
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '3.4.2'
2
+ Version = '3.5.0'
3
3
  end
@@ -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.2
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: 2017-11-29 00:00:00.000000000 Z
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