Global View (app.xml) (deprecated)

app.xml is considered deprecated

Support for app.xml may be dropped in future versions of the JourneyApps Runtime. Please upgrade your app to use the Navigation Drawer to ensure that your app remains compatible with the JourneyApps Runtime.

The current implementation allows overriding the default Messages menu item in the hamburger sidemenu, adding arbitrary other menu items, and customizing the app badge counter. The feature requires the "Call JS functions from XML" feature flag.

Open the mobile/app.xml file via the command palette in OXIDE. Please note that new apps are no longer created with an app.xml file.

The format can be seen in the following example.

mobile/app.xml
<app>
    <!-- Manually control the number displayed on the app's badge, like this: -->
    <notifications indicator="$:appBadgeCount()" />

    <nav>
    <!-- Add custom entries to the hamburger menu -->
        <menu>
            <!-- Declaring type="messages" will override the default Messages entry -->
            <item type="messages" label="In-tray" icon="ion-filing"  on-press="viewIntray()" indicator="$:intrayNewCount()" />
            <!-- Declaring type="custom" will add a new entry -->
            <item type="custom" label="Order Coffee" icon="ion-coffee"  on-press="orderCoffee()" />
        </menu>
    </nav>
</app>

When push notifications are enabled for an app (ie. there exists a model with notify-user tag), the default Messages menu item appears in the side menu. This menu item can be hidden by adding one or more items of type="messages" in the menu section of app.xml. The referenced functions in the on-press and indicator should be defined in the SharedJS (these are executed in the context of the current view state).

function viewIntray() {
    return link.intray();
}

function intrayNewCount() {
    return DB.message_items.where('recipient = ? and status = ?', user, 0).count();
}

function appBadgeCount() {
   return intrayNewCount();
}

The on-press functions are standard and can perform navigation as you would expect - perhaps to a custom messages view. The menu items indicator functions should always return an integer (any greater than zero is displayed in brackets alongside the label) and are executed after sync completes or errors (exactly like the current Push Notification "messages" count).

Similarly, the notifications indicator function is executed after the notify-user (push notification) objects are processed for the received-field, and updates the external app badge. Notice that this is useful when you have more than one model generating push notifications: eg. new job assignments and approval workflow for quotes. Note that these count functions should be very lean and fast.

Replacing the hamburger menu logo image with your own

Version compatibility

The ability to replace the hamburger menu logo image with your own was introduced in version 4.25.3 of the JourneyApps Container.

The <menu> item now supports a <logo> child:

<logo src="images/my-png.png" />

where images/my-transparent-png.png is an image uploaded via the Assets panel on OXIDE. (Similarly to what you would use for display-image)

Example:

<app>
    <nav>
        <menu>
            <logo src="images/my-png.png" />
        </menu>
    </nav>
</app>

Notes about the logo:

  • Only .png files supported

  • We recommend a transparent background

Last updated