react-native-mparticle 2.7.8 → 2.7.10

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.
@@ -12,7 +12,7 @@ jobs:
12
12
  runs-on: macOS-latest
13
13
  steps:
14
14
  - name: "Checkout"
15
- uses: actions/checkout@v3
15
+ uses: actions/checkout@v4
16
16
  - uses: actions/setup-node@master
17
17
  - uses: c-hive/gha-yarn-cache@v2
18
18
 
@@ -29,7 +29,7 @@ jobs:
29
29
  runs-on: ubuntu-latest
30
30
  steps:
31
31
  - name: "Checkout"
32
- uses: actions/checkout@v3
32
+ uses: actions/checkout@v4
33
33
  - name: "Run Android Unit Tests"
34
34
  working-directory: android
35
35
  run: ./gradlew test
@@ -39,7 +39,7 @@ jobs:
39
39
  runs-on: ubuntu-latest
40
40
  steps:
41
41
  - name: "Checkout"
42
- uses: actions/checkout@v3
42
+ uses: actions/checkout@v4
43
43
  - name: "Run Android Unit Tests"
44
44
  working-directory: android
45
45
  run: ./gradlew lint
@@ -49,7 +49,7 @@ jobs:
49
49
  runs-on: ubuntu-latest
50
50
  steps:
51
51
  - name: "Checkout"
52
- uses: actions/checkout@v3
52
+ uses: actions/checkout@v4
53
53
  - name: "Run Android Unit Tests"
54
54
  working-directory: android
55
55
  run: ./gradlew ktlintCheck
package/README.md CHANGED
@@ -16,18 +16,12 @@ React Native allows developers to use a single code base to deploy features to m
16
16
 
17
17
  # Installation
18
18
 
19
- 1. **Download and install the mParticle React Native library** from npm:
19
+ **Download and install the mParticle React Native library** from npm:
20
20
 
21
21
  ```bash
22
22
  $ npm install react-native-mparticle --save
23
23
  ```
24
24
 
25
- 2. **Install the native dependencies**. You can use `rnpm` (now part of `react-native` core via `link`) to add native dependencies automatically:
26
-
27
- ```bash
28
- $ react-native link
29
- ```
30
-
31
25
  ## <a name="iOS"></a>iOS
32
26
 
33
27
  1. **Copy your mParticle key and secret** from [your app's dashboard][1].
@@ -37,8 +31,12 @@ $ react-native link
37
31
  2. **Install the SDK** using CocoaPods:
38
32
 
39
33
  ```bash
40
- $ # Update your Podfile to depend on 'mParticle-Apple-SDK' version 7.2.0 or later
41
- $ pod install
34
+ $ # Update your Podfile to be ready to use dynamically linked frameworks by commenting out the following line
35
+ $ # :flipper_configuration => flipper_config,
36
+ ```
37
+ Then run the following command
38
+ ```
39
+ $ USE_FRAMEWORKS=dynamic bundle exec pod install
42
40
  ```
43
41
 
44
42
  The mParticle SDK is initialized by calling the `startWithOptions` method within the `application:didFinishLaunchingWithOptions:` delegate call.
@@ -83,21 +81,16 @@ func application(_ application: UIApplication, didFinishLaunchingWithOptions lau
83
81
 
84
82
  #### Objective-C Example
85
83
 
86
- For apps supporting iOS 8 and above, Apple recommends using the import syntax for **modules** or **semantic import**. However, if you prefer the traditional CocoaPods and static libraries delivery mechanism, that is fully supported as well.
87
-
88
- If you are using mParticle as a framework, your import statement will be as follows:
89
-
90
- ```objective-c
91
- @import mParticle_Apple_SDK; // Apple recommended syntax, but requires "Enable Modules (C and Objective-C)" in pbxproj
92
- #import <mParticle_Apple_SDK/mParticle.h> // Works when modules are not enabled
93
-
94
- ```
95
-
96
- Otherwise, for CocoaPods without `use_frameworks!`, you can use either of these statements:
84
+ Your import statement should be this:
97
85
 
98
86
  ```objective-c
99
- #import <mParticle-Apple-SDK/mParticle.h>
100
- #import "mParticle.h"
87
+ #if defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle.h>)
88
+ #import <mParticle_Apple_SDK/mParticle.h>
89
+ #elif defined(__has_include) && __has_include(<mParticle_Apple_SDK_NoLocation/mParticle.h>)
90
+ #import <mParticle_Apple_SDK_NoLocation/mParticle.h>
91
+ #else
92
+ #import "mParticle.h"
93
+ #endif
101
94
  ```
102
95
 
103
96
  Next, you'll need to start the SDK:
@@ -130,6 +123,12 @@ Next, you'll need to start the SDK:
130
123
 
131
124
  See [Identity](http://docs.mparticle.com/developers/sdk/ios/identity/) for more information on supplying an `MPIdentityApiRequest` object during SDK initialization.
132
125
 
126
+ 4. Remember to start Metro with:
127
+ ```bash
128
+ $ npm start
129
+ ```
130
+ and build your workspace from xCode.
131
+
133
132
 
134
133
  ## <a name="Android"></a>Android
135
134
 
@@ -254,14 +253,6 @@ MParticle.Identity.getUserIdentities((userIdentities) => {
254
253
  var request = new MParticle.IdentityRequest()
255
254
  ```
256
255
 
257
- **Set** a user Alias to be ran anytime the user’s identity changes
258
- ```js
259
- request.onUserAlias = (previousUser, newUser) => {
260
- console.debug(previousUser.userID);
261
- console.debug(newUser.userID);
262
- };
263
- ```
264
-
265
256
  **Setting** user identities:
266
257
 
267
258
  ```js
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <classpath>
3
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
3
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-19/"/>
4
4
  <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5
5
  <classpathentry kind="output" path="bin/default"/>
6
6
  </classpath>
@@ -5,7 +5,7 @@ connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5
5
  connection.project.dir=
6
6
  eclipse.preferences.version=1
7
7
  gradle.user.home=
8
- java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
8
+ java.home=/Users/bstalnaker/Library/Java/JavaVirtualMachines/openjdk-19.0.2/Contents/Home
9
9
  jvm.arguments=
10
10
  offline.mode=false
11
11
  override.workspace.settings=true
@@ -0,0 +1,4 @@
1
+ eclipse.preferences.version=1
2
+ org.eclipse.jdt.core.compiler.codegen.targetPlatform=19
3
+ org.eclipse.jdt.core.compiler.compliance=19
4
+ org.eclipse.jdt.core.compiler.source=19
@@ -4,13 +4,13 @@ buildscript {
4
4
  google()
5
5
  }
6
6
  dependencies {
7
- classpath 'com.android.tools.build:gradle:7.3.1'
7
+ classpath 'com.android.tools.build:gradle:7.4.2'
8
8
  }
9
9
  }
10
10
 
11
11
  plugins {
12
- id "org.sonarqube" version "3.5.0.2730"
13
- id "org.jlleitschuh.gradle.ktlint" version "11.0.0"
12
+ id "org.sonarqube" version "4.4.1.3373"
13
+ id "org.jlleitschuh.gradle.ktlint" version "11.6.1"
14
14
  }
15
15
 
16
16
  sonarqube {
@@ -72,13 +72,13 @@ dependencies {
72
72
  // compile 'com.mparticle:android-example-kit:REPLACEME'
73
73
  //
74
74
 
75
- testImplementation 'org.mockito:mockito-core:4.11.0'
76
- androidTestImplementation 'org.mockito:mockito-android:4.11.0'
77
- testImplementation 'androidx.annotation:annotation:1.5.0'
75
+ testImplementation 'org.mockito:mockito-core:5.8.0'
76
+ androidTestImplementation 'org.mockito:mockito-android:5.8.0'
77
+ testImplementation 'androidx.annotation:annotation:1.7.1'
78
78
 
79
79
  testImplementation 'junit:junit:4.13.2'
80
80
  testImplementation files('libs/java-json.jar')
81
81
 
82
- testImplementation 'com.mparticle:android-core:5.49.0'
82
+ testImplementation 'com.mparticle:android-core:5.55.0'
83
83
  testImplementation 'com.facebook.react:react-native:0.20.1'
84
84
  }
@@ -1,5 +1,6 @@
1
1
  package com.mparticle.react;
2
2
 
3
+ import android.location.Location;
3
4
  import android.util.Log;
4
5
 
5
6
  import com.facebook.react.bridge.Arguments;
@@ -73,6 +74,15 @@ public class MParticleModule extends ReactContextBaseJavaModule {
73
74
  MParticle.getInstance().setUpdateInterval(uploadInterval);
74
75
  }
75
76
 
77
+ @ReactMethod
78
+ public void setLocation(double latitude, double longitude) {
79
+ Location newLocation = new Location("");
80
+ newLocation.setLatitude(latitude);
81
+ newLocation.setLongitude(longitude);
82
+ MParticle.getInstance().setLocation(newLocation);
83
+
84
+ }
85
+
76
86
  @ReactMethod
77
87
  public void logEvent(final String name, int type, final ReadableMap attributesMap) {
78
88
  Map<String, String> attributes = ConvertStringMap(attributesMap);
@@ -835,6 +845,10 @@ public class MParticleModule extends ReactContextBaseJavaModule {
835
845
  return MParticle.EventType.UserPreference;
836
846
  case 7:
837
847
  return MParticle.EventType.Social;
848
+ case 8:
849
+ return MParticle.EventType.Other;
850
+ case 9:
851
+ return MParticle.EventType.Media;
838
852
  default:
839
853
  return MParticle.EventType.Other;
840
854
  }
@@ -1,5 +1,11 @@
1
1
  #import "RNMParticle.h"
2
- #import "mParticle.h"
2
+ #if defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle.h>)
3
+ #import <mParticle_Apple_SDK/mParticle.h>
4
+ #elif defined(__has_include) && __has_include(<mParticle_Apple_SDK_NoLocation/mParticle.h>)
5
+ #import <mParticle_Apple_SDK_NoLocation/mParticle.h>
6
+ #else
7
+ #import "mParticle.h"
8
+ #endif
3
9
  #import <React/RCTConvert.h>
4
10
 
5
11
  @interface MParticleUser ()
@@ -24,6 +30,12 @@ RCT_EXPORT_METHOD(upload)
24
30
  [[MParticle sharedInstance] upload];
25
31
  }
26
32
 
33
+ RCT_EXPORT_METHOD(setLocation:(double)latitude longitude:(double)longitude)
34
+ {
35
+ CLLocation *newLocation = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
36
+ [MParticle sharedInstance].location = newLocation;
37
+ }
38
+
27
39
  RCT_EXPORT_METHOD(setUploadInterval:(NSInteger)uploadInterval)
28
40
  {
29
41
  [[MParticle sharedInstance] setUploadInterval:uploadInterval];
package/js/index.js CHANGED
@@ -12,7 +12,8 @@ const EventType = {
12
12
  UserContent: 5,
13
13
  UserPreference: 6,
14
14
  Social: 7,
15
- Other: 8
15
+ Other: 8,
16
+ Media: 9
16
17
  }
17
18
 
18
19
  const UserAttributeType = {
@@ -157,6 +158,10 @@ const getSession = (completion) => {
157
158
  NativeModules.MParticle.getSession(completion)
158
159
  }
159
160
 
161
+ const setLocation = (latitude, longitude) => {
162
+ NativeModules.MParticle.setLocation(latitude, longitude)
163
+ }
164
+
160
165
  // ******** Identity ********
161
166
  class User {
162
167
  constructor (userId) {
@@ -685,7 +690,8 @@ const MParticle = {
685
690
  isKitActive,
686
691
  getAttributions,
687
692
  logPushRegistration,
688
- getSession
693
+ getSession,
694
+ setLocation
689
695
  }
690
696
 
691
697
  export default MParticle
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "homepage": "https://www.mparticle.com",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "mParticle/react-native-mparticle",
7
- "version": "2.7.8",
7
+ "version": "2.7.10",
8
8
  "main": "js/index.js",
9
9
  "scripts": {
10
10
  "test": "./node_modules/standard/bin/cmd.js",
@@ -1,5 +1,8 @@
1
1
  require 'json'
2
2
 
3
+ new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
4
+ ios_platform = new_arch_enabled ? '11.0' : '9.0'
5
+
3
6
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
7
 
5
8
  Pod::Spec.new do |s|
@@ -11,10 +14,15 @@ Pod::Spec.new do |s|
11
14
 
12
15
  s.homepage = package['homepage']
13
16
  s.license = package['license']
14
- s.platforms = { :ios => "9.0", :tvos => "9.2" }
17
+ s.platforms = { :ios => ios_platform, :tvos => "9.2" }
15
18
 
16
19
  s.source = { :git => "https://github.com/mParticle/react-native-mparticle.git", :tag => "#{s.version}" }
17
20
  s.source_files = "ios/**/*.{h,m}"
18
-
19
- s.dependency 'React'
20
- end
21
+
22
+ if defined?(install_modules_dependencies()) != nil
23
+ install_modules_dependencies(s);
24
+ else
25
+ s.dependency 'React'
26
+ end
27
+ s.dependency 'mParticle-Apple-SDK', '~> 8.0'
28
+ end