@sentiance-react-native/legacy 6.0.0-beta.9 → 6.0.2

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/README.md CHANGED
@@ -1,34 +1,9 @@
1
- ## Installation
1
+ # Sentiance Legacy module for React Native
2
2
 
3
- This module requires that the `@sentiance-react-native/crash-detection` and `@sentiance-react-native/core` modules are already setup and installed.
3
+ ## Demo Application
4
4
 
5
- ```bash
6
- # Install & setup the core module
7
- npm i @sentiance-react-native/core
8
-
9
- # Install & setup the crash detection module
10
- npm i @sentiance-react-native/crash-detection
11
-
12
- # Install the legacy module
13
- npm i @sentiance-react-native/legacy
14
- ```
5
+ https://github.com/sentiance/sample-apps-react-native
15
6
 
16
7
  ## Usage
17
8
 
18
- ### Importing the package
19
-
20
- You can import the entire contents of the package for use under a namespace of your choosing:
21
-
22
- ```javascript
23
- import * as SentianceLegacy from "@sentiance-react-native/legacy";
24
- ```
25
-
26
- or you can require specific functionality using named imports:
27
-
28
- ```javascript
29
- import {
30
- enableDetections,
31
- invokeDummyVehicleCrash,
32
- createUser
33
- } from "@sentiance-react-native/legacy";
34
- ```
9
+ To use the legacy SDK module, please visit the corresponding [API reference page.](https://docs.sentiance.com/sdk/api-reference/react-native/legacy)
@@ -28,6 +28,13 @@ if (findProject(':crash-detection')) {
28
28
  throw new GradleException('Could not find the @sentiance-react-native/crash-detection package, have you installed it?')
29
29
  }
30
30
 
31
+ android {
32
+ compileOptions {
33
+ sourceCompatibility JavaVersion.VERSION_1_8
34
+ targetCompatibility JavaVersion.VERSION_1_8
35
+ }
36
+ }
37
+
31
38
  apply from: "$coreProj.projectDir/package-json-reader.gradle"
32
39
 
33
40
  def corePackageJson = PackageJson.of(coreProj)
@@ -312,5 +312,15 @@ public class LegacySentianceModule extends AbstractSentianceModule implements Li
312
312
  public void onHostDestroy() {
313
313
  // Activity `onDestroy`
314
314
  }
315
+
316
+ @ReactMethod
317
+ public void addListener(String eventName) {
318
+ // Set up any upstream listeners or background tasks as necessary
319
+ }
320
+
321
+ @ReactMethod
322
+ public void removeListeners(Integer count) {
323
+ // Remove upstream listeners, stop unnecessary background tasks
324
+ }
315
325
  }
316
326
 
package/lib/index.js CHANGED
@@ -1,9 +1,11 @@
1
- import legacy from './legacy';
2
- import core from '@sentiance-react-native/core';
3
- import crashDetection from '@sentiance-react-native/crash-detection';
1
+ const legacy = require('./legacy');
2
+ const core = require('@sentiance-react-native/core');
3
+ const crashDetection = require('@sentiance-react-native/crash-detection');
4
4
 
5
5
  var RNSentiance = {};
6
- RNSentiance.TransportMode = core.transportModes;
6
+ if (core) {
7
+ RNSentiance.TransportMode = core.transportModes;
8
+ }
7
9
 
8
10
  const {
9
11
  userLinkCallback,
@@ -122,4 +124,4 @@ RNSentiance.disableNativeInitialization = disableNativeInitialization;
122
124
  RNSentiance.addListener = addListener
123
125
  RNSentiance.removeListeners = removeListeners
124
126
 
125
- export default RNSentiance;
127
+ module.exports = RNSentiance;
@@ -1,23 +1,25 @@
1
- import {NativeModules, Platform} from 'react-native'
2
- import {varToString} from '@sentiance-react-native/core/lib/utils'
1
+ const {NativeModules, Platform} = require('react-native');
2
+ const {varToString} = require('@sentiance-react-native/core/lib/utils');
3
3
 
4
4
  const {RNSentiance, SentianceCore} = NativeModules;
5
5
 
6
- var legacyModule
6
+ let legacyModule = {};
7
7
  if (Platform.OS === 'ios') {
8
8
  if (!SentianceCore) {
9
9
  const nativeModuleName = varToString({SentianceCore});
10
- throw `Could not locate the native ${nativeModuleName} module.
11
- Make sure that your native code is properly linked, and that the module name you specified is correct.`;
10
+ console.error(`Could not locate the native ${nativeModuleName} module.
11
+ Make sure that your native code is properly linked, and that the module name you specified is correct.`);
12
+ } else {
13
+ legacyModule = SentianceCore
12
14
  }
13
- legacyModule = SentianceCore
14
15
  } else {
15
16
  if (!RNSentiance) {
16
17
  const nativeModuleName = varToString({RNSentiance});
17
- throw `Could not locate the native ${nativeModuleName} module.
18
- Make sure that your native code is properly linked, and that the module name you specified is correct.`;
18
+ console.error(`Could not locate the native ${nativeModuleName} module.
19
+ Make sure that your native code is properly linked, and that the module name you specified is correct.`);
20
+ } else {
21
+ legacyModule = RNSentiance
19
22
  }
20
- legacyModule = RNSentiance
21
23
  }
22
24
 
23
- export default legacyModule
25
+ module.exports = legacyModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentiance-react-native/legacy",
3
- "version": "6.0.0-beta.9",
3
+ "version": "6.0.2",
4
4
  "description": "React Native Sentiance - This module provides a legacy API.",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -14,7 +14,7 @@
14
14
  "sentiance"
15
15
  ],
16
16
  "peerDependencies": {
17
- "@sentiance-react-native/crash-detection": "6.0.0-beta.9"
17
+ "@sentiance-react-native/crash-detection": "6.0.2"
18
18
  },
19
19
  "author": "",
20
20
  "license": "",