applin-rails 0.5.0 → 0.7.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
  SHA256:
3
- metadata.gz: 7cdc30c31c59b934ab7a5592ca8c6e380025e19d9fd5d349eb50239cd86caf29
4
- data.tar.gz: 303ed1586f7fa12a4b0ff4d8fb2b9db12671e503b73a556700aea0f2415207e3
3
+ metadata.gz: 9549a088e20dc0e39d0152d3a13be7c4f1bcb2202ce9fd3b78c87793ddba0dff
4
+ data.tar.gz: d6c833d8898a537d2542c861273aac8a4908d7d7cbe0b39a59ad22b2b607b106
5
5
  SHA512:
6
- metadata.gz: 257fbad034bd0e46bbc2b122076ce3bfa4e0bd75db1bdec47dc6fec40473b36e9bbf89a2ab59ba91350fa71a340f0e3cb9b18394aaf734a2b71842dd1f3b3940
7
- data.tar.gz: 16e60297df8d5d96f8ba089f6c01210a860fa192fabff0614d4f4841974ab3755f8661f37ac112a44ab2a8fa3eea41728aba461673b3fe1d2bd940d624691e61
6
+ metadata.gz: 84fe8b3b2b3da47a61027ea8e7187e366e2ae82a22e9c6449780beb1113aff83abb5399208749827801ce35fd95a2ee06138cde56bac84c90e44e8ebbb4713be
7
+ data.tar.gz: 2a75e3c118c8811a43e14033fb29949d2947cc4994b45c4c14e23dc26b53bc982e2edade9d4ff8743f4368cf125b33aa5b92c760e47ee052736ef64ac9a81e5d
data/CHANGELOG.md CHANGED
@@ -0,0 +1,10 @@
1
+ ## applin Ruby Gem Changes
2
+ - v0.7.0
3
+ - Support ApplinIos 0.32.0.
4
+ - Remove on_user_error_poll action and make it a parameter of the rpc action.
5
+ - Add `modal` action.
6
+ - Add `aspect_ratio` param to `choose_photo` and `take_photo` actions.
7
+ - v0.6.0
8
+ - Support ApplinIos v0.25.0.
9
+ - Add `poll_delay_ms` to checkbox and textfield.
10
+ - Remove checkbox `rpc` field.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Applin
4
4
  module Rails
5
- VERSION = "0.5.0"
5
+ VERSION = "0.7.0"
6
6
  end
7
7
  end
data/lib/applin/rails.rb CHANGED
@@ -6,7 +6,6 @@ Mime::Type.register "application/vnd.applin_response", :applin
6
6
  module Applin
7
7
  # Helper functions for creating Applin responses from controllers.
8
8
  module Rails
9
-
10
9
  module_function
11
10
 
12
11
  def send_page(page, options = {})
data/lib/applin.rb CHANGED
@@ -20,6 +20,90 @@ module Applin
20
20
 
21
21
  module_function
22
22
 
23
+ # Actions ###################################################################
24
+
25
+ def choose_photo(upload_url:, aspect_ratio: nil)
26
+ { typ: "choose_photo", url: upload_url, aspect_ratio: aspect_ratio }
27
+ end
28
+
29
+ def copy_to_clipboard(text)
30
+ { typ: "copy_to_clipboard", string_value: text }
31
+ end
32
+
33
+ def launch_url(url)
34
+ { typ: "launch_url", url: url }
35
+ end
36
+
37
+ def logout
38
+ { typ: "logout" }
39
+ end
40
+
41
+ def modal_button(text:, actions:)
42
+ { text: text, actions: actions }
43
+ end
44
+
45
+ def modal(title:, buttons:, message: nil)
46
+ { typ: "modal", title: title, message: message, buttons: buttons }
47
+ end
48
+
49
+ def poll
50
+ { typ: "poll" }
51
+ end
52
+
53
+ def pop
54
+ { typ: "pop" }
55
+ end
56
+
57
+ def push(page_key)
58
+ { typ: "push", page: page_key }
59
+ end
60
+
61
+ def replace_all(page_key)
62
+ { typ: "replace_all", page: page_key }
63
+ end
64
+
65
+ def rpc(url:, on_user_error_poll: nil)
66
+ { typ: "rpc", url: url, on_user_error_poll: on_user_error_poll }
67
+ end
68
+
69
+ def take_photo(upload_url:, aspect_ratio: nil)
70
+ { typ: "take_photo", url: upload_url, aspect_ratio: aspect_ratio }
71
+ end
72
+
73
+ # Pages #####################################################################
74
+
75
+ def nav_page(
76
+ title:,
77
+ start: nil,
78
+ end_: nil,
79
+ ephemeral: nil,
80
+ stream: nil,
81
+ poll_seconds: nil,
82
+ &widget_block
83
+ )
84
+ {
85
+ typ: :nav_page,
86
+ start: start,
87
+ end: end_,
88
+ ephemeral: ephemeral,
89
+ title: title,
90
+ stream: stream,
91
+ poll_seconds: poll_seconds,
92
+ widget: widget_block.yield,
93
+ }.compact
94
+ end
95
+
96
+ def plain_page(title: nil, ephemeral: nil, stream: nil, poll_seconds: nil, &widget_block)
97
+ {
98
+ typ: :plain_page,
99
+ title: title,
100
+ ephemeral: ephemeral,
101
+ stream: stream,
102
+ poll_seconds: poll_seconds,
103
+ widget: widget_block.yield,
104
+ }.compact
105
+ end
106
+
23
107
  # Widgets ###################################################################
24
108
 
25
109
  def back_button(actions:)
@@ -30,12 +114,12 @@ module Applin
30
114
  { typ: :button, text: text, actions: actions }
31
115
  end
32
116
 
33
- def checkbox(text:, var_name:, actions: nil, initial_bool: nil, rpc: nil)
117
+ def checkbox(text:, var_name:, actions: nil, initial_bool: nil, poll_delay_ms: nil)
34
118
  {
35
119
  typ: :checkbox,
36
120
  actions: actions,
37
121
  initial_bool: initial_bool,
38
- rpc: rpc,
122
+ poll_delay_ms: poll_delay_ms,
39
123
  text: text,
40
124
  var_name: var_name,
41
125
  }.compact
@@ -118,7 +202,8 @@ module Applin
118
202
  label: nil,
119
203
  max_chars: nil,
120
204
  max_lines: nil,
121
- min_chars: nil
205
+ min_chars: nil,
206
+ poll_delay_ms: nil
122
207
  )
123
208
  {
124
209
  typ: :textfield,
@@ -130,89 +215,10 @@ module Applin
130
215
  max_chars: max_chars,
131
216
  max_lines: max_lines,
132
217
  min_chars: min_chars,
218
+ poll_delay_ms: poll_delay_ms,
133
219
  var_name: var_name,
134
220
  }.compact
135
221
  end
136
222
 
137
- # Pages #####################################################################
138
-
139
- def nav_page(
140
- title:,
141
- start: nil,
142
- end_: nil,
143
- ephemeral: nil,
144
- stream: nil,
145
- poll_seconds: nil,
146
- &widget_block
147
- )
148
- {
149
- typ: :nav_page,
150
- start: start,
151
- end: end_,
152
- ephemeral: ephemeral,
153
- title: title,
154
- stream: stream,
155
- poll_seconds: poll_seconds,
156
- widget: widget_block.yield,
157
- }.compact
158
- end
159
-
160
- def plain_page(title: nil, ephemeral: nil, stream: nil, poll_seconds: nil, &widget_block)
161
- {
162
- typ: :plain_page,
163
- title: title,
164
- ephemeral: ephemeral,
165
- stream: stream,
166
- poll_seconds: poll_seconds,
167
- widget: widget_block.yield,
168
- }.compact
169
- end
170
-
171
- # Actions ###################################################################
172
-
173
- def choose_photo(upload_url:)
174
- "choose_photo:#{upload_url}"
175
- end
176
-
177
- def copy_to_clipboard(text)
178
- "copy_to_clipboard:#{text}"
179
- end
180
-
181
- def launch_url(url)
182
- "launch_url:#{url}"
183
- end
184
-
185
- def logout
186
- "logout"
187
- end
188
-
189
- def nothing
190
- "nothing"
191
- end
192
-
193
- def poll
194
- "poll"
195
- end
196
-
197
- def pop
198
- "pop"
199
- end
200
-
201
- def push(page_key)
202
- "push:#{page_key}"
203
- end
204
-
205
- def replace_all(page_key)
206
- "replace_all:#{page_key}"
207
- end
208
-
209
- def rpc(url)
210
- "rpc:#{url}"
211
- end
212
-
213
- def take_photo(upload_url:)
214
- "take_photo:#{upload_url}"
215
- end
216
-
217
223
  # rubocop:enable Metrics/MethodLength, Metrics/ParameterLists
218
224
  end
data/sig/applin.rbs CHANGED
@@ -27,7 +27,8 @@ module Applin
27
27
  DISPOSITION_STRETCH: disposition
28
28
  VERSION: String
29
29
 
30
- type action = String
30
+ type action = { typ: String }
31
+ type modal_button = { text: String, actions: Array[action] }
31
32
  type page = { title: String }
32
33
  type widget = { typ: String }
33
34
 
@@ -35,9 +36,15 @@ module Applin
35
36
 
36
37
  def button: (text: String, actions: Array[action]) -> widget
37
38
 
38
- def checkbox: (text: String, var_name: String, actions: Array[action]?, initial_bool: bool?, rpc: String?) -> widget
39
+ def checkbox: (
40
+ text: String,
41
+ var_name: String,
42
+ actions: Array[action]?,
43
+ initial_bool: bool?,
44
+ poll_delay_ms: Numeric?,
45
+ ) -> widget
39
46
 
40
- def choose_photo: (upload_url: String) -> action
47
+ def choose_photo: (upload_url: String, aspect_ratio: Numeric?) -> action
41
48
 
42
49
  def column: (widgets: Array[widget], align: alignment?, spacing: Numeric?) -> widget
43
50
 
@@ -63,6 +70,10 @@ module Applin
63
70
 
64
71
  def logout: -> action
65
72
 
73
+ def modal_button: (text: String, actions: Array[action]) -> modal_button
74
+
75
+ def modal: (title: String, message: String?, buttons: Array[modal_button]) -> action
76
+
66
77
  def nav_button: (text: String, actions: Array[action], badge_text: String?, photo_url: String?, sub_text: String?) -> widget
67
78
 
68
79
  def nav_page: (
@@ -74,8 +85,6 @@ module Applin
74
85
  poll_seconds: Numeric?,
75
86
  ) { () -> widget } -> page
76
87
 
77
- def nothing: -> action
78
-
79
88
  def plain_page: (
80
89
  title: String?,
81
90
  ephemeral: bool?,
@@ -91,13 +100,13 @@ module Applin
91
100
 
92
101
  def replace_all: (String) -> action
93
102
 
94
- def rpc: (String) -> action
103
+ def rpc: (url: String, on_user_error_poll: bool?) -> action
95
104
 
96
105
  def scroll: () { () -> widget } -> widget
97
106
 
98
107
  def table: (rows: Array[Array[widget]], spacing: Numeric?) -> widget
99
108
 
100
- def take_photo: (upload_url: String) -> action
109
+ def take_photo: (upload_url: String, aspect_ratio: Numeric?) -> action
101
110
 
102
111
  def text: (String) -> widget
103
112
 
@@ -110,6 +119,7 @@ module Applin
110
119
  label: String?,
111
120
  max_chars: Numeric?,
112
121
  max_lines: Numeric?,
113
- min_chars: Numeric?
122
+ min_chars: Numeric?,
123
+ poll_delay_ms: Numeric?
114
124
  ) -> widget
115
125
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: applin-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Leonhard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-26 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Create mobile apps using only backend code. Applin™ is a Server-Driven
14
14
  UI (SDUI) system.