Skip to content

Commit e88dad7

Browse files
Merge pull request #6 from lorenc-tomasz/1.2.5
Version 1.2.5
2 parents 38cc715 + 2c00c7f commit e88dad7

8 files changed

Lines changed: 66 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# 1.2.5
2+
3+
- [Android] Update SDK to 5.8.4 (https://github.com/mixpanel/mixpanel-android/releases/tag/v5.8.4)
4+
- [Android] Add option to disable automatic flushing when the app goes into the background. Add the following to you <application> tag on your AndroidManifest.xml if you don't want the SDK to automatically flush its queues when the app goes into the background: (https://github.com/mixpanel/mixpanel-android/releases/tag/v5.8.3)
5+
- [iOS] Update SDK to 3.6.2 (https://github.com/mixpanel/mixpanel-iphone/releases/tag/v3.6.2)
6+
- [iOS] Remove IFA/IDFA - Removing using IFA as distinct id. Beginning with this version, Mixpanel no longer uses the IFA(ID for Advertisers) but uses a randomly generated UUID as the default distinct ID instead. After you call reset, Mixpanel generates a new distinct_id by default. This ensures that multiple users on the same device are not assigned the same alias. If you want to use IFV(identifierForVendor) as the distinct_id, you can set MIXPANEL_UNIQUE_DISTINCT_ID=1 in build settings Preprocessor Macros on the Mixpanel framework target. After you call reset, the IFV will not change. However, when a user removes and then re-installs the app, the IFV will change with each installation. More: (https://github.com/mixpanel/mixpanel-iphone/releases/tag/v3.6.2)
7+
- [iOS] All fixes from SDK 3.6.1: (https://github.com/mixpanel/mixpanel-iphone/releases/tag/v3.6.1)
8+
- Allow to configure mixpanel server urls, e.g. https://api-eu.mixpanel.com More in README.md
9+
- [iOS] Add access to the setAppSessionPropertiesIOS which was not exposed
10+
111
# 1.2.4
212

313
- [Android] Update SDK to 5.8.2 (https://github.com/mixpanel/mixpanel-android/releases/tag/v5.8.2)

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,13 @@ Mixpanel.reset();
271271
// get the last distinct id set with identify or, if identify hasn't been
272272
// called, the default mixpanel id for this device.
273273
Mixpanel.getDistinctId(function(id){})
274+
275+
// iOS
276+
// Allows control of the min/max sessions
277+
Mixpanel.setAppSessionPropertiesIOS({
278+
minimumSessionDuration: 60,
279+
maximumSessionDuration: 10,
280+
});
274281
```
275282

276283
## Displaying in-app messages ##
@@ -281,7 +288,7 @@ This behaviour can be disabled by default, and explicitally triggered at a later
281288
For iOS, in your app delegate, add the following line:
282289

283290
```
284-
// In application:didFinishLaunchingWithOptions:
291+
// In (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions:
285292
Mixpanel *mixpanel = [Mixpanel sharedInstanceWithToken:YOUR_MIXPANEL_TOKEN];
286293
// Turn this off so the message doesn't pop up automatically.
287294
mixpanel.showNotificationOnActive = NO;
@@ -330,5 +337,27 @@ For Android, add the following to your app mainifest in the `<application>` tag:
330337

331338
More info: https://help.mixpanel.com/hc/en-us/articles/115004494803-Disable-Geolocation-Collection
332339

340+
## Configure mixpanel urls
341+
342+
Add server url in `.plist` files in iOS project.
343+
344+
```
345+
<key>com.mixpanel.config.serverURL</key>
346+
<string>https://api-eu.mixpanel.com</string>
347+
```
348+
349+
Add endpoints to `manifest` in your Android project.
350+
351+
```
352+
<application ...>
353+
<meta-data android:name="com.mixpanel.android.MPConfig.EventsEndpoint"
354+
android:value="https://api-eu.mixpanel.com/track" />
355+
<meta-data android:name="com.mixpanel.android.MPConfig.PeopleEndpoint"
356+
android:value="https://api-eu.mixpanel.com/engage" />
357+
<meta-data android:name="com.mixpanel.android.MPConfig.GroupsEndpoint"
358+
android:value="https://api-eu.mixpanel.com/groups" />
359+
</application>
360+
```
361+
333362
## Notes ##
334363
For more info please have a look at the [official Mixpanel reference](https://mixpanel.com/help/reference/ios) for iOS

RNMixpanel/RNMixpanel.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ -(Mixpanel*) getInstance: (NSString *)name {
4747
automaticPushTracking:automaticPushTracking
4848
optOutTrackingByDefault:optOutTrackingByDefault];
4949

50+
NSString *serverURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"com.mixpanel.config.serverURL"];
51+
if (serverURL != nil) {
52+
instance.serverURL = serverURL;
53+
}
54+
5055
// copy instances and add the new instance. then reassign instances
5156
NSMutableDictionary *newInstances = [NSMutableDictionary dictionaryWithDictionary:instances];
5257
[newInstances setObject:instance forKey:apiToken];

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ android {
1717

1818
dependencies {
1919
implementation 'com.facebook.react:react-native:+'
20-
api "com.mixpanel.android:mixpanel-android:5.8.2"
20+
api "com.mixpanel.android:mixpanel-android:5.8.4"
2121
}

index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ declare module 'react-native-mixpanel' {
3535
getPushRegistrationId(): Promise<string>
3636

3737
// iOS only
38+
setAppSessionPropertiesIOS(properties: Object): Promise<void>
3839
removePushDeviceToken(pushDeviceToken: string): Promise<void>
3940
removeAllPushDeviceTokens(): Promise<void>
4041
addPushDeviceToken(token: string): Promise<void>
@@ -75,6 +76,7 @@ declare module 'react-native-mixpanel' {
7576
getPushRegistrationId(callback: (token?: string) => void): void;
7677

7778
// iOS only
79+
setAppSessionPropertiesIOS(properties: Object): Promise<void>;
7880
addPushDeviceToken(token: string): void;
7981
removePushDeviceToken(pushDeviceToken: string): void;
8082
removeAllPushDeviceTokens(): void;

index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,14 @@ export class MixpanelInstance {
204204
return RNMixpanel.addPushDeviceToken(token, this.apiToken)
205205
}
206206

207+
// iOS only
208+
setAppSessionPropertiesIOS(properties: Object): Promise<void> {
209+
if (!this.initialized) throw new Error(uninitializedError('setAppSessionPropertiesIOS'))
210+
211+
if (!RNMixpanel.setAppSessionPropertiesIOS) throw new Error('No native implementation for setAppSessionPropertiesIOS. This is iOS only.')
212+
return RNMixpanel.setAppSessionPropertiesIOS(properties)
213+
}
214+
207215
// android only
208216
setPushRegistrationId(token: string): Promise<void> {
209217
if (!this.initialized) throw new Error(uninitializedError('setPushRegistrationId'))
@@ -446,6 +454,13 @@ export default {
446454
defaultInstance.addPushDeviceToken(token)
447455
},
448456

457+
// iOS only
458+
setAppSessionPropertiesIOS(properties: Object) {
459+
if (!defaultInstance) throw new Error(NO_INSTANCE_ERROR)
460+
461+
defaultInstance.setAppSessionPropertiesIOS(properties)
462+
},
463+
449464
// android only
450465
setPushRegistrationId(token: string) {
451466
if (!defaultInstance) throw new Error(NO_INSTANCE_ERROR)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-mixpanel",
3-
"version": "1.2.4",
3+
"version": "1.2.5",
44
"description": "A React Native wrapper for Mixpanel tracking",
55
"main": "index.js",
66
"repository": {

react-native-mixpanel.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Pod::Spec.new do |s|
1212
s.homepage = package['homepage']
1313
s.source = { :git => "https://github.com/davodesign84/react-native-mixpanel.git" }
1414
s.source_files = 'RNMixpanel/*'
15-
s.platform = :ios, "8.0"
15+
s.platform = :ios, "10.0"
1616
s.tvos.deployment_target = '10.0'
17-
s.dependency 'Mixpanel', '3.6.0'
17+
s.dependency 'Mixpanel', '3.6.2'
1818
s.dependency 'React'
1919
end

0 commit comments

Comments
 (0)