Messages from TableRealms

You need to implement a single function we call in the WebView it will take a single object as a parameter.


window.receiveTRAction = function(action) {
    switch (action.a){
    case 'ExitApplication':
        // Perform the exit function here.
        break;
    case 'OpenLink':
        // Perform the open link here.
        break;
    case 'CreateAppointment':
        // Perform creation of an appointment (Diary entry)
        break;
    case 'SendEmail':
        // Start the creation of an email here
        break;
    case 'Navigate':
        // Perform custom navigation. 
        break;
    case 'ScanQRCode':
        // A request to scan a QR code and return that value. 
        break;
    case 'Share':
        // A request to share a URL via the platforsm share facility. 
        break;
    case 'Orientation':
        // A request to change the orientation of the display. 
        break;
    case 'PlayVideo':
        // A request to play a video fullscreen. This will include information if it should be player landscape or portrait
    case 'MakePurchase':
        // A request o execute a purchase
    case "RequestLocation":
        // A request for the current GPS location
    }
};

Below is a breakdown of each instruction and it’s parameters that will be sent to you.

ExitApplication

Instructs the containing WebView to close teh application and navigate back as it would do in general.

This has no additional parameters.

Instructs the holding WebView to ask the local environment to open a url in a separate browser.

Param Description
url The url to open in the external browser.

CreateAppointment

Instructs the holding WebView to request the OS to perform the creation of a diary appointment.

Param Description
description
start Start date time. Date()
end End date time. Date()

SendEmail

Instructs the holding WebView to request the OS performs the creation of an email.

Param Description
description
to Destination email address.
subject Subject line.
content Optional content line for the email.

This is a custom navigation instruction to your application to redirect the user to a place within.

Param Description
to Primary navigation string.
argument Custom parameter object with whatever you need to perform the navigation.

ScanQRCode

This is a request for the device to scan a QR code and return the string value back to the application.

Param Description
reference The reference for the return string so the application can tie it to the request.

Share

This is a request for the application to share a URL via the share feature of the operating system.

Param Description
title The title to use when sharing.
text The text description for the share.
url The URL to share.

Orientation

This is a request for the application to change the orientation of the phone.

Param Description
orientation Either Landscape or Portrait.

PlayVideo

This is a request to play a video full screen. The user may not be able to interrupt this video playback.

Param Description
orientation Either Landscape or Portrait.
videoUrl The url for the video clip to be played.
interruptible Boolean true or false if false the playback must be completed before the video can ended.

Once the video has completed and returning to the app please see the PlayVideoResult message that needs to be sent.

MakePurchase

A request o execute a purchase using whatever technologies suit the implementation. This could be credit card, play stores or add to bill for some situations. The implementation will be determined by the business needs.

Param Description
purchaseId A unique id that represents the purchase, this will be used to give feedback to the server when the purchase has been done.
name The product name being purchased.
description The description of the purchased product.
value The value of the product being purchased, the currency for this is determined by the implementation and not the call.
meta This is a dictionary of custom values configured and delivered to the front end for the application. This will be an empty set if no meta data has been configured.

After the purchase has been made a secure call to the backend needs to be made from the web server. The call is a post to an application url that we will supply. The payload is a JSON record.

{
    "purchaseId": "...", //The purchase id supplied in the original call
    "status": "Success/Failed"
}

This call should happen before the application returns to the app. When returning to the app please see the MakePurchaseResult message that needs to be sent.

RequestLocation

This is sent with no parameters as a request to get the current location of the device. Once completed the implementation should send the Location message as described in Messages to Table