Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c72bbac9 authored by Ellen Poe's avatar Ellen Poe
Browse files

refactor: move literals in FerrostarWrapper.kt to companion object

parent a0ff2c3b
Loading
Loading
Loading
Loading
Loading
+23 −10
Original line number Original line Diff line number Diff line
@@ -121,11 +121,11 @@ class FerrostarWrapper(
            httpClient = OkHttpClientProvider(OkHttpClient()),
            httpClient = OkHttpClientProvider(OkHttpClient()),
            locationProvider = locationProvider,
            locationProvider = locationProvider,
            navigationControllerConfig = NavigationControllerConfig(
            navigationControllerConfig = NavigationControllerConfig(
                waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(100.0),
                waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(WAYPOINT_ADVANCE_RANGE),
                stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(30u, 5u, 32u),
                stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(STEP_ADVANCE_DISTANCE_TO_END.toUShort(), STEP_ADVANCE_DISTANCE_AFTER_END.toUShort(), STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()),
                arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(30u, 32u),
                arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(ARRIVAL_STEP_ADVANCE_DISTANCE.toUShort(), ARRIVAL_STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()),
                routeDeviationTracking = RouteDeviationTracking.StaticThreshold(15U, 50.0),
                routeDeviationTracking = RouteDeviationTracking.StaticThreshold(ROUTE_DEVIATION_MINIMUM_ACCURACY.toUShort(), ROUTE_DEVIATION_MAX_DEVIATION),
                snappedLocationCourseFiltering = CourseFiltering.SNAP_TO_ROUTE
                snappedLocationCourseFiltering = COURSE_FILTERING
            ),
            ),
            foregroundServiceManager = foregroundServiceManager,
            foregroundServiceManager = foregroundServiceManager,
        )
        )
@@ -152,14 +152,27 @@ class FerrostarWrapper(
            httpClient = OkHttpClientProvider(OkHttpClient()),
            httpClient = OkHttpClientProvider(OkHttpClient()),
            locationProvider = locationProvider,
            locationProvider = locationProvider,
            navigationControllerConfig = NavigationControllerConfig(
            navigationControllerConfig = NavigationControllerConfig(
                waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(100.0),
                waypointAdvance = WaypointAdvanceMode.WaypointWithinRange(WAYPOINT_ADVANCE_RANGE),
                stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(30u, 5u, 32u),
                stepAdvanceCondition = stepAdvanceDistanceEntryAndExit(STEP_ADVANCE_DISTANCE_TO_END.toUShort(), STEP_ADVANCE_DISTANCE_AFTER_END.toUShort(), STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()),
                arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(30u, 32u),
                arrivalStepAdvanceCondition = stepAdvanceDistanceToEndOfStep(ARRIVAL_STEP_ADVANCE_DISTANCE.toUShort(), ARRIVAL_STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY.toUShort()),
                routeDeviationTracking = RouteDeviationTracking.StaticThreshold(15U, 50.0),
                routeDeviationTracking = RouteDeviationTracking.StaticThreshold(ROUTE_DEVIATION_MINIMUM_ACCURACY.toUShort(), ROUTE_DEVIATION_MAX_DEVIATION),
                snappedLocationCourseFiltering = CourseFiltering.SNAP_TO_ROUTE
                snappedLocationCourseFiltering = COURSE_FILTERING
            ),
            ),
            foregroundServiceManager = foregroundServiceManager
            foregroundServiceManager = foregroundServiceManager
        )
        )
        core.spokenInstructionObserver = androidTtsObserver
        core.spokenInstructionObserver = androidTtsObserver
    }
    }

    companion object {
        const val WAYPOINT_ADVANCE_RANGE = 100.0
        const val STEP_ADVANCE_DISTANCE_TO_END = 30u
        const val STEP_ADVANCE_DISTANCE_AFTER_END = 5u
        const val STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY = 32u
        const val ARRIVAL_STEP_ADVANCE_DISTANCE = 30u
        const val ARRIVAL_STEP_ADVANCE_MINIMUM_HORIZONTAL_ACCURACY = 32u
        const val ROUTE_DEVIATION_MINIMUM_ACCURACY = 15u
        const val ROUTE_DEVIATION_MAX_DEVIATION = 50.0
        val COURSE_FILTERING = CourseFiltering.SNAP_TO_ROUTE

    }
}
}