AppState

final class AppState : ObservableObject

Envirorment object that holds the globl state of the app

  • The userID of the user we want to mock

    Declaration

    Swift

    var userID: String { get set }
  • If there is an active ticket is is held here

    Declaration

    Swift

    @Published
    var activeTicket: Ticket? { get set }
  • The total amount of CO2 the user has saved by taking public tansport

    Declaration

    Swift

    @Published
    var totalCO2: Int { get set }
  • Valid coupons the user has erned.

    Declaration

    Swift

    @Published
    var coupons: [Coupon] { get set }
  • Sends a request for ticket mocking to server

    Declaration

    Swift

    func activateTicket()
  • Invalidates the ticket client side.

    Declaration

    Swift

    func invalidateTicket()
  • Represents the visual state the tree should be in

    Declaration

    Swift

    var treeLevel: Int { get }
  • Fetches the wallet from the backend and updates the local state.

    Declaration

    Swift

    func refreshWallet()
  • Fetches the coupons from the backend and updates the local state.

    Declaration

    Swift

    func refreshCoupons()