Skip to content

Commit b4b59f6

Browse files
Merge pull request #10 from lorenc-tomasz/1.2.9
1.2.9
2 parents 0d1f432 + 183551f commit b4b59f6

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.2.9
2+
3+
- [Android] Fix an uncommon issue with this.getCurrentActivity returning null inside of showInAppMessageIfAvailable
4+
15
# 1.2.8
26

37
- Fix `sharedInstanceWithToken` method definition

android/src/main/java/com/kevinejohn/RNMixpanel/RNMixpanelModule.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.util.Map;
2121
import java.util.UUID;
2222

23+
import android.app.Activity;
24+
2325
/**
2426
* Mixpanel React Native module.
2527
* Note that synchronized(instance) is used in methods because that's what MixpanelAPI.java recommends you do if you are keeping instances.
@@ -270,6 +272,9 @@ public void initPushHandling (final String token, final String apiToken, Promise
270272
// REMOVED: https://github.com/mixpanel/mixpanel-android/pull/582
271273
// is not needed any more as it uses FCM
272274
// instance.getPeople().initPushHandling(token);
275+
// MixpanelAPI.initPushHandling is deprecated.
276+
// Mixpanel now uses Firebase Cloud Messaging.
277+
// initPushHandling will be removed in a future version.
273278
}
274279
promise.resolve(null);
275280
}
@@ -474,7 +479,12 @@ public void showNotificationIfAvailable(final String apiToken, Promise promise)
474479
return;
475480
}
476481
synchronized(instance) {
477-
instance.getPeople().showNotificationIfAvailable(this.getCurrentActivity());
482+
Activity activity = this.getCurrentActivity();
483+
MixpanelAPI.People people = instance.getPeople();
484+
485+
if(activity != null && people != null){
486+
people.showNotificationIfAvailable(activity);
487+
}
478488
}
479489
promise.resolve(null);
480490
}

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.8",
3+
"version": "1.2.9",
44
"description": "A React Native wrapper for Mixpanel tracking",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)