Skip to content

Commit

Permalink
Upgrade to latest Intercom SDK and resolve GCM crashing with custom hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jerodfritz committed Jun 29, 2016
1 parent cfb9bf7 commit 4594368
Show file tree
Hide file tree
Showing 40 changed files with 224 additions and 321 deletions.
9 changes: 6 additions & 3 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/Applications/Android/platforms/android-23/android.jar"/>
<classpathentry kind="lib" path="/Applications/Android/add-ons/addon-google_apis-google-23/libs/maps.jar"/>
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.1.1.GA/android/titanium.jar"/>
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.1.1.GA/android/kroll-common.jar"/>
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.1.1.GA/android/kroll-apt.jar"/>
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/android/titanium.jar"/>
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/android/kroll-common.jar"/>
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/android/kroll-apt.jar"/>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="android/lib/intercom-sdk-base-classes.jar"/>
<classpathentry kind="lib" path="android/lib/repackaged_dependencies.jar"/>
<classpathentry kind="lib" path="android/lib/intercom-sdk-gcm-classes.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 0 additions & 1 deletion CHANGELOG.txt

This file was deleted.

51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Intercom android module for Intercom Android SDK version 1.1.11
### Intercom android module for Intercom Android SDK version 1.1.21

Integrate Intercom.io with Appcelerator. iOS module available here https://github.com/markive/TiIntercom . Tested with 5.1.1GA SDK

Expand Down Expand Up @@ -47,7 +47,7 @@ exports.setDeviceToken = function(token, appicon /* 'device-token', Ti.App.Andro
```

### tiapp.xml changes for Android GCM support
### IMPORTANT : tiapp.xml changes for Android GCM support
```
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
Expand Down Expand Up @@ -78,6 +78,53 @@ exports.setDeviceToken = function(token, appicon /* 'device-token', Ti.App.Andro
</android>
```

### IMPORTANT : create hooks folder and intercom.js file in the module for Android GCM support
You need to create a hooks folder with a .js file inside the module directory with the following contents. This makes sure the additional R values are added for intercom during compile. If someone can tell me how to update the ant build script to create this automatically in the compiled dist please let me know otherwise you need to do this manually after compile.

Create the following file:

FILE: /modules/android/ti.intercom.android/1.0.4/hooks/intercom.js
```
exports.cliVersion = '>=3.X';
exports.init = function(logger, config, cli, appc) {
cli.on('build.android.aapt', {
pre : function(data, next) {
var args = data.args[1];
if (args.indexOf('--auto-add-overlay') < 0) {
args.push('--auto-add-overlay');
}
var externalLibraries = [{
javaClass : 'io.intercom.android.sdk.gcm',
resPath : '/Users/jerodfritz/Appcelerator/Prspctr/modules/android/ti.intercom.android/1.0.4/platform/android/gcm-res'
}];
console.log("Add Intercom GCM External Libraries", JSON.stringify(externalLibraries));
// --extra-packages can be defined just once
if (args.indexOf('--extra-packages') < 0) {
args.push('--extra-packages');
args.push('');
}
var namespaceIndex = args.indexOf('--extra-packages') + 1;
externalLibraries.forEach(function(lib) {
if (args[namespaceIndex].indexOf(lib.javaClass) < 0) {
args[namespaceIndex].length && (args[namespaceIndex] += ':');
args[namespaceIndex] += lib.javaClass;
}
if (args.indexOf(lib.resPath) < 0) {
args.push('-S');
args.push(lib.resPath);
}
});
next(null, data);
}
});
};
```


#### Author
Jerod
([email protected])
Expand Down
1 change: 0 additions & 1 deletion android/LICENSE

This file was deleted.

3 changes: 2 additions & 1 deletion android/build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
titanium.platform=/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.1.1.GA/android
titanium.platform=/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/android
android.platform=/Applications/Android/platforms/android-23
google.apis=/Applications/Android/add-ons/addon-google_apis-google-23
android.ndk=/Applications/Android/ndk
27 changes: 0 additions & 27 deletions android/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,6 @@
</condition>
</fail>

<!-- Copy documentation subdirectories -->
<mkdir dir="${basedir}/documentation"/>
<copy todir="${basedir}/documentation">
<fileset dir="${basedir}/../documentation"/>
</copy>

<!-- Copy example subdirectories -->
<mkdir dir="${basedir}/example"/>
<copy todir="${basedir}/example">
<fileset dir="${basedir}/../example"/>
</copy>

<!-- Copy assets subdirectories -->
<mkdir dir="${basedir}/assets"/>
<copy todir="${basedir}/assets">
<fileset dir="${basedir}/../assets"/>
</copy>

<!-- Copy license -->
<copy todir="${basedir}" file="${basedir}/../LICENSE"/>

<target name="cleancopy" description="Delete old copies">
<delete dir="${basedir}/documentation"/>
<delete dir="${basedir}/example"/>
<delete dir="${basedir}/assets"/>
<delete file="${basedir}/LICENSE"/>
</target>

<import file="${titanium.platform}/../module/android/build.xml"/>
</project>
Binary file removed android/dist/ti.intercom.android-android-1.0.2.zip
Binary file not shown.
Binary file not shown.
Binary file modified android/dist/tiintercomandroid.jar
Binary file not shown.
39 changes: 0 additions & 39 deletions android/documentation/index.md

This file was deleted.

39 changes: 0 additions & 39 deletions android/example/app.js

This file was deleted.

1 change: 1 addition & 0 deletions android/java-sources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"/Users/jerodfritz/Documents/Appcelerator_Studio_Workspace/tiintercomandroid/android/src/ti/intercom/android/TiintercomandroidModule.java"
2 changes: 0 additions & 2 deletions android/lib/README

This file was deleted.

Binary file renamed android/lib/classes.jar → android/lib/intercom-sdk-base-classes.jar
100644 → 100755
Binary file not shown.
Binary file added android/lib/intercom-sdk-gcm-classes.jar
Binary file not shown.
Binary file modified android/lib/repackaged_dependencies.jar
100644 → 100755
Binary file not shown.
Binary file modified android/libs/armeabi-v7a/libti.intercom.android.so
Binary file not shown.
Binary file modified android/libs/armeabi/libti.intercom.android.so
Binary file not shown.
Binary file modified android/libs/x86/libti.intercom.android.so
Binary file not shown.
4 changes: 2 additions & 2 deletions android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 1.0.2
version: 1.0.4
apiversion: 2
architectures: armeabi armeabi-v7a x86
description: tiintercomandroid
author: Jerod Fritz
license: Specify your license
copyright: Copyright (c) 2015 by Your Company
respackage: io.intercom.android.sdk
respackage: io.intercom.android.sdk

# these should not be edited
name: tiintercomandroid
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions android/platform/android/gcm-res/values/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="intercomsdk_groupMessage">
<item quantity="one">"You have a new message"</item>
<item quantity="other">"You have %d new messages"</item>
</plurals>
<string name="intercomsdk_groupExpandedTitle">New notifications</string>
<string name="intercomsdk_groupTitle">New notifications</string>
<string name="intercomsdk_push_title_format">%1$s from %2$s</string>
</resources>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 17 additions & 10 deletions android/platform/android/res/values/values.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="http://schemas.android.com/tools">
<!-- From: file:/Users/intercom/Agents/Android/Andy/work/5095e7c558cfdc56/intercom-sdk-base/src/main/res/values/colours.xml -->
<eat-comment/>
<color name="intercomsdk_app_name_colour">#009CDE</color>
<color name="intercomsdk_attachment_color">#B0BEC5</color>
<color name="intercomsdk_background_grey">#eceff1</color>
Expand All @@ -25,8 +23,6 @@
<color name="intercomsdk_text_light_black">#455A64</color>
<color name="intercomsdk_white">#FFFFFF</color>
<declare-styleable name="MaxSizeLinearLayout"><attr format="dimension" name="intercomsdk_maxWidth"/><attr format="dimension" name="intercomsdk_maxHeight"/></declare-styleable>
<!-- From: file:/Users/intercom/Agents/Android/Andy/work/5095e7c558cfdc56/intercom-sdk-base/src/main/res/values/dimens.xml -->
<eat-comment/>
<dimen name="intercomsdk_action_item_width">50dp</dimen>
<dimen name="intercomsdk_cell_padding_admin_left">18dp</dimen>
<dimen name="intercomsdk_cell_padding_admin_right">12dp</dimen>
Expand All @@ -47,20 +43,18 @@
<dimen name="intercomsdk_rowtime_padding_top">2dp</dimen>
<item format="float" name="intercomsdk_scaled_down_is_typing" type="dimen">0.7</item>
<item format="float" name="intercomsdk_scaled_up_is_typing" type="dimen">1.0</item>
<!-- From: file:/Users/intercom/Agents/Android/Andy/work/5095e7c558cfdc56/intercom-sdk-base/src/main/res/values/plurals.xml -->
<eat-comment/>
<plurals name="intercomsdk_others">
<item quantity="one">" &amp; 1 other"</item>
<item quantity="other">" &amp; %d others"</item>
</plurals>
<!-- From: file:/Users/intercom/Agents/Android/Andy/work/5095e7c558cfdc56/intercom-sdk-base/src/main/res/values/strings.xml -->
<eat-comment/>
<string name="intercomsdk_accessibility_avatar">Avatar</string>
<string name="intercomsdk_accessibility_is_typing">Someone is typing</string>
<string name="intercomsdk_accessibility_powered_by">Powered by Intercom</string>
<string name="intercomsdk_accessibility_shadow">Shadow</string>
<string name="intercomsdk_accessibility_welcome">Welcome message</string>
<string name="intercomsdk_activated_key_message">You\'ve successfully integrated your Android app with the Intercom platform.</string>
<string name="intercomsdk_attachment_cancel">CANCEL</string>
<string name="intercomsdk_attachment_send">SEND</string>
<string name="intercomsdk_close">Close</string>
<string name="intercomsdk_congratulations">Congratulations</string>
<string name="intercomsdk_delivered">Delivered</string>
Expand All @@ -78,14 +72,19 @@
<string name="intercomsdk_sending">Sending…</string>
<string name="intercomsdk_sending_failure">Not delivered. Tap to try again.</string>
<string name="intercomsdk_start_new_conversation">Start a conversation…</string>
<string name="intercomsdk_time_day_ago">%dd ago</string>
<string name="intercomsdk_time_hour_ago">%dh ago</string>
<string name="intercomsdk_time_just_now">Just now</string>
<string name="intercomsdk_time_minute_ago">%dm ago</string>
<string name="intercomsdk_time_never">Never</string>
<string name="intercomsdk_time_week_ago">%dw ago</string>
<string name="intercomsdk_time_year_ago">%dy ago</string>
<string name="intercomsdk_title_activity_conversations">Conversations</string>
<string name="intercomsdk_try_again">Tap to try again.</string>
<string name="intercomsdk_twitter_follow">Follow us on Twitter</string>
<string name="intercomsdk_unable_to_load">Unable to load conversations</string>
<string name="intercomsdk_write_a_reply">Write a reply</string>
<string name="intercomsdk_you">You</string>
<!-- From: file:/Users/intercom/Agents/Android/Andy/work/5095e7c558cfdc56/intercom-sdk-base/src/main/res/values/styles.xml -->
<eat-comment/>
<style name="IntercomSDK_AttachmentTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
Expand All @@ -102,4 +101,12 @@
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowActionModeOverlay" ns1:ignore="NewApi">true</item>
</style>
<plurals name="intercomsdk_groupMessage">
<item quantity="one">"You have a new message"</item>
<item quantity="other">"You have %d new messages"</item>
</plurals>
<string name="intercomsdk_groupExpandedTitle">New notifications</string>
<string name="intercomsdk_groupTitle">New notifications</string>
<string name="intercomsdk_push_title_format">%1$s from %2$s</string>

</resources>
4 changes: 4 additions & 0 deletions android/platform/android/res/values/version.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="google_play_services_version">7571000</integer>
</resources>
Loading

0 comments on commit 4594368

Please sign in to comment.