react-native-mparticle 2.7.10 → 2.7.12
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.
package/README.md
CHANGED
|
@@ -30,15 +30,42 @@ $ npm install react-native-mparticle --save
|
|
|
30
30
|
|
|
31
31
|
2. **Install the SDK** using CocoaPods:
|
|
32
32
|
|
|
33
|
+
The npm install step above will automatically include our react framework and the core iOS framework in your project. However depending on your app and its other dependecies you must integrate it in 1 of 3 ways
|
|
34
|
+
|
|
35
|
+
A. Static Libraries are the React Native default but since mParticle iOS contains swift code you need to add an exception for it in the from of a pre-install command in the Podfile.
|
|
33
36
|
```bash
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
pre_install do |installer|
|
|
38
|
+
installer.pod_targets.each do |pod|
|
|
39
|
+
if pod.name == 'mParticle-Apple-SDK'
|
|
40
|
+
def pod.build_type;
|
|
41
|
+
Pod::BuildType.new(:linkage => :dynamic, :packaging => :framework)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
36
46
|
```
|
|
37
47
|
Then run the following command
|
|
38
48
|
```
|
|
49
|
+
bundle exec pod install
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
B&C. Frameworks are the default for Swift development and while it isn't preferred by React Native it is supported. Additionally you can define whether the frameworks are built staticly or dynamically.
|
|
53
|
+
|
|
54
|
+
Update your Podfile to be ready to use dynamically linked frameworks by commenting out the following line
|
|
55
|
+
```bash
|
|
56
|
+
# :flipper_configuration => flipper_config,
|
|
57
|
+
```
|
|
58
|
+
Then run either of the following commands
|
|
59
|
+
```
|
|
60
|
+
$ USE_FRAMEWORKS=static bundle exec pod install
|
|
61
|
+
```
|
|
62
|
+
or
|
|
63
|
+
```
|
|
39
64
|
$ USE_FRAMEWORKS=dynamic bundle exec pod install
|
|
40
65
|
```
|
|
41
66
|
|
|
67
|
+
3. Import and start the mParticle Apple SDK into Swift or Objective-C.
|
|
68
|
+
|
|
42
69
|
The mParticle SDK is initialized by calling the `startWithOptions` method within the `application:didFinishLaunchingWithOptions:` delegate call.
|
|
43
70
|
|
|
44
71
|
Preferably the location of the initialization method call should be one of the last statements in the `application:didFinishLaunchingWithOptions:`.
|
|
@@ -49,9 +76,6 @@ The `startWithOptions` method requires an options argument containing your key a
|
|
|
49
76
|
|
|
50
77
|
For more help, see [the iOS set up docs](https://docs.mparticle.com/developers/sdk/ios/getting-started/#create-an-input).
|
|
51
78
|
|
|
52
|
-
3. Import and start the mParticle Apple SDK into Swift or Objective-C.
|
|
53
|
-
|
|
54
|
-
|
|
55
79
|
#### Swift Example
|
|
56
80
|
|
|
57
81
|
```swift
|
|
@@ -684,6 +684,11 @@ public class MParticleModule extends ReactContextBaseJavaModule {
|
|
|
684
684
|
builder.quantity(quantity);
|
|
685
685
|
}
|
|
686
686
|
|
|
687
|
+
if (map.hasKey("variant")) {
|
|
688
|
+
String variant = map.getString("variant");
|
|
689
|
+
builder.variant(variant);
|
|
690
|
+
}
|
|
691
|
+
|
|
687
692
|
return builder.build();
|
|
688
693
|
}
|
|
689
694
|
|
package/package.json
CHANGED