@sentiance-react-native/legacy 6.6.0-rc1 → 6.6.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,9 +1,9 @@
1
1
  package com.sentiance.react.bridge.legacy;
2
2
 
3
- import static com.sentiance.react.bridge.core.utils.ErrorCodes.E_SDK_GET_TOKEN_ERROR;
4
- import static com.sentiance.react.bridge.core.utils.ErrorCodes.E_SDK_START_TRIP_ERROR;
5
- import static com.sentiance.react.bridge.core.utils.ErrorCodes.E_SDK_STOP_TRIP_ERROR;
6
- import static com.sentiance.react.bridge.core.utils.ErrorCodes.E_SDK_SUBMIT_DETECTIONS_ERROR;
3
+ import static com.sentiance.react.bridge.core.common.util.ErrorCodes.E_SDK_GET_TOKEN_ERROR;
4
+ import static com.sentiance.react.bridge.core.common.util.ErrorCodes.E_SDK_START_TRIP_ERROR;
5
+ import static com.sentiance.react.bridge.core.common.util.ErrorCodes.E_SDK_STOP_TRIP_ERROR;
6
+ import static com.sentiance.react.bridge.core.common.util.ErrorCodes.E_SDK_SUBMIT_DETECTIONS_ERROR;
7
7
 
8
8
  import android.os.Handler;
9
9
  import android.os.Looper;
@@ -18,8 +18,8 @@ import com.facebook.react.bridge.ReactApplicationContext;
18
18
  import com.facebook.react.bridge.ReactMethod;
19
19
  import com.facebook.react.bridge.ReadableMap;
20
20
  import com.sentiance.react.bridge.core.SentianceConverter;
21
- import com.sentiance.react.bridge.core.base.AbstractSentianceModule;
22
21
  import com.sentiance.react.bridge.core.common.SentianceSubscriptionsManager;
22
+ import com.sentiance.react.bridge.core.common.base.AbstractSentianceModule;
23
23
  import com.sentiance.sdk.OnInitCallback;
24
24
  import com.sentiance.sdk.ResetCallback;
25
25
  import com.sentiance.sdk.SdkStatus;
@@ -40,11 +40,13 @@ public class LegacySentianceModule extends AbstractSentianceModule implements Li
40
40
  private final Handler mHandler = new Handler(Looper.getMainLooper());
41
41
  private final RNSentianceHelper legacySentianceHelper;
42
42
  private final StartFinishedHandlerCreator startFinishedHandlerCreator;
43
+ private final SentianceConverter converter;
43
44
 
44
45
  public LegacySentianceModule(ReactApplicationContext reactContext) {
45
46
  super(reactContext, Sentiance.getInstance(reactContext), new SentianceSubscriptionsManager());
46
47
  legacySentianceHelper = RNSentianceHelper.getInstance(reactContext);
47
48
  startFinishedHandlerCreator = new StartFinishedHandlerCreator();
49
+ converter = new SentianceConverter();
48
50
  }
49
51
 
50
52
  @NonNull
@@ -186,7 +188,7 @@ public class LegacySentianceModule extends AbstractSentianceModule implements Li
186
188
  metadataMap.put(entry.getKey(), entry.getValue().toString());
187
189
  }
188
190
  }
189
- final TransportMode transportModeHint = SentianceConverter.toTransportMode(hint);
191
+ final TransportMode transportModeHint = converter.toTransportMode(hint);
190
192
  mSdk.startTrip(metadataMap, transportModeHint, new StartTripCallback() {
191
193
  @Override
192
194
  public void onSuccess() {
@@ -269,7 +271,7 @@ public class LegacySentianceModule extends AbstractSentianceModule implements Li
269
271
  mSdk.getUserAccessToken(new TokenResultCallback() {
270
272
  @Override
271
273
  public void onSuccess(@NonNull Token token) {
272
- promise.resolve(SentianceConverter.convertToken(token));
274
+ promise.resolve(converter.convertToken(token));
273
275
  }
274
276
 
275
277
  @Override
@@ -329,10 +331,12 @@ public class LegacySentianceModule extends AbstractSentianceModule implements Li
329
331
 
330
332
  @Override
331
333
  @ReactMethod
332
- protected void addListener(String eventName) {}
334
+ protected void addListener(String eventName) {
335
+ }
333
336
 
334
337
  @Override
335
338
  @ReactMethod
336
- public void removeListeners(Integer count) {}
339
+ public void removeListeners(Integer count) {
340
+ }
337
341
  }
338
342
 
@@ -13,16 +13,18 @@ import java.util.List;
13
13
  public class StartFinishedHandlerCreator {
14
14
 
15
15
  private final List<OnStartFinishedHandler> startFinishedHandlers;
16
+ private final SentianceConverter converter;
16
17
 
17
18
  StartFinishedHandlerCreator() {
18
19
  this.startFinishedHandlers = new ArrayList<>();
20
+ converter = new SentianceConverter();
19
21
  }
20
22
 
21
23
  OnStartFinishedHandler createNewStartFinishedHandler(final Promise promise) {
22
24
  final OnStartFinishedHandler startFinishedHandler = new OnStartFinishedHandler() {
23
25
  @Override
24
26
  public void onStartFinished(@NonNull SdkStatus sdkStatus) {
25
- promise.resolve(SentianceConverter.convertSdkStatus(sdkStatus));
27
+ promise.resolve(converter.convertSdkStatus(sdkStatus));
26
28
  removeStartFinishHandler(this);
27
29
  }
28
30
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentiance-react-native/legacy",
3
- "version": "6.6.0-rc1",
4
- "description": "React Native Sentiance - This module provides a legacy API.",
3
+ "version": "6.6.0",
4
+ "description": "The Sentiance Legacy library",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "scripts": {
@@ -14,11 +14,11 @@
14
14
  "sentiance"
15
15
  ],
16
16
  "peerDependencies": {
17
- "@sentiance-react-native/crash-detection": "6.6.0-rc1"
17
+ "@sentiance-react-native/crash-detection": "6.6.0"
18
18
  },
19
19
  "author": "",
20
20
  "license": "",
21
- "homepage": "https://github.com/sentiance/react-native-sentiance/legacy#readme",
21
+ "homepage": "https://github.com/sentiance/react-native-sentiance/tree/main/packages/legacy",
22
22
  "repository": "github:sentiance/react-native-sentiance",
23
23
  "publishConfig": {
24
24
  "access": "public"