diff --git a/UPGRADE.md b/UPGRADE.md index 2a1387f0..eb8b3c66 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -40,16 +40,15 @@ In this file we share a way to upgrade previous versions of react-native-situm-p ```js // your imports -const SITUM_EMAIL = "YOUR_EMAIL_HERE"; const SITUM_API_KEY = "YOUR_APIKEY_HERE"; -const SITUM_BUILDING_ID = "YOUR_BUILDING_ID_HERE"; +const BUILDING_IDENTIFIER = "YOUR_BUILDING_IDENTIFIER_HERE"; const App: React.FC = () => { return ( diff --git a/example/README.md b/example/README.md index ebb7fa0d..6eab304c 100644 --- a/example/README.md +++ b/example/README.md @@ -62,16 +62,13 @@ pod install ### Step 2: Set your credentials For this step you must create a situm account, so [setup your account](../README.md#setup-your-account) before continuing. -After creating your situm account, you can set your credentials on the properties of [`src/situm.tsx`](./src/situm.tsx), like so: +After creating your situm account, you can set your [credentials](https://situm.com/docs/built-in-wayfinding-ui/#prepare-viewer) on the properties of [`src/situm.tsx`](./src/situm.tsx), like so: ```js -export const SITUM_EMAIL = ''; export const SITUM_API_KEY = ''; -export const SITUM_BUILDING_ID = ''; // Identifier of the building -export const SITUM_DASHBOARD_URL = 'https://dashboard.situm.com'; +export const BUILDING_IDENTIFIER = ''; ``` -**NOTE**: You should also fill the [SITUM_BUILDING_ID](https://situm.com/docs/sdk-cartography/#building-identifier) and [SITUM_FLOOR_ID](https://situm.com/docs/sdk-cartography/#floor-identifier) variables so all the examples are able to work as expected. In case you haven't created POIs or paths yet, learn [how to create these cartography elements](https://situm.com/docs/sdk-cartography/#sdk-a-basic-complete-cartography-example). ### Step 3: Run the app diff --git a/example/azure-pipelines.yml b/example/azure-pipelines.yml index d73bcaa6..f74a8dad 100644 --- a/example/azure-pipelines.yml +++ b/example/azure-pipelines.yml @@ -26,6 +26,12 @@ parameters: - name: DASHBOARD_URL type: string default: "https://dashboard.situm.com" + - name: REMOTEID + type: string + default: "demo" + - name: LANG + type: string + default: "en" variables: - group: Passwords @@ -54,6 +60,8 @@ jobs: echo "##vso[task.setvariable variable=XAPIEMAIL]$(echo $(XAPIEMAIL_EXAMPLES))" echo "##vso[task.setvariable variable=BUILDINGID]$(echo $(BUILDING_ID_EXAMPLES))" echo "##vso[task.setvariable variable=FLOORID]$(echo $(FLOOR_ID_EXAMPLES))" + echo "##vso[task.setvariable variable=REMOTEID]$(echo 'demo')" + echo "##vso[task.setvariable variable=LANG]$(echo 'en')" echo "##vso[task.setvariable variable=DASHBOARD_URL]$(echo 'https://dashboard.situm.com')" echo "##vso[task.setvariable variable=BUILDNUMBER]$(echo $(Build.BuildNumber) | awk -F"." '{if ($2 < 10) print $1"0"$2; else print $1$2}')" @@ -66,6 +74,8 @@ jobs: echo "##vso[task.setvariable variable=XAPIEMAIL]$(echo ${{ parameters.XAPIEMAIL}})" echo "##vso[task.setvariable variable=BUILDINGID]$(echo ${{ parameters.BUILDINGID}})" echo "##vso[task.setvariable variable=FLOORID]$(echo ${{ parameters.FLOORID}})" + echo "##vso[task.setvariable variable=REMOTEID]$(echo ${{ parameters.REMOTEID}})" + echo "##vso[task.setvariable variable=LANG]$(echo ${{ parameters.LANG}})" echo "##vso[task.setvariable variable=DASHBOARD_URL]$(echo ${{ parameters.DASHBOARD_URL }})" echo "##vso[task.setvariable variable=BUILDNUMBER]$(echo $(Build.BuildNumber) | awk -F"." '{if ($2 < 10) print $1"0"$2; else print $1$2}')" @@ -79,6 +89,8 @@ jobs: BUILDINGID: $(BUILDINGID) FLOORID: $(FLOORID) DASHBOARD_URL: $(DASHBOARD_URL) + REMOTEID: $(REMOTEID) + LANG: $(LANG) system: $(ubuntuVersion) - template: azure/build-examples.yaml @@ -88,6 +100,7 @@ jobs: BUILDINGID: $(BUILDINGID) XAPIEMAIL: $(XAPIEMAIL) BUILDNUMBER: $(BUILDNUMBER) + - ${{ if ne(variables['Build.Reason'],'manual') }}: - template: azure-templates/teams-notifier.yml@sys_kubernetes_templates parameters: @@ -111,6 +124,8 @@ jobs: echo "##vso[task.setvariable variable=XAPIEMAIL]$(echo $(XAPIEMAIL_EXAMPLES))" echo "##vso[task.setvariable variable=BUILDINGID]$(echo $(BUILDING_ID_EXAMPLES))" echo "##vso[task.setvariable variable=FLOORID]$(echo $(FLOOR_ID_EXAMPLES))" + echo "##vso[task.setvariable variable=REMOTEID]$(echo 'demo')" + echo "##vso[task.setvariable variable=LANG]$(echo 'en')" echo "##vso[task.setvariable variable=DASHBOARD_URL]$(echo 'https://dashboard.situm.com')" echo "##vso[task.setvariable variable=BUILDNUMBER]$(echo $(Build.BuildNumber) | awk -F"." '{if ($2 < 10) print $1"0"$2; else print $1$2}')" @@ -123,6 +138,8 @@ jobs: echo "##vso[task.setvariable variable=XAPIEMAIL]$(echo ${{ parameters.XAPIEMAIL}})" echo "##vso[task.setvariable variable=BUILDINGID]$(echo ${{ parameters.BUILDINGID}})" echo "##vso[task.setvariable variable=FLOORID]$(echo ${{ parameters.FLOORID}})" + echo "##vso[task.setvariable variable=REMOTEID]$(echo ${{ parameters.REMOTEID}})" + echo "##vso[task.setvariable variable=LANG]$(echo ${{ parameters.LANG}})" echo "##vso[task.setvariable variable=DASHBOARD_URL]$(echo ${{ parameters.DASHBOARD_URL }})" echo "##vso[task.setvariable variable=BUILDNUMBER]$(echo $(Build.BuildNumber) | awk -F"." '{if ($2 < 10) print $1"0"$2; else print $1$2}')" @@ -143,6 +160,8 @@ jobs: BUILDINGID: $(BUILDINGID) FLOORID: $(FLOORID) DASHBOARD_URL: $(DASHBOARD_URL) + REMOTEID: $(REMOTEID) + LANG: $(LANG) system: $(macOSVersion) BUILDNUMBER: $(BUILDNUMBER) @@ -153,6 +172,8 @@ jobs: XAPIEMAIL: $(XAPIEMAIL) BUILDINGID: $(BUILDINGID) BUILDNUMBER: $(BUILDNUMBER) + REMOTEID: $(REMOTEID) + LANG: $(LANG) - ${{ if ne(variables['Build.Reason'],'manual') }}: - template: azure-templates/teams-notifier.yml@sys_kubernetes_templates diff --git a/example/azure/build-examples.yaml b/example/azure/build-examples.yaml index 7e0ef767..5d8217cf 100644 --- a/example/azure/build-examples.yaml +++ b/example/azure/build-examples.yaml @@ -10,6 +10,13 @@ parameters: - name: BUILDNUMBER type: string default: "202430015" + - name: REMOTEID + type: string + default: "demo" + - name: LANG + type: string + default: "en" + steps: - ${{ if contains(parameters.system, 'macOS') }}: @@ -54,7 +61,7 @@ steps: gem install fastlane dashboard=$(echo ${{ parameters.DASHBOARD_URL }} | awk -F"/" '{print $3}') - export WHATS_NEW="Plugin version: $(pluginVersion), USER: ${{parameters.XAPIEMAIL}}, BUILDINGID: ${{ parameters.BUILDINGID }}, DASHBOARD_URL: $dashboard" + export WHATS_NEW="Plugin version: $(pluginVersion), USER: ${{parameters.XAPIEMAIL}}, BUILDINGID: ${{ parameters.BUILDINGID }}, DASHBOARD_URL: $dashboard ,REMOTEID: ${{parameters.REMOTEID}}, LANG: ${{ parameters.LANG}} " export BUILDNUMBER=${{ parameters.BUILDNUMBER }} echo -e "\n[+] Setting variables to deploy:" echo -e "\t[+] Set WHATS_NEW: $WHATS_NEW" diff --git a/example/azure/common-steps.yaml b/example/azure/common-steps.yaml index 296c05b0..b127aaa1 100644 --- a/example/azure/common-steps.yaml +++ b/example/azure/common-steps.yaml @@ -14,6 +14,12 @@ parameters: - name: BUILDNUMBER type: string default: "Value only set in iOS" + - name: REMOTEID + type: string + default: "demo" + - name: LANG + type: string + default: "en" steps: - checkout: self fetchDepth: 1 @@ -53,12 +59,14 @@ steps: echo -e "\t[+] FLOORID: ${{ parameters.FLOORID }}" echo -e "\t[+] DASHBOARD_URL: ${{ parameters.DASHBOARD_URL }}" echo -e "\t[+] BUILDNUMBER: ${{ parameters.BUILDNUMBER }}" + echo -e "\t[+] REMOTEID: ${{ parameters.REMOTEID }}" + echo -e "\t[+] LANG: ${{ parameters.LANG }}" echo -e "\t[+] Plugin Version used: $pluginVersion" - echo "export const SITUM_EMAIL = '${{ parameters.XAPIEMAIL }}';" > example/src/situm.tsx - echo "export const SITUM_API_KEY = '${{ parameters.XAPIKEY }}';" >> example/src/situm.tsx - echo "export const SITUM_BUILDING_ID = '${{ parameters.BUILDINGID }}';" >> example/src/situm.tsx - echo "export const SITUM_FLOOR_ID = '${{ parameters.FLOORID }}';" >> example/src/situm.tsx - echo "export const SITUM_DASHBOARD_URL = '${{ parameters.DASHBOARD_URL }}';" >> example/src/situm.tsx + echo "export const SITUM_API_KEY = '${{ parameters.XAPIKEY }}';" > example/src/situm.tsx + echo "export const BUILDING_IDENTIFIER = '${{ parameters.BUILDINGID }}';" >> example/src/situm.tsx + echo "export const API_DOMAIN = '${{ parameters.DASHBOARD_URL }}';" >> example/src/situm.tsx + echo "export const REMOTE_IDENTIFIER = '${{ parameters.REMOTEID }}';" >> example/src/situm.tsx + echo "export const LANGUAGE = '${{ parameters.LANG }}';" >> example/src/situm.tsx displayName: Configure credentials diff --git a/example/src/App.tsx b/example/src/App.tsx index b89f2ba1..9e1a6c33 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -5,7 +5,7 @@ import {NavigationContainer} from '@react-navigation/native'; import {createNativeStackNavigator} from '@react-navigation/native-stack'; import SitumPlugin from '@situm/react-native'; -import {SITUM_API_KEY, SITUM_DASHBOARD_URL} from './situm'; +import {SITUM_API_KEY, API_DOMAIN} from './situm'; import Theme from './examples/styles/theme'; import PositioningScreen from './examples/sdk/Positioning'; @@ -46,7 +46,7 @@ const HomeScreen = ({navigation}) => { useEffect(() => { try { SitumPlugin.init(); - SitumPlugin.setDashboardURL(SITUM_DASHBOARD_URL); + SitumPlugin.setDashboardURL(API_DOMAIN); SitumPlugin.setApiKey(SITUM_API_KEY); } catch (e) { console.error(`Situm > example > Could not initialize SDK ${e}`); diff --git a/example/src/examples/sdk/BuildingFullInfo.tsx b/example/src/examples/sdk/BuildingFullInfo.tsx index a6b5206d..61602db4 100644 --- a/example/src/examples/sdk/BuildingFullInfo.tsx +++ b/example/src/examples/sdk/BuildingFullInfo.tsx @@ -3,7 +3,7 @@ import {ScrollView} from 'react-native'; import SitumPlugin from '@situm/react-native'; import type {Building, Floor, Poi} from '@situm/react-native'; -import {SITUM_BUILDING_ID} from '../../situm'; +import {BUILDING_IDENTIFIER} from '../../situm'; import styles from '../styles/styles'; import {fetchBuilding} from '../Utils/CommonFetchs'; import {Card, Text} from 'react-native-paper'; @@ -41,7 +41,7 @@ export const BuildingFullInfo = () => { }; useEffect(() => { - fetchBuilding(SITUM_BUILDING_ID) + fetchBuilding(BUILDING_IDENTIFIER) .then(setBuilding) .catch(error => { console.error(`Situm > example > Failed to fetch building: ${error}`); @@ -56,7 +56,7 @@ export const BuildingFullInfo = () => { return ( - {!SITUM_BUILDING_ID && ( + {!BUILDING_IDENTIFIER && ( No building id provided, please edit your situm.tsx file )} diff --git a/example/src/examples/sdk/InfoFromBuilding.tsx b/example/src/examples/sdk/InfoFromBuilding.tsx index 5454b449..155cac17 100644 --- a/example/src/examples/sdk/InfoFromBuilding.tsx +++ b/example/src/examples/sdk/InfoFromBuilding.tsx @@ -2,7 +2,7 @@ import React, {useEffect, useState} from 'react'; import {Text, ScrollView} from 'react-native'; import SitumPlugin, {BuildingInfo} from '@situm/react-native'; -import {SITUM_BUILDING_ID} from '../../situm'; +import {BUILDING_IDENTIFIER} from '../../situm'; import styles from '../styles/styles'; import {fetchBuilding} from '../Utils/CommonFetchs'; import {Card} from 'react-native-paper'; @@ -23,7 +23,7 @@ export const InfoFromBuilding = () => { }; useEffect(() => { - fetchBuilding(SITUM_BUILDING_ID) + fetchBuilding(BUILDING_IDENTIFIER) .then(myBuilding => getInfoFromBuilding(myBuilding)) .catch(e => { console.error(`Situm > example > Could not fetch building: ${e}`); diff --git a/example/src/examples/sdk/RouteBetweenPOIs.tsx b/example/src/examples/sdk/RouteBetweenPOIs.tsx index e17bfddb..9dcc2ccc 100644 --- a/example/src/examples/sdk/RouteBetweenPOIs.tsx +++ b/example/src/examples/sdk/RouteBetweenPOIs.tsx @@ -2,7 +2,7 @@ import React, {useEffect, useState} from 'react'; import {ScrollView, Text} from 'react-native'; import SitumPlugin, {Building, Poi} from '@situm/react-native'; -import {SITUM_BUILDING_ID} from '../../situm'; +import {BUILDING_IDENTIFIER} from '../../situm'; import styles from '../styles/styles'; import {fetchBuilding} from '../Utils/CommonFetchs'; import {Card} from 'react-native-paper'; @@ -51,7 +51,7 @@ export const RouteBetweenPOIs = () => { useEffect(() => { // first load the building - fetchBuilding(SITUM_BUILDING_ID) + fetchBuilding(BUILDING_IDENTIFIER) .then(setBuilding) .catch(e => { console.error(`Situm > example > Coult not fetch building ${e}`); diff --git a/example/src/examples/wayfinding/NavigateToPoi.tsx b/example/src/examples/wayfinding/NavigateToPoi.tsx index a43467ec..e2576ed5 100644 --- a/example/src/examples/wayfinding/NavigateToPoi.tsx +++ b/example/src/examples/wayfinding/NavigateToPoi.tsx @@ -8,7 +8,12 @@ import SitumPlugin, { requestPermission, } from '@situm/react-native'; import type {MapViewRef} from '@situm/react-native'; -import {SITUM_API_KEY, SITUM_BUILDING_ID} from '../../situm'; +import { + SITUM_API_KEY, + BUILDING_IDENTIFIER, + LANGUAGE, + REMOTE_IDENTIFIER, +} from '../../situm'; import {Button, TextInput} from 'react-native-paper'; const styles = StyleSheet.create({ @@ -88,8 +93,10 @@ const Screen: React.FC = () => { { setSelectedPoiIdentifier(evt?.identifier.toString()); diff --git a/example/src/examples/wayfinding/SelectPoi.tsx b/example/src/examples/wayfinding/SelectPoi.tsx index a67f7b5e..e6defa2e 100644 --- a/example/src/examples/wayfinding/SelectPoi.tsx +++ b/example/src/examples/wayfinding/SelectPoi.tsx @@ -8,7 +8,12 @@ import SitumPlugin, { requestPermission, } from '@situm/react-native'; import type {MapViewRef} from '@situm/react-native'; -import {SITUM_API_KEY, SITUM_BUILDING_ID} from '../../situm'; +import { + SITUM_API_KEY, + BUILDING_IDENTIFIER, + LANGUAGE, + REMOTE_IDENTIFIER, +} from '../../situm'; import {Button, TextInput} from 'react-native-paper'; const styles = StyleSheet.create({ @@ -88,8 +93,10 @@ const Screen: React.FC = () => { diff --git a/example/src/examples/wayfinding/SelectPoiCategory.tsx b/example/src/examples/wayfinding/SelectPoiCategory.tsx index 51e9c422..228078b5 100644 --- a/example/src/examples/wayfinding/SelectPoiCategory.tsx +++ b/example/src/examples/wayfinding/SelectPoiCategory.tsx @@ -8,7 +8,12 @@ import SitumPlugin, { requestPermission, } from '@situm/react-native'; import type {MapViewRef} from '@situm/react-native'; -import {SITUM_API_KEY, SITUM_BUILDING_ID} from '../../situm'; +import { + SITUM_API_KEY, + BUILDING_IDENTIFIER, + LANGUAGE, + REMOTE_IDENTIFIER, +} from '../../situm'; import {Button, TextInput} from 'react-native-paper'; const styles = StyleSheet.create({ @@ -90,8 +95,10 @@ const Screen: React.FC = () => { diff --git a/example/src/examples/wayfinding/SetFavoritePois.tsx b/example/src/examples/wayfinding/SetFavoritePois.tsx index 380c41f6..b2038888 100644 --- a/example/src/examples/wayfinding/SetFavoritePois.tsx +++ b/example/src/examples/wayfinding/SetFavoritePois.tsx @@ -9,7 +9,12 @@ import SitumPlugin, { } from '@situm/react-native'; import type {MapViewRef} from '@situm/react-native'; import type {OnFavoritePoisUpdatedResult} from '@situm/react-native'; -import {SITUM_API_KEY, SITUM_BUILDING_ID} from '../../situm'; +import { + SITUM_API_KEY, + BUILDING_IDENTIFIER, + LANGUAGE, + REMOTE_IDENTIFIER, +} from '../../situm'; import {Button, TextInput} from 'react-native-paper'; const styles = StyleSheet.create({ @@ -104,8 +109,10 @@ const Screen: React.FC = () => { ref={mapViewRef} onFavoritePoisUpdated={onFavoritePoisUpdated} configuration={{ - buildingIdentifier: SITUM_BUILDING_ID, + buildingIdentifier: BUILDING_IDENTIFIER, situmApiKey: SITUM_API_KEY, + remoteIdentifier: REMOTE_IDENTIFIER, + language: LANGUAGE, }} /> diff --git a/example/src/examples/wayfinding/Wayfinding.tsx b/example/src/examples/wayfinding/Wayfinding.tsx index 1aee4a23..c01da10c 100644 --- a/example/src/examples/wayfinding/Wayfinding.tsx +++ b/example/src/examples/wayfinding/Wayfinding.tsx @@ -20,7 +20,12 @@ import type { OnExternalLinkClickedResult, MapViewRef, } from '@situm/react-native'; -import {SITUM_API_KEY, SITUM_BUILDING_ID} from '../../situm'; +import { + SITUM_API_KEY, + BUILDING_IDENTIFIER, + LANGUAGE, + REMOTE_IDENTIFIER, +} from '../../situm'; const styles = StyleSheet.create({ container: { @@ -137,8 +142,10 @@ const Screen: React.FC = () => { ( * ref.selectPoi(122)} * configuration={{ - * buildingIdentifier: SITUM_BUILDING_ID, + * buildingIdentifier: BUILDING_IDENTIFIER, * }} * onLoad={onLoad} /> */