AdaSupport / ios-sdk

EmbedFramework is a small iOS SDK that is used to embed the Ada Chat bot into native iOS applications.
MIT License
4 stars 21 forks source link

CXP-185: Event callbacks #12

Closed NicHaley closed 4 years ago

NicHaley commented 4 years ago

Description

Adds eventCallbacks support to the iOS SDK. This allows a callback to be triggered by the App following a message in the bot.

To test, setup a JavaScript Event block in your bot. Set the bot handle in ExampleApp to your bot. Add the eventCallbacks attribute to your bot. Note: The JavaScript Event requires the custom_javascript_event_block feature flag be turned on.

ex.

lazy var adaFramework = AdaWebHost(handle: "nic", appScheme: "adaexampleapp", eventCallbacks: ["my-event": { event in print("it worked!") }])

Start the simulator and test. It should work! You can also try specifying a general callback with "*" as the key name. This will be triggered for any event.


Checklist

px0 commented 4 years ago

Oof you always tag me in those like I know what I'm doing 😅