TransportViewModel

class TransportViewModel @Inject constructor(validators: Validators, selectRouteUseCase: SelectRouteUseCase, insertCargoUseCase: InsertCargoUseCase, updateCargoUseCase: UpdateCargoUseCase, addImagesUseCase: AddImagesUseCase, deleteActiveTransportUseCase: DeleteActiveTransportUseCase, setDriverUseCase: SetDriverUseCase, deleteImageUseCase: DeleteImageUseCase, getActiveTransportUseCase: GetActiveTransportUseCase, finishTransportUseCase: FinishTransportUseCase) : ViewModel

ViewModel for managing transport-related logic and data.

This ViewModel is annotated with HiltViewModel for Dagger-Hilt integration.

Constructors

Link copied to clipboard
@Inject
constructor(validators: Validators, selectRouteUseCase: SelectRouteUseCase, insertCargoUseCase: InsertCargoUseCase, updateCargoUseCase: UpdateCargoUseCase, addImagesUseCase: AddImagesUseCase, deleteActiveTransportUseCase: DeleteActiveTransportUseCase, setDriverUseCase: SetDriverUseCase, deleteImageUseCase: DeleteImageUseCase, getActiveTransportUseCase: GetActiveTransportUseCase, finishTransportUseCase: FinishTransportUseCase)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard

Initiates the process of deleting the active transport, including deleting associated images.

Link copied to clipboard
fun deleteImageOnIndex(imageUuid: UUID)

Deletes the image associated with the specified UUID from the transport state.

Link copied to clipboard

Initiates the process of finishing the transport and updates the UI state accordingly.

Link copied to clipboard

Checks if the entered cargo number is valid and saves the cargo information if valid.

Link copied to clipboard
fun isDriverNameValid(hasDriverName: Boolean, hasLicensePlate: Boolean)

Checks if the entered driver name and license plate are valid and performs the necessary actions.

Link copied to clipboard

Checks if the entered route number is valid and performs the necessary actions.

Link copied to clipboard

Checks if the entered transport details are valid and performs the necessary actions.

Link copied to clipboard
fun onTakePhoto(bitmap: Bitmap)

Handles the process after taking a photo with the camera, and updates the transport state with the captured image.

Link copied to clipboard

Toggles the state of various dialogs based on the provided DialogToggleEvent.

Link copied to clipboard
Link copied to clipboard

Initiates the process of scanning a cargo number using the device's camera.

Link copied to clipboard

Initiates the process of scanning a route number using the device's camera.