Skip to content

Commit

Permalink
feat: add upload bypass support to logscreenevent (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
alla-uday committed Nov 3, 2021
1 parent 293c987 commit 1bfd098
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mParticle-Apple-SDK/Include/mParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,18 @@ Defaults to false. Prevents the eventsHost above from overwriting the alias endp
*/
- (void)logScreen:(NSString *)screenName eventInfo:(nullable NSDictionary<NSString *, id> *)eventInfo;

/**
Logs a screen event and gives developer option to choose whether this screen event should be uploaded to mParticle when logged or only passed to kits. This is a convenience method for logging simple screen events; internally it creates an instance
of MPEvent and calls logScreenEvent:
@param screenName The name of the screen to be logged (required not nil and up to 255 characters)
@param eventInfo A dictionary containing further information about the screen. This dictionary is limited to 100 key
value pairs. Keys must be strings (up to 255 characters) and values can be strings (up to 4096 characters), numbers,
booleans, or dates
@param shouldUploadEvent A boolean flag that indicates whether this screen event should be uploaded to mParticle when logged or only passed to kits
@see logScreenEvent:
*/
- (void)logScreen:(NSString *)screenName eventInfo:(nullable NSDictionary<NSString *, id> *)eventInfo shouldUploadEvent:(BOOL)shouldUploadEvent;

/**
Sets the ATT Authorization state with the supplied timestamp, or uses the current time if none is supplied.
@param status The authorization state of ATT, determines whether the user has approved access to app-related data that can be used for tracking the user or the device.
Expand Down
1 change: 1 addition & 0 deletions mParticle-Apple-SDK/MPBackendController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,7 @@ - (void)logScreen:(MPEvent *)event completionHandler:(void (^)(MPEvent *event, M
messageBuilder = [messageBuilder withLocation:[MParticle sharedInstance].stateMachine.location];
#endif
MPMessage *message = [messageBuilder build];
message.shouldUploadEvent = event.shouldUploadEvent;

[self saveMessage:message updateSession:YES];

Expand Down
5 changes: 5 additions & 0 deletions mParticle-Apple-SDK/mParticle.m
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,10 @@ - (void)logScreenEvent:(MPEvent *)event {
}

- (void)logScreen:(NSString *)screenName eventInfo:(NSDictionary<NSString *, id> *)eventInfo {
[self logScreen:screenName eventInfo:eventInfo shouldUploadEvent:YES];
}

- (void)logScreen:(NSString *)screenName eventInfo:(NSDictionary<NSString *, id> *)eventInfo shouldUploadEvent:(BOOL)shouldUploadEvent {
if (!screenName) {
MPILogError(@"Screen name is required.");
return;
Expand All @@ -994,6 +998,7 @@ - (void)logScreen:(NSString *)screenName eventInfo:(NSDictionary<NSString *, id>
}

event.customAttributes = eventInfo;
event.shouldUploadEvent = shouldUploadEvent;

[self logScreenEvent:event];
}
Expand Down

0 comments on commit 1bfd098

Please sign in to comment.