Skip to content

7.7.0

Compare
Choose a tag to compare
@ferologics ferologics released this 21 Aug 20:15
· 8 commits to master since this release

Added

Example use for worker clock in:

fun handlePresence(isInsideResult: Result<Boolean, HyperTrackLocationError>) {
  when (isInsideResult) {
    is Result.Success -> {
      val isInside = isInsideResult.getOrNull() ?: false
      if (isInside) {
        // allow worker to clock in for the shift
      } else {
        // "to clock in you must be at order destination"
      }
    }
    is Result.Failure -> {
      // resolve any tracking errors to obtain geofence presence
    }
  }
}

// Check if a worker is inside an order's geofence
handlePresence(HyperTrack.orders["my_order"]?.isInsideGeofence)

// Or, listen to order.isInsideGeofence changes
HyperTrack.subscribeToOrders { orders ->
  handlePresence(orders["my_order"]?.isInsideGeofence)
}