react-native-pointr 9.2.0 → 9.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API_REFERENCE.md +887 -0
- package/CHANGELOG.md +35 -0
- package/EXTENDING.md +419 -0
- package/README.md +221 -117
- package/WAYFINDING_EVENTS.md +243 -0
- package/android/build.gradle +3 -4
- package/android/src/main/java/com/pointr/PTRCoreExtensions.kt +126 -0
- package/android/src/main/java/com/pointr/PTRMapWidgetCommandType.kt +2 -1
- package/android/src/main/java/com/pointr/PTRMapWidgetManager.kt +73 -11
- package/android/src/main/java/com/pointr/PointrModule.kt +106 -3
- package/example/pointr_rn_demo/.bundle/config +2 -0
- package/example/pointr_rn_demo/.eslintrc.js +4 -0
- package/example/pointr_rn_demo/.prettierrc.js +5 -0
- package/example/pointr_rn_demo/.watchmanconfig +1 -0
- package/example/pointr_rn_demo/App.tsx +323 -0
- package/example/pointr_rn_demo/Gemfile +16 -0
- package/example/pointr_rn_demo/Gemfile.lock +111 -0
- package/example/pointr_rn_demo/README.md +188 -0
- package/example/pointr_rn_demo/__tests__/App.test.tsx +13 -0
- package/example/pointr_rn_demo/android/app/build.gradle +119 -0
- package/example/pointr_rn_demo/android/app/debug.keystore +0 -0
- package/example/pointr_rn_demo/android/app/proguard-rules.pro +10 -0
- package/example/pointr_rn_demo/android/app/src/main/AndroidManifest.xml +27 -0
- package/example/pointr_rn_demo/android/app/src/main/java/com/pointr_rn_demo/MainActivity.kt +22 -0
- package/example/pointr_rn_demo/android/app/src/main/java/com/pointr_rn_demo/MainApplication.kt +27 -0
- package/example/pointr_rn_demo/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/pointr_rn_demo/android/app/src/main/res/values/strings.xml +3 -0
- package/example/pointr_rn_demo/android/app/src/main/res/values/styles.xml +9 -0
- package/example/pointr_rn_demo/android/build.gradle +32 -0
- package/example/pointr_rn_demo/android/gradle.properties +44 -0
- package/example/pointr_rn_demo/android/settings.gradle +6 -0
- package/example/pointr_rn_demo/app.json +4 -0
- package/example/pointr_rn_demo/babel.config.js +3 -0
- package/example/pointr_rn_demo/index.js +16 -0
- package/example/pointr_rn_demo/ios/.xcode.env +11 -0
- package/example/pointr_rn_demo/ios/Podfile +40 -0
- package/example/pointr_rn_demo/ios/Podfile.lock +2767 -0
- package/example/pointr_rn_demo/ios/pointr_rn_demo/AppDelegate.swift +48 -0
- package/example/pointr_rn_demo/ios/pointr_rn_demo/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/example/pointr_rn_demo/ios/pointr_rn_demo/Images.xcassets/Contents.json +6 -0
- package/example/pointr_rn_demo/ios/pointr_rn_demo/Info.plist +63 -0
- package/example/pointr_rn_demo/ios/pointr_rn_demo/LaunchScreen.storyboard +47 -0
- package/example/pointr_rn_demo/ios/pointr_rn_demo/PrivacyInfo.xcprivacy +37 -0
- package/example/pointr_rn_demo/ios/pointr_rn_demo.xcodeproj/project.pbxproj +496 -0
- package/example/pointr_rn_demo/ios/pointr_rn_demo.xcodeproj/xcshareddata/xcschemes/pointr_rn_demo.xcscheme +88 -0
- package/example/pointr_rn_demo/ios/pointr_rn_demo.xcworkspace/contents.xcworkspacedata +10 -0
- package/example/pointr_rn_demo/jest.config.js +3 -0
- package/example/pointr_rn_demo/metro.config.js +22 -0
- package/example/pointr_rn_demo/package-lock.json +11747 -0
- package/example/pointr_rn_demo/package.json +46 -0
- package/example/pointr_rn_demo/prepare-demo-distribution.sh +103 -0
- package/example/pointr_rn_demo/tsconfig.json +5 -0
- package/ios/PTRMapWidgetContainerView.swift +56 -5
- package/ios/PTRMapWidgetManager-Bridging.m +7 -0
- package/ios/PTRMapWidgetManager.swift +28 -0
- package/ios/PTRNativeLibrary-Bridging.m +4 -0
- package/ios/PTRNativeLibrary.swift +208 -2
- package/package.json +16 -2
- package/prepare-distribution.sh +84 -0
- package/react-native-pointr.podspec +1 -1
- package/src/PTRCommand.ts +13 -0
- package/src/PTRMapWidgetUtils.ts +10 -1
- package/src/PTRPoiManager.ts +20 -0
- package/src/index.tsx +40 -1
- package/src/types/PTRGeometry.ts +70 -0
- package/src/types/PTRPoi.ts +49 -0
- package/src/types/PTRPosition.ts +22 -0
- package/src/types/PTRWayfindingEvent.ts +18 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
requireNativeComponent,
|
|
4
|
+
findNodeHandle,
|
|
5
|
+
Button,
|
|
6
|
+
View,
|
|
7
|
+
ScrollView,
|
|
8
|
+
NativeSyntheticEvent,
|
|
9
|
+
NativeModules,
|
|
10
|
+
NativeEventEmitter
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
13
|
+
import {
|
|
14
|
+
getPois,
|
|
15
|
+
showMapWidget,
|
|
16
|
+
PTRSiteCommand,
|
|
17
|
+
PTRBuildingCommand,
|
|
18
|
+
PTRLevelCommand,
|
|
19
|
+
PTRPoiCommand,
|
|
20
|
+
PTRPathCommand,
|
|
21
|
+
PTRStaticPathCommand,
|
|
22
|
+
PTRMarkMyCarLevelCommand,
|
|
23
|
+
PTRMarkMyCarSiteCommand,
|
|
24
|
+
PTRShowMyCarSiteCommand,
|
|
25
|
+
PTRStartAndFocusCommand,
|
|
26
|
+
type PTRPoi,
|
|
27
|
+
type PTRWayfindingEvent,
|
|
28
|
+
} from 'react-native-pointr';
|
|
29
|
+
|
|
30
|
+
interface PTRMapWidgetProps {
|
|
31
|
+
style?: any;
|
|
32
|
+
onMapWidgetDidEndLoading?: (event: NativeSyntheticEvent<any>) => void;
|
|
33
|
+
onWayfindingEvent?: (event: NativeSyntheticEvent<PTRWayfindingEvent>) => void;
|
|
34
|
+
}
|
|
35
|
+
const PTRMapWidget = requireNativeComponent<PTRMapWidgetProps>('PTRMapWidget');
|
|
36
|
+
|
|
37
|
+
// Create event emitter for Pointr events
|
|
38
|
+
const PTREventEmitter = new NativeEventEmitter(NativeModules.PTRNativePointrLibrary);
|
|
39
|
+
|
|
40
|
+
function App(): React.JSX.Element {
|
|
41
|
+
const ref = useRef<any>(null);
|
|
42
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
43
|
+
const insets = useSafeAreaInsets();
|
|
44
|
+
|
|
45
|
+
// Initialize Pointr library when component mounts
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
// Use setTimeout to defer initialization to next tick, preventing blocking
|
|
48
|
+
const timer = setTimeout(() => {
|
|
49
|
+
try {
|
|
50
|
+
console.log('Initializing Pointr library...');
|
|
51
|
+
|
|
52
|
+
// Initialize the Pointr library
|
|
53
|
+
NativeModules.PTRNativePointrLibrary.initialize(
|
|
54
|
+
"1ee58e56-fc35-4ec4-b32e-5d49e65fb52d",
|
|
55
|
+
"af5d9431-56a3-46a9-ae0a-65d9757528d1",
|
|
56
|
+
"https://sample-app-v9.pointr.cloud",
|
|
57
|
+
0
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// Start the Pointr SDK
|
|
61
|
+
NativeModules.PTRNativePointrLibrary.start((state: string) => {
|
|
62
|
+
console.log(`Pointr state: ${state}`);
|
|
63
|
+
setIsInitialized(true);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error('Error initializing Pointr:', error);
|
|
68
|
+
setIsInitialized(true); // Set to true anyway to prevent blocking UI
|
|
69
|
+
}
|
|
70
|
+
}, 100);
|
|
71
|
+
|
|
72
|
+
return () => clearTimeout(timer);
|
|
73
|
+
}, []);
|
|
74
|
+
|
|
75
|
+
// Set up geofence event listener
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!isInitialized) return;
|
|
78
|
+
// Subscribe to OnGeofenceEvent
|
|
79
|
+
const geofenceSubscription = PTREventEmitter.addListener(
|
|
80
|
+
'OnGeofenceEvent',
|
|
81
|
+
(geofenceEvent) => {
|
|
82
|
+
console.log('=== Geofence Event Received ===');
|
|
83
|
+
// Log the event type
|
|
84
|
+
console.log(`Event Type: ${geofenceEvent.eventType}`);
|
|
85
|
+
|
|
86
|
+
// Log timestamp if available (iOS only)
|
|
87
|
+
if (geofenceEvent.timestamp) {
|
|
88
|
+
console.log(`Timestamp: ${new Date(geofenceEvent.timestamp).toISOString()}`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Log geofence information
|
|
92
|
+
if (geofenceEvent.geofence) {
|
|
93
|
+
console.log('Geofence Information:');
|
|
94
|
+
console.log(` - ID: ${geofenceEvent.geofence.id}`);
|
|
95
|
+
console.log(` - External ID: ${geofenceEvent.geofence.externalId}`);
|
|
96
|
+
console.log(` - Name: ${geofenceEvent.geofence.name}`);
|
|
97
|
+
console.log(` - Type: ${geofenceEvent.geofence.geofenceType}`);
|
|
98
|
+
console.log(` - Location: ${geofenceEvent.geofence.position.latitude}, ${geofenceEvent.geofence.position.longitude}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Log notification information if available
|
|
102
|
+
if (geofenceEvent.geofenceNotification) {
|
|
103
|
+
console.log('Notification:');
|
|
104
|
+
console.log(` - ID: ${geofenceEvent.geofenceNotification.id}`);
|
|
105
|
+
console.log(` - Message: ${geofenceEvent.geofenceNotification.message}`);
|
|
106
|
+
console.log(` - Timestamp: ${geofenceEvent.geofenceNotification.timestamp}`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
console.log('================================');
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const positionSubscription = PTREventEmitter.addListener("OnPositionManagerCalculatedLocation", (location) => {
|
|
114
|
+
// console.log("Calculated Location: ", location);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// Clean up the subscription when component unmounts
|
|
118
|
+
return () => {
|
|
119
|
+
geofenceSubscription.remove();
|
|
120
|
+
positionSubscription.remove();
|
|
121
|
+
};
|
|
122
|
+
}, [isInitialized]);
|
|
123
|
+
|
|
124
|
+
const handleWayfindingEvent = (event: NativeSyntheticEvent<PTRWayfindingEvent>) => {
|
|
125
|
+
const wayfindingEvent = event.nativeEvent;
|
|
126
|
+
|
|
127
|
+
// Determine event type name
|
|
128
|
+
let eventTypeName: string;
|
|
129
|
+
switch (wayfindingEvent.type) {
|
|
130
|
+
case -1:
|
|
131
|
+
eventTypeName = 'Cancelled';
|
|
132
|
+
break;
|
|
133
|
+
case 0:
|
|
134
|
+
eventTypeName = 'Started';
|
|
135
|
+
break;
|
|
136
|
+
case 1:
|
|
137
|
+
eventTypeName = 'Ended';
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
eventTypeName = 'Unknown';
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
console.log('=== Wayfinding Event ===');
|
|
144
|
+
console.log(`Event Type: ${eventTypeName} (${wayfindingEvent.type})`);
|
|
145
|
+
console.log('Destination POI:');
|
|
146
|
+
console.log(` - Name: ${wayfindingEvent.poi.name}`);
|
|
147
|
+
console.log(` - Identifier: ${wayfindingEvent.poi.identifier}`);
|
|
148
|
+
console.log(` - External ID: ${wayfindingEvent.poi.externalIdentifier}`);
|
|
149
|
+
console.log(` - Type Code: ${wayfindingEvent.poi.typeCode}`);
|
|
150
|
+
console.log(` - Position: lat ${wayfindingEvent.poi.position.lat}, lon ${wayfindingEvent.poi.position.lon}, level ${wayfindingEvent.poi.position.lvl}`);
|
|
151
|
+
console.log('========================');
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const handleMapWidgetDidEndLoading = (event: NativeSyntheticEvent<any>) => {
|
|
155
|
+
const ptrCommandResponse = event.nativeEvent;
|
|
156
|
+
if (ptrCommandResponse.command === "site") {
|
|
157
|
+
console.log("Map did end loading:", ptrCommandResponse.command, ptrCommandResponse.siteExternalIdentifier, ptrCommandResponse.error);
|
|
158
|
+
|
|
159
|
+
getPois(ptrCommandResponse.siteExternalIdentifier)
|
|
160
|
+
.then((pois: PTRPoi[]) => {
|
|
161
|
+
console.log(`POIs fetched: ${pois.length} items`);
|
|
162
|
+
// Example: Log first POI details
|
|
163
|
+
if (pois.length > 0) {
|
|
164
|
+
const firstPoi = pois[0];
|
|
165
|
+
console.log('First POI:', {
|
|
166
|
+
name: firstPoi.name,
|
|
167
|
+
identifier: firstPoi.identifier,
|
|
168
|
+
typeCode: firstPoi.typeCode,
|
|
169
|
+
position: firstPoi.position,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
.catch((error) => {
|
|
174
|
+
console.error("Error fetching POIs:", error);
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
console.log("Map did end loading with unknown parameters:", ptrCommandResponse);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const showSite = () => {
|
|
182
|
+
const reactTag = findNodeHandle(ref.current);
|
|
183
|
+
if (reactTag) {
|
|
184
|
+
let command = new PTRSiteCommand("workplace-portland");
|
|
185
|
+
showMapWidget(reactTag, command);
|
|
186
|
+
} else {
|
|
187
|
+
console.error("Failed to find node handle for ref");
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const showBuilding = () => {
|
|
192
|
+
const reactTag = findNodeHandle(ref.current);
|
|
193
|
+
if (reactTag) {
|
|
194
|
+
let command = new PTRBuildingCommand("workplace-portland", "office-east");
|
|
195
|
+
showMapWidget(reactTag, command);
|
|
196
|
+
} else {
|
|
197
|
+
console.error("Failed to find node handle for ref");
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const showLevel = () => {
|
|
202
|
+
const reactTag = findNodeHandle(ref.current);
|
|
203
|
+
if (reactTag) {
|
|
204
|
+
let command = new PTRLevelCommand("workplace-portland", "office-east", 2);
|
|
205
|
+
showMapWidget(reactTag, command);
|
|
206
|
+
} else {
|
|
207
|
+
console.error("Failed to find node handle for ref");
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const showPoi = () => {
|
|
212
|
+
const reactTag = findNodeHandle(ref.current);
|
|
213
|
+
if (reactTag) {
|
|
214
|
+
let command = new PTRPoiCommand("workplace-portland", "Lobby");
|
|
215
|
+
showMapWidget(reactTag, command);
|
|
216
|
+
} else {
|
|
217
|
+
console.error("Failed to find node handle for ref");
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const showPath = () => {
|
|
222
|
+
const reactTag = findNodeHandle(ref.current);
|
|
223
|
+
if (reactTag) {
|
|
224
|
+
let command = new PTRPathCommand("workplace-portland", "Lobby");
|
|
225
|
+
showMapWidget(reactTag, command);
|
|
226
|
+
} else {
|
|
227
|
+
console.error("Failed to find node handle for ref");
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const showStaticPath = () => {
|
|
232
|
+
const reactTag = findNodeHandle(ref.current);
|
|
233
|
+
if (reactTag) {
|
|
234
|
+
let command = new PTRStaticPathCommand("workplace-portland", "Accessories", "Lobby");
|
|
235
|
+
showMapWidget(reactTag, command);
|
|
236
|
+
} else {
|
|
237
|
+
console.error("Failed to find node handle for ref");
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const markMyCarLevel = () => {
|
|
242
|
+
const reactTag = findNodeHandle(ref.current);
|
|
243
|
+
if (reactTag) {
|
|
244
|
+
let command = new PTRMarkMyCarLevelCommand("workplace-portland", "office-east", 1, true);
|
|
245
|
+
showMapWidget(reactTag, command);
|
|
246
|
+
} else {
|
|
247
|
+
console.error("Failed to find node handle for ref");
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const markMyCarSite = () => {
|
|
252
|
+
const reactTag = findNodeHandle(ref.current);
|
|
253
|
+
if (reactTag) {
|
|
254
|
+
let command = new PTRMarkMyCarSiteCommand("workplace-portland", true);
|
|
255
|
+
showMapWidget(reactTag, command);
|
|
256
|
+
} else {
|
|
257
|
+
console.error("Failed to find node handle for ref");
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const showMyCarSite = () => {
|
|
262
|
+
const reactTag = findNodeHandle(ref.current);
|
|
263
|
+
if (reactTag) {
|
|
264
|
+
let command = new PTRShowMyCarSiteCommand("workplace-portland", true);
|
|
265
|
+
showMapWidget(reactTag, command);
|
|
266
|
+
} else {
|
|
267
|
+
console.error("Failed to find node handle for ref");
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const startAndFocusSite = () => {
|
|
272
|
+
const reactTag = findNodeHandle(ref.current);
|
|
273
|
+
if (reactTag) {
|
|
274
|
+
const siteCommand = new PTRSiteCommand("workplace-portland");
|
|
275
|
+
const command = new PTRStartAndFocusCommand(
|
|
276
|
+
"1ee58e56-fc35-4ec4-b32e-5d49e65fb52d",
|
|
277
|
+
"af5d9431-56a3-46a9-ae0a-65d9757528d1",
|
|
278
|
+
"https://sample-app-v9.pointr.cloud",
|
|
279
|
+
0,
|
|
280
|
+
siteCommand
|
|
281
|
+
);
|
|
282
|
+
showMapWidget(reactTag, command);
|
|
283
|
+
} else {
|
|
284
|
+
console.error("Failed to find node handle for ref");
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
return (
|
|
289
|
+
<View style={{ flex: 1 }}>
|
|
290
|
+
<View style={{ flex: 1, paddingTop: insets.top, paddingLeft: insets.left, paddingRight: insets.right }}>
|
|
291
|
+
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ padding: 16 }}>
|
|
292
|
+
<Button title="Show Site" onPress={showSite} />
|
|
293
|
+
<View style={{ height: 12 }} />
|
|
294
|
+
<Button title="Show Building" onPress={showBuilding} />
|
|
295
|
+
<View style={{ height: 12 }} />
|
|
296
|
+
<Button title="Show Level" onPress={showLevel} />
|
|
297
|
+
<View style={{ height: 12 }} />
|
|
298
|
+
<Button title="Show POI" onPress={showPoi} />
|
|
299
|
+
<View style={{ height: 12 }} />
|
|
300
|
+
<Button title="Show Path" onPress={showPath} />
|
|
301
|
+
<View style={{ height: 12 }} />
|
|
302
|
+
<Button title="Show Static Path" onPress={showStaticPath} />
|
|
303
|
+
<View style={{ height: 12 }} />
|
|
304
|
+
<Button title="Mark My Car Level" onPress={markMyCarLevel} />
|
|
305
|
+
<View style={{ height: 12 }} />
|
|
306
|
+
<Button title="Mark My Car Site" onPress={markMyCarSite} />
|
|
307
|
+
<View style={{ height: 12 }} />
|
|
308
|
+
<Button title="Show My Car Site" onPress={showMyCarSite} />
|
|
309
|
+
<View style={{ height: 12 }} />
|
|
310
|
+
<Button title="Start & Focus Site" onPress={startAndFocusSite} />
|
|
311
|
+
</ScrollView>
|
|
312
|
+
</View>
|
|
313
|
+
<PTRMapWidget
|
|
314
|
+
ref={ref}
|
|
315
|
+
style={{ flex: 4 }}
|
|
316
|
+
onMapWidgetDidEndLoading={handleMapWidgetDidEndLoading}
|
|
317
|
+
onWayfindingEvent={handleWayfindingEvent}
|
|
318
|
+
/>
|
|
319
|
+
</View>
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export default App;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
4
|
+
ruby ">= 2.6.10"
|
|
5
|
+
|
|
6
|
+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
|
|
7
|
+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
|
|
8
|
+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
|
|
9
|
+
gem 'xcodeproj', '< 1.26.0'
|
|
10
|
+
gem 'concurrent-ruby', '< 1.3.4'
|
|
11
|
+
|
|
12
|
+
# Ruby 3.4.0 has removed some libraries from the standard library.
|
|
13
|
+
gem 'bigdecimal'
|
|
14
|
+
gem 'logger'
|
|
15
|
+
gem 'benchmark'
|
|
16
|
+
gem 'mutex_m'
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
CFPropertyList (3.0.8)
|
|
5
|
+
activesupport (6.1.7.10)
|
|
6
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
7
|
+
i18n (>= 1.6, < 2)
|
|
8
|
+
minitest (>= 5.1)
|
|
9
|
+
tzinfo (~> 2.0)
|
|
10
|
+
zeitwerk (~> 2.3)
|
|
11
|
+
addressable (2.8.7)
|
|
12
|
+
public_suffix (>= 2.0.2, < 7.0)
|
|
13
|
+
algoliasearch (1.27.5)
|
|
14
|
+
httpclient (~> 2.8, >= 2.8.3)
|
|
15
|
+
json (>= 1.5.1)
|
|
16
|
+
atomos (0.1.3)
|
|
17
|
+
benchmark (0.5.0)
|
|
18
|
+
bigdecimal (3.3.1)
|
|
19
|
+
claide (1.1.0)
|
|
20
|
+
cocoapods (1.15.2)
|
|
21
|
+
addressable (~> 2.8)
|
|
22
|
+
claide (>= 1.0.2, < 2.0)
|
|
23
|
+
cocoapods-core (= 1.15.2)
|
|
24
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
|
25
|
+
cocoapods-downloader (>= 2.1, < 3.0)
|
|
26
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
|
27
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
|
28
|
+
cocoapods-trunk (>= 1.6.0, < 2.0)
|
|
29
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
|
30
|
+
colored2 (~> 3.1)
|
|
31
|
+
escape (~> 0.0.4)
|
|
32
|
+
fourflusher (>= 2.3.0, < 3.0)
|
|
33
|
+
gh_inspector (~> 1.0)
|
|
34
|
+
molinillo (~> 0.8.0)
|
|
35
|
+
nap (~> 1.0)
|
|
36
|
+
ruby-macho (>= 2.3.0, < 3.0)
|
|
37
|
+
xcodeproj (>= 1.23.0, < 2.0)
|
|
38
|
+
cocoapods-core (1.15.2)
|
|
39
|
+
activesupport (>= 5.0, < 8)
|
|
40
|
+
addressable (~> 2.8)
|
|
41
|
+
algoliasearch (~> 1.0)
|
|
42
|
+
concurrent-ruby (~> 1.1)
|
|
43
|
+
fuzzy_match (~> 2.0.4)
|
|
44
|
+
nap (~> 1.0)
|
|
45
|
+
netrc (~> 0.11)
|
|
46
|
+
public_suffix (~> 4.0)
|
|
47
|
+
typhoeus (~> 1.0)
|
|
48
|
+
cocoapods-deintegrate (1.0.5)
|
|
49
|
+
cocoapods-downloader (2.1)
|
|
50
|
+
cocoapods-plugins (1.0.0)
|
|
51
|
+
nap
|
|
52
|
+
cocoapods-search (1.0.1)
|
|
53
|
+
cocoapods-trunk (1.6.0)
|
|
54
|
+
nap (>= 0.8, < 2.0)
|
|
55
|
+
netrc (~> 0.11)
|
|
56
|
+
cocoapods-try (1.2.0)
|
|
57
|
+
colored2 (3.1.2)
|
|
58
|
+
concurrent-ruby (1.3.3)
|
|
59
|
+
escape (0.0.4)
|
|
60
|
+
ethon (0.15.0)
|
|
61
|
+
ffi (>= 1.15.0)
|
|
62
|
+
ffi (1.17.2)
|
|
63
|
+
fourflusher (2.3.1)
|
|
64
|
+
fuzzy_match (2.0.4)
|
|
65
|
+
gh_inspector (1.1.3)
|
|
66
|
+
httpclient (2.9.0)
|
|
67
|
+
mutex_m
|
|
68
|
+
i18n (1.14.7)
|
|
69
|
+
concurrent-ruby (~> 1.0)
|
|
70
|
+
json (2.7.6)
|
|
71
|
+
logger (1.7.0)
|
|
72
|
+
minitest (5.25.4)
|
|
73
|
+
molinillo (0.8.0)
|
|
74
|
+
mutex_m (0.3.0)
|
|
75
|
+
nanaimo (0.3.0)
|
|
76
|
+
nap (1.1.0)
|
|
77
|
+
netrc (0.11.0)
|
|
78
|
+
public_suffix (4.0.7)
|
|
79
|
+
rexml (3.4.4)
|
|
80
|
+
ruby-macho (2.5.1)
|
|
81
|
+
typhoeus (1.5.0)
|
|
82
|
+
ethon (>= 0.9.0, < 0.16.0)
|
|
83
|
+
tzinfo (2.0.6)
|
|
84
|
+
concurrent-ruby (~> 1.0)
|
|
85
|
+
xcodeproj (1.25.1)
|
|
86
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
|
87
|
+
atomos (~> 0.1.3)
|
|
88
|
+
claide (>= 1.0.2, < 2.0)
|
|
89
|
+
colored2 (~> 3.1)
|
|
90
|
+
nanaimo (~> 0.3.0)
|
|
91
|
+
rexml (>= 3.3.6, < 4.0)
|
|
92
|
+
zeitwerk (2.6.18)
|
|
93
|
+
|
|
94
|
+
PLATFORMS
|
|
95
|
+
ruby
|
|
96
|
+
|
|
97
|
+
DEPENDENCIES
|
|
98
|
+
activesupport (>= 6.1.7.5, != 7.1.0)
|
|
99
|
+
benchmark
|
|
100
|
+
bigdecimal
|
|
101
|
+
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
|
|
102
|
+
concurrent-ruby (< 1.3.4)
|
|
103
|
+
logger
|
|
104
|
+
mutex_m
|
|
105
|
+
xcodeproj (< 1.26.0)
|
|
106
|
+
|
|
107
|
+
RUBY VERSION
|
|
108
|
+
ruby 2.6.10p210
|
|
109
|
+
|
|
110
|
+
BUNDLED WITH
|
|
111
|
+
2.4.22
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Pointr React Native Demo
|
|
2
|
+
|
|
3
|
+
This is a demo [**React Native**](https://reactnative.dev) project showcasing the Pointr SDK integration, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
|
|
4
|
+
|
|
5
|
+
# Getting Started
|
|
6
|
+
|
|
7
|
+
> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Node.js >= 20
|
|
12
|
+
- React Native 0.82.1
|
|
13
|
+
- Xcode (for iOS development)
|
|
14
|
+
- Android Studio (for Android development)
|
|
15
|
+
|
|
16
|
+
## Setup Instructions
|
|
17
|
+
|
|
18
|
+
### Step 1: Install React Native Pointr Package
|
|
19
|
+
|
|
20
|
+
This demo requires the `react-native-pointr` package. You have two options:
|
|
21
|
+
|
|
22
|
+
#### Option A: Local Package (Recommended for Testing)
|
|
23
|
+
|
|
24
|
+
1. Place the `react-native-pointr` package in the parent directory structure
|
|
25
|
+
2. The demo expects the package at: `../../../react-native-pointr` (relative to the demo folder)
|
|
26
|
+
3. Verify the path in `package.json` under dependencies:
|
|
27
|
+
```json
|
|
28
|
+
"react-native-pointr": "file:../../../react-native-pointr"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### Option B: Published Package
|
|
32
|
+
|
|
33
|
+
If the package is published to npm, update `package.json` to reference it:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
"react-native-pointr": "^9.3.1"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Step 2: Configure Pointr Credentials
|
|
40
|
+
|
|
41
|
+
Before installing dependencies, you need to configure your Pointr credentials:
|
|
42
|
+
|
|
43
|
+
#### Android (android/build.gradle)
|
|
44
|
+
|
|
45
|
+
Replace the Maven credentials in `android/build.gradle`:
|
|
46
|
+
|
|
47
|
+
```gradle
|
|
48
|
+
credentials {
|
|
49
|
+
username 'YOUR_MAVEN_USERNAME' // Replace with your Maven username
|
|
50
|
+
password 'YOUR_MAVEN_PASSWORD' // Replace with your Maven password
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### iOS (ios/Podfile)
|
|
55
|
+
|
|
56
|
+
Replace the Pointr SDK token in `ios/Podfile` (line 4):
|
|
57
|
+
|
|
58
|
+
```ruby
|
|
59
|
+
ENV['POINTR_SDK_TOKEN'] = 'YOUR_POINTR_SDK_TOKEN' // Replace with your SDK token
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### App Configuration (App.tsx)
|
|
63
|
+
|
|
64
|
+
Replace the Pointr SDK credentials in `App.tsx` (lines 54-56 and 276-278):
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
NativeModules.PTRNativePointrLibrary.initialize(
|
|
68
|
+
"YOUR_CLIENT_ID", // Replace with your client ID
|
|
69
|
+
"YOUR_LICENSE_KEY", // Replace with your license key
|
|
70
|
+
"https://your-instance.pointr.cloud", // Replace with your instance URL
|
|
71
|
+
0
|
|
72
|
+
);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Step 3: Install Dependencies
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm install
|
|
79
|
+
cd ios && pod install && cd ..
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or use the reset script for a complete setup:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm run reset
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Step 4: Start Metro
|
|
89
|
+
|
|
90
|
+
First, you will need to run **Metro**, the JavaScript build tool for React Native.
|
|
91
|
+
|
|
92
|
+
To start the Metro dev server, run the following command from the root of your React Native project:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
# Using npm
|
|
96
|
+
npm start
|
|
97
|
+
|
|
98
|
+
# OR using Yarn
|
|
99
|
+
yarn start
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Step 5: Build and Run Your App
|
|
103
|
+
|
|
104
|
+
With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
|
|
105
|
+
|
|
106
|
+
### For Android
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
# Using npm
|
|
110
|
+
npm run android
|
|
111
|
+
|
|
112
|
+
# OR using Yarn
|
|
113
|
+
yarn android
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### For iOS
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
# Using npm
|
|
120
|
+
npm run ios
|
|
121
|
+
|
|
122
|
+
# OR using Yarn
|
|
123
|
+
yarn ios
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
|
|
127
|
+
|
|
128
|
+
This is one way to run your app — you can also build it directly from Android Studio or Xcode.
|
|
129
|
+
|
|
130
|
+
## Features Demonstrated
|
|
131
|
+
|
|
132
|
+
This demo showcases the following Pointr SDK capabilities:
|
|
133
|
+
|
|
134
|
+
- **Map Widget Integration**: Shows how to integrate and display the Pointr map
|
|
135
|
+
- **POI Management**: Demonstrates fetching and displaying Points of Interest
|
|
136
|
+
- **Navigation Commands**: Examples of various map commands (site, building, level, POI, path)
|
|
137
|
+
- **Geofence Events**: Listening to geofence enter/exit events
|
|
138
|
+
- **Wayfinding Events**: Tracking wayfinding navigation state
|
|
139
|
+
- **My Car Feature**: Marking and showing saved car locations
|
|
140
|
+
|
|
141
|
+
## Available Scripts
|
|
142
|
+
|
|
143
|
+
- `npm start` - Start Metro bundler
|
|
144
|
+
- `npm run android` - Run on Android
|
|
145
|
+
- `npm run ios` - Run on iOS
|
|
146
|
+
- `npm run clean` - Clean build artifacts and caches
|
|
147
|
+
- `npm run reset` - Complete reset (clean + install + pod install)
|
|
148
|
+
- `npm run lint` - Run ESLint
|
|
149
|
+
- `npm test` - Run tests
|
|
150
|
+
- `npm run prepare-dist` - Create distribution package
|
|
151
|
+
|
|
152
|
+
## Modifying the App
|
|
153
|
+
|
|
154
|
+
Now that you have successfully run the app, let's make changes!
|
|
155
|
+
|
|
156
|
+
Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh).
|
|
157
|
+
|
|
158
|
+
When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
|
|
159
|
+
|
|
160
|
+
- **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Dev Menu**, accessed via <kbd>Ctrl</kbd> + <kbd>M</kbd> (Windows/Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (macOS).
|
|
161
|
+
- **iOS**: Press <kbd>R</kbd> in iOS Simulator.
|
|
162
|
+
|
|
163
|
+
# Pointr SDK Documentation
|
|
164
|
+
|
|
165
|
+
For more information about the Pointr React Native SDK, please refer to the main package documentation.
|
|
166
|
+
|
|
167
|
+
## Congratulations! :tada:
|
|
168
|
+
|
|
169
|
+
You've successfully run and modified your React Native App. :partying_face:
|
|
170
|
+
|
|
171
|
+
### Now what?
|
|
172
|
+
|
|
173
|
+
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
|
|
174
|
+
- If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started).
|
|
175
|
+
|
|
176
|
+
# Troubleshooting
|
|
177
|
+
|
|
178
|
+
If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
|
|
179
|
+
|
|
180
|
+
# Learn More
|
|
181
|
+
|
|
182
|
+
To learn more about React Native, take a look at the following resources:
|
|
183
|
+
|
|
184
|
+
- [React Native Website](https://reactnative.dev) - learn more about React Native.
|
|
185
|
+
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
|
|
186
|
+
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
|
|
187
|
+
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
|
|
188
|
+
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @format
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactTestRenderer from 'react-test-renderer';
|
|
7
|
+
import App from '../App';
|
|
8
|
+
|
|
9
|
+
test('renders correctly', async () => {
|
|
10
|
+
await ReactTestRenderer.act(() => {
|
|
11
|
+
ReactTestRenderer.create(<App />);
|
|
12
|
+
});
|
|
13
|
+
});
|