Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 6078 update imports #197

Merged
merged 6 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: macOS-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-node@master
- uses: c-hive/gha-yarn-cache@v2

Expand All @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "Run Android Unit Tests"
working-directory: android
run: ./gradlew test
Expand All @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "Run Android Unit Tests"
working-directory: android
run: ./gradlew lint
Expand All @@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "Run Android Unit Tests"
working-directory: android
run: ./gradlew ktlintCheck
Expand Down
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ React Native allows developers to use a single code base to deploy features to m
$ npm install react-native-mparticle --save
```

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

```bash
$ react-native link
$ npm link react-native-mparticle
```

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

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

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

#### Objective-C Example

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.

Your import statement can be either of these:
Your import statement should be this:

```objective-c
#import <mParticle-Apple-SDK/mParticle.h>
#import "mParticle.h"
#if defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle.h>)
#import <mParticle_Apple_SDK/mParticle.h>
#elif defined(__has_include) && __has_include(<mParticle_Apple_SDK_NoLocation/mParticle.h>)
#import <mParticle_Apple_SDK_NoLocation/mParticle.h>
#else
#import "mParticle.h"
#endif
```

Next, you'll need to start the SDK:
Expand Down Expand Up @@ -122,6 +129,12 @@ Next, you'll need to start the SDK:

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

4. Remember to start Metro with:
```bash
$ npm start
```
and build your workspace from xCode.


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

Expand Down
8 changes: 7 additions & 1 deletion ios/RNMParticle/RNMParticle.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#import "RNMParticle.h"
#import "mParticle.h"
#if defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle.h>)
#import <mParticle_Apple_SDK/mParticle.h>
#elif defined(__has_include) && __has_include(<mParticle_Apple_SDK_NoLocation/mParticle.h>)
#import <mParticle_Apple_SDK_NoLocation/mParticle.h>
#else
#import "mParticle.h"
#endif
#import <React/RCTConvert.h>

@interface MParticleUser ()
Expand Down
16 changes: 12 additions & 4 deletions react-native-mparticle.podspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
require 'json'

new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
ios_platform = new_arch_enabled ? '11.0' : '9.0'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

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

s.homepage = package['homepage']
s.license = package['license']
s.platforms = { :ios => "9.0", :tvos => "9.2" }
s.platforms = { :ios => ios_platform, :tvos => "9.2" }

s.source = { :git => "https://github.com/mParticle/react-native-mparticle.git", :tag => "#{s.version}" }
s.source_files = "ios/**/*.{h,m}"

s.dependency 'React'
end

if defined?(install_modules_dependencies()) != nil
install_modules_dependencies(s);
else
s.dependency 'React'
end
s.dependency 'mParticle-Apple-SDK', '~> 8.0'
end
Loading
Loading