Update guide presentation and route preview gating
This commit is contained in:
@@ -8,6 +8,9 @@ import {
|
||||
guideRouteRepository,
|
||||
type GuideRouteRepository
|
||||
} from '@/repositories/GuideRouteRepository'
|
||||
import {
|
||||
applyRouteReadinessGate
|
||||
} from '@/domain/guideReadiness'
|
||||
|
||||
const toSearchText = (target: GuideRouteTarget) => [
|
||||
target.name,
|
||||
@@ -38,7 +41,7 @@ export class GuideRouteUseCase {
|
||||
async getRouteReadiness() {
|
||||
if (this.readinessCache) return this.readinessCache
|
||||
|
||||
this.readinessCache = await this.repository.getRouteReadiness()
|
||||
this.readinessCache = applyRouteReadinessGate(await this.repository.getRouteReadiness())
|
||||
return this.readinessCache
|
||||
}
|
||||
|
||||
@@ -64,7 +67,7 @@ export class GuideRouteUseCase {
|
||||
if (!readiness.ready) {
|
||||
return {
|
||||
route: null,
|
||||
error: readiness.message || '路线数据暂不可用'
|
||||
error: readiness.message || '当前暂不支持正式导航,可查看位置预览和路线示意'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
type GuideModelRepository
|
||||
} from '@/repositories/GuideModelRepository'
|
||||
import {
|
||||
applyRouteReadinessGate,
|
||||
NAV_ROUTE_READINESS
|
||||
} from '@/domain/guideReadiness'
|
||||
|
||||
@@ -81,12 +82,12 @@ export class GuideUseCase {
|
||||
|
||||
const routeReadiness = await this.guide.getRouteReadiness()
|
||||
.catch(() => NAV_ROUTE_READINESS)
|
||||
this.routeReadinessCache = NAV_ROUTE_READINESS.ready ? routeReadiness : NAV_ROUTE_READINESS
|
||||
this.routeReadinessCache = applyRouteReadinessGate(routeReadiness)
|
||||
return this.routeReadinessCache
|
||||
}
|
||||
|
||||
getRouteReadinessSnapshot(): GuideRouteReadiness {
|
||||
return this.routeReadinessCache || NAV_ROUTE_READINESS
|
||||
return this.routeReadinessCache || applyRouteReadinessGate(NAV_ROUTE_READINESS)
|
||||
}
|
||||
|
||||
getFloors() {
|
||||
|
||||
Reference in New Issue
Block a user