react-native-mparticle 2.7.9 → 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,13 +81,16 @@ func application(_ application: UIApplication, didFinishLaunchingWithOptions lau
83
81
 
84
82
  #### Objective-C Example
85
83
 
86
- With recent changes in Swift support for static libraries and React Native's preference for the traditional CocoaPods and static libraries delivery mechanism, we reccomend against setting `use_frameworks!` in your Podfile.
87
-
88
- Your import statement can be either of these:
84
+ Your import statement should be this:
89
85
 
90
86
  ```objective-c
91
- #import <mParticle-Apple-SDK/mParticle.h>
92
- #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
93
94
  ```
94
95
 
95
96
  Next, you'll need to start the SDK:
@@ -122,6 +123,12 @@ Next, you'll need to start the SDK:
122
123
 
123
124
  See [Identity](http://docs.mparticle.com/developers/sdk/ios/identity/) for more information on supplying an `MPIdentityApiRequest` object during SDK initialization.
124
125
 
126
+ 4. Remember to start Metro with:
127
+ ```bash
128
+ $ npm start
129
+ ```
130
+ and build your workspace from xCode.
131
+
125
132
 
126
133
  ## <a name="Android"></a>Android
127
134
 
@@ -74,11 +74,11 @@ dependencies {
74
74
 
75
75
  testImplementation 'org.mockito:mockito-core:5.8.0'
76
76
  androidTestImplementation 'org.mockito:mockito-android:5.8.0'
77
- testImplementation 'androidx.annotation:annotation:1.7.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.54.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);
@@ -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
@@ -158,6 +158,10 @@ const getSession = (completion) => {
158
158
  NativeModules.MParticle.getSession(completion)
159
159
  }
160
160
 
161
+ const setLocation = (latitude, longitude) => {
162
+ NativeModules.MParticle.setLocation(latitude, longitude)
163
+ }
164
+
161
165
  // ******** Identity ********
162
166
  class User {
163
167
  constructor (userId) {
@@ -686,7 +690,8 @@ const MParticle = {
686
690
  isKitActive,
687
691
  getAttributions,
688
692
  logPushRegistration,
689
- getSession
693
+ getSession,
694
+ setLocation
690
695
  }
691
696
 
692
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.9",
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