Skip to content

Commit

Permalink
Merge Feature/39 feature deliver rider to destination (#53)
Browse files Browse the repository at this point in the history
* move test file to coreLocalTestModule function

* Add production/testing notes

* Add appModule doc

* Replace manual koin setup with application setup function

* Create KoinExt to simplify test setup

* replace manual koin setup with extension function

* Fix shared package identifiers

* replace manual koin configuration with setup function

* Move test bindings out to feature test koin modules

* Replace explicit construction of TestRideRepository with consistent koin configuration

* rename repository for role ownership clarity

* Clean up unused imports

* Fix test docs

* remove empty test

* move drive/ride tests to package directory

* remove empty test

* move koin retrieval below complete setup

* Move common dependencies to setUp block

* Rename screen/state/viewmodel with Provider over Driver

* Update roles in README to reflect preferred terminology

* Add provider dashboard view model

* rename file to match composable

* Fix doc

* Rename uis and models to reflect preferred terminology

* Provider
* Passenger
* Trip

* rename tests/files with preferred term

* rename test/file with preferred term

* replace "ride request" with "trip request"

* Fix test repo not found by koin

* cast DriverRideRepository as TestDriverRideRepository

* Add test actions/expectations comments

* Add new location service

* Add coroutines platform dependencies

* Move ~Provider~LocationService

* Rename DriverRideRepository.kt

* Add deprecation note

* remove missing interface symbol

* Provide location service bindings in platform modules

* Add location service to provider trip repository

* Create simple test location service

* Fix location type

* Add android location comment

* provide test location service in koin

* get test location service in test

* Use real coordinates

* replace todos with simulated location

* conceal scope

* Add plan ride function

* Provide more specific ride types at different points in repository functions

* Provide fake driver profile for testing

* Remove superfluous PickUp state

* add screen state docs

* Move provider dashboard screen state to dedicated file

* generalize provider dashboard screen state to ui state

* Add pickUpRider repository function

* Pass pick up event to repository

* Create new watch distance use case

* Add boolean for pick up ability

* Start watching pick up distance when provider picks up passenger

* Add interactor factory

* Pass enablement

* remove unused latlong

* Fix location service not started before test

* Use map over success/failure extension

* Use map over success/failure extension

* Simplify type check

* Add closure parameter name

* Initialize view model after driver rates have been set

* Fix location service instance not shared

* Fix LatLong.distanceTo returning negative lengths

* Move toRadians function to dedicated extension file

* Fix wrong arc-trig function used to calculate great angle

* Remove flaky wait

* tighten calculation expectations slightly

* Watch distance to drop off point after picking up rider

* Add drop off event

* Display delivery information

* Add blank completion info view

* Fix wrong text string

* reorganize expectations

* move distance watcher after mutable state update

* fix active ride not being set

* remove redundant text

* provide trip completion view model event

* dispose any jobs when view model is disposed

* Add base view model doc

* modify doc

* add trip completion view

* Finish test expectations

* print stack traces on unexpected conditions

* Add complete function to skip CompletingRide state

* expand accepted types to Active/CompletionRide

* Fix provider/passenger references in error strings

* Add documentation about skipped state

* Add test todo

* restore test repository in koin graph for request ride ui test
  • Loading branch information
TSampley authored Sep 23, 2024
1 parent a5f4f0c commit a366467
Show file tree
Hide file tree
Showing 56 changed files with 1,164 additions and 796 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# XYZ
Get your X from Y to Z

## Users
* Riders - Individuals, Groups, or Wards
* Drivers - Owners or Operators
## Roles
* Passengers - Individuals, Groups, or Wards taking a trip.
* Providers - Owners or Operators providing the service.
* Managers - Fleet Managers or Dispatchers managing the service.

## Features
* [Manage](./feature/manage/README.md)
Expand Down
1 change: 1 addition & 0 deletions app-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ android {

dependencies {
implementation(projects.core.entities)
implementation(projects.core.local)
implementation(projects.core.ui)

implementation(projects.feature.drive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import org.koin.dsl.module
import org.pointyware.xyz.android.ads.AdMobController
import org.pointyware.painteddogs.android.di.AndroidLoadingViewResources
import org.pointyware.painteddogs.android.di.AndroidResources
import org.pointyware.xyz.android.local.AndroidLocationService
import org.pointyware.xyz.core.local.org.pointyware.xyz.core.local.LocationService
import org.pointyware.xyz.core.ui.ads.AdsController
import org.pointyware.xyz.core.ui.components.LoadingViewResources
import org.pointyware.xyz.core.ui.design.Resources
Expand All @@ -22,4 +24,6 @@ fun androidModule() = module {

factory<AdsController> { params -> AdMobController(params.get()) }
factory<LoadingViewResources> { AndroidLoadingViewResources() }

factory<LocationService> { AndroidLocationService() }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 Pointyware. Use of this software is governed by the GPL-3.0 license.
*/

package org.pointyware.xyz.android.local

import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import org.pointyware.xyz.core.local.org.pointyware.xyz.core.local.LocationService

/**
*
*/
class AndroidLocationService(

): LocationService {

override fun start() {
// https://developer.android.com/develop/sensors-and-location/location/request-updates
TODO("Inject FusedLocationProvider service; start location updates")
}

override fun stop() {
mutableState.value = LocationService.State.Stopped
}

private val mutableState = MutableStateFlow(LocationService.State.Stopped)
override val state: StateFlow<LocationService.State>
get() = mutableState.asStateFlow()
}
4 changes: 4 additions & 0 deletions app-desktop/src/main/kotlin/di/Module.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
package org.pointyware.xyz.desktop.di

import org.koin.dsl.module
import org.pointyware.xyz.core.local.org.pointyware.xyz.core.local.LocationService
import org.pointyware.xyz.core.ui.components.LoadingViewResources
import org.pointyware.xyz.core.ui.design.Resources
import org.pointyware.xyz.desktop.local.DesktopLocationService
import org.pointyware.xyz.shared.entities.SharedFileResources
import org.pointyware.xyz.shared.entities.SharedStringResources
import org.pointyware.xyz.shared.ui.SharedDrawableResources
Expand All @@ -25,4 +27,6 @@ fun desktopModule() = module {
// loading view resources

factory<LoadingViewResources> { DesktopLoadingViewResources() }

factory<LocationService> { DesktopLocationService() }
}
29 changes: 29 additions & 0 deletions app-desktop/src/main/kotlin/local/DesktopLocationService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2024 Pointyware. Use of this software is governed by the GPL-3.0 license.
*/

package org.pointyware.xyz.desktop.local

import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import org.pointyware.xyz.core.local.org.pointyware.xyz.core.local.LocationService

/**
*
*/
class DesktopLocationService(

): LocationService {
override fun start() {
TODO("Get desktop location service; start location updates")
}

override fun stop() {
mutableState.value = LocationService.State.Stopped
}

private val mutableState = MutableStateFlow(LocationService.State.Stopped)
override val state: StateFlow<LocationService.State>
get() = mutableState.asStateFlow()
}
7 changes: 5 additions & 2 deletions app-shared/src/commonMain/kotlin/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ import org.pointyware.xyz.feature.login.di.featureLoginModule
import org.pointyware.xyz.feature.login.di.featureProfileModule
import org.pointyware.xyz.feature.ride.di.featureRideModule


fun setupKoin(platformModule: Module) {
/**
* Starts Koin with the standard application module, supported by the given platform module.
* @param platformModule A module with platform-specific dependencies.
*/
fun setupKoin(platformModule: Module = module {}) {
startKoin {
modules(
appModule(),
Expand Down
75 changes: 0 additions & 75 deletions app-shared/src/commonTest/kotlin/RideShareUiTest.kt

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2024 Pointyware. Use of this software is governed by the GPL-3.0 license.
*/

package org.pointyware.xyz.app.drive
package org.pointyware.xyz.shared.drive

import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.assertIsEnabled
Expand All @@ -21,6 +21,7 @@ import org.pointyware.xyz.core.ui.di.EmptyTestUiDependencies
import org.pointyware.xyz.feature.login.DriverProfileCreationScreen
import org.pointyware.xyz.feature.login.viewmodels.DriverProfileCreationViewModel
import org.pointyware.xyz.shared.di.appModule
import org.pointyware.xyz.shared.di.setupKoin
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
Expand All @@ -33,11 +34,7 @@ class DriverProfileCreationUiTest {

@BeforeTest
fun setUp() {
startKoin {
modules(
appModule()
)
}
setupKoin()
}

@AfterTest
Expand Down
Loading

0 comments on commit a366467

Please sign in to comment.