Skip to content

Commit db8e980

Browse files
fix: 6078 Update README and import statements
1 parent ad54b0f commit db8e980

File tree

5 files changed

+363
-239
lines changed

5 files changed

+363
-239
lines changed

.github/workflows/pull-request.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: macOS-latest
1313
steps:
1414
- name: "Checkout"
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
- uses: actions/setup-node@master
1717
- uses: c-hive/gha-yarn-cache@v2
1818

@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: "Checkout"
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
3333
- name: "Run Android Unit Tests"
3434
working-directory: android
3535
run: ./gradlew test
@@ -39,7 +39,7 @@ jobs:
3939
runs-on: ubuntu-latest
4040
steps:
4141
- name: "Checkout"
42-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4343
- name: "Run Android Unit Tests"
4444
working-directory: android
4545
run: ./gradlew lint
@@ -49,7 +49,7 @@ jobs:
4949
runs-on: ubuntu-latest
5050
steps:
5151
- name: "Checkout"
52-
uses: actions/checkout@v3
52+
uses: actions/checkout@v4
5353
- name: "Run Android Unit Tests"
5454
working-directory: android
5555
run: ./gradlew ktlintCheck

README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ React Native allows developers to use a single code base to deploy features to m
2222
$ npm install react-native-mparticle --save
2323
```
2424

25-
2. **Install the native dependencies**. You can use `rnpm` (now part of `react-native` core via `link`) to add native dependencies automatically:
25+
2. **Install the native dependencies**.
2626

2727
```bash
28-
$ react-native link
28+
$ npm link react-native-mparticle
2929
```
3030

3131
## <a name="iOS"></a>iOS
@@ -37,8 +37,12 @@ $ react-native link
3737
2. **Install the SDK** using CocoaPods:
3838

3939
```bash
40-
$ # Update your Podfile to depend on 'mParticle-Apple-SDK' version 7.2.0 or later
41-
$ pod install
40+
$ # Update your Podfile to be ready to use dynamically linked frameworks by commenting out the following line
41+
$ # :flipper_configuration => flipper_config,
42+
```
43+
Then run the following command
44+
```
45+
$ USE_FRAMEWORKS=dynamic bundle exec pod install
4246
```
4347

4448
The mParticle SDK is initialized by calling the `startWithOptions` method within the `application:didFinishLaunchingWithOptions:` delegate call.
@@ -83,13 +87,16 @@ func application(_ application: UIApplication, didFinishLaunchingWithOptions lau
8387

8488
#### Objective-C Example
8589

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:
90+
Your import statement should be this:
8991

9092
```objective-c
91-
#import <mParticle-Apple-SDK/mParticle.h>
92-
#import "mParticle.h"
93+
#if defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle.h>)
94+
#import <mParticle_Apple_SDK/mParticle.h>
95+
#elif defined(__has_include) && __has_include(<mParticle_Apple_SDK_NoLocation/mParticle.h>)
96+
#import <mParticle_Apple_SDK_NoLocation/mParticle.h>
97+
#else
98+
#import "mParticle.h"
99+
#endif
93100
```
94101

95102
Next, you'll need to start the SDK:
@@ -122,6 +129,12 @@ Next, you'll need to start the SDK:
122129

123130
See [Identity](http://docs.mparticle.com/developers/sdk/ios/identity/) for more information on supplying an `MPIdentityApiRequest` object during SDK initialization.
124131

132+
4. Remember to start Metro with:
133+
```bash
134+
$ npm start
135+
```
136+
and build your workspace from xCode.
137+
125138

126139
## <a name="Android"></a>Android
127140

ios/RNMParticle/RNMParticle.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#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
39
#import <React/RCTConvert.h>
410

511
@interface MParticleUser ()

react-native-mparticle.podspec

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
require 'json'
22

3+
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
4+
ios_platform = new_arch_enabled ? '11.0' : '9.0'
5+
36
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
47

58
Pod::Spec.new do |s|
@@ -11,10 +14,15 @@ Pod::Spec.new do |s|
1114

1215
s.homepage = package['homepage']
1316
s.license = package['license']
14-
s.platforms = { :ios => "9.0", :tvos => "9.2" }
17+
s.platforms = { :ios => ios_platform, :tvos => "9.2" }
1518

1619
s.source = { :git => "https://github.com/mParticle/react-native-mparticle.git", :tag => "#{s.version}" }
1720
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

0 commit comments

Comments
 (0)