Table realms only accepts two messages currently. Of course specific applications may require additional messages especially for authentication requirements.
You are required to call this once when you have added your code to WebView for message processing.
window.tableRealmsInit();
The application may require information injected in before you call init. Such information could be a token for authentication or other user information that application can use.
Below are just some examples it’s completely flexible and could be extended for various applications.
Often a token will be needed so we can extend the user’s session from the application we hosted in to the new application running. Specifics of this token and how it’s authenticated will be up to the individual team implementing them. Below is an example of how that would be added.
window.token="ABCDEFG12354";
If applications require the ability to show different information based on the location a country code could be passed in.
window.country="ZA";
If your application requires language codes use this value.
window.language="eng";
If your application has a user profile image and would like to use it in a TR application it can be shared below.
window.profileImageUrl="https://someurl.com/profile.jpg";
Many social logins like android give you a URL and you can pass that on to us direction. If you have an image in local storage you want to use you can provide it as a url with data.
There is a standard for supplying data in the url. Read more on Mozilla.org
data:[<mediatype>][;base64],<data>
For example the red dot from wikipedia
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
Just as you need to create an action listener Table Realms implements one of it’s own. These can be extended as needed but there is only one guaranteed function in the TableRealms.
window.receiveAction(action)
This instructs Table Realms to navigate back. If Table Realms has reached it’s main menu it will in turn instruct teh WebView to close the application. This is predominantly needed on Android where there is a Back button. User’s expect that to navigate in the application and if it does not that can cause some confusion.
window.receiveAction({
a:"back"
})
This is the returned value for a QR code scan request. You need to send back the reference value and the value scanned. If the scan was aborted send a null for the value.
window.receiveAction({
a:"qrCode",
reference:"...", // reference Code given when the scan was requested.
value:"..." // String value of the QR code scanned.
})