Skip to content

Commit

Permalink
Update to 4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ronocod committed Nov 2, 2017
1 parent 0d883fc commit 34761f9
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 21 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Intercom for Cordova/PhoneGap

## 4.1.0 (2017-11-02)

* Updated Intercom for Android to 4.1.x
* Updated Intercom for iOS to 4.1.x
* Added `intercom.logout()`.
* Added diagnostic messages for Android build errors.

## 4.0.0 (2017-08-29)

* Updated Intercom for Android to 4.0.1
Expand Down
2 changes: 1 addition & 1 deletion Example/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<img class="logo" src="img/Intercom-logo.png" width="112" height="99"/>

<p><button id="login-btn">Login</button></p>
<p><button id="logut-btn">Logout</button></p>
<p><button id="logout-btn">Logout</button></p>
<p><button id="open-intercom-btn">Open Intercom</button></p>
</div>
<script type="text/javascript" src="cordova.js"></script>
Expand Down
8 changes: 4 additions & 4 deletions Example/www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ var app = {
app.login();
}, false);

document.getElementById("logut-btn").addEventListener("click", function(){
intercom.reset();
document.getElementById("logout-btn").addEventListener("click", function(){
intercom.logout();
var storage = window.localStorage;
storage.removeItem("email");
app.configureViewForLoggedOutUser();
Expand Down Expand Up @@ -81,13 +81,13 @@ var app = {
},

configureViewForLoggedInUser: function() {
document.getElementById("logut-btn").style.visibility = 'visible';
document.getElementById("logout-btn").style.visibility = 'visible';
document.getElementById("open-intercom-btn").style.visibility = 'visible';
document.getElementById("login-btn").style.visibility = 'hidden';
},

configureViewForLoggedOutUser: function() {
document.getElementById("logut-btn").style.visibility = 'hidden';
document.getElementById("logout-btn").style.visibility = 'hidden';
document.getElementById("open-intercom-btn").style.visibility = 'hidden';
document.getElementById("login-btn").style.visibility = 'visible';
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cordova plugin add cordova-plugin-intercom

To add the plugin to your PhoneGap app, add the following to your `config.xml`:
```xml
<plugin name="cordova-plugin-intercom" version="~4.0.0" />
<plugin name="cordova-plugin-intercom" version="~4.1.0" />
```
### Ionic

Expand Down
2 changes: 1 addition & 1 deletion intercom-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-intercom",
"version": "4.0.0",
"version": "4.1.0",
"description": "Official Cordova/PhoneGap plugin for Intercom",
"cordova": {
"id": "cordova-plugin-intercom",
Expand Down
4 changes: 2 additions & 2 deletions intercom-plugin/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-intercom" version="4.0.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<plugin id="cordova-plugin-intercom" version="4.1.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>Intercom</name>
<author>Intercom</author>
<license>MIT License</license>
Expand Down Expand Up @@ -47,7 +47,7 @@
</array>
</config-file>

<framework src="Intercom" type="podspec" spec="~> 4.0.0" />
<framework src="Intercom" type="podspec" spec="~> 4.1.0" />
</platform>

<platform name="android">
Expand Down
6 changes: 3 additions & 3 deletions intercom-plugin/src/android/IntercomBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void setUpIntercom() {
try {
Context context = IntercomBridge.this.cordova.getActivity().getApplicationContext();

CordovaHeaderInterceptor.setCordovaVersion(context, "4.0.0");
CordovaHeaderInterceptor.setCordovaVersion(context, "4.1.0");

switch (IntercomPushManager.getInstalledModuleType()) {
case GCM: {
Expand Down Expand Up @@ -117,9 +117,9 @@ private enum Action {
callbackContext.success();
}
},
reset {
logout {
@Override void performAction(JSONArray args, CallbackContext callbackContext, CordovaInterface cordova) {
Intercom.client().reset();
Intercom.client().logout();
callbackContext.success();
}
},
Expand Down
8 changes: 4 additions & 4 deletions intercom-plugin/src/android/intercom.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
if (pushType == 'fcm') {
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.google.gms:google-services:3.1.0'
}
}
}
Expand All @@ -26,12 +26,12 @@ repositories {
}

dependencies {
compile 'io.intercom.android:intercom-sdk-base:4.0.+'
compile 'io.intercom.android:intercom-sdk-base:4.1.+'
if (pushType == 'gcm') {
compile 'io.intercom.android:intercom-sdk-gcm:4.0.+'
compile 'io.intercom.android:intercom-sdk-gcm:4.1.+'
} else if (pushType == 'fcm') {
compile 'com.google.firebase:firebase-messaging:11.+'
compile 'io.intercom.android:intercom-sdk-fcm:4.0.+'
compile 'io.intercom.android:intercom-sdk-fcm:4.1.+'
}
}

Expand Down
2 changes: 1 addition & 1 deletion intercom-plugin/src/ios/IntercomBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- (void)registerIdentifiedUser:(CDVInvokedUrlCommand*)command;
- (void)registerUnidentifiedUser:(CDVInvokedUrlCommand*)command;
- (void)reset:(CDVInvokedUrlCommand*)command;
- (void)logout:(CDVInvokedUrlCommand*)command;

- (void)setUserHash:(CDVInvokedUrlCommand*)command;

Expand Down
6 changes: 3 additions & 3 deletions intercom-plugin/src/ios/IntercomBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ + (void)setCordovaVersion:(NSString *)v;
@implementation IntercomBridge : CDVPlugin

- (void)pluginInitialize {
[Intercom setCordovaVersion:@"4.0.0"];
[Intercom setCordovaVersion:@"4.1.0"];
#ifdef DEBUG
[Intercom enableLogging];
#endif
Expand Down Expand Up @@ -51,8 +51,8 @@ - (void)registerUnidentifiedUser:(CDVInvokedUrlCommand*)command {
[self sendSuccess:command];
}

- (void)reset:(CDVInvokedUrlCommand*)command {
[Intercom reset];
- (void)logout:(CDVInvokedUrlCommand*)command {
[Intercom logout];
[self sendSuccess:command];
}

Expand Down
6 changes: 5 additions & 1 deletion intercom-plugin/www/intercom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ var intercom = {
},

reset: function(success, error) {
cordova.exec(success, error, 'Intercom', 'reset', []);
cordova.exec(success, error, 'Intercom', 'logout', []);
},

logout: function(success, error) {
cordova.exec(success, error, 'Intercom', 'logout', []);
},

setSecureMode: function(secureHash, secureData, success, error) {
Expand Down

0 comments on commit 34761f9

Please sign in to comment.