diff --git a/CHANGELOG_UNRELEASED.md b/CHANGELOG_UNRELEASED.md
index e69de29..b8b7677 100644
--- a/CHANGELOG_UNRELEASED.md
+++ b/CHANGELOG_UNRELEASED.md
@@ -0,0 +1,2 @@
+- Added new method MapViewRef.setShareLiveLocationSession to set the session identifier of the Share Live Location Session the MapView should display. When enabled in the [Map Viewer Configuration Settings](https://situm.com/docs/map-viewer-configuration-settings/), Share Live Location functionality allows a user to share their real-time location with another user.
+- Added the internal functionality that allows to share the user location (a Share Live Location Session) with another user.
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..f0b14f8 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,11 +87,21 @@ export const HomeScreen = () => {
return;
}
navigation.navigate("Wayfinding", {
- poiIdentifier: identifier,
+ elementIdentifier: identifier,
action: "navigate",
});
};
+ // ////////////////////////////////////////////////////////////////////////
+ // SHARE LIVE LOCATION:
+ // ////////////////////////////////////////////////////////////////////////
+ const setShareLiveLocationSession = (identifier: string) => {
+ navigation.navigate("Wayfinding", {
+ elementIdentifier: identifier,
+ action: "shareLiveLocation",
+ });
+ };
+
// ////////////////////////////////////////////////////////////////////////
// FETCH RESOURCES:
// ////////////////////////////////////////////////////////////////////////
@@ -186,6 +197,9 @@ export const HomeScreen = () => {
onSelectPoi={selectPoi}
onNavigateToPoi={navigateToPoi}
/>
+
{
// 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) => {
controller?.selectPoi(Number(poiIdentifier));
};
- // eslint-disable-next-line @typescript-eslint/no-shadow
const navigateToPoi = (poiIdentifier: string) => {
controller?.navigateToPoi({
identifier: Number(poiIdentifier),
});
};
+ 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 */}
+
+
+
+
+
+
+
+
+ );
+};
+
+const styles = StyleSheet.create({
+ input: {
+ borderWidth: 1,
+ borderColor: "#ccc",
+ borderRadius: 6,
+ padding: 10,
+ marginBottom: 12,
+ },
+ sectionTitle: {
+ fontWeight: "bold",
+ marginTop: 8,
+ color: Colors.primary,
+ },
+ logText: {
+ fontFamily: Platform.OS === "ios" ? "Courier New" : "monospace",
+ fontSize: 12,
+ color: "#000",
+ },
+});
diff --git a/plugin/android/src/main/java/com/situm/plugin/PluginHelper.java b/plugin/android/src/main/java/com/situm/plugin/PluginHelper.java
index e32d367..25874bc 100644
--- a/plugin/android/src/main/java/com/situm/plugin/PluginHelper.java
+++ b/plugin/android/src/main/java/com/situm/plugin/PluginHelper.java
@@ -59,6 +59,8 @@
import es.situm.sdk.location.GeofenceListener;
import es.situm.sdk.navigation.ExternalNavigation;
import es.situm.sdk.userhelper.UserHelperColorScheme;
+import es.situm.sdk.location.InternalLocationManager;
+import es.situm.sdk.location.ShareLiveLocationOptions;
import static com.situm.plugin.SitumPlugin.EVENT_LOCATION_CHANGED;
import static com.situm.plugin.SitumPlugin.EVENT_LOCATION_ERROR;
@@ -855,6 +857,15 @@ public void removeRealTimeUpdates() {
getRealtimeManagerInstance().removeRealTimeUpdates();
}
+ public void startShareLiveLocation(ReadableMap payload) {
+ Map shareLiveLocationOptionsMap = convertReadableMapToMap(payload);
+ ((InternalLocationManager)SitumSdk.locationManager()).startShareLiveLocation(ShareLiveLocationOptions.fromMap(shareLiveLocationOptionsMap));
+ }
+
+ public void stopShareLiveLocation() {
+ ((InternalLocationManager)SitumSdk.locationManager()).stopShareLiveLocation();
+ }
+
public void checkIfPointIsInsideGeoFence(ReadableMap map, Callback callback) {
if (geofencePolygonMap.isEmpty()) {
return;
diff --git a/plugin/android/src/main/java/com/situm/plugin/SitumPlugin.java b/plugin/android/src/main/java/com/situm/plugin/SitumPlugin.java
index 879aeb9..f5cace7 100644
--- a/plugin/android/src/main/java/com/situm/plugin/SitumPlugin.java
+++ b/plugin/android/src/main/java/com/situm/plugin/SitumPlugin.java
@@ -78,6 +78,10 @@ public interface SitumPlugin {
void removeRealTimeUpdates();
+ void startShareLiveLocation(ReadableMap map);
+
+ void stopShareLiveLocation();
+
void checkIfPointInsideGeofence(ReadableMap map, Callback callback);
void invalidateCache();
diff --git a/plugin/android/src/main/java/com/situm/plugin/SitumPluginImpl.java b/plugin/android/src/main/java/com/situm/plugin/SitumPluginImpl.java
index 232e538..aa32aac 100755
--- a/plugin/android/src/main/java/com/situm/plugin/SitumPluginImpl.java
+++ b/plugin/android/src/main/java/com/situm/plugin/SitumPluginImpl.java
@@ -264,6 +264,18 @@ public void removeRealTimeUpdates() {
getPluginInstance().removeRealTimeUpdates();
}
+ @Override
+ @ReactMethod
+ public void startShareLiveLocation(ReadableMap map) {
+ getPluginInstance().startShareLiveLocation(map);
+ }
+
+ @Override
+ @ReactMethod
+ public void stopShareLiveLocation() {
+ getPluginInstance().stopShareLiveLocation();
+ }
+
@Override
@ReactMethod
public void checkIfPointInsideGeofence(ReadableMap map, Callback callback) {
diff --git a/plugin/ios/SitumPlugin.m b/plugin/ios/SitumPlugin.m
index 88b29f3..fa5f962 100755
--- a/plugin/ios/SitumPlugin.m
+++ b/plugin/ios/SitumPlugin.m
@@ -1004,6 +1004,20 @@ - (void)didExitedGeofences:(NSArray *)geofences {
[[SITUserHelperManager sharedInstance] autoManage:autoManage];
}
+
+RCT_EXPORT_METHOD(startShareLiveLocation:(NSDictionary *)arguments)
+{
+ if (arguments.count > 0) {
+ SITShareLiveLocationOptions *shareLiveLocationOptions = [SITShareLiveLocationOptions fromDictionary:arguments];
+ [((id)[SITLocationManager sharedInstance]) startShareLiveLocationWithOptions:shareLiveLocationOptions];
+ }
+}
+
+RCT_EXPORT_METHOD(stopShareLiveLocation)
+{
+ [((id)[SITLocationManager sharedInstance]) stopShareLiveLocation];
+}
+
RCT_EXPORT_METHOD(speakAloudText:(NSDictionary *)arguments) {
[_ttsSpeaker speakWithPayload: arguments];
}
diff --git a/plugin/src/sdk/index.ts b/plugin/src/sdk/index.ts
index b52c530..ded493a 100644
--- a/plugin/src/sdk/index.ts
+++ b/plugin/src/sdk/index.ts
@@ -771,6 +771,31 @@ export default class SitumPlugin {
});
};
+ /**
+ * INTERNAL METHOD.
+ *
+ * Ask sdk to start sharing its location.
+ * Do not use this method as it is intended for internal use
+ * by the map viewer module.
+ *
+ * @param startLiveLocationSharing
+ */
+ static startShareLiveLocation = (options: any) => {
+ RNCSitumPlugin.startShareLiveLocation(options);
+ };
+
+ /**
+ * INTERNAL METHOD.
+ *
+ * Ask sdk to stop sharing its location.
+ * Do not use this method as it is intended for internal use
+ * by the map viewer module.
+ *
+ */
+ static stopShareLiveLocation = () => {
+ RNCSitumPlugin.stopShareLiveLocation();
+ };
+
/**
* INTERNAL METHOD.
*
diff --git a/plugin/src/sdk/nativeInterface.ts b/plugin/src/sdk/nativeInterface.ts
index 95ef63d..7324b91 100644
--- a/plugin/src/sdk/nativeInterface.ts
+++ b/plugin/src/sdk/nativeInterface.ts
@@ -88,6 +88,8 @@ interface CartographyAPI {
interface LocationAPI {
startPositioning: (locationRequest?: LocationRequest) => void;
stopPositioning: (callback: (response: { success: boolean }) => void) => void;
+ startShareLiveLocation: (options: any) => void;
+ stopShareLiveLocation: () => void;
}
interface NavigationAPI {
diff --git a/plugin/src/wayfinding/components/MapView.tsx b/plugin/src/wayfinding/components/MapView.tsx
index 5625333..ce8c907 100644
--- a/plugin/src/wayfinding/components/MapView.tsx
+++ b/plugin/src/wayfinding/components/MapView.tsx
@@ -39,6 +39,7 @@ import {
type NavigateToCarPayload,
type NavigateToPointPayload,
type NavigateToPoiPayload,
+ type ShareLiveLocationSessionPayload,
type OnDirectionsRequestInterceptor,
type OnExternalLinkClickedResult,
type OnFavoritePoisUpdatedResult,
@@ -327,6 +328,18 @@ const MapView = React.forwardRef(
);
}, []);
+ //Share Live Location
+ const _setShareLiveLocationSession = useCallback(
+ (payload: ShareLiveLocationSessionPayload) => {
+ if (!webViewRef.current || !payload?.identifier) return;
+ sendMessageToViewer(
+ webViewRef.current,
+ ViewerMapper.setShareLiveLocationSession(payload),
+ );
+ },
+ [],
+ );
+
const _onMapIsReady = () => {
if (locationStatus) {
sendMessageToViewer(
@@ -410,6 +423,11 @@ const MapView = React.forwardRef(
ViewerMapper.cancelNavigation(),
);
},
+ setShareLiveLocationSession(
+ payload: ShareLiveLocationSessionPayload,
+ ): void {
+ _setShareLiveLocationSession(payload);
+ },
search(payload): void {
_search(payload);
},
@@ -431,6 +449,7 @@ const MapView = React.forwardRef(
_selectFloor,
_setDirectionsOptions,
_setFavoritePois,
+ _setShareLiveLocationSession,
_search,
]);
@@ -588,6 +607,12 @@ const MapView = React.forwardRef(
case "viewer.navigation.stopped":
SitumPlugin.updateNavigationState(payload);
break;
+ case "share_location.uploading_locations_started":
+ SitumPlugin.startShareLiveLocation(payload);
+ break;
+ case "share_location.uploading_locations_stopped":
+ SitumPlugin.stopShareLiveLocation();
+ break;
case "ui.speak_aloud_text":
SitumPlugin.speakAloudText(payload);
break;
diff --git a/plugin/src/wayfinding/types/index.ts b/plugin/src/wayfinding/types/index.ts
index fdfa0c5..feb3462 100644
--- a/plugin/src/wayfinding/types/index.ts
+++ b/plugin/src/wayfinding/types/index.ts
@@ -104,6 +104,26 @@ export interface MapViewRef {
* To use it, the feature 'Find My Car' must be enabled.
*/
navigateToCar: (params?: NavigateToCarPayload) => void;
+
+ /**
+ * Sets the live location sharing session to be displayed on the mapView.
+ *
+ * When enabled in the [Map Viewer Configuration Settings](https://situm.com/docs/map-viewer-configuration-settings/),
+ * Share Live Location allows a user to share their real-time location with another user.
+ *
+ * The sharing user receives a link that can be sent to their friends. If deep
+ * linking is correctly configured, the receiving user can open the link and
+ * see the shared location in their own app.
+ *
+ * The deep link includes a parameter called `shared_session_id`, which must be
+ * passed to this method so the mapView can display the sender’s location.
+ *
+ * For more information check [Situm Documentation](https://situm.com/docs)
+ * @param params.sessionIdentifier The identifier of the live location sharing session that the mapView should display.
+ */
+ setShareLiveLocationSession: (
+ params: ShareLiveLocationSessionPayload,
+ ) => void;
}
/**
@@ -219,6 +239,10 @@ export type NavigateToPointPayload = {
accessibilityMode?: AccessibilityMode;
};
+export type ShareLiveLocationSessionPayload = {
+ identifier: string;
+};
+
export type DirectionsMessage = {
buildingIdentifier: string;
originIdentifier: string;
diff --git a/plugin/src/wayfinding/utils/mapper.ts b/plugin/src/wayfinding/utils/mapper.ts
index abdbb19..e5553cb 100644
--- a/plugin/src/wayfinding/utils/mapper.ts
+++ b/plugin/src/wayfinding/utils/mapper.ts
@@ -19,6 +19,7 @@ import type {
OnNavigationResult,
SearchFilter,
ViewerConfigItem,
+ ShareLiveLocationSessionPayload,
} from "../types";
export const createPoint = (payload: any): Point => {
@@ -217,6 +218,13 @@ const ViewerMapper = {
setConfigItems: (configItems: ViewerConfigItem[]) => {
return mapperWrapper(`app.set_config_item`, configItems);
},
+ // Share Live Lovation
+ setShareLiveLocationSession: (session: ShareLiveLocationSessionPayload) => {
+ return mapperWrapper(
+ "share_location.set_shared_session_identifier",
+ session,
+ );
+ },
};
export default ViewerMapper;