Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sup 7038 #321

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
5 changes: 2 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En otros repos no se añade el _HERE del final, lo dejaría igual en todos


const App: React.FC = () => {
return (
<View>
<SitumProvider email={SITUM_EMAIL} apiKey={SITUM_API_KEY}>
<MapView
buildingId={SITUM_BUILDING_ID}
buildingId={BUILDING_IDENTIFIER}
// other props
/>
</SitumProvider>
Expand Down
7 changes: 2 additions & 5 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,13 @@ pod install
### Step 2: Set your credentials <a name="config"/>

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 <a name="runapplication"></a>

Expand Down
21 changes: 21 additions & 0 deletions example/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}')"

Expand All @@ -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}')"

Expand All @@ -79,6 +89,8 @@ jobs:
BUILDINGID: $(BUILDINGID)
FLOORID: $(FLOORID)
DASHBOARD_URL: $(DASHBOARD_URL)
REMOTEID: $(REMOTEID)
LANG: $(LANG)
system: $(ubuntuVersion)

- template: azure/build-examples.yaml
Expand All @@ -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:
Expand All @@ -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}')"

Expand All @@ -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}')"

Expand All @@ -143,6 +160,8 @@ jobs:
BUILDINGID: $(BUILDINGID)
FLOORID: $(FLOORID)
DASHBOARD_URL: $(DASHBOARD_URL)
REMOTEID: $(REMOTEID)
LANG: $(LANG)
system: $(macOSVersion)
BUILDNUMBER: $(BUILDNUMBER)

Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion example/azure/build-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}:
Expand Down Expand Up @@ -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"
Expand Down
18 changes: 13 additions & 5 deletions example/azure/common-steps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
emmanueltd marked this conversation as resolved.
Show resolved Hide resolved
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
4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}`);
Expand Down
6 changes: 3 additions & 3 deletions example/src/examples/sdk/BuildingFullInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}`);
Expand All @@ -56,7 +56,7 @@ export const BuildingFullInfo = () => {

return (
<ScrollView style={{...styles.screenWrapper}}>
{!SITUM_BUILDING_ID && (
{!BUILDING_IDENTIFIER && (
<Text>No building id provided, please edit your situm.tsx file</Text>
)}
<Card mode="contained" style={styles.margin}>
Expand Down
4 changes: 2 additions & 2 deletions example/src/examples/sdk/InfoFromBuilding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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}`);
Expand Down
4 changes: 2 additions & 2 deletions example/src/examples/sdk/RouteBetweenPOIs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}`);
Expand Down
11 changes: 9 additions & 2 deletions example/src/examples/wayfinding/NavigateToPoi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -88,8 +93,10 @@ const Screen: React.FC = () => {
<MapView
ref={mapViewRef}
configuration={{
buildingIdentifier: SITUM_BUILDING_ID,
buildingIdentifier: BUILDING_IDENTIFIER,
situmApiKey: SITUM_API_KEY,
remoteIdentifier: REMOTE_IDENTIFIER,
language: LANGUAGE,
}}
onPoiSelected={evt => {
setSelectedPoiIdentifier(evt?.identifier.toString());
Expand Down
11 changes: 9 additions & 2 deletions example/src/examples/wayfinding/SelectPoi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -88,8 +93,10 @@ const Screen: React.FC = () => {
<MapView
ref={mapViewRef}
configuration={{
buildingIdentifier: SITUM_BUILDING_ID,
buildingIdentifier: BUILDING_IDENTIFIER,
situmApiKey: SITUM_API_KEY,
remoteIdentifier: REMOTE_IDENTIFIER,
language: LANGUAGE,
}}
/>
</SafeAreaView>
Expand Down
11 changes: 9 additions & 2 deletions example/src/examples/wayfinding/SelectPoiCategory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -90,8 +95,10 @@ const Screen: React.FC = () => {
<MapView
ref={mapViewRef}
configuration={{
buildingIdentifier: SITUM_BUILDING_ID,
buildingIdentifier: BUILDING_IDENTIFIER,
situmApiKey: SITUM_API_KEY,
remoteIdentifier: REMOTE_IDENTIFIER,
language: LANGUAGE,
}}
/>
</SafeAreaView>
Expand Down
11 changes: 9 additions & 2 deletions example/src/examples/wayfinding/SetFavoritePois.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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,
}}
/>
</SafeAreaView>
Expand Down
11 changes: 9 additions & 2 deletions example/src/examples/wayfinding/Wayfinding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -137,8 +142,10 @@ const Screen: React.FC = () => {
<MapView
ref={mapViewRef}
configuration={{
buildingIdentifier: SITUM_BUILDING_ID,
buildingIdentifier: BUILDING_IDENTIFIER,
situmApiKey: SITUM_API_KEY,
remoteIdentifier: REMOTE_IDENTIFIER,
language: LANGUAGE,
}}
onLoad={onLoad}
onPoiSelected={onPoiSelected}
Expand Down
Loading