Action/Help Button
  • 16 Apr 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Action/Help Button

  • Dark
    Light

Article summary

An optional Action button can be added to the top right of the Tickets Nav Bar.

Hidden Action Button

By default, this Action button is hidden:

TMTickets.shared.navBarButtonTitle = nil

Action-NoButton

Custom Action Button

You can set the title of the Action button to any string you want, though preferrably something short:

TMTickets.shared.navBarButtonTitle = "Help"

Action-Ticket

TMTickets.shared.navBarButtonTitle = "Chat"

Action-ChatButton

Relevant Action Button Pages

The Action button will be shown on the top right of the Tickets Page, Back of Ticket Page, and Barcode Page:

TicketBack of TicketBarcode
Action-TicketAction-BackOfTicketAction-Barcode2

Button Functionality

Pressing the Action button does not do anything by itself. The Tickets SDK does not currently have any built-in operations, such as Help or Chat.

If you enable the Action button, you must handle the button's functionality yourself in the TMTicketsOrderDelegate:

// set your class as the orderDelegate
TMTickets.shared.orderDelegate = self

/// optional delegate to be informed of non-analytics User-actions
extension MyClass: TMTicketsOrderDelegate {

/// Method is invoked if the client app needs to handle the navBar button
///
/// - Parameters:
///   - page: SDK page where button was pressed
///   - screenTitleName: title of screen where button was pressed
///   - event: current Event and purchased Orders being viewed (if any)
func handleNavBarButtonAction(
  page: TicketmasterTickets.TMTickets.Analytics.Page, 
  screenTitleName: String?, 
  event: TicketmasterTickets.TMPurchasedEvent?) {
    // TODO: handle Action button operation yourself
    // for example, open a webpage, or a native ViewController, or some other SDK
    if let event = event {
        if let name = screenTitleName {
            print("User Pressed NavBar Button on Page: \(page.rawValue) Named: \(name) Event: \(event.info.identifier)")
        } else {
            print("User Pressed NavBar Button on Page: \(page.rawValue) Event: \(event.info.identifier)")
        }
    } else if let name = screenTitleName {
        print("User Pressed NavBar Button on Page: \(page.rawValue) Named: \(name)")
    } else {
        print("User Pressed NavBar Button on Page: \(page.rawValue)")
    }
}

Was this article helpful?

What's Next