Skip to content

Commit 4594368

Browse files
committed
Upgrade to latest Intercom SDK and resolve GCM crashing with custom hook
1 parent cfb9bf7 commit 4594368

40 files changed

+224
-321
lines changed

.classpath

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
66
<classpathentry kind="lib" path="/Applications/Android/platforms/android-23/android.jar"/>
77
<classpathentry kind="lib" path="/Applications/Android/add-ons/addon-google_apis-google-23/libs/maps.jar"/>
8-
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.1.1.GA/android/titanium.jar"/>
9-
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.1.1.GA/android/kroll-common.jar"/>
10-
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.1.1.GA/android/kroll-apt.jar"/>
8+
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/android/titanium.jar"/>
9+
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/android/kroll-common.jar"/>
10+
<classpathentry kind="lib" path="/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA/android/kroll-apt.jar"/>
1111
<classpathentry kind="src" path=".apt_generated">
1212
<attributes>
1313
<attribute name="optional" value="true"/>
1414
</attributes>
1515
</classpathentry>
16+
<classpathentry kind="lib" path="android/lib/intercom-sdk-base-classes.jar"/>
17+
<classpathentry kind="lib" path="android/lib/repackaged_dependencies.jar"/>
18+
<classpathentry kind="lib" path="android/lib/intercom-sdk-gcm-classes.jar"/>
1619
<classpathentry kind="output" path="bin"/>
1720
</classpath>

CHANGELOG.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Intercom android module for Intercom Android SDK version 1.1.11
1+
### Intercom android module for Intercom Android SDK version 1.1.21
22

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

@@ -47,7 +47,7 @@ exports.setDeviceToken = function(token, appicon /* 'device-token', Ti.App.Andro
4747
4848
```
4949

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

81+
### IMPORTANT : create hooks folder and intercom.js file in the module for Android GCM support
82+
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.
83+
84+
Create the following file:
85+
86+
FILE: /modules/android/ti.intercom.android/1.0.4/hooks/intercom.js
87+
```
88+
exports.cliVersion = '>=3.X';
89+
90+
exports.init = function(logger, config, cli, appc) {
91+
cli.on('build.android.aapt', {
92+
pre : function(data, next) {
93+
var args = data.args[1];
94+
if (args.indexOf('--auto-add-overlay') < 0) {
95+
args.push('--auto-add-overlay');
96+
}
97+
98+
var externalLibraries = [{
99+
javaClass : 'io.intercom.android.sdk.gcm',
100+
resPath : '/Users/jerodfritz/Appcelerator/Prspctr/modules/android/ti.intercom.android/1.0.4/platform/android/gcm-res'
101+
}];
102+
console.log("Add Intercom GCM External Libraries", JSON.stringify(externalLibraries));
103+
104+
// --extra-packages can be defined just once
105+
if (args.indexOf('--extra-packages') < 0) {
106+
args.push('--extra-packages');
107+
args.push('');
108+
}
109+
var namespaceIndex = args.indexOf('--extra-packages') + 1;
110+
111+
externalLibraries.forEach(function(lib) {
112+
if (args[namespaceIndex].indexOf(lib.javaClass) < 0) {
113+
args[namespaceIndex].length && (args[namespaceIndex] += ':');
114+
args[namespaceIndex] += lib.javaClass;
115+
}
116+
if (args.indexOf(lib.resPath) < 0) {
117+
args.push('-S');
118+
args.push(lib.resPath);
119+
}
120+
});
121+
next(null, data);
122+
}
123+
});
124+
};
125+
```
126+
127+
81128
#### Author
82129
Jerod
83130

android/LICENSE

Lines changed: 0 additions & 1 deletion
This file was deleted.

android/build.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
titanium.platform=/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.1.1.GA/android
1+
titanium.platform=/Users/jerodfritz/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/android
22
android.platform=/Applications/Android/platforms/android-23
33
google.apis=/Applications/Android/add-ons/addon-google_apis-google-23
4+
android.ndk=/Applications/Android/ndk

android/build.xml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,6 @@
2424
</condition>
2525
</fail>
2626

27-
<!-- Copy documentation subdirectories -->
28-
<mkdir dir="${basedir}/documentation"/>
29-
<copy todir="${basedir}/documentation">
30-
<fileset dir="${basedir}/../documentation"/>
31-
</copy>
32-
33-
<!-- Copy example subdirectories -->
34-
<mkdir dir="${basedir}/example"/>
35-
<copy todir="${basedir}/example">
36-
<fileset dir="${basedir}/../example"/>
37-
</copy>
38-
39-
<!-- Copy assets subdirectories -->
40-
<mkdir dir="${basedir}/assets"/>
41-
<copy todir="${basedir}/assets">
42-
<fileset dir="${basedir}/../assets"/>
43-
</copy>
44-
45-
<!-- Copy license -->
46-
<copy todir="${basedir}" file="${basedir}/../LICENSE"/>
47-
48-
<target name="cleancopy" description="Delete old copies">
49-
<delete dir="${basedir}/documentation"/>
50-
<delete dir="${basedir}/example"/>
51-
<delete dir="${basedir}/assets"/>
52-
<delete file="${basedir}/LICENSE"/>
53-
</target>
5427

5528
<import file="${titanium.platform}/../module/android/build.xml"/>
5629
</project>
-1.73 MB
Binary file not shown.
1.91 MB
Binary file not shown.

0 commit comments

Comments
 (0)