From fb7f809d5c1face98c7a80ada0d57e7c69a7f9a7 Mon Sep 17 00:00:00 2001 From: James Treanor Date: Fri, 25 Aug 2017 16:26:38 +0100 Subject: [PATCH 01/30] Use 4.0.0 of iOS and Android --- plugin.xml | 2 +- src/android/build-extras-intercom.gradle | 2 +- src/android/intercom.gradle | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugin.xml b/plugin.xml index b8f447d..9a47173 100644 --- a/plugin.xml +++ b/plugin.xml @@ -47,7 +47,7 @@ - + diff --git a/src/android/build-extras-intercom.gradle b/src/android/build-extras-intercom.gradle index 4d38f4b..13fad84 100644 --- a/src/android/build-extras-intercom.gradle +++ b/src/android/build-extras-intercom.gradle @@ -9,7 +9,7 @@ android.defaultConfig.applicationId manifest.@package.text() // some libraries depend on higher versions of our dependencies than we support // we keep track of these dependencies here and override the version to a safe one def safeVersions = [ - "com.android.support:support-v4": "25.+" + "com.android.support:support-v4": "26.+" ] def badVersionIndicators = [ diff --git a/src/android/intercom.gradle b/src/android/intercom.gradle index 972da3f..a44f138 100644 --- a/src/android/intercom.gradle +++ b/src/android/intercom.gradle @@ -23,12 +23,12 @@ repositories { jcenter() } dependencies { - compile 'io.intercom.android:intercom-sdk-base:3.2.+' + compile 'io.intercom.android:intercom-sdk-base:4.0.+' if (pushType == 'gcm') { - compile 'io.intercom.android:intercom-sdk-gcm:3.2.+' + compile 'io.intercom.android:intercom-sdk-gcm:4.0.+' } else if (pushType == 'fcm') { - compile 'com.google.firebase:firebase-messaging:10.+' - compile 'io.intercom.android:intercom-sdk-fcm:3.2.+' + compile 'com.google.firebase:firebase-messaging:11.+' + compile 'io.intercom.android:intercom-sdk-fcm:4.0.+' } } From 37a8b21085b357d6f5750f77dd18d986a6351b46 Mon Sep 17 00:00:00 2001 From: James Treanor Date: Fri, 25 Aug 2017 16:26:48 +0100 Subject: [PATCH 02/30] Update iOS bridge to use ICMUserAttributes --- src/ios/IntercomBridge.h | 2 +- src/ios/IntercomBridge.m | 111 +++++++++++++++++++++++++++++++++++---- 2 files changed, 101 insertions(+), 12 deletions(-) diff --git a/src/ios/IntercomBridge.h b/src/ios/IntercomBridge.h index ce79332..58aeae9 100644 --- a/src/ios/IntercomBridge.h +++ b/src/ios/IntercomBridge.h @@ -8,7 +8,7 @@ - (void)registerUnidentifiedUser:(CDVInvokedUrlCommand*)command; - (void)reset:(CDVInvokedUrlCommand*)command; -- (void)setSecureMode:(CDVInvokedUrlCommand*)command; +- (void)setUserHash:(CDVInvokedUrlCommand*)command; - (void)updateUser:(CDVInvokedUrlCommand*)command; - (void)logEvent:(CDVInvokedUrlCommand*)command; diff --git a/src/ios/IntercomBridge.m b/src/ios/IntercomBridge.m index 9865c49..3da7ca8 100644 --- a/src/ios/IntercomBridge.m +++ b/src/ios/IntercomBridge.m @@ -56,14 +56,6 @@ - (void)reset:(CDVInvokedUrlCommand*)command { [self sendSuccess:command]; } -- (void)setSecureMode:(CDVInvokedUrlCommand*)command { - NSString *hmac = command.arguments[0]; - NSString *data = command.arguments[1]; - - [Intercom setHMAC:hmac data:data]; - [self sendSuccess:command]; -} - - (void)setUserHash:(CDVInvokedUrlCommand*)command { NSString *hmac = command.arguments[0]; @@ -72,9 +64,8 @@ - (void)setUserHash:(CDVInvokedUrlCommand*)command { } - (void)updateUser:(CDVInvokedUrlCommand*)command { - NSDictionary* attributes = command.arguments[0]; - [Intercom updateUserWithAttributes:attributes]; - + NSDictionary* attributesDict = command.arguments[0]; + [Intercom updateUser:[self userAttributesForDictionary:attributesDict]]; [self sendSuccess:command]; } @@ -153,6 +144,104 @@ - (void)registerForPush:(CDVInvokedUrlCommand*)command { [self sendSuccess:command]; } +#pragma mark - User attributes + +- (ICMUserAttributes *)userAttributesForDictionary:(NSDictionary *)attributesDict { + ICMUserAttributes *attributes = [ICMUserAttributes new]; + if ([self stringValueForKey:@"email" inDictionary:attributesDict]) { + attributes.email = [self stringValueForKey:@"email" inDictionary:attributesDict]; + } + if ([self stringValueForKey:@"user_id" inDictionary:attributesDict]) { + attributes.userId = [self stringValueForKey:@"user_id" inDictionary:attributesDict]; + } + if ([self stringValueForKey:@"name" inDictionary:attributesDict]) { + attributes.name = [self stringValueForKey:@"name" inDictionary:attributesDict]; + } + if ([self stringValueForKey:@"phone" inDictionary:attributesDict]) { + attributes.phone = [self stringValueForKey:@"phone" inDictionary:attributesDict]; + } + if ([self stringValueForKey:@"language_override" inDictionary:attributesDict]) { + attributes.languageOverride = [self stringValueForKey:@"language_override" inDictionary:attributesDict]; + } + if ([self dateValueForKey:@"signed_up_at" inDictionary:attributesDict]) { + attributes.signedUpAt = [self dateValueForKey:@"signed_up_at" inDictionary:attributesDict]; + } + if ([self stringValueForKey:@"unsubscribed_from_emails" inDictionary:attributesDict]) { + attributes.unsubscribedFromEmails = [self stringValueForKey:@"unsubscribed_from_emails" inDictionary:attributesDict]; + } + if (attributesDict[@"custom_attributes"]) { + attributes.customAttributes = attributesDict[@"custom_attributes"]; + } + if (attributesDict[@"companies"]) { + NSMutableArray *companies = [NSMutableArray new]; + for (NSDictionary *companyDict in attributesDict[@"companies"]) { + [companies addObject:[self companyForDictionary:companyDict]]; + } + attributes.companies = companies; + } + return attributes; +} + +- (ICMCompany *)companyForDictionary:(NSDictionary *)attributesDict { + ICMCompany *company = [ICMCompany new]; + if ([self stringValueForKey:@"company_id" inDictionary:attributesDict]) { + company.companyId = [self stringValueForKey:@"company_id" inDictionary:attributesDict]; + } + if ([self stringValueForKey:@"name" inDictionary:attributesDict]) { + company.name = [self stringValueForKey:@"name" inDictionary:attributesDict]; + } + if ([self dateValueForKey:@"created_at" inDictionary:attributesDict]) { + company.createdAt = [self dateValueForKey:@"created_at" inDictionary:attributesDict]; + } + if ([self numberValueForKey:@"monthly_spend" inDictionary:attributesDict]) { + company.monthlySpend = [self numberValueForKey:@"monthly_spend" inDictionary:attributesDict]; + } + if ([self stringValueForKey:@"plan" inDictionary:attributesDict]) { + company.plan = [self stringValueForKey:@"plan" inDictionary:attributesDict]; + } + if (attributesDict[@"custom_attributes"]) { + company.customAttributes = attributesDict[@"custom_attributes"]; + } + return company; +} + +- (NSString *)stringValueForKey:(NSString *)key inDictionary:(NSDictionary *)dictionary { + NSString *value = dictionary[key]; + if ([value isKindOfClass:[NSString class]]) { + return value; + } + if ([value isKindOfClass:[NSNumber class]]) { + return [NSString stringWithFormat:@"%@", value]; + } + if ([value isKindOfClass:[NSNull class]]) { + return [ICMUserAttributes nullStringAttribute]; + } + return nil; +} + +- (NSNumber *)numberValueForKey:(NSString *)key inDictionary:(NSDictionary *)dictionary { + NSNumber *value = dictionary[key]; + if ([value isKindOfClass:[NSNumber class]]) { + return value; + } + if ([value isKindOfClass:[NSNull class]]) { + return [ICMUserAttributes nullNumberAttribute]; + } + return nil; +} + +- (NSDate *)dateValueForKey:(NSString *)key inDictionary:(NSDictionary *)dictionary { + NSNumber *value = dictionary[key]; + if ([value isKindOfClass:[NSNumber class]]) { + return [NSDate dateWithTimeIntervalSince1970:[value doubleValue]]; + } + if ([value isKindOfClass:[NSNull class]]) { + return [ICMUserAttributes nullDateAttribute]; + } + return nil; +} + + #pragma mark - Private methods - (void)sendSuccess:(CDVInvokedUrlCommand*)command { From c120d45f41fb8cdc8f5c8879de2a84c71c1dce7f Mon Sep 17 00:00:00 2001 From: James Treanor Date: Fri, 25 Aug 2017 16:28:13 +0100 Subject: [PATCH 03/30] Bump version for 4.0.0 --- README.md | 2 +- package.json | 2 +- plugin.xml | 2 +- src/android/IntercomBridge.java | 2 +- src/ios/IntercomBridge.m | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a45e594..b7263cc 100644 --- a/README.md +++ b/README.md @@ -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 - + ``` ### Ionic diff --git a/package.json b/package.json index 1e5073c..03dab9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-intercom", - "version": "3.2.2", + "version": "4.0.0", "description": "Official Cordova/PhoneGap plugin for Intercom", "cordova": { "id": "cordova-plugin-intercom", diff --git a/plugin.xml b/plugin.xml index 9a47173..3c66528 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - + Intercom Intercom MIT License diff --git a/src/android/IntercomBridge.java b/src/android/IntercomBridge.java index 3d1ac18..1b60374 100644 --- a/src/android/IntercomBridge.java +++ b/src/android/IntercomBridge.java @@ -66,7 +66,7 @@ private void setUpIntercom() { try { Context context = IntercomBridge.this.cordova.getActivity().getApplicationContext(); - CordovaHeaderInterceptor.setCordovaVersion(context, "3.2.2"); + CordovaHeaderInterceptor.setCordovaVersion(context, "4.0.0"); switch (IntercomPushManager.getInstalledModuleType()) { case GCM: { diff --git a/src/ios/IntercomBridge.m b/src/ios/IntercomBridge.m index 3da7ca8..15580bd 100644 --- a/src/ios/IntercomBridge.m +++ b/src/ios/IntercomBridge.m @@ -9,7 +9,7 @@ + (void)setCordovaVersion:(NSString *)v; @implementation IntercomBridge : CDVPlugin - (void)pluginInitialize { - [Intercom setCordovaVersion:@"3.2.2"]; + [Intercom setCordovaVersion:@"4.0.0"]; #ifdef DEBUG [Intercom enableLogging]; #endif From d68114d1fe5b63881ae9d5bf59e70c53e59f074f Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Mon, 28 Aug 2017 16:31:57 +0100 Subject: [PATCH 04/30] Use new updateUser API on Android --- src/android/IntercomBridge.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/android/IntercomBridge.java b/src/android/IntercomBridge.java index 1b60374..8ee82da 100644 --- a/src/android/IntercomBridge.java +++ b/src/android/IntercomBridge.java @@ -34,6 +34,8 @@ public class IntercomBridge extends CordovaPlugin { + private static final String CUSTOM_ATTRIBUTES = "custom_attributes"; + @Override protected void pluginInitialize() { cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { @@ -212,7 +214,15 @@ private enum Action { updateUser { @Override void performAction(JSONArray args, CallbackContext callbackContext, CordovaInterface cordova) { Map attributes = IntercomBridge.mapFromJSON(args.optJSONObject(0)); - Intercom.client().updateUser(attributes); + UserAttributes.Builder builder = new UserAttributes.Builder(); + Object customAttributes = attributes.get(CUSTOM_ATTRIBUTES); + if (customAttributes instanceof Map) { + //noinspection unchecked + builder.customAttributes.putAll((Map) customAttributes); + } + attributes.remove(CUSTOM_ATTRIBUTES); + builder.attributes.putAll(attributes); + Intercom.client().updateUser(builder.build()); callbackContext.success(); } }, From 4d1e6f8226f77c948b99666e6c6c1437f0643e83 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 09:40:03 +0100 Subject: [PATCH 05/30] - Specified iOS 11 support --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7263cc..cc9dbf5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is a plugin that allows your Cordova or PhoneGap app to use [Intercom for iOS](https://github.com/intercom/intercom-ios) and/or [Intercom for Android](https://github.com/intercom/intercom-android). -* Intercom for iOS supports iOS 8, 9 & 10. +* Intercom for iOS supports iOS 8, 9, 10 & 11. * Intercom for Android supports API 15 and above. ## Installation From b22eedaacbee81425a27a82efeb013c53756e2a1 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 09:58:53 +0100 Subject: [PATCH 06/30] - updated changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32c4559..5551c9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Intercom for Cordova/PhoneGap +## 4.0.0 (2017-08-29) + +* Updated Intercom for Android to 4.0.1 +* Updated Intercom for iOS to 4.0.1 +* Removed deprecated method `intercom.setSecureMode(hmac, data)` + ## 3.2.2 (2017-05-17) * Prevent unsafe versions of the Support Library being used to fix [#182](https://github.com/intercom/intercom-cordova/issues/182). From a4c73fab89a35402f620f5c1e0afe2e8f093fc72 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 10:02:28 +0100 Subject: [PATCH 07/30] - udpated changelog details --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5551c9f..e7eed3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,10 @@ * Updated Intercom for Android to 4.0.1 * Updated Intercom for iOS to 4.0.1 -* Removed deprecated method `intercom.setSecureMode(hmac, data)` +* Removed deprecated method `intercom.setSecureMode(hmac, data)`. +* Added support for iOS 11. +* Added support for Android Oreo. +* Updated GCM & FCM to version 11. ## 3.2.2 (2017-05-17) From 098d79f69858c99c6674670aaa21a0bd1a4db450 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 10:08:48 +0100 Subject: [PATCH 08/30] Update circle.yml --- circle.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index 90ad67b..28ce54e 100644 --- a/circle.yml +++ b/circle.yml @@ -11,12 +11,12 @@ dependencies: override: - npm install -g cordova - if [ ! -e $ANDROID_HOME/platforms/android-25 ]; then echo y | android update sdk --no-ui --all --filter android-25; fi - - if [ ! -e $ANDROID_HOME/extras/android/m2repository/com/android/support/design/25.3.1 ]; then echo y | android update sdk --no-ui --all --filter extra-android-m2repository; fi - - if [ ! -e $ANDROID_HOME/extras/google/m2repository/com/google/firebase/firebase-messaging/10.2.1 ]; then echo y | android update sdk --no-ui --all --filter extra-google-m2repository; fi + - if [ ! -e $ANDROID_HOME/extras/android/m2repository/com/android/support/design/26.0.1 ]; then echo y | android update sdk --no-ui --all --filter extra-android-m2repository; fi + - if [ ! -e $ANDROID_HOME/extras/google/m2repository/com/google/firebase/firebase-messaging/11.0.4 ]; then echo y | android update sdk --no-ui --all --filter extra-google-m2repository; fi cache_directories: # Android SDK - - "/usr/local/android-sdk-linux/platforms/android-24" + - "/usr/local/android-sdk-linux/platforms/android-25" - "/usr/local/android-sdk-linux/extras/android/m2repository" - "/usr/local/android-sdk-linux/extras/google/m2repository" @@ -29,7 +29,7 @@ test: deployment: master: - tag: /3(\.[0-9]+)+/ + tag: /[0-9](\.[0-9]+)+/ owner: intercom commands: - echo -e "$NPM_USER\n$NPM_PASSWORD\n$NPM_EMAIL" | npm login From 83088639bedd434ab6a488b29a000ae0701aaa83 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 10:17:14 +0100 Subject: [PATCH 09/30] Add Google Maven repository --- src/android/intercom.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/android/intercom.gradle b/src/android/intercom.gradle index a44f138..ed4522e 100644 --- a/src/android/intercom.gradle +++ b/src/android/intercom.gradle @@ -10,6 +10,7 @@ buildscript { repositories { jcenter() mavenLocal() + maven { url 'https://maven.google.com' } } dependencies { classpath 'com.android.tools.build:gradle:+' @@ -21,6 +22,7 @@ buildscript { repositories { jcenter() + maven { url 'https://maven.google.com' } } dependencies { compile 'io.intercom.android:intercom-sdk-base:4.0.+' From 17e7fb3c7d89bc24ddb4e299de9913fb878d0b80 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 10:35:23 +0100 Subject: [PATCH 10/30] Add Cordova environment variables to CircleCI --- circle.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/circle.yml b/circle.yml index 28ce54e..ceb7975 100644 --- a/circle.yml +++ b/circle.yml @@ -2,6 +2,9 @@ general: build_dir: Example machine: + environment: + ORG_GRADLE_PROJECT_cdvCompileSdkVersion: 26 + ORG_GRADLE_PROJECT_cdvBuildToolsVersion: 26.0.1 node: version: 6.1.0 java: From 424411c24229305e381e5898aaa262d5d1eb9f62 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 10:46:26 +0100 Subject: [PATCH 11/30] Update CircleCI config again --- circle.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index ceb7975..af303d1 100644 --- a/circle.yml +++ b/circle.yml @@ -13,13 +13,15 @@ machine: dependencies: override: - npm install -g cordova - - if [ ! -e $ANDROID_HOME/platforms/android-25 ]; then echo y | android update sdk --no-ui --all --filter android-25; fi + - if [ ! -e $ANDROID_HOME/platforms/android-26 ]; then echo y | android update sdk --no-ui --all --filter android-26; fi + - if [ ! -e $ANDROID_HOME/build-tools/26.0.1 ]; then echo y | android update sdk --no-ui --all --filter build-tools-26.0.1; fi - if [ ! -e $ANDROID_HOME/extras/android/m2repository/com/android/support/design/26.0.1 ]; then echo y | android update sdk --no-ui --all --filter extra-android-m2repository; fi - if [ ! -e $ANDROID_HOME/extras/google/m2repository/com/google/firebase/firebase-messaging/11.0.4 ]; then echo y | android update sdk --no-ui --all --filter extra-google-m2repository; fi cache_directories: # Android SDK - "/usr/local/android-sdk-linux/platforms/android-25" + - "/usr/local/android-sdk-linux/build-tools/26.0.1" - "/usr/local/android-sdk-linux/extras/android/m2repository" - "/usr/local/android-sdk-linux/extras/google/m2repository" From 35ba32f996f36fcb66d2829aba5c165164c9fe4f Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 10:46:42 +0100 Subject: [PATCH 12/30] - Added command to make sure we have the latest NVM version. This is in response to this bug that we had https://issues.apache.org/jira/browse/CB-13004 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9f36610..483a9ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ node_js: sudo: false install: + - npm install npm@latest -g - npm install -g cordova before_script: From 8e1fc6cbffb722bb4df26258959a1d7d68d7fb29 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 10:52:22 +0100 Subject: [PATCH 13/30] Use stable version of Android Gradle plugin --- src/android/intercom.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/intercom.gradle b/src/android/intercom.gradle index ed4522e..68561ed 100644 --- a/src/android/intercom.gradle +++ b/src/android/intercom.gradle @@ -13,7 +13,7 @@ buildscript { maven { url 'https://maven.google.com' } } dependencies { - classpath 'com.android.tools.build:gradle:+' + classpath 'com.android.tools.build:gradle:2.3.+' if (pushType == 'fcm') { classpath 'com.google.gms:google-services:3.0.0' } From a48c03967f8a62a03e030e61027f5255616eef8b Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 12:10:00 +0100 Subject: [PATCH 14/30] Added verbose logging --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 483a9ae..4e950ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,8 @@ install: before_script: - cd Example - - cordova platform add ios - - cordova plugin add .. + - cordova platform add ios --verbose + - cordova plugin add .. --verbose script: - cordova build ios From d8b4ecef4e9c0735a7f529bf29874544ee855753 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 13:19:54 +0100 Subject: [PATCH 15/30] Update Node versions in Travis --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4e950ff..897ee53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,14 @@ language: objective-c node_js: - - 5.10 + - 7 sudo: false +before_install: + - npm install -g npm@5.3.0 + install: - - npm install npm@latest -g - npm install -g cordova before_script: From ad82b5ee8fe0018d5b49ee65683d847c1dd051d5 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 13:37:50 +0100 Subject: [PATCH 16/30] Update CI setups --- .travis.yml | 11 ++++++----- circle.yml | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 897ee53..c2295d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,15 @@ language: objective-c -node_js: - - 7 +node_js: '6.11.2' sudo: false -before_install: - - npm install -g npm@5.3.0 - +cache: + directories: + - node_modules + install: + - npm install -g npm@5.3.0 - npm install -g cordova before_script: diff --git a/circle.yml b/circle.yml index af303d1..5005b6d 100644 --- a/circle.yml +++ b/circle.yml @@ -6,7 +6,7 @@ machine: ORG_GRADLE_PROJECT_cdvCompileSdkVersion: 26 ORG_GRADLE_PROJECT_cdvBuildToolsVersion: 26.0.1 node: - version: 6.1.0 + version: 6.11.2 java: version: openjdk8 @@ -15,22 +15,22 @@ dependencies: - npm install -g cordova - if [ ! -e $ANDROID_HOME/platforms/android-26 ]; then echo y | android update sdk --no-ui --all --filter android-26; fi - if [ ! -e $ANDROID_HOME/build-tools/26.0.1 ]; then echo y | android update sdk --no-ui --all --filter build-tools-26.0.1; fi - - if [ ! -e $ANDROID_HOME/extras/android/m2repository/com/android/support/design/26.0.1 ]; then echo y | android update sdk --no-ui --all --filter extra-android-m2repository; fi - if [ ! -e $ANDROID_HOME/extras/google/m2repository/com/google/firebase/firebase-messaging/11.0.4 ]; then echo y | android update sdk --no-ui --all --filter extra-google-m2repository; fi cache_directories: + # Node dependencies + - "node_modules" # Android SDK - - "/usr/local/android-sdk-linux/platforms/android-25" + - "/usr/local/android-sdk-linux/platforms/android-26" - "/usr/local/android-sdk-linux/build-tools/26.0.1" - "/usr/local/android-sdk-linux/extras/android/m2repository" - "/usr/local/android-sdk-linux/extras/google/m2repository" test: - pre: + override: - cordova platform add android - cordova plugin add .. - override: - - cordova build android + - cordova build android --verbose -- --gradleArg=--stacktrace deployment: master: From 61b097e7d1c47c952fd8cf524addce817ef08584 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 13:44:10 +0100 Subject: [PATCH 17/30] set the directory name for the cordova plugin to add --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4e950ff..af30943 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ install: before_script: - cd Example - cordova platform add ios --verbose - - cordova plugin add .. --verbose + - cordova plugin add /Users/travis/build/intercom/intercom-cordova --verbose script: - cordova build ios From c4fa2efcadfd631d8832b56f4af30441af4d903e Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 14:17:49 +0100 Subject: [PATCH 18/30] Force Android compileSdkVersion --- Example/config.xml | 1 + Example/gradle.properties | 1 + Example/scripts/beforeAndroidBuild.sh | 1 + 3 files changed, 3 insertions(+) create mode 100644 Example/gradle.properties create mode 100644 Example/scripts/beforeAndroidBuild.sh diff --git a/Example/config.xml b/Example/config.xml index e0511da..a4262a3 100644 --- a/Example/config.xml +++ b/Example/config.xml @@ -17,6 +17,7 @@ + diff --git a/Example/gradle.properties b/Example/gradle.properties new file mode 100644 index 0000000..0e3abfb --- /dev/null +++ b/Example/gradle.properties @@ -0,0 +1 @@ +cdvCompileSdkVersion = 26 diff --git a/Example/scripts/beforeAndroidBuild.sh b/Example/scripts/beforeAndroidBuild.sh new file mode 100644 index 0000000..a748253 --- /dev/null +++ b/Example/scripts/beforeAndroidBuild.sh @@ -0,0 +1 @@ +cp ./gradle.properties ./platforms/android/ From 5603d6d593575f981f53ae42b119a1a4e100c38a Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 14:26:18 +0100 Subject: [PATCH 19/30] Revert "Force Android compileSdkVersion" This reverts commit c4fa2efcadfd631d8832b56f4af30441af4d903e. --- Example/config.xml | 1 - Example/gradle.properties | 1 - Example/scripts/beforeAndroidBuild.sh | 1 - 3 files changed, 3 deletions(-) delete mode 100644 Example/gradle.properties delete mode 100644 Example/scripts/beforeAndroidBuild.sh diff --git a/Example/config.xml b/Example/config.xml index a4262a3..e0511da 100644 --- a/Example/config.xml +++ b/Example/config.xml @@ -17,7 +17,6 @@ - diff --git a/Example/gradle.properties b/Example/gradle.properties deleted file mode 100644 index 0e3abfb..0000000 --- a/Example/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -cdvCompileSdkVersion = 26 diff --git a/Example/scripts/beforeAndroidBuild.sh b/Example/scripts/beforeAndroidBuild.sh deleted file mode 100644 index a748253..0000000 --- a/Example/scripts/beforeAndroidBuild.sh +++ /dev/null @@ -1 +0,0 @@ -cp ./gradle.properties ./platforms/android/ From 38b27bba0635c175743c6cfb3b3fb22800d6ef3f Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 14:26:33 +0100 Subject: [PATCH 20/30] Try fixing env variable --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 5005b6d..490bf27 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ general: machine: environment: - ORG_GRADLE_PROJECT_cdvCompileSdkVersion: 26 + ORG_GRADLE_PROJECT_cdvCompileSdkVersion: android-26 ORG_GRADLE_PROJECT_cdvBuildToolsVersion: 26.0.1 node: version: 6.11.2 From a4da7d2395b4e3a0b794d56364a681315547780f Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 14:31:49 +0100 Subject: [PATCH 21/30] Replace usage of removed method --- src/android/IntercomBridge.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/android/IntercomBridge.java b/src/android/IntercomBridge.java index 8ee82da..102ebcc 100644 --- a/src/android/IntercomBridge.java +++ b/src/android/IntercomBridge.java @@ -126,8 +126,7 @@ private enum Action { setSecureMode { @Override void performAction(JSONArray args, CallbackContext callbackContext, CordovaInterface cordova) { String hmac = args.optString(0); - String data = args.optString(1); - Intercom.client().setSecureMode(hmac, data); + Intercom.client().setUserHash(hmac); callbackContext.success(); } }, From 2b8859857050954041cf997a49f45f6a0825bb05 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 14:32:49 +0100 Subject: [PATCH 22/30] Remove deprecated method --- src/android/IntercomBridge.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/android/IntercomBridge.java b/src/android/IntercomBridge.java index 102ebcc..0ae1850 100644 --- a/src/android/IntercomBridge.java +++ b/src/android/IntercomBridge.java @@ -123,13 +123,6 @@ private enum Action { callbackContext.success(); } }, - setSecureMode { - @Override void performAction(JSONArray args, CallbackContext callbackContext, CordovaInterface cordova) { - String hmac = args.optString(0); - Intercom.client().setUserHash(hmac); - callbackContext.success(); - } - }, setUserHash { @Override void performAction(JSONArray args, CallbackContext callbackContext, CordovaInterface cordova) { String hmac = args.optString(0); From c85360f79e80c16733ed2c66ceb9045d91206e0e Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 14:36:03 +0100 Subject: [PATCH 23/30] - testing build failure workaround --- .travis.yml | 2 +- CHANGELOG.md => intercom-plugin/CHANGELOG.md | 0 LICENSE => intercom-plugin/LICENSE | 0 README.md => intercom-plugin/README.md | 0 circle.yml => intercom-plugin/circle.yml | 0 package.json => intercom-plugin/package.json | 4 ++-- plugin.xml => intercom-plugin/plugin.xml | 0 {scripts => intercom-plugin/scripts}/checkForUpdate.js | 0 {scripts => intercom-plugin/scripts}/prepareCocoaPods.js | 0 .../src}/android/CordovaHeaderInterceptor.java | 0 {src => intercom-plugin/src}/android/IntercomBridge.java | 0 .../src}/android/IntercomIntentService.java | 0 .../src}/android/build-extras-intercom.gradle | 0 {src => intercom-plugin/src}/android/intercom.gradle | 0 {src => intercom-plugin/src}/ios/AppDelegate+IntercomPush.h | 0 {src => intercom-plugin/src}/ios/AppDelegate+IntercomPush.m | 0 {src => intercom-plugin/src}/ios/IntercomBridge.h | 0 {src => intercom-plugin/src}/ios/IntercomBridge.m | 0 {www => intercom-plugin/www}/intercom.js | 0 19 files changed, 3 insertions(+), 3 deletions(-) rename CHANGELOG.md => intercom-plugin/CHANGELOG.md (100%) rename LICENSE => intercom-plugin/LICENSE (100%) rename README.md => intercom-plugin/README.md (100%) rename circle.yml => intercom-plugin/circle.yml (100%) rename package.json => intercom-plugin/package.json (94%) rename plugin.xml => intercom-plugin/plugin.xml (100%) rename {scripts => intercom-plugin/scripts}/checkForUpdate.js (100%) rename {scripts => intercom-plugin/scripts}/prepareCocoaPods.js (100%) rename {src => intercom-plugin/src}/android/CordovaHeaderInterceptor.java (100%) rename {src => intercom-plugin/src}/android/IntercomBridge.java (100%) rename {src => intercom-plugin/src}/android/IntercomIntentService.java (100%) rename {src => intercom-plugin/src}/android/build-extras-intercom.gradle (100%) rename {src => intercom-plugin/src}/android/intercom.gradle (100%) rename {src => intercom-plugin/src}/ios/AppDelegate+IntercomPush.h (100%) rename {src => intercom-plugin/src}/ios/AppDelegate+IntercomPush.m (100%) rename {src => intercom-plugin/src}/ios/IntercomBridge.h (100%) rename {src => intercom-plugin/src}/ios/IntercomBridge.m (100%) rename {www => intercom-plugin/www}/intercom.js (100%) diff --git a/.travis.yml b/.travis.yml index c20c67d..3be1011 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ install: before_script: - cd Example - cordova platform add ios --verbose - - cordova plugin add /Users/travis/build/intercom/intercom-cordova --verbose + - cordova plugin add ../intercom-plugin --verbose script: - cordova build ios diff --git a/CHANGELOG.md b/intercom-plugin/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to intercom-plugin/CHANGELOG.md diff --git a/LICENSE b/intercom-plugin/LICENSE similarity index 100% rename from LICENSE rename to intercom-plugin/LICENSE diff --git a/README.md b/intercom-plugin/README.md similarity index 100% rename from README.md rename to intercom-plugin/README.md diff --git a/circle.yml b/intercom-plugin/circle.yml similarity index 100% rename from circle.yml rename to intercom-plugin/circle.yml diff --git a/package.json b/intercom-plugin/package.json similarity index 94% rename from package.json rename to intercom-plugin/package.json index 03dab9a..4fdc8c1 100644 --- a/package.json +++ b/intercom-plugin/package.json @@ -23,7 +23,7 @@ "engines": [ { "name": "cordova", - "version": ">=6.4.0" + "version": ">=7.0.1" }, { "name": "cordova-android", @@ -31,7 +31,7 @@ }, { "name": "cordova-ios", - "version": ">=4.3.1" + "version": ">=4.4.0" } ], "author": "Intercom", diff --git a/plugin.xml b/intercom-plugin/plugin.xml similarity index 100% rename from plugin.xml rename to intercom-plugin/plugin.xml diff --git a/scripts/checkForUpdate.js b/intercom-plugin/scripts/checkForUpdate.js similarity index 100% rename from scripts/checkForUpdate.js rename to intercom-plugin/scripts/checkForUpdate.js diff --git a/scripts/prepareCocoaPods.js b/intercom-plugin/scripts/prepareCocoaPods.js similarity index 100% rename from scripts/prepareCocoaPods.js rename to intercom-plugin/scripts/prepareCocoaPods.js diff --git a/src/android/CordovaHeaderInterceptor.java b/intercom-plugin/src/android/CordovaHeaderInterceptor.java similarity index 100% rename from src/android/CordovaHeaderInterceptor.java rename to intercom-plugin/src/android/CordovaHeaderInterceptor.java diff --git a/src/android/IntercomBridge.java b/intercom-plugin/src/android/IntercomBridge.java similarity index 100% rename from src/android/IntercomBridge.java rename to intercom-plugin/src/android/IntercomBridge.java diff --git a/src/android/IntercomIntentService.java b/intercom-plugin/src/android/IntercomIntentService.java similarity index 100% rename from src/android/IntercomIntentService.java rename to intercom-plugin/src/android/IntercomIntentService.java diff --git a/src/android/build-extras-intercom.gradle b/intercom-plugin/src/android/build-extras-intercom.gradle similarity index 100% rename from src/android/build-extras-intercom.gradle rename to intercom-plugin/src/android/build-extras-intercom.gradle diff --git a/src/android/intercom.gradle b/intercom-plugin/src/android/intercom.gradle similarity index 100% rename from src/android/intercom.gradle rename to intercom-plugin/src/android/intercom.gradle diff --git a/src/ios/AppDelegate+IntercomPush.h b/intercom-plugin/src/ios/AppDelegate+IntercomPush.h similarity index 100% rename from src/ios/AppDelegate+IntercomPush.h rename to intercom-plugin/src/ios/AppDelegate+IntercomPush.h diff --git a/src/ios/AppDelegate+IntercomPush.m b/intercom-plugin/src/ios/AppDelegate+IntercomPush.m similarity index 100% rename from src/ios/AppDelegate+IntercomPush.m rename to intercom-plugin/src/ios/AppDelegate+IntercomPush.m diff --git a/src/ios/IntercomBridge.h b/intercom-plugin/src/ios/IntercomBridge.h similarity index 100% rename from src/ios/IntercomBridge.h rename to intercom-plugin/src/ios/IntercomBridge.h diff --git a/src/ios/IntercomBridge.m b/intercom-plugin/src/ios/IntercomBridge.m similarity index 100% rename from src/ios/IntercomBridge.m rename to intercom-plugin/src/ios/IntercomBridge.m diff --git a/www/intercom.js b/intercom-plugin/www/intercom.js similarity index 100% rename from www/intercom.js rename to intercom-plugin/www/intercom.js From c21a81b439cace22abcb628aee33e9f47deca7a9 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 14:40:27 +0100 Subject: [PATCH 24/30] - restructured plugin --- intercom-plugin/CHANGELOG.md => CHANGELOG.md | 0 intercom-plugin/LICENSE => LICENSE | 0 intercom-plugin/README.md => README.md | 0 intercom-plugin/circle.yml => circle.yml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename intercom-plugin/CHANGELOG.md => CHANGELOG.md (100%) rename intercom-plugin/LICENSE => LICENSE (100%) rename intercom-plugin/README.md => README.md (100%) rename intercom-plugin/circle.yml => circle.yml (100%) diff --git a/intercom-plugin/CHANGELOG.md b/CHANGELOG.md similarity index 100% rename from intercom-plugin/CHANGELOG.md rename to CHANGELOG.md diff --git a/intercom-plugin/LICENSE b/LICENSE similarity index 100% rename from intercom-plugin/LICENSE rename to LICENSE diff --git a/intercom-plugin/README.md b/README.md similarity index 100% rename from intercom-plugin/README.md rename to README.md diff --git a/intercom-plugin/circle.yml b/circle.yml similarity index 100% rename from intercom-plugin/circle.yml rename to circle.yml From d546e23e0faedbf10537ec846cd4ccccc6342ae5 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 14:51:00 +0100 Subject: [PATCH 25/30] - updated the circle build settings --- circle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index 490bf27..4f42930 100644 --- a/circle.yml +++ b/circle.yml @@ -25,11 +25,11 @@ dependencies: - "/usr/local/android-sdk-linux/build-tools/26.0.1" - "/usr/local/android-sdk-linux/extras/android/m2repository" - "/usr/local/android-sdk-linux/extras/google/m2repository" - + test: override: - cordova platform add android - - cordova plugin add .. + - cordova plugin add ../intercom-plugin - cordova build android --verbose -- --gradleArg=--stacktrace deployment: @@ -38,4 +38,4 @@ deployment: owner: intercom commands: - echo -e "$NPM_USER\n$NPM_PASSWORD\n$NPM_EMAIL" | npm login - - cd .. && npm publish + - cd ../intercom-plugin && npm publish From f2824ec9edd7793b3f213306835b954cb666c35d Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 15:02:43 +0100 Subject: [PATCH 26/30] Update CircleCI config --- circle.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/circle.yml b/circle.yml index 4f42930..65b63be 100644 --- a/circle.yml +++ b/circle.yml @@ -13,17 +13,14 @@ machine: dependencies: override: - npm install -g cordova - - if [ ! -e $ANDROID_HOME/platforms/android-26 ]; then echo y | android update sdk --no-ui --all --filter android-26; fi + - if [ ! -e $ANDROID_HOME/platforms/android-25 ]; then echo y | android update sdk --no-ui --all --filter android-25; fi - if [ ! -e $ANDROID_HOME/build-tools/26.0.1 ]; then echo y | android update sdk --no-ui --all --filter build-tools-26.0.1; fi - if [ ! -e $ANDROID_HOME/extras/google/m2repository/com/google/firebase/firebase-messaging/11.0.4 ]; then echo y | android update sdk --no-ui --all --filter extra-google-m2repository; fi cache_directories: - # Node dependencies - - "node_modules" # Android SDK - - "/usr/local/android-sdk-linux/platforms/android-26" + - "/usr/local/android-sdk-linux/platforms/android-25" - "/usr/local/android-sdk-linux/build-tools/26.0.1" - - "/usr/local/android-sdk-linux/extras/android/m2repository" - "/usr/local/android-sdk-linux/extras/google/m2repository" test: From 95a5d688366b01681ce1aef6c6a611c77ad0549a Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 15:36:53 +0100 Subject: [PATCH 27/30] - removed verbose logging --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3be1011..33bb97b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,8 @@ install: before_script: - cd Example - - cordova platform add ios --verbose - - cordova plugin add ../intercom-plugin --verbose + - cordova platform add ios + - cordova plugin add ../intercom-plugin script: - cordova build ios From 15f8a2704dbc2c9ae307c12bba8479075f2e525c Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 29 Aug 2017 15:42:49 +0100 Subject: [PATCH 28/30] - reverted versions that were mistakenly bumped --- intercom-plugin/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intercom-plugin/package.json b/intercom-plugin/package.json index 4fdc8c1..03dab9a 100644 --- a/intercom-plugin/package.json +++ b/intercom-plugin/package.json @@ -23,7 +23,7 @@ "engines": [ { "name": "cordova", - "version": ">=7.0.1" + "version": ">=6.4.0" }, { "name": "cordova-android", @@ -31,7 +31,7 @@ }, { "name": "cordova-ios", - "version": ">=4.4.0" + "version": ">=4.3.1" } ], "author": "Intercom", From 1e4a5de25406d79834c7c3bc034abaae3a16f274 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 16:03:11 +0100 Subject: [PATCH 29/30] Fix Circle issues --- circle.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 65b63be..0ca0a40 100644 --- a/circle.yml +++ b/circle.yml @@ -13,13 +13,14 @@ machine: dependencies: override: - npm install -g cordova - - if [ ! -e $ANDROID_HOME/platforms/android-25 ]; then echo y | android update sdk --no-ui --all --filter android-25; fi + # Need to always update these 2 to accept licenses + - echo y | android update sdk --no-ui --all --filter android-25; fi + - echo y | android update sdk --no-ui --all --filter android-26; fi - if [ ! -e $ANDROID_HOME/build-tools/26.0.1 ]; then echo y | android update sdk --no-ui --all --filter build-tools-26.0.1; fi - if [ ! -e $ANDROID_HOME/extras/google/m2repository/com/google/firebase/firebase-messaging/11.0.4 ]; then echo y | android update sdk --no-ui --all --filter extra-google-m2repository; fi cache_directories: # Android SDK - - "/usr/local/android-sdk-linux/platforms/android-25" - "/usr/local/android-sdk-linux/build-tools/26.0.1" - "/usr/local/android-sdk-linux/extras/google/m2repository" From 32901e664ed33370b527e53afa0106a355ed1625 Mon Sep 17 00:00:00 2001 From: Conor O'Donnell Date: Tue, 29 Aug 2017 16:20:15 +0100 Subject: [PATCH 30/30] Remove typo --- circle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 0ca0a40..86472da 100644 --- a/circle.yml +++ b/circle.yml @@ -14,8 +14,8 @@ dependencies: override: - npm install -g cordova # Need to always update these 2 to accept licenses - - echo y | android update sdk --no-ui --all --filter android-25; fi - - echo y | android update sdk --no-ui --all --filter android-26; fi + - echo y | android update sdk --no-ui --all --filter android-25 + - echo y | android update sdk --no-ui --all --filter android-26 - if [ ! -e $ANDROID_HOME/build-tools/26.0.1 ]; then echo y | android update sdk --no-ui --all --filter build-tools-26.0.1; fi - if [ ! -e $ANDROID_HOME/extras/google/m2repository/com/google/firebase/firebase-messaging/11.0.4 ]; then echo y | android update sdk --no-ui --all --filter extra-google-m2repository; fi