Feature/prd 504 Remove routing bridge between MapView and native SDK#647
Feature/prd 504 Remove routing bridge between MapView and native SDK#647adrian-situm wants to merge 53 commits into
Conversation
Automatic merge into master to Release 3.18.6
Automatic merge into master to Release 3.18.7
Automatic merge into master to Release 3.18.8
Automatic merge into master to Release 3.18.9
Automatic merge into master to Release 3.18.10
Automatic merge into master to Release 3.18.11
Automatic merge into master to Release 3.18.12
Automatic merge into master to Release 3.18.13
Automatic merge into master to Release 3.18.14
Automatic merge into master to Release 3.18.15
Automatic merge into master to Release 3.18.16
Automatic merge into master to Release 3.18.17
Automatic merge into master to Release 3.18.18
Automatic merge into master to Release 3.18.19
Automatic merge into master to Release 3.18.20
Automatic merge into master to Release 3.18.21
Automatic merge into master to Release 3.18.22
Automatic merge into master to Release 3.18.23
Automatic merge into master to Release 3.18.24
Automatic merge into master to Release 3.18.25
Update version to 3.18.25
Automatic merge into master to Release 3.18.26
Update version to 3.18.26
| const receivedError = internalCall.get<Error>(); | ||
| dispatch(setError(receivedError)); | ||
| break; | ||
| case InternalCallType.NAVIGATION_START: |
There was a problem hiding this comment.
Aquí llegaban los mensajes que enviaba el InternalCall, también se eliminan porque ya no se desea informar al viewer de estos cambios
| ); | ||
| } | ||
|
|
||
| const calculateRoute = async ( |
There was a problem hiding this comment.
Esta lógica era llamada por el MapView cuando recibía mensajes del viewer relacionados con la navegación y las rutas
| }, | ||
| setNavigation: (state: State, payload: State["navigation"]) => { | ||
| return { ...state, navigation: payload }; | ||
| }, |
There was a problem hiding this comment.
Se utilizaban por el bridge para actualizar el estado de la store al hacer ruta y navegación por medio del sdk
| currentBuilding: undefined, | ||
| pois: [], | ||
| directions: undefined, | ||
| navigation: undefined, |
There was a problem hiding this comment.
Desde que se cambio el viewer para calcular las rutas desde javascript, esto se queda siempre en undefined. Ojo que si algún cliente los tenía en el código (aunque ya no funcionaban) podría lanzar error de typescript
There was a problem hiding this comment.
Si se rompe compatibilidade hai que ter coidado. Eu deprecaría en primeiro lugar e nunha release posterior eliminaría. É unha putada, pero é o proceso a seguir.
@fsvilas que opinas?
Certo é que non creo que nadie acceda a esto...
There was a problem hiding this comment.
Si eu marcaria como deprecada e indicaria que nunca vai recibir ningún valor, pero que se manten para non romper compatibilidad.
Se fixeramos nun futuro proximo un release que cambie o major (guiño, guiño), sí que se podería eliminar.
| export const selectNavigation = (state: State) => { | ||
| return state.navigation; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Se ha borrado el state.directions y state.navigation, no tiene sentido mantener los selects
There was a problem hiding this comment.
Sep, deixaria os métodos inda que non fagan nada e marcariaos como deprecados
| cancelNavigation: () => void; | ||
| setOnDirectionsRequestInterceptor: (params: { | ||
| onDirectionsRequestInterceptor: OnDirectionsRequestInterceptor; | ||
| }) => void; |
There was a problem hiding this comment.
Esto era una función que cambiaba un parámetro del MapView para guardar un Interceptor. Este Interceptor era una función a la que calculateRoute llamaba para modificar o capturar la información de la ruta
There was a problem hiding this comment.
Igual: tecnicamente é unha función pública da API, primeiro habería que deprecala e despois eliminala.
Nadie debería estar usando esto... non sei que pensar. @fsvilas ?
| ), | ||
| ); | ||
| }; | ||
|
|
There was a problem hiding this comment.
Se utilizaban exclusivamente en calculateRoute
| // Navigation | ||
| navigation: (navigation: Navigation) => { | ||
| return mapperWrapper(`navigation.${navigation.status}`, navigation); | ||
| }, |
There was a problem hiding this comment.
Estas eran funciones que convertían un objeto en un mensaje para el viewer. El viewer ya no capta estos mensajes, así que se borran.
| navigation, | ||
| calculateRoute, | ||
| startNavigation, | ||
| stopNavigation, |
There was a problem hiding this comment.
Se han borrado estos estados y funciones de la store, sincronizaban la navegación y rutas del sdk con el viewer
| ) => { | ||
| const webViewRef = useRef<WebView>(null); | ||
| const [_onDirectionsRequestInterceptor, setInterceptor] = | ||
| useState<OnDirectionsRequestInterceptor>(); |
There was a problem hiding this comment.
El Interceptor permitía modificar los valores de una ruta antes de calcularse. Ya no se usa el sdk para calcularse así que no tiene sentido dejarlo.
|
|
||
| sendMessageToViewer(webViewRef.current, ViewerMapper.route(directions)); | ||
| }, [directions, mapLoaded]); | ||
|
|
There was a problem hiding this comment.
Enviaban mensajes al viewer cuando la navegación o ruta de la store cambiaban. Se borraron estos valores de la store, así que de aquí también.
| /** Point to, where the route should end */ | ||
| to: Point | Poi; | ||
| } & DirectionsOptions; | ||
|
|
There was a problem hiding this comment.
Solo se usaba en createDirectionsRequest y en el Interceptor, ambos eliminados
There was a problem hiding this comment.
Esto non estou convencido de que poidamos eliminalo:
- Pertence á API pública, por tanto un cliente podería estar usándoo aínda que nós non o fagamos como tal.
- Probablemente tería sentido engadir unha sobrecarga de requestDirections que reciba como parámetro este tipo.
There was a problem hiding this comment.
É unha cousa rara porque como di Roi despois requestDirections:
static requestDirections = ( building: Building, from: Point | Location, to: Point | Poi, directionOptions?: DirectionsOptions, ) => { return promiseWrapper<Directions>(({ onSuccess, onError }) => { const params = [building, from, to, directionOptions || {}]; RNCSitumPlugin.requestDirections(params, onSuccess, onError); }); };
non usa ese obxeto.
Como di Roi eu sobrecargaria o metodo para usalo e incluso poderia valorarse deprecar o antigo
There was a problem hiding this comment.
Lo estuve mirando y parece que habría que hacer cambios en la implementación nativa. De momento lo reintroduzco y dejo como está, si queréis lo podemos mirar.
| "Situm > hook > Navigation on course, poi category selection is unavailable", | ||
| ); | ||
| return; | ||
| } |
There was a problem hiding this comment.
SitumPlugin.navigationIsRunning() comprueba si el SDK está utilizando la navegación, como ya no va sincronizado con el viewer no tiene usarlo aquí
| }, | ||
| cancelNavigation(): void { | ||
| if (!webViewRef.current) return; | ||
| stopNavigation(); |
There was a problem hiding this comment.
stopNavigation detenía la navegación en el SDK y actualizaba la store, esto se borra y se deja el sendMessageToViewer, que es el método moderno, para que se pueda seguir deteniendo la navegación por medio de esta función
| /** Point to, where the route should end */ | ||
| to: Point | Poi; | ||
| } & DirectionsOptions; | ||
|
|
There was a problem hiding this comment.
Esto non estou convencido de que poidamos eliminalo:
- Pertence á API pública, por tanto un cliente podería estar usándoo aínda que nós non o fagamos como tal.
- Probablemente tería sentido engadir unha sobrecarga de requestDirections que reciba como parámetro este tipo.
|
|
||
| /** | ||
| * Available accessibility modes used in the {@link DirectionsRequest}. | ||
| * Available accessibility modes used when calculating routes. |
There was a problem hiding this comment.
Aquí creo que había unha confusión, o tipo correcto era DirectionsOptions, non DirectionsRequest (un está dentro do outro, é un pouco confuso)
| }; | ||
|
|
||
| const _internalNavigationProgressCallback = (progress: NavigationProgress) => { | ||
| internalMethodCallMapDelegate( |
There was a problem hiding this comment.
Ten sentido manter a callback interna? Non se podería eliminar e usar directamente a callback de cliente? Igual para os casos de abaixo.
| currentBuilding: undefined, | ||
| pois: [], | ||
| directions: undefined, | ||
| navigation: undefined, |
There was a problem hiding this comment.
Si se rompe compatibilidade hai que ter coidado. Eu deprecaría en primeiro lugar e nunha release posterior eliminaría. É unha putada, pero é o proceso a seguir.
@fsvilas que opinas?
Certo é que non creo que nadie acceda a esto...
| export const selectNavigation = (state: State) => { | ||
| return state.navigation; | ||
| }; | ||
|
|
| cancelNavigation: () => void; | ||
| setOnDirectionsRequestInterceptor: (params: { | ||
| onDirectionsRequestInterceptor: OnDirectionsRequestInterceptor; | ||
| }) => void; |
There was a problem hiding this comment.
Igual: tecnicamente é unha función pública da API, primeiro habería que deprecala e despois eliminala.
Nadie debería estar usando esto... non sei que pensar. @fsvilas ?
| * This interface allows you to modify all the parameters in the DirectionRequest used by the MapViewer to calculate the route. | ||
| * To use this you will need to load the MapView and once it ends loading use the MapViewRef that you obtain an call setOnDirectionsRequestInterceptor(interceptor) | ||
| */ | ||
| export interface OnDirectionsRequestInterceptor { |
| selectPoi: (poiId: number | null) => { | ||
| return mapperWrapper(`cartography.select_poi`, { identifier: poiId }); | ||
| }, | ||
| deselectPoi: () => { |
There was a problem hiding this comment.
Este método existe nalgunha outra plataforma (ex. flutter)? Está ben, pero é API pública e si existe debe chamarse igual, usarse igual, etc.
There was a problem hiding this comment.
Esto lo acabo de meter hace unos minutos porque haciendo el plan de prueba descubrí que el deselectPoi que había en el MapView no funcionaba. No he añadido ninguna interfaz publica, solo he arreglado una función imperativa del MapView que no funcionaba.
| navigation?: Navigation; | ||
| error?: Error; | ||
| } | ||
|
|
There was a problem hiding this comment.
Entendo que o mesmo tamen para estos tres
| destinationIdentifier: string; | ||
| destinationCategory: string; | ||
| identifier: string; | ||
| }; |
|
|
||
| ### Removed | ||
|
|
||
| - Removed routing and navigation bridge between MapView and native SDK. |
There was a problem hiding this comment.
Explicar esto mellor, esto faise porque agora o mapView nunca vai usar a navegación do sdk
R-lagoman
left a comment
There was a problem hiding this comment.
Aprobada, pero porfa revisa ese último comentario que puxen.
| @@ -1,17 +1,3 @@ | |||
| export enum NavigationStatus { | |||
There was a problem hiding this comment.
Estame vindo á cabeza que esta enum quizais estivera aí unicamente para ser usada desde o lado cliente, para que dispoña dun listado exhaustivo de estados. Quizais non atopaches usos no código por eso. Pode ser?
There was a problem hiding this comment.
Tenía usos en el puente que se eliminó, pero me suena bastante realista pensar que un integrador podría haberlo usado. Lo vuelvo a añadir como deprecado. Si consideras que no debería estar deprecado avísame y lo cambio sin problema.
No description provided.