Skip to content

Commit

Permalink
Merge pull request #274 from intercom/nicolette/bump-cordova-ios-andr…
Browse files Browse the repository at this point in the history
…oid-versions

Update to cordova-android 8.0.0 and cordova-ios 5.0.0, remove GCM
  • Loading branch information
nymerias authored Jul 17, 2019
2 parents e8a9dcc + 26b5750 commit 31c0879
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Before you run your app, you'll need to add your Intercom **AppID** and **API Ke
<preference name="intercom-android-api-key" value="YOUR_ANDROID_API_KEY"/>
```

If you want to enable Android FCM/GCM push notifications copy your `google-services.json` file into the `Example/` folder add this line to `config.xml`:
If you want to enable Android FCM push notifications copy your `google-services.json` file into the `Example/` folder add this line to `config.xml`:
```xml
<preference name="intercom-android-push-type" value="FCM"/>
```
Expand Down
6 changes: 3 additions & 3 deletions Example/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
<splash src="www/img/launch/Default@2x~universal~anyany.png" />
</platform>
<preference name="intercom-app-id" value="YOUR_APP_ID" />
<preference name="intercom-ios-api-key" value="YOU_IOS_API_KEY" />
<preference name="intercom-ios-api-key" value="YOUR_IOS_API_KEY" />
<preference name="intercom-android-api-key" value="YOUR_ANDROID_API_KEY" />
<plugin name="cordova-plugin-whitelist" spec="1.0.0" />
<engine name="ios" spec="^4.5.4" />
<engine name="android" spec="~7.1.4" />
<engine name="ios" spec="^5.0.0" />
<engine name="android" spec="~8.0.0" />
</widget>
4 changes: 2 additions & 2 deletions Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
}
},
"dependencies": {
"cordova-android": "^7.1.4",
"cordova-ios": "^4.5.4",
"cordova-android": "^8.0.0",
"cordova-ios": "^5.0.0",
"cordova-plugin-whitelist": "^1.0.0"
}
}
6 changes: 3 additions & 3 deletions intercom-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"engines": [
{
"name": "cordova",
"version": ">=7.1.0"
"version": ">=9.0.0"
},
{
"name": "cordova-android",
"version": ">=7.0.0"
"version": ">=8.0.0"
},
{
"name": "cordova-ios",
"version": ">=4.5.4"
"version": ">=5.0.0"
}
],
"author": "Intercom",
Expand Down
8 changes: 4 additions & 4 deletions intercom-plugin/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<keywords>intercom,intercom-cordova</keywords>

<engines>
<engine name="cordova" version=">=7.1.0" />
<engine name="cordova-android" version=">=7.1.0" />
<engine name="cordova-ios" version=">=4.5.4" />
<engine name="cordova" version=">=9.0.0" />
<engine name="cordova-android" version=">=8.0.0" />
<engine name="cordova-ios" version=">=5.0.0" />
</engines>

<js-module name="Intercom" src="www/intercom.js">
Expand Down Expand Up @@ -47,7 +47,7 @@
</array>
</config-file>

<framework src="Intercom" type="podspec" spec="~> 5.1.0" />
<framework src="Intercom" type="podspec" spec="~> 5.4.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 @@ -60,14 +60,14 @@ private void setUpIntercom() {
try {
Context context = cordova.getActivity().getApplicationContext();

CordovaHeaderInterceptor.setCordovaVersion(context, "6.2.0");
CordovaHeaderInterceptor.setCordovaVersion(context, "7.0.0");

switch (IntercomPushManager.getInstalledModuleType()) {
case GCM: {
case FCM: {
String senderId = getSenderId(context);

if (senderId != null) {
LumberMill.getLogger().d("Using GCM Sender ID: " + senderId);
LumberMill.getLogger().d("Using FCM Sender ID: " + senderId);
IntercomPushManager.cacheSenderId(context, senderId);
}
break;
Expand Down
29 changes: 5 additions & 24 deletions intercom-plugin/src/android/intercom.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ repositories {
}

dependencies {
compile 'io.intercom.android:intercom-sdk-base:5.1.5'
if (pushType == 'gcm') {
compile 'io.intercom.android:intercom-sdk-gcm:5.1.5'
} else if (pushType == 'fcm' || pushType == 'fcm-without-build-plugin') {
compile 'com.google.firebase:firebase-messaging:11.+'
compile 'io.intercom.android:intercom-sdk-fcm:5.1.5'
compile 'io.intercom.android:intercom-sdk-base:5.+'
if (pushType == 'fcm' || pushType == 'fcm-without-build-plugin') {
compile 'com.google.firebase:firebase-messaging:17.+'
compile 'io.intercom.android:intercom-sdk-fcm:5.+'
}
}

Expand All @@ -44,24 +42,7 @@ task copyGoogleServices(type: Copy) {
into '.'
}

if (pushType == 'gcm') {
try {
def jsonFile = file(googleServicesJsonPath)
def parsedJson = new groovy.json.JsonSlurper().parseText(jsonFile.text)
def senderId = parsedJson.project_info.project_number

android {
defaultConfig {
resValue "string", "intercom_gcm_sender_id", senderId
buildConfigField "String", 'INTERCOM_SENDER_ID', "\"${senderId}\""
}
}
} catch (Exception e) {
logger.error("Could not read sender ID from google-services.json, falling back to " +
"`intercom-android-sender-id` preference:" + e.getMessage())
}

} else if (pushType == 'fcm') {
if (pushType == 'fcm') {
tasks.copyGoogleServices.execute()
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
} else if (pushType == 'fcm-without-build-plugin') {
Expand Down
2 changes: 1 addition & 1 deletion 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:@"6.2.0"];
[Intercom setCordovaVersion:@"7.0.0"];
#ifdef DEBUG
[Intercom enableLogging];
#endif
Expand Down

0 comments on commit 31c0879

Please sign in to comment.