CSUserSession

@interface CSUserSession : CSSession
  This class is the heart of the transmit application. Once the session is created with the usageToken
  you can identify the user to the session by setting the trackingIdentifier and then be able to start/complete/cancel trips to different
  sites which are prefefined on the ARRIVE platorm.
  •   The sites which can be currently (at the time of the call) notified that the user has arrived at the site.
    

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        NSSet<CSSite *> *_Nonnull sitesToNotifyMonitoringSessionUserOfArrival;
  • The delegate object for the CSUserSession.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) id delegate;

    Swift

    var delegate: Any? { get set }
  • This returns all the currently tracked CSSite(s) for the sigened in user.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSSet<CSSite *> *_Nonnull trackedSites;
  •   Consumers should be using this method to create a new session with their usageToken. The state of the session
      can be checked using the sessionState property. The delegate is also notified of sessionState changes  by the
      delegate callback.
    
      Note: The usage token is scoped to the Production and Sandbox. Make sure to use the production usage token when deploying
      your app to the Apple App Store.
    

    Declaration

    Objective-C

    + (nonnull instancetype)createSessionWithUsageToken:
                                (nonnull NSString *)usageToken
                                               delegate:(nullable id)delegate;

    Swift

    class func createSession(withUsageToken usageToken: Any!, delegate: Any?) -> Self!
  •   This method returns the CSUserSession initialized by createSessionWithUsageToken:delegate:.
    

    Declaration

    Objective-C

    + (nonnull instancetype)currentSession;

    Swift

    class func current() -> Self!
  • Call this method to notify the user in the CSMonitoringSession of the arrival of this user at the site.

    Declaration

    Objective-C

    - (void)notifyMonitoringSessionUserOfArrivalAtSite:(nonnull CSSite *)site;

    Swift

    func notifyMonitoringSessionUserOfArrival(atSite site: Any!)
  •   Start a trip tracking the user to the site identified by the siteID. Call this method when
      the application thinks its appropriate to start tracking the user eg. Order is ready to be picked up at
      the site. This information is persisted across relaunch.
    
      If an error occurs because of an invalid session state, permissions or authentication with the ARRIVE server,
      the CSUserSessionDelegate will be informed with the reason as to why startTripToSiteWithIdentifier: failed.
    

    Declaration

    Objective-C

    - (void)startTripToSiteWithIdentifier:(nonnull NSString *)siteID
                               trackToken:(nonnull NSString *)trackToken;

    Swift

    func startTripToSite(withIdentifier siteID: Any!, trackToken: Any!)
  •   Completes the trip for the user to the site identified by the siteID with the given trackToken.
       If no trackToken is specified, then *all*   trips to this site  will be completed.
    
      - note: Do not call this when the user logs out, instead set the trackingIdentifier to nil when the user logs out.
    

    Declaration

    Objective-C

    - (void)completeTripToSiteWithIdentifier:(nonnull NSString *)siteID
                                  trackToken:(nullable NSString *)trackToken;

    Swift

    func completeTripToSite(withIdentifier siteID: Any!, trackToken: Any!)
  •   This method would complete all trips for this user across all devices.
    
      - note: Do not call this when the user logs out, instead set the trackingIdentifier to nil when the user logs out.
    

    Declaration

    Objective-C

    - (void)completeAllTrips;

    Swift

    func completeAllTrips()
  •   Cancels the trip for the user to the given site identified by the siteID with the given trackToken. 
      If no trackToken is set, then *all* trips to this site are cancelled.
    
      - note: Do not call this when the user logs out, instead set the trackingIdentifier to nil when the user logs out.
    

    Declaration

    Objective-C

    - (void)cancelTripToSiteWithIdentifier:(nonnull NSString *)siteID
                                trackToken:(nullable NSString *)trackToken;

    Swift

    func cancelTripToSite(withIdentifier siteID: Any!, trackToken: Any!)
  •   This method will cancels all trips for all sites for the user.
    
      - note: Do not call this when the user logs out, instead set the trackingIdentifier to nil when the user logs out.
    

    Declaration

    Objective-C

    - (void)cancelAllTrips;

    Swift

    func cancelAllTrips()
  • This method would update the ARRIVE SDK with the current state of tracked trips for the user from the server.

    Declaration

    Objective-C

    - (void)updateTripsFromServer;

    Swift

    func updateTripsFromServer()
  •   This method simulates a mock trip to the site. It does the following :
          - startTripToSiteWithIdentifier: with the given site
          - Gets a route from the given startLocation to the site
          - Sends up the location on the route to the site at regular intervals to ARRIVE Server
    
      - note: You must cancel the trip using cancelMockTrip, once you are done. You can only do one Mock trip at a time.
    

    Declaration

    Objective-C

    - (void)startMockTripToSiteWithIdentifier:(nonnull NSString *)siteID
                                 fromLocation:(nonnull CLLocation *)startLocation;

    Swift

    func startMockTripToSite(withIdentifier siteID: Any!, from startLocation: CLLocation!)
  •   This method cancels the mock trip started by the startMockTripToSite:fromLocation: method
    
      - note: You must call this method if you have started a MockTrip using startMockTripToSiteWithIdentifier:fromLocation:
    

    Declaration

    Objective-C

    - (void)cancelMockTrip;

    Swift

    func cancelMockTrip()