Skip to content
This repository was archived by the owner on Dec 13, 2021. It is now read-only.
Open
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ local.properties
*.iml
*.iws
*.ipr
node_modules
node_modules
gradlew.bat
gradlew
gradle
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ repositories {

dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'io.intercom.android:intercom-sdk-base:9.1.0'
implementation 'io.intercom.android:intercom-sdk-base:10.0.2'
}

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class IntercomModule extends ReactContextBaseJavaModule {

private static final String MODULE_NAME = "IntercomWrapper";
public static final String TAG = "Intercom";
public static final String HIDE_INTERCOM = "206";

private final IntercomPushClient intercomPushClient = new IntercomPushClient();

Expand All @@ -43,7 +44,7 @@ public String getName() {
}

@Override
public boolean canOverrideExistingModule() {
public boolean canOverrideExistingModule() {
return true;
}

Expand Down Expand Up @@ -94,7 +95,7 @@ public void sendTokenToIntercom(String token, Promise promise) {
promise.reject(e.toString());
}
}

@ReactMethod
public void presentCarousel(String carouselID, Promise promise) {
try {
Expand Down Expand Up @@ -186,11 +187,13 @@ public void displayMessenger(Promise promise) {
@ReactMethod
public void hideMessenger(Promise promise) {
try {
Intercom.client().hideMessenger();
promise.resolve(null);
} catch(Exception e) {
Log.e(TAG, "Intercom not initialized");
promise.reject(e.toString());
Intercom.client().hideIntercom();
Log.d(TAG, "hideIntercom");
promise.resolve(true);
} catch (Exception err) {
Log.e(TAG, "hideIntercom error:");
Log.e(TAG, err.toString());
promise.reject(HIDE_INTERCOM, err.toString());
}
}

Expand Down
2 changes: 1 addition & 1 deletion react-native-intercom.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ Pod::Spec.new do |s|
s.frameworks = [ "Intercom" ]
s.static_framework = true
s.dependency 'React'
s.dependency 'Intercom', '~> 9.3.3'
s.dependency 'Intercom', '~> 10.0.2'
end