Skip to content

Commit b2f40b8

Browse files
authored
Add support for screen calls (#48)
1 parent 4d4638d commit b2f40b8

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

Example/Tests/Tests.m

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,29 @@
6565
@"Starship_Type" : @"Death Star"
6666
}];
6767
});
68-
68+
6969
it(@"track with event name and parmas separated by periods", ^{
7070
SEGTrackPayload *payload = [[SEGTrackPayload alloc] initWithEvent:@"Starship.Ordered"
7171
properties:@{
7272
@"Starship.Type" : @"Death Star"
7373
}
7474
context:@{}
7575
integrations:@{}];
76-
76+
7777
[integration track:payload];
7878
[verify(mockFirebase) logEventWithName:@"Starship_Ordered" parameters:@{
7979
@"Starship_Type" : @"Death Star"
8080
}];
8181
});
82-
82+
8383
it(@"track with leading and trailing spacing for event name", ^{
8484
SEGTrackPayload *payload = [[SEGTrackPayload alloc] initWithEvent:@" Starship Ordered "
8585
properties:@{
8686
@"Starship.Type" : @"Death Star"
8787
}
8888
context:@{}
8989
integrations:@{}];
90-
90+
9191
[integration track:payload];
9292
[verify(mockFirebase) logEventWithName:@"Starship_Ordered" parameters:@{
9393
@"Starship_Type" : @"Death Star"
@@ -555,6 +555,15 @@
555555
}];
556556
});
557557

558+
it(@"track screen with name", ^{
559+
SEGScreenPayload *payload = [[SEGScreenPayload alloc] initWithName:@"Home screen"
560+
properties:@{}
561+
context:@{}
562+
integrations:@{}];
563+
[integration screen:payload];
564+
[verify(mockFirebase) setScreenName:@"Home screen" screenClass:nil];
565+
});
566+
558567
});
559568

560569
SpecEnd

Segment-Firebase/Classes/SEGFirebaseIntegration.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ - (void)track:(SEGTrackPayload *)payload
6464
}
6565

6666

67+
- (void)screen:(SEGScreenPayload *)payload
68+
{
69+
[self.firebaseClass setScreenName:payload.name screenClass:nil];
70+
SEGLog(@"[FIRAnalytics setScreenName:%@]", payload.name);
71+
}
72+
73+
6774
#pragma mark - Utilities
6875

6976
// Event names can be up to 32 characters long, may only contain alphanumeric

0 commit comments

Comments
 (0)