Skip to content

Commit

Permalink
Support ApplinIos 0.32.0. Remove on_user_error_poll action and make i…
Browse files Browse the repository at this point in the history
…t a parameter of the rpc action. Add `modal` action. Add `aspect_ratio` param to `choose_photo` and `take_photo` actions.
  • Loading branch information
mleonhard committed Jan 10, 2024
1 parent f061ac7 commit 7b41366
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## applin Ruby Gem Changes
- v0.7.0
- Support ApplinIos 0.32.0.
- Remove on_user_error_poll action and make it a parameter of the rpc action.
- Add `modal` action.
- Add `aspect_ratio` param to `choose_photo` and `take_photo` actions.
- v0.6.0
- Support ApplinIos v0.25.0.
- Add `poll_delay_ms` to checkbox and textfield.
Expand Down
34 changes: 19 additions & 15 deletions lib/applin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,52 @@ module Applin

# Actions ###################################################################

def choose_photo(upload_url:)
"choose_photo:#{upload_url}"
def choose_photo(upload_url:, aspect_ratio: nil)
{ typ: "choose_photo", url: upload_url, aspect_ratio: aspect_ratio }
end

def copy_to_clipboard(text)
"copy_to_clipboard:#{text}"
{ typ: "copy_to_clipboard", string_value: text }
end

def launch_url(url)
"launch_url:#{url}"
{ typ: "launch_url", url: url }
end

def logout
"logout"
{ typ: "logout" }
end

def on_user_error_poll
"on_user_error_poll"
def modal_button(text:, actions:)
{ text: text, actions: actions }
end

def modal(title:, buttons:, message: nil)
{ typ: "modal", title: title, message: message, buttons: buttons }
end

def poll
"poll"
{ typ: "poll" }
end

def pop
"pop"
{ typ: "pop" }
end

def push(page_key)
"push:#{page_key}"
{ typ: "push", page: page_key }
end

def replace_all(page_key)
"replace_all:#{page_key}"
{ typ: "replace_all", page: page_key }
end

def rpc(url)
"rpc:#{url}"
def rpc(url:, on_user_error_poll: nil)
{ typ: "rpc", url: url, on_user_error_poll: on_user_error_poll }
end

def take_photo(upload_url:)
"take_photo:#{upload_url}"
def take_photo(upload_url:, aspect_ratio: nil)
{ typ: "take_photo", url: upload_url, aspect_ratio: aspect_ratio }
end

# Pages #####################################################################
Expand Down
2 changes: 1 addition & 1 deletion lib/applin/rails/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Applin
module Rails
VERSION = "0.6.0"
VERSION = "0.7.0"
end
end
15 changes: 9 additions & 6 deletions sig/applin.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ module Applin
DISPOSITION_STRETCH: disposition
VERSION: String

type action = String
type action = { typ: String }
type modal_button = { text: String, actions: Array[action] }
type page = { title: String }
type widget = { typ: String }

Expand All @@ -43,7 +44,7 @@ module Applin
poll_delay_ms: Numeric?,
) -> widget

def choose_photo: (upload_url: String) -> action
def choose_photo: (upload_url: String, aspect_ratio: Numeric?) -> action

def column: (widgets: Array[widget], align: alignment?, spacing: Numeric?) -> widget

Expand All @@ -69,6 +70,10 @@ module Applin

def logout: -> action

def modal_button: (text: String, actions: Array[action]) -> modal_button

def modal: (title: String, message: String?, buttons: Array[modal_button]) -> action

def nav_button: (text: String, actions: Array[action], badge_text: String?, photo_url: String?, sub_text: String?) -> widget

def nav_page: (
Expand All @@ -80,8 +85,6 @@ module Applin
poll_seconds: Numeric?,
) { () -> widget } -> page

def on_user_error_poll: -> action

def plain_page: (
title: String?,
ephemeral: bool?,
Expand All @@ -97,13 +100,13 @@ module Applin

def replace_all: (String) -> action

def rpc: (String) -> action
def rpc: (url: String, on_user_error_poll: bool?) -> action

def scroll: () { () -> widget } -> widget

def table: (rows: Array[Array[widget]], spacing: Numeric?) -> widget

def take_photo: (upload_url: String) -> action
def take_photo: (upload_url: String, aspect_ratio: Numeric?) -> action

def text: (String) -> widget

Expand Down

0 comments on commit 7b41366

Please sign in to comment.