Basic-Car-Maintenance
Basic-Car-Maintenance copied to clipboard
Implement AddOdometerReading AppIntent
What it Does
- Closes #222 Implement shortcut for adding new odometer reading
What is implemented?
-
Vehicle
now conforms toAppEntity
protocol, hence, it should have an explicitid
, which representsdocumentId
under the hood -
VehicleQuery
is simply fetching vehicles from the server -
DistanceUnit
enum is used to make it more readable for selecting Distance unit - In
AddOdometerReadingIntent
, validation is applied toDistance
, and if the vehicles are empty, then the user will not be able to finish the shortcut
How I Tested
Happy Scenario
- Install the app
- Make sure at least one vehicle is added in the app by going to
Settings
tab >Add Vehicle
- Switch to Shortcuts app
- Tab on the
+
on the top right corner - Tab on
⨁ Add Action
- Select
Apps
tab - Tab on
Basic Car
- Tab on
Add Odometer Reading
- Add data for all fields and tab the play button on the bottom right corner
- See the result
Unhappy Scenario
Senario1
- Install the app
- Make sure at least one vehicle is added in the app by going to
Settings
tab >Add Vehicle
- Switch to Shortcuts app
- Tab on the
+
on the top right corner - Tab on
⨁ Add Action
- Select
Apps
tab - Tab on
Basic Car
- Tab on
Add Odometer Reading
- Try to set distance value to zero or negative value
- See the result (user won't be able to proceed if the distance value is less than 1)
Senario2
- Install the app
- Make sure no vehicles are added
- Switch to Shortcuts app
- Tab on the
+
on the top right corner - Tab on
⨁ Add Action
- Select
Apps
tab - Tab on
Basic Car
- Tab on
Add Odometer Reading
- Try to set distance value to zero or negative value
- See the result (user won't be able to proceed because there are no vehicles)