Skip to content

Commit

Permalink
Merge Feature/40 feature ride to destination (#54)
Browse files Browse the repository at this point in the history
* remove example client test

* remove module info

* Create :feature:ride test koin extensions

* Add setupKoin docs

* remove unsupported unit tests

* Move passenger test to :feature:ride module

* Specify annotation targets

* Add annotation defaults

* Create expiration date entity

* Use constants to express range expectations

* Add ExpirationDateTest

* Add payment selection to ride ui test

* Add PaymentMethod

* Add PaymentSelectionView

* Move PassengerDashboardView

* Add payment repository

* Add payment events

* Add payment method state to destination search ui state

* Bind payment method event callbacks to view model

* Use state class as content key

* Move RideViewModel

* Move files from dot-separated package directory

* Move remaining files from root to package directory

* Create local payment store

* Expand actions of payment repository

* update onSelectPayment to use Result

* Add payment data types to ride module

* Change payment method id to uuid-v4

* Fix invalid expiration date year

* Fix missing home route

* Fix wrong content description

* Update content description expectations for consistency

* Fix button expectation

* Fix test expectations

* Add arrived rider state

* Rename RideRequestRepository to reflect generalized purpose

* Reorganize test setup

* Add current trip observable

* rename service/cache

* Move test data to test setup

* Make test payment store accessible with test type

* rename TestPaymentStore

* implement fake request ride

* Move passenger profile to test setup

* Add testing event functions

* Finish test script

* implement test repository functions

* Rename RideViewModel.kt as Trip-

* Watch for accepted trip events

* Emit trip events

* Move MessageInput to :core:ui

* Review Drive.status forms

* reformat actions/expectations for clarity

* Add hailing message expectation

* Emit event in coroutine scope to ensure emission

* Add driver profile content description and message input

* Send trip request on detail confirmation

* replace arbitrary delay with smart wait

* Add user readable name to Accommodation

* replace BriefProfileUiState with DriverProfile

* Fix wrong text

* Add missing elements from active ride view

* Add smart wait for button

* Include profile and ride in each trip event

* cover remaining trip events

* Fill completed ride view

* wrap event emissions in coroutines

* add driver profile semantics; remove erroneous text

* Add cancel/rate view model events and bindings

* Add smart wait

* Fix arrival message

* Add missing done button
  • Loading branch information
TSampley authored Sep 24, 2024
1 parent a366467 commit 6d3ebc3
Show file tree
Hide file tree
Showing 36 changed files with 1,351 additions and 502 deletions.
1 change: 0 additions & 1 deletion .github/workflows/main-release-flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
- name: "Build: Assemble and Test entire project"
run: |
./gradlew :app-android:buildRelease
./gradlew testReleaseUnitTest
# - run: ./gradlew generate coverage report, upload test/coverage reports

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ package org.pointyware.xyz.core.common
/**
* Expresses a constraint on the length of a string.
*/
annotation class StringLength(val min: Int, val max: Int)
@Target(AnnotationTarget.PROPERTY)
annotation class StringLength(val min: Int = 0, val max: Int = Int.MAX_VALUE)

/**
* Expresses a constraint on the range of an integer.
*/
annotation class IntRange(val min: Int, val max: Int)
@Target(AnnotationTarget.PROPERTY)
annotation class IntRange(val min: Int = Int.MIN_VALUE, val max: Int = Int.MAX_VALUE)

/**
* Expresses a regular expression constraint on a string.
*/
annotation class Regex(val pattern: String)
@Target(AnnotationTarget.PROPERTY)
annotation class Regex(val pattern: String = "^.*$")
6 changes: 3 additions & 3 deletions core/entities/src/commonMain/kotlin/ride/Accommodation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable
* Describes a driver accommodation that can be provided to a rider with a [Disability].
*/
@Serializable
sealed class Accommodation {
data object WheelchairAccess : Accommodation()
data object AnimalFriendly : Accommodation()
sealed class Accommodation(val name: String) { // TODO: replace with resource ID for i18n
data object WheelchairAccess : Accommodation("Wheelchair Access")
data object AnimalFriendly : Accommodation("Animal Friendly")
}
18 changes: 13 additions & 5 deletions core/entities/src/commonMain/kotlin/ride/Ride.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sealed interface Ride {
/**
* The current status of the ride as it progresses through the system.
*/
val status: Status
val status: Status // TODO: remove; redundant

/**
* The time the ride was posted to the system by the rider.
Expand Down Expand Up @@ -110,6 +110,14 @@ sealed interface Ride {
val timeToStart: Instant
): Status, RouteProgress.Unrealized

/**
* The ride has been accepted by a driver for future completion.
* Possible transitions are [Active], [Ended]
*/
data class AcceptedImmediate(
val timeAccepted: Instant
): Status, RouteProgress.Unrealized

/**
* The ride is in progress.
* Possible transitions are [Ended]
Expand Down Expand Up @@ -242,7 +250,7 @@ data class PendingRide(
): Ride {

override val status: Ride.Status
get() = Ride.Status.Immediate
get() = Ride.Status.AcceptedImmediate(timeAccepted)

fun arrive(timeArrived: Instant): ActiveRide {
return ActiveRide(
Expand Down Expand Up @@ -271,7 +279,7 @@ data class ActiveRide(
): Ride {

override val status: Ride.Status
get() = Ride.Status.Active(TODO())
get() = Ride.Status.Active(plannedRoute)

fun start(timeStarted: Instant): CompletingRide {
return CompletingRide(
Expand Down Expand Up @@ -320,7 +328,7 @@ data class CompletingRide(
): Ride {

override val status: Ride.Status
get() = Ride.Status.Active(TODO())
get() = Ride.Status.Active(plannedRoute)

fun complete(timeEnded: Instant): CompletedRide {
return CompletedRide(
Expand Down Expand Up @@ -349,5 +357,5 @@ data class CompletedRide(
override val timeEnded: Instant,
): Ride {
override val status: Ride.Status
get() = Ride.Status.Completed(TODO())
get() = Ride.Status.Completed(plannedRoute)
}
25 changes: 25 additions & 0 deletions core/ui/src/commonMain/kotlin/MessageInput.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 Pointyware. Use of this software is governed by the GPL-3.0 license.
*/

package org.pointyware.xyz.core.ui

import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics

/**
*
*/
@Composable
fun MessageInput(
modifier: Modifier = Modifier,
) {
TextField(
value = "",
onValueChange = {},
modifier = modifier.semantics { contentDescription = "Message Input" }
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package org.pointyware.xyz.core.viewmodels
import org.pointyware.xyz.core.entities.ride.Rating
import org.pointyware.xyz.core.entities.data.Uri
import org.pointyware.xyz.core.entities.Uuid
import org.pointyware.xyz.core.entities.profile.Profile

/**
* A brief profile UI state. For more detail see [ProfileUiState].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.pointyware.xyz.core.navigation.XyzNavController
import org.pointyware.xyz.core.ui.AdView
import org.pointyware.xyz.core.ui.AdViewState
import org.pointyware.xyz.core.ui.MapView
import org.pointyware.xyz.core.ui.MessageInput
import org.pointyware.xyz.core.viewmodels.MapUiState
import org.pointyware.xyz.drive.viewmodels.ProviderDashboardViewModel
import org.pointyware.xyz.drive.viewmodels.RideRequestUiState
Expand Down Expand Up @@ -176,17 +177,6 @@ fun DeliveryInfo(
}
}

@Composable
fun MessageInput(
modifier: Modifier = Modifier,
) {
TextField(
value = "",
onValueChange = {},
modifier = modifier.semantics { contentDescription = "Message Input" }
)
}

@Composable
fun TripCompletionView(
onConfirmCompletion: () -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.pointyware.xyz.core.viewmodels.di.coreViewModelsModule
import org.pointyware.xyz.drive.di.featureDriveModule

/**
* TODO: describe purpose/intent of KoinExt
* Starts koin with the required modules for testing
*/
fun setupKoin() {
startKoin {
Expand Down
Loading

0 comments on commit 6d3ebc3

Please sign in to comment.