react-native-pointr 8.16.1 → 9.2.0

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.
@@ -1,164 +0,0 @@
1
- #import "PTRNativeLibrary.h"
2
-
3
- #if __has_include("react_native_pointr-Swift.h")
4
- #import "react_native_pointr-Swift.h"
5
- #else
6
- #import <react_native_pointr/react_native_pointr-Swift.h>
7
- #endif
8
-
9
- #import <React/RCTUtils.h>
10
-
11
- @interface PTRNativeLibrary() <RCTBridgeModule, PTREventManagerDelegate>
12
-
13
- @end
14
-
15
- @implementation PTRNativeLibrary
16
-
17
- bool hasListeners;
18
-
19
- - (instancetype)init {
20
- self = [super init];
21
- PointrApp.sharedApp.eventManagerDelegate = self;
22
- return self;
23
- }
24
-
25
- + (BOOL)requiresMainQueueSetup {
26
- return NO;
27
- }
28
-
29
- RCT_EXPORT_MODULE(PTRNativePointrLibrary);
30
-
31
- - (NSArray<NSString *> *)supportedEvents {
32
- return @[@"OnPositionManagerCalculatedLocation", @"OnBuildingClicked", @"OnSiteClicked"];
33
- }
34
-
35
- - (dispatch_queue_t)methodQueue
36
- {
37
- return dispatch_get_main_queue();
38
- }
39
-
40
- // Will be called when this module's first listener is added.
41
- -(void)startObserving {
42
- hasListeners = YES;
43
- }
44
-
45
- // Will be called when this module's last listener is removed, or on dealloc.
46
- -(void)stopObserving {
47
- hasListeners = NO;
48
- }
49
-
50
- RCT_EXPORT_METHOD(shouldRequestPermissionsAtStartup:(BOOL) shouldRequestPermissionsAtStartup) {
51
- PointrApp.shouldRequestPermissionsAtStartup = shouldRequestPermissionsAtStartup;
52
- }
53
-
54
- RCT_EXPORT_METHOD(initialize:(NSString *)licenseKey baseUrl:(NSString *)baseUrl clientIdentifier:(NSString *)clientIdentifier environment:(NSString *)environment logLevel:(int)logLevel) {
55
- UIViewController *presentedViewController = RCTPresentedViewController();
56
- [PointrApp.sharedApp initializeWithLicenseKey:licenseKey baseUrl:baseUrl clientIdentifier:clientIdentifier environment:environment logLevel:logLevel rootViewController:presentedViewController];
57
- }
58
-
59
- RCT_EXPORT_METHOD(start:(RCTResponseSenderBlock)callback) {
60
- if (Pointr.shared.state == PointrStateRunning) {
61
- callback(@[@"Pointr is already running"]);
62
- } else {
63
- [PointrApp.sharedApp startWithCompletion: ^(NSString *state) {
64
- callback(@[state]);
65
- }];
66
- }
67
- }
68
-
69
- RCT_EXPORT_METHOD(stop) {
70
- [PointrApp.sharedApp stop];
71
- }
72
-
73
- #pragma mark MapWidget
74
-
75
- RCT_EXPORT_METHOD(showSite:(NSString *)siteExternalIdentifier animationType:(int)animationType callback:(RCTResponseSenderBlock)callback) {
76
- [PointrApp.sharedApp showSiteWithSiteExternalIdentifier:siteExternalIdentifier animationType:animationType completion:^(NSString *error) {
77
- callback(@[error]);
78
- }];
79
- }
80
-
81
- RCT_EXPORT_METHOD(showBuilding:(NSString *)siteExternalIdentifier buildingExternalIdentifier: (NSString *)buildingExternalIdentifier animationType:(int)animationType callback:(RCTResponseSenderBlock)callback) {
82
- [PointrApp.sharedApp showBuildingWithSiteExternalIdentifier:siteExternalIdentifier buildingExternalIdentifier:buildingExternalIdentifier animationType:animationType completion:^(NSString *error) {
83
- callback(@[error]);
84
- }];
85
- }
86
-
87
- RCT_EXPORT_METHOD(showLevel:(NSString *)siteExternalIdentifier buildingExternalIdentifier: (NSString *)buildingExternalIdentifier levelIndex:(int)levelIndex animationType:(int)animationType callback:(RCTResponseSenderBlock)callback) {
88
- [PointrApp.sharedApp showLevelWithSiteExternalIdentifier:siteExternalIdentifier buildingExternalIdentifier:buildingExternalIdentifier levelIndex:levelIndex animationType:animationType completion:^(NSString *error) {
89
- callback(@[error]);
90
- }];
91
- }
92
-
93
- RCT_EXPORT_METHOD(showPoiDetails:(NSString *)siteExternalIdentifier poiExternalIdentifier: (NSString *)poiExternalIdentifier animationType:(int)animationType callback:(RCTResponseSenderBlock)callback) {
94
- [PointrApp.sharedApp showPoiDetailsWithSiteExternalIdentifier:siteExternalIdentifier poiExternalIdentifier:poiExternalIdentifier animationType:animationType completion:^(NSString *error) {
95
- callback(@[error]);
96
- }];
97
- }
98
-
99
- RCT_EXPORT_METHOD(showPathFindingToPoi:(NSString *)siteExternalIdentifier poiExternalIdentifier: (NSString *)poiExternalIdentifier animationType:(int)animationType callback:(RCTResponseSenderBlock)callback) {
100
- [PointrApp.sharedApp showPathFindingToPoiWithSiteExternalIdentifier:siteExternalIdentifier poiExternalIdentifier:poiExternalIdentifier animationType:animationType completion:^(NSString *error) {
101
- callback(@[error]);
102
- }];
103
- }
104
-
105
- RCT_EXPORT_METHOD(showPathFindingBetweenPOIs:(NSString *)siteExternalIdentifier sourcePoiExternalIdentifier: (NSString *)sourcePoiExternalIdentifier destinationPoiExternalIdentifier: (NSString *)destinationPoiExternalIdentifier animationType:(int)animationType callback:(RCTResponseSenderBlock)callback) {
106
- [PointrApp.sharedApp showPathFindingBetweenPOIsWithSiteExternalIdentifier:siteExternalIdentifier sourcePoiExternalIdentifier:sourcePoiExternalIdentifier destinationPoiExternalIdentifier:destinationPoiExternalIdentifier animationType:animationType completion:^(NSString *error) {
107
- if (error) {
108
- callback(@[error]);
109
- return;
110
- }
111
- callback(@[]);
112
- }];
113
- }
114
-
115
- RCT_EXPORT_METHOD(getCurrentLocation:(RCTResponseSenderBlock)callback) {
116
- [PointrApp.sharedApp getCurrentLocationWithCompletion:^(NSDictionary *location, NSString *error) {
117
- if (error != nil) {
118
- callback(@[error]);
119
- } else {
120
- if ([location count] > 0 && [[location objectForKey:@"latitude"] integerValue] != -999999) {
121
- callback(@[location]);
122
- } else {
123
- callback(@[@"There is no location"]);
124
- }
125
- }
126
- }];
127
- }
128
-
129
- RCT_EXPORT_METHOD(setPointrMapWidgetConfiguration:(NSString *)string) {
130
- [PointrApp.sharedApp setPointrMapWidgetConfigurationWithString:string];
131
- }
132
-
133
- RCT_EXPORT_METHOD(requestPermissions) {
134
- [PointrApp.sharedApp requestPermissions];
135
- }
136
-
137
- RCT_EXPORT_METHOD(isMyCarMarked:(RCTResponseSenderBlock)callback) {
138
- PTRFeature *feature = [Pointr.shared getMyCarFeature];
139
- if (feature == nil) {
140
- callback(@[@"No saved location"]);
141
- return;
142
- }
143
- callback(@[]);
144
- }
145
-
146
- #pragma mark Event Manager Delegate
147
-
148
- - (void)onPositionManagerCalculatedLocationWithLocation:(NSDictionary<NSString *,id> * _Nonnull)location {
149
- if (!hasListeners) return;
150
- [self sendEventWithName:@"OnPositionManagerCalculatedLocation" body:location];
151
- }
152
-
153
- - (void)onBuildingClicked:(NSDictionary<NSString *,id> * _Nonnull)building {
154
- if (!hasListeners) return;
155
- [self sendEventWithName:@"OnBuildingClicked" body:building];
156
- }
157
-
158
-
159
- - (void)onSiteClicked:(NSDictionary<NSString *,id> * _Nonnull)site {
160
- if (!hasListeners) return;
161
- [self sendEventWithName:@"OnSiteClicked" body:site];
162
- }
163
-
164
- @end