Skip to content

Commit 850b26e

Browse files
committed
feat: refactor sample app and sdk to support new react native version
chore: Update project structure and add new features - Added new development scripts and configuration files. - Introduced new Android and iOS modules for Rokt integration. - Updated Gradle and Xcode project settings. - Removed deprecated files and adjusted sample project structure. - Enhanced TypeScript definitions and added new components for better integration.
1 parent a09018c commit 850b26e

File tree

163 files changed

+9300
-7122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+9300
-7122
lines changed

.github/workflows/pull-request.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ jobs:
1414
- name: "Checkout"
1515
uses: actions/checkout@v4
1616
- uses: actions/setup-node@master
17-
- uses: c-hive/gha-yarn-cache@v2
17+
with:
18+
node-version: 18
19+
cache: yarn
20+
cache-dependency-path: yarn.lock
1821

1922
- name: "Install node modules"
2023
run: |

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## Build generated
66
build/
77
DerivedData/
8+
.yarn/
89
*.DS_Store
910

1011
## Various settings
@@ -78,3 +79,9 @@ build
7879
.gradle
7980
local.properties
8081
package-lock.json
82+
83+
# TypeScript build output
84+
lib/
85+
86+
# Development package
87+
*.tgz

.npmignore

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,65 @@
1-
sample
1+
# Sample app
2+
sample/
3+
4+
# Android build artifacts and libs
5+
android/libs/
6+
android/build/
7+
android/.gradle/
8+
android/local.properties
9+
10+
# iOS build artifacts
11+
ios/build/
12+
ios/Pods/
13+
ios/Podfile.lock
14+
15+
# Build directories
16+
build/
17+
dist/
18+
19+
# Dependencies
20+
node_modules/
21+
22+
# IDE files
23+
.idea/
24+
.vscode/
25+
*.iml
26+
*.iws
27+
28+
# OS files
29+
.DS_Store
30+
Thumbs.db
31+
32+
# Git
33+
.git/
34+
.github/
35+
36+
# Logs
37+
*.log
38+
npm-debug.log*
39+
yarn-debug.log*
40+
yarn-error.log*
41+
42+
# Other
43+
.gradle/
44+
.trunk/
45+
*.tgz
46+
*.tar.gz
47+
48+
# Heavy binary files
49+
*.jar
50+
*.aar
51+
*.so
52+
*.dylib
53+
*.dll
54+
55+
# Development files
56+
package-lock.json
57+
yarn.lock
58+
tsconfig.json
59+
release.sh
60+
61+
# Development and test files
62+
**/*.test.ts
63+
**/*.test.tsx
64+
**/*.spec.ts
65+
**/*.spec.tsx

ONBOARDING.md

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
# Developer Onboarding Guide
2+
3+
This guide will help you set up your development environment for working on the react-native-mparticle SDK.
4+
5+
## Prerequisites
6+
7+
- Node.js and npm
8+
- React Native development environment set up ([React Native Environment Setup Guide](https://reactnative.dev/docs/environment-setup))
9+
- For iOS:
10+
- macOS
11+
- Xcode (latest version recommended)
12+
- CocoaPods
13+
- Ruby (for CocoaPods)
14+
- For Android:
15+
- Android Studio
16+
- Java Development Kit (JDK)
17+
- Android SDK
18+
19+
## Project Structure
20+
21+
```
22+
react-native-mparticle/
23+
├── android/ # Native Android SDK implementation
24+
├── ios/ # Native iOS SDK implementation
25+
├── js/ # JavaScript/TypeScript SDK implementation
26+
├── sample/ # Sample app for testing
27+
└── ...
28+
```
29+
30+
## Initial Setup
31+
32+
Install dependencies:
33+
```bash
34+
yarn install
35+
```
36+
37+
## Running the Sample App
38+
39+
The sample app is a great way to test your changes and see the SDK in action.
40+
41+
### iOS Sample App
42+
43+
1. Navigate to the sample directory:
44+
```bash
45+
cd sample
46+
```
47+
48+
2. Install JavaScript dependencies:
49+
```bash
50+
yarn install
51+
```
52+
53+
3. Install iOS dependencies:
54+
```bash
55+
cd ios
56+
pod install
57+
cd ..
58+
```
59+
60+
4. Start the Metro bundler:
61+
```bash
62+
yarn start
63+
```
64+
65+
5. Open the iOS workspace:
66+
```bash
67+
open ios/MParticleSample.xcworkspace
68+
```
69+
70+
6. In Xcode:
71+
- Select your target device/simulator
72+
- Update signing configuration if needed
73+
- Build and run (⌘R)
74+
75+
### Android Sample App
76+
77+
1. Navigate to the sample directory:
78+
```bash
79+
cd sample
80+
```
81+
82+
2. Install JavaScript dependencies:
83+
```bash
84+
npm install
85+
# or
86+
yarn install
87+
```
88+
89+
3. Start the Metro bundler:
90+
```bash
91+
npm start
92+
# or
93+
yarn start
94+
```
95+
96+
4. Open Android Studio:
97+
- Open the `android` folder in Android Studio
98+
- Let Gradle sync complete
99+
- Update any required SDK packages if prompted
100+
101+
5. Run the app:
102+
- Select your target device/emulator
103+
- Click Run (or press ⇧F10)
104+
105+
## Development Workflow
106+
107+
### Building the SDK
108+
109+
#### Android
110+
```bash
111+
cd android
112+
./gradlew build
113+
```
114+
115+
#### iOS
116+
```bash
117+
cd ios
118+
pod install
119+
```
120+
121+
### Running Tests
122+
123+
```bash
124+
# Run JavaScript tests
125+
npm test
126+
127+
# Run Android tests
128+
cd android
129+
./gradlew test
130+
131+
# Run iOS tests
132+
cd ios/RNMParticle.xcodeproj
133+
xcodebuild test
134+
```
135+
136+
## Troubleshooting
137+
138+
### Common iOS Issues
139+
140+
1. "Missing config.h" error:
141+
This error occurs because the mParticle SDK contains Swift code which requires special handling. To fix this:
142+
143+
a. Open your `sample/ios/Podfile` and add this block before the target definition:
144+
```ruby
145+
pre_install do |installer|
146+
installer.pod_targets.each do |pod|
147+
if pod.name == 'mParticle-Apple-SDK'
148+
def pod.build_type;
149+
Pod::BuildType.new(:linkage => :dynamic, :packaging => :framework)
150+
end
151+
end
152+
end
153+
end
154+
```
155+
156+
b. Clean and reinstall pods:
157+
```bash
158+
cd sample/ios
159+
pod cache clean --all
160+
rm -rf Pods Podfile.lock
161+
pod install
162+
```
163+
164+
c. If using Xcode 12 or later, ensure your project's Build Settings has "Allow Non-modular Includes In Framework Modules" set to Yes
165+
166+
2. Pod install fails:
167+
- Try cleaning the pod cache: `pod cache clean --all`
168+
- Delete Podfile.lock and try again
169+
- Ensure CocoaPods is up to date: `bundle update`
170+
171+
3. Build errors:
172+
- Clean build folder in Xcode (⇧⌘K)
173+
- Delete derived data: `rm -rf ~/Library/Developer/Xcode/DerivedData`
174+
- Ensure all dependencies are properly installed
175+
176+
### Common Android Issues
177+
178+
1. Gradle sync fails:
179+
- Check Android Studio SDK Manager for missing packages
180+
- Update Gradle version if needed
181+
- Clean project and rebuild
182+
183+
2. Build errors:
184+
- Run `./gradlew clean`
185+
- Invalidate caches in Android Studio
186+
- Ensure all dependencies are properly installed
187+
188+
## Contributing
189+
190+
1. Create a feature branch
191+
2. Make your changes
192+
3. Test thoroughly
193+
4. Create a pull request
194+
5. Ensure CI passes
195+
6. Request review
196+
197+
## Release Process
198+
199+
1. Update version numbers:
200+
- package.json
201+
- android/build.gradle
202+
- ios/RNMParticle.podspec
203+
204+
2. Update CHANGELOG.md
205+
206+
3. Create release PR
207+
208+
4. After merge, create a new release on GitHub
209+
210+
5. Publish to npm:
211+
```bash
212+
npm publish
213+
```

0 commit comments

Comments
 (0)