From 809f50b14b69205012646239de2ba1c863ba5632 Mon Sep 17 00:00:00 2001 From: alex78pro Date: Wed, 23 Nov 2022 11:50:18 +0300 Subject: [PATCH 1/2] Did add support of Intercom 14 Added support new Intercom version due to issue https://github.com/segment-integrations/analytics-ios-integration-intercom/issues/17 --- Segment-Intercom/Classes/SEGIntercomIntegration.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Segment-Intercom/Classes/SEGIntercomIntegration.m b/Segment-Intercom/Classes/SEGIntercomIntegration.m index ddfa523..19dd7e0 100644 --- a/Segment-Intercom/Classes/SEGIntercomIntegration.m +++ b/Segment-Intercom/Classes/SEGIntercomIntegration.m @@ -19,7 +19,6 @@ #endif - @implementation SEGIntercomIntegration #pragma mark - Initialization @@ -54,10 +53,12 @@ - (void)identify:(SEGIdentifyPayload *)payload { // Intercom allows users to choose to track only known or only unknown users, as well as both. Segment will support the ability to track both by checking for loggedIn users (determined by the userId) and falling back to setting the user as "Unidentified" if this is not present. if (payload.userId) { - [self.intercom registerUserWithUserId:payload.userId]; + ICMUserAttributes *attributes = [ICMUserAttributes new]; + attributes.userId = payload.userId; + [self.intercom loginUserWithUserAttributes:attributes success:nil failure:nil]; SEGLog(@"[Intercom registerUserWithUserId:%@];", payload.userId); } else if (payload.anonymousId) { - [self.intercom registerUnidentifiedUser]; + [self.intercom loginUnidentifiedUserWithSuccess:nil failure:nil]; SEGLog(@"[Intercom registerUnidentifiedUser];"); } @@ -130,7 +131,7 @@ - (void)group:(SEGGroupPayload *)payload ICMUserAttributes *userAttributes = [ICMUserAttributes new]; userAttributes.companies = @[ company ]; - [self.intercom updateUser:userAttributes]; + [self.intercom updateUser:userAttributes success:nil failure:nil]; SEGLog(@"[Intercom updateUser:%@];", userAttributes); } @@ -204,7 +205,7 @@ - (void)setUserAttributes:(SEGIdentifyPayload *)payload } userAttributes.customAttributes = customAttributes; - [self.intercom updateUser:userAttributes]; + [self.intercom updateUser:userAttributes success:nil failure:nil]; SEGLog(@"[Intercom updateUser:%@];", userAttributes); } From 22912441a8250c5e0bf08130883b613b650d69a0 Mon Sep 17 00:00:00 2001 From: alex78pro Date: Wed, 23 Nov 2022 12:54:15 +0300 Subject: [PATCH 2/2] Did fix logout for Intercom 14 Did fix logout for Intercom 14 --- Segment-Intercom/Classes/SEGIntercomIntegration.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Segment-Intercom/Classes/SEGIntercomIntegration.m b/Segment-Intercom/Classes/SEGIntercomIntegration.m index 19dd7e0..6c8b68c 100644 --- a/Segment-Intercom/Classes/SEGIntercomIntegration.m +++ b/Segment-Intercom/Classes/SEGIntercomIntegration.m @@ -138,7 +138,7 @@ - (void)group:(SEGGroupPayload *)payload - (void)reset { [self.intercom reset]; - SEGLog(@" [Intercom reset];"); + SEGLog(@" [Intercom logout];"); } #pragma mark - Utils