diff --git a/Example/Podfile b/Example/Podfile index 505afad..ac2b812 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,5 +1,5 @@ source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '10.0' +platform :ios, '13.0' #use_frameworks! diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 604d728..d17b4c9 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,11 +1,11 @@ PODS: - Analytics (4.1.3) - Expecta (1.0.6) - - Intercom (9.3.1) + - Intercom (16.0.2) - OCHamcrest (7.2.0) - OCMockito (5.1.3): - OCHamcrest (~> 7.0) - - Segment-Intercom (1.0.1): + - Segment-Intercom (1.0.2): - Analytics - Intercom - Specta (1.0.7) @@ -32,12 +32,12 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Analytics: 4c01e3e19d4be86705bad6581a1c2aa5a15a9d22 Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5 - Intercom: f87679713dab3105d3144880ddbf1f0fa1bd00a1 + Intercom: 605585b4c8d59f47269dde4f70c9702fbe0e8612 OCHamcrest: 8097ab14ab9366f44cd66638aa589fea3840d779 OCMockito: 677cbb4a18fd492b5a4fb10144dada4de5ddb877 - Segment-Intercom: 6c242e7c0eb6b6972d2db87ec85bdc24e2aa066c + Segment-Intercom: 8dd32f465076ae88aef3780becc254a472ed1000 Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 -PODFILE CHECKSUM: 814d22aada40c6f5e3be731b2811ed77a5378fad +PODFILE CHECKSUM: 93e9b54371f0f3d8c37db72a568846114fd24fcb -COCOAPODS: 1.10.1 +COCOAPODS: 1.13.0 diff --git a/Example/Segment-Intercom.xcodeproj/project.pbxproj b/Example/Segment-Intercom.xcodeproj/project.pbxproj index cfde8fc..77fa6df 100644 --- a/Example/Segment-Intercom.xcodeproj/project.pbxproj +++ b/Example/Segment-Intercom.xcodeproj/project.pbxproj @@ -257,6 +257,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -441,7 +442,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -475,7 +476,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; diff --git a/Example/Tests/Tests.m b/Example/Tests/Tests.m index 7405b8f..0399f13 100644 --- a/Example/Tests/Tests.m +++ b/Example/Tests/Tests.m @@ -44,7 +44,9 @@ } context:@{} integrations:@{}]; [integration identify:identifyPayload]; - [verify(mockIntercom) registerUserWithUserId:@"3942084234230"]; + ICMUserAttributes *attributes = [ICMUserAttributes new]; + attributes.userId = @"3942084234230"; + [verify(mockIntercom) loginUserWithUserAttributes:attributes success:nil failure:nil]; }); it(@"calls track without properties", ^{ @@ -100,7 +102,7 @@ ICMUserAttributes *userAttributes = [ICMUserAttributes new]; userAttributes.companies = @[ company ]; - [verify(mockIntercom) updateUser:userAttributes]; + [verify(mockIntercom) updateUser:userAttributes success:nil failure:nil]; }); it(@"calls track with revenue and total", ^{ @@ -191,7 +193,7 @@ } context:@{} integrations:@{}]; [integration identify:identifyPayload]; - [verify(mockIntercom) registerUnidentifiedUser]; + [verify(mockIntercom) loginUnidentifiedUserWithSuccess:nil failure:nil]; }); it(@"calls track with properties", ^{ @@ -301,7 +303,7 @@ userAttributes.companies = @[ company ]; [integration identify:identifyPayload]; - [verify(mockIntercom) updateUser:userAttributes]; + [verify(mockIntercom) updateUser:userAttributes success:nil failure:nil]; }); it(@"identfies a known user with traits", ^{ @@ -337,19 +339,21 @@ }; [integration identify:identifyPayload]; - [verify(mockIntercom) updateUser:userAttributes]; + [verify(mockIntercom) updateUser:userAttributes success:nil failure:nil]; }); it(@"identfies a known user without traits", ^{ SEGIdentifyPayload *identifyPayload = [[SEGIdentifyPayload alloc] initWithUserId:@"3942084234230" anonymousId:nil traits:@{} context:@{} integrations:@{}]; [integration identify:identifyPayload]; - [verify(mockIntercom) registerUserWithUserId:@"3942084234230"]; + ICMUserAttributes *attributes = [ICMUserAttributes new]; + attributes.userId = @"3942084234230"; + [verify(mockIntercom) loginUserWithUserAttributes:attributes success:nil failure:nil]; }); it(@"resets user", ^{ [integration reset]; - [verify(mockIntercom) reset]; + [verify(mockIntercom) logout]; }); }); diff --git a/Segment-Intercom/Classes/SEGIntercomIntegration.m b/Segment-Intercom/Classes/SEGIntercomIntegration.m index ddfa523..ebf1eaa 100644 --- a/Segment-Intercom/Classes/SEGIntercomIntegration.m +++ b/Segment-Intercom/Classes/SEGIntercomIntegration.m @@ -54,11 +54,13 @@ - (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]; - SEGLog(@"[Intercom registerUserWithUserId:%@];", payload.userId); + ICMUserAttributes *attributes = [ICMUserAttributes new]; + attributes.userId = payload.userId; + [self.intercom loginUserWithUserAttributes:attributes success:nil failure:nil]; + SEGLog(@"[Intercom loginUserWithUserAttributes:%@];", payload.userId); } else if (payload.anonymousId) { - [self.intercom registerUnidentifiedUser]; - SEGLog(@"[Intercom registerUnidentifiedUser];"); + [self.intercom loginUnidentifiedUserWithSuccess:nil failure:nil]; + SEGLog(@"[Intercom loginUnidentifiedUserWithSuccess];"); } NSDictionary *integration = [payload.integrations valueForKey:@"intercom"]; @@ -96,7 +98,7 @@ - (void)track:(SEGTrackPayload *)payload [price setObject:finalAmount forKey:@"amount"]; [output removeObjectForKey:key]; - isAmountSet = @YES; + isAmountSet = true; } if ([key isEqual:@"currency"]) { @@ -130,14 +132,14 @@ - (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); } - (void)reset { - [self.intercom reset]; - SEGLog(@" [Intercom reset];"); + [self.intercom logout]; + SEGLog(@" [Intercom logout];"); } #pragma mark - Utils @@ -204,7 +206,7 @@ - (void)setUserAttributes:(SEGIdentifyPayload *)payload } userAttributes.customAttributes = customAttributes; - [self.intercom updateUser:userAttributes]; + [self.intercom updateUser:userAttributes success:nil failure:nil]; SEGLog(@"[Intercom updateUser:%@];", userAttributes); }