react-native-steerpath-smart-map 1.25.2 → 1.26.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.
package/CHANGELOG.md CHANGED
@@ -15,6 +15,17 @@ This package is built on top of Steerpath's Smart SDK, and most of releases are
15
15
  - [iOS](https://s3-eu-west-1.amazonaws.com/steerpath/ios/releases/smart-sdk-changelog/index.html)
16
16
  - [Web](https://s3-eu-west-1.amazonaws.com/steerpath-web-sdk/documentation/smart/latest/index.html)
17
17
 
18
+ ## [1.26.0] - 2023-12-05
19
+
20
+ - Add loginToLive and logoutFromLive methods for iOS and Android
21
+ - Deprecated setLiveConfiguration
22
+ - Changed showThisDevice to showsThisDevice in LiveConfig
23
+ - Bump iOS Smart SDK version to 1.18.0
24
+
25
+ ## [1.25.3] - 2023-12-04
26
+
27
+ - Bump Android Smart SDK version to android-smart-1.21.4
28
+
18
29
  ## [1.25.2] - 2023-11-29
19
30
 
20
31
  - Bump Android Smart SDK version to android-smart-1.21.3
@@ -53,7 +53,7 @@ repositories {
53
53
 
54
54
  dependencies {
55
55
  implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
56
- implementation "com.steerpath:smart:android-smart-1.21.3"
56
+ implementation "com.steerpath:smart:android-smart-1.21.4"
57
57
  implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
58
58
  implementation "androidx.lifecycle:lifecycle-viewmodel:2.2.0"
59
59
  }
@@ -36,7 +36,6 @@ public class RNSmartMapManager extends ReactContextBaseJavaModule {
36
36
 
37
37
  @ReactMethod
38
38
  public void start(String apiKey) {
39
- Log.d("RNSmartMapManager", "start");
40
39
  appContext.runOnUiQueueThread(() -> SmartSDK.getInstance().start(appContext, apiKey));
41
40
  }
42
41
 
@@ -59,7 +58,8 @@ public class RNSmartMapManager extends ReactContextBaseJavaModule {
59
58
  // TODO: throw error
60
59
  }
61
60
  }
62
-
61
+
62
+ @Deprecated
63
63
  @ReactMethod
64
64
  public void setLiveConfig(ReadableMap map) {
65
65
  if (map == null) {
@@ -74,6 +74,24 @@ public class RNSmartMapManager extends ReactContextBaseJavaModule {
74
74
  }
75
75
  }
76
76
  }
77
+
78
+ @ReactMethod
79
+ public void loginToLive(ReadableMap map) {
80
+ if (map != null) {
81
+ try {
82
+ JSONObject obj = Utils.convertMapToJson(map);
83
+ appContext.runOnUiQueueThread(() -> SmartSDK.getInstance().loginToLive(appContext, obj));
84
+ } catch (JSONException e) {
85
+ Log.e("Error", "Failed to login into Steerpath live service");
86
+ }
87
+ }
88
+ }
89
+
90
+ @ReactMethod
91
+ public void logoutFromLive(){
92
+ appContext.runOnUiQueueThread(() -> SmartSDK.getInstance().logoutFromLive(appContext));
93
+ }
94
+
77
95
 
78
96
  @ReactMethod
79
97
  public void fetchVersions(Callback callback) {
@@ -16,14 +16,30 @@ export interface LiveConfig {
16
16
  };
17
17
  };
18
18
  receive?: {
19
- showThisDevice?: boolean;
19
+ showsThisDevice?: boolean;
20
20
  groups?: string[];
21
21
  };
22
22
  }
23
23
  export declare const SmartMapManager: {
24
24
  start(apiKey: string): void;
25
25
  startWithConfig(config: ConfigSDK): void;
26
+ /**
27
+ *
28
+ * @deprecated Use loginToLive instead.
29
+ */
26
30
  setLiveConfig(config: LiveConfig | null): void;
31
+ /**
32
+ * Share user location by setting transmit options and show live updates on map by setting receive options.
33
+ *
34
+ * Leave transmit out of the config if you don't want to share location and receive out if you don't want updates to map.
35
+ *
36
+ * @param config
37
+ */
38
+ loginToLive(config: LiveConfig): void;
39
+ /**
40
+ * Stop sharing user location and receiving live updates. Call loginToLive to start again.
41
+ */
42
+ logoutFromLive(): void;
27
43
  fetchVersions(callback: (versions: FetchVersionResponse) => void): void;
28
44
  setLanguage(languageCode: String): void;
29
45
  };
@@ -21,9 +21,29 @@ export var SmartMapManager = {
21
21
  configString: configString,
22
22
  });
23
23
  },
24
+ /**
25
+ *
26
+ * @deprecated Use loginToLive instead.
27
+ */
24
28
  setLiveConfig: function (config) {
25
29
  RNSmartMapManager.setLiveConfig(config);
26
30
  },
31
+ /**
32
+ * Share user location by setting transmit options and show live updates on map by setting receive options.
33
+ *
34
+ * Leave transmit out of the config if you don't want to share location and receive out if you don't want updates to map.
35
+ *
36
+ * @param config
37
+ */
38
+ loginToLive: function (config) {
39
+ RNSmartMapManager.loginToLive(config);
40
+ },
41
+ /**
42
+ * Stop sharing user location and receiving live updates. Call loginToLive to start again.
43
+ */
44
+ logoutFromLive: function () {
45
+ RNSmartMapManager.logoutFromLive();
46
+ },
27
47
  fetchVersions: function (callback) {
28
48
  RNSmartMapManager.fetchVersions(callback);
29
49
  },
@@ -1,4 +1,12 @@
1
1
  export declare const SmartMapManager: {
2
2
  start(apiKey: string, config?: string | Record<string, unknown> | undefined): void;
3
+ /**
4
+ * Not implemented for web. Use start() instead.
5
+ */
6
+ startWithConfig(): void;
3
7
  setLanguage(languageCode: String): void;
8
+ setLiveConfig(): void;
9
+ loginToLive(): void;
10
+ logoutFromLive(): void;
11
+ fetchVersions(): void;
4
12
  };
@@ -9,7 +9,25 @@ export var SmartMapManager = {
9
9
  smartSDKInstance = smartSDK;
10
10
  smartSDK.start(apiKey, config);
11
11
  },
12
+ /**
13
+ * Not implemented for web. Use start() instead.
14
+ */
15
+ startWithConfig: function () {
16
+ // No web implementation
17
+ },
12
18
  setLanguage: function (languageCode) {
13
19
  smartSDKInstance.setLanguage(languageCode);
20
+ },
21
+ setLiveConfig: function () {
22
+ // No web implementation
23
+ },
24
+ loginToLive: function () {
25
+ // No web implementation
26
+ },
27
+ logoutFromLive: function () {
28
+ // No web implementation
29
+ },
30
+ fetchVersions: function () {
31
+ // No web implementation
14
32
  }
15
33
  };
@@ -32,7 +32,28 @@ RCT_EXPORT_METHOD(startWithConfig:(nonnull NSDictionary *)config)
32
32
 
33
33
  RCT_EXPORT_METHOD(setLiveConfig:(NSDictionary *)config)
34
34
  {
35
- [[SPSmartSDK getInstance] setLiveConfiguration: config];
35
+ // TODO: call setLiveConfiguration in the native iOS Smart SDK on main thead instead of here
36
+ dispatch_async(dispatch_get_main_queue(), ^{
37
+ [[SPSmartSDK getInstance] setLiveConfiguration: config];
38
+ });
39
+
40
+ }
41
+
42
+ RCT_EXPORT_METHOD(loginToLive:(NSDictionary *)config)
43
+ {
44
+ // TODO: call loginToLive in the native iOS Smart SDK on main thead instead of here
45
+ dispatch_async(dispatch_get_main_queue(), ^{
46
+ [[SPSmartSDK getInstance] loginToLive: config];
47
+ });
48
+ }
49
+
50
+ RCT_EXPORT_METHOD(logoutFromLive)
51
+ {
52
+ // TODO: call logoutFrom in the native iOS Smart SDK on main thead instead of here
53
+ dispatch_async(dispatch_get_main_queue(), ^{
54
+ [[SPSmartSDK getInstance] logoutFromLive];
55
+ });
56
+
36
57
  }
37
58
 
38
59
  RCT_EXPORT_METHOD(fetchVersions:(RCTResponseSenderBlock)callback)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-steerpath-smart-map",
3
3
  "title": "React Native Steerpath Smart Map",
4
- "version": "1.25.2",
4
+ "version": "1.26.0",
5
5
  "description": "Steerpath SmartMapView for React Native",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {
@@ -20,7 +20,7 @@ Pod::Spec.new do |s|
20
20
  s.requires_arc = true
21
21
 
22
22
  s.dependency "React"
23
- s.dependency 'SteerpathSmartSDK', '~> 1.17.2'
23
+ s.dependency 'SteerpathSmartSDK', '~> 1.18.0'
24
24
  # s.dependency "..."
25
25
  end
26
26
 
@@ -22,7 +22,7 @@ export interface LiveConfig {
22
22
  };
23
23
  };
24
24
  receive?: {
25
- showThisDevice?: boolean;
25
+ showsThisDevice?: boolean;
26
26
  groups?: string[];
27
27
  };
28
28
  }
@@ -49,9 +49,29 @@ export const SmartMapManager = {
49
49
  configString,
50
50
  });
51
51
  },
52
+ /**
53
+ *
54
+ * @deprecated Use loginToLive instead.
55
+ */
52
56
  setLiveConfig(config: LiveConfig | null): void {
53
57
  RNSmartMapManager.setLiveConfig(config);
54
58
  },
59
+ /**
60
+ * Share user location by setting transmit options and show live updates on map by setting receive options.
61
+ *
62
+ * Leave transmit out of the config if you don't want to share location and receive out if you don't want updates to map.
63
+ *
64
+ * @param config
65
+ */
66
+ loginToLive(config: LiveConfig): void {
67
+ RNSmartMapManager.loginToLive(config);
68
+ },
69
+ /**
70
+ * Stop sharing user location and receiving live updates. Call loginToLive to start again.
71
+ */
72
+ logoutFromLive(): void {
73
+ RNSmartMapManager.logoutFromLive();
74
+ },
55
75
  fetchVersions(callback: (versions: FetchVersionResponse) => void) {
56
76
  RNSmartMapManager.fetchVersions(callback);
57
77
  },
@@ -14,7 +14,25 @@ export const SmartMapManager = {
14
14
  smartSDKInstance = smartSDK;
15
15
  smartSDK.start(apiKey, config);
16
16
  },
17
+ /**
18
+ * Not implemented for web. Use start() instead.
19
+ */
20
+ startWithConfig(): void{
21
+ // No web implementation
22
+ },
17
23
  setLanguage(languageCode: String): void {
18
24
  smartSDKInstance.setLanguage(languageCode);
25
+ },
26
+ setLiveConfig(): void {
27
+ // No web implementation
28
+ },
29
+ loginToLive(): void {
30
+ // No web implementation
31
+ },
32
+ logoutFromLive(): void {
33
+ // No web implementation
34
+ },
35
+ fetchVersions(): void {
36
+ // No web implementation
19
37
  }
20
38
  };