Basic-Car-Maintenance icon indicating copy to clipboard operation
Basic-Car-Maintenance copied to clipboard

Implement AddOdometerReading AppIntent

Open OmarHegazy93 opened this issue 5 months ago • 2 comments

What it Does

  • Closes #222 Implement shortcut for adding new odometer reading

What is implemented?

  1. Vehicle now conforms to AppEntity protocol, hence, it should have an explicit id, which represents documentId under the hood
  2. VehicleQuery is simply fetching vehicles from the server
  3. DistanceUnit enum is used to make it more readable for selecting Distance unit
  4. In AddOdometerReadingIntent, validation is applied to Distance, and if the vehicles are empty, then the user will not be able to finish the shortcut

How I Tested

Happy Scenario

  1. Install the app
  2. Make sure at least one vehicle is added in the app by going to Settings tab > Add Vehicle
  3. Switch to Shortcuts app
  4. Tab on the + on the top right corner
  5. Tab on ⨁ Add Action
  6. Select Apps tab
  7. Tab on Basic Car
  8. Tab on Add Odometer Reading
  9. Add data for all fields and tab the play button on the bottom right corner
  10. See the result

Unhappy Scenario

Senario1

  1. Install the app
  2. Make sure at least one vehicle is added in the app by going to Settings tab > Add Vehicle
  3. Switch to Shortcuts app
  4. Tab on the + on the top right corner
  5. Tab on ⨁ Add Action
  6. Select Apps tab
  7. Tab on Basic Car
  8. Tab on Add Odometer Reading
  9. Try to set distance value to zero or negative value
  10. See the result (user won't be able to proceed if the distance value is less than 1)

Senario2

  1. Install the app
  2. Make sure no vehicles are added
  3. Switch to Shortcuts app
  4. Tab on the + on the top right corner
  5. Tab on ⨁ Add Action
  6. Select Apps tab
  7. Tab on Basic Car
  8. Tab on Add Odometer Reading
  9. Try to set distance value to zero or negative value
  10. See the result (user won't be able to proceed because there are no vehicles)

OmarHegazy93 avatar Aug 30 '24 08:08 OmarHegazy93