From 63f64f99236f7f06c270c3b7c2f6e469d606f8ee Mon Sep 17 00:00:00 2001 From: fsvilas Date: Fri, 30 Jan 2026 11:06:21 +0100 Subject: [PATCH 1/4] First iteration --- example/ios/Podfile.lock | 10 +-- example/src/navigation/types.tsx | 4 +- example/src/screens/HomeScreen.tsx | 18 ++++- example/src/screens/WayfindingScreen.tsx | 23 +++++-- .../screens/cards/ShareLiveLocationCard.tsx | 67 +++++++++++++++++++ plugin/ios/SitumPlugin.m | 14 ++++ plugin/src/sdk/index.ts | 25 +++++++ plugin/src/sdk/nativeInterface.ts | 2 + plugin/src/wayfinding/components/MapView.tsx | 25 +++++++ plugin/src/wayfinding/types/index.ts | 13 ++++ plugin/src/wayfinding/utils/mapper.ts | 8 +++ 11 files changed, 193 insertions(+), 16 deletions(-) create mode 100644 example/src/screens/cards/ShareLiveLocationCard.tsx diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index c876a33..4399287 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1681,7 +1681,7 @@ PODS: - React-logger (= 0.79.1) - React-perflogger (= 0.79.1) - React-utils (= 0.79.1) - - ReactNativeSitumPlugin (3.17.2): + - ReactNativeSitumPlugin (3.18.2): - DoubleConversion - glog - hermes-engine @@ -1705,7 +1705,7 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - SitumSDK (= 3.34.10) + - SitumSDK (= 3.35.0) - Yoga - RNScreens (4.11.1): - DoubleConversion @@ -1756,7 +1756,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - SitumSDK (3.34.10): + - SitumSDK (3.35.0): - Protobuf (~> 3.18) - SSZipArchive (~> 2.4) - SocketRocket (0.7.1) @@ -2075,10 +2075,10 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: f3426eaf6dabae0baec543cd7bac588b6f59210c ReactCodegen: 3288d61658273d72fbd348a74b59710b9790615f ReactCommon: 9f975582dc535de1de110bdb46d4553140a77541 - ReactNativeSitumPlugin: c0f365b20d0368473061abf31fa649417a98a647 + ReactNativeSitumPlugin: 62552d7f3e5b0ac826ebbfe920ef40365235863f RNScreens: 3dbce61975990754e4eadd42e9155d327c3445e7 RNVectorIcons: ae8e1b95f3468a360896c6242d61885efcc64241 - SitumSDK: de58cad6f48b83451f820452e57f1586ab8b9d2a + SitumSDK: 87645bb5da3348b0da02b440ca40d3c244684692 SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef Yoga: d15f5aa644c466e917569ac43b19cbf17975239a diff --git a/example/src/navigation/types.tsx b/example/src/navigation/types.tsx index 9d6bad0..8f4f37f 100644 --- a/example/src/navigation/types.tsx +++ b/example/src/navigation/types.tsx @@ -3,8 +3,8 @@ export type RootTabsParamsList = { Home: undefined; Wayfinding: { - poiIdentifier: string; - action: "select" | "navigate"; + elementIdentifier: string; + action: "select" | "navigate" | "shareLiveLocation"; }; }; diff --git a/example/src/screens/HomeScreen.tsx b/example/src/screens/HomeScreen.tsx index 8866db4..e2e21c9 100644 --- a/example/src/screens/HomeScreen.tsx +++ b/example/src/screens/HomeScreen.tsx @@ -11,6 +11,7 @@ import { Alert, ScrollView, StyleSheet } from "react-native"; import { FetchResourcesCard } from "./cards/FetchResourcesCard"; import { SITUM_BUILDING_ID } from "../situm"; import { MapInteractionCard } from "./cards/MapInteractionCard"; +import { ShareLiveLocationCard } from "./cards/ShareLiveLocationCard"; import { useNavigation } from "@react-navigation/native"; export const HomeScreen = () => { @@ -72,7 +73,7 @@ export const HomeScreen = () => { const selectPoi = (identifier: string) => { navigation.navigate("Wayfinding", { - poiIdentifier: identifier, + elementIdentifier: identifier, action: "select", }); }; @@ -86,7 +87,7 @@ export const HomeScreen = () => { return; } navigation.navigate("Wayfinding", { - poiIdentifier: identifier, + elementIdentifier: identifier, action: "navigate", }); }; @@ -158,6 +159,16 @@ export const HomeScreen = () => { }); }; + // //////////////////////////////////////////////////////////////////////// + // SHARE LIVE LOCATION: + // //////////////////////////////////////////////////////////////////////// + const setShareLiveLocationSession = (identifier: string) => { + navigation.navigate("Wayfinding", { + elementIdentifier: identifier, + action: "shareLiveLocation", + }); + }; + const invalidateCache = () => { setFetchOutput("invalidateCache..."); SitumPlugin.invalidateCache(); @@ -194,6 +205,9 @@ export const HomeScreen = () => { onInvalidateCache={invalidateCache} output={fetchOutput} /> + ); diff --git a/example/src/screens/WayfindingScreen.tsx b/example/src/screens/WayfindingScreen.tsx index 2140a49..6610999 100644 --- a/example/src/screens/WayfindingScreen.tsx +++ b/example/src/screens/WayfindingScreen.tsx @@ -77,29 +77,31 @@ export const WayfindingScreen: React.FC = () => { // ACTIONS: // //////////////////////////////////////////////////////////////////////// - // Get the POI identifier from react-navigation route params. + // Get the Element identifier from react-navigation route params. const navigation = useNavigation(); const route = useRoute>(); - const { poiIdentifier, action } = route.params || {}; + const { elementIdentifier, action } = route.params || {}; useEffect(() => { // The MapView must be loaded to perform actions. if (!mapViewLoaded) return; - if (!poiIdentifier || !action) return; + if (!elementIdentifier || !action) return; if (action === "select") { - selectPoi(poiIdentifier); + selectPoi(elementIdentifier); } else if (action === "navigate") { - navigateToPoi(poiIdentifier); + navigateToPoi(elementIdentifier); + } else if (action === "shareLiveLocation") { + setShareLiveLocationSession(elementIdentifier); } // Reset params to make the useEffect execute even with the same values. navigation.setParams({ - poiIdentifier: undefined, + elementIdentifier: undefined, action: undefined, }); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [poiIdentifier, action, mapViewLoaded]); + }, [elementIdentifier, action, mapViewLoaded]); // eslint-disable-next-line @typescript-eslint/no-shadow const selectPoi = (poiIdentifier: string) => { @@ -113,6 +115,13 @@ export const WayfindingScreen: React.FC = () => { }); }; + // eslint-disable-next-line @typescript-eslint/no-shadow + const setShareLiveLocationSession = (sessionIdentifier: string) => { + controller?.setShareLiveLocationSession({ + identifier: sessionIdentifier, + }); + }; + return ( diff --git a/example/src/screens/cards/ShareLiveLocationCard.tsx b/example/src/screens/cards/ShareLiveLocationCard.tsx new file mode 100644 index 0000000..1697bde --- /dev/null +++ b/example/src/screens/cards/ShareLiveLocationCard.tsx @@ -0,0 +1,67 @@ +import React, { useState } from "react"; +import { Button, View, StyleSheet, Platform, TextInput } from "react-native"; +import { Card, Icon, Text } from "react-native-paper"; +import { Colors, SharedStyles } from "../../SharedStyles"; + +const CardTitleIcon = () => ; + +interface ShareLiveLocationCardProps { + onSetShareLiveLocationSession: (identifier: string) => void; +} + +export const ShareLiveLocationCard: React.FC = ({ + onSetShareLiveLocationSession, +}) => { + const [identifier, setIdentifier] = useState(""); + + return ( + + + + + {/* Campo de texto */} + + + + +