Skip to content

Commit 94065af

Browse files
committed
Don't send influenced session time under 1 second
* We truncate session time to an int and it may become 0 seconds, but we will receive an error response from the server if we send 0 seconds of session_time
1 parent 6823096 commit 94065af

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

iOS_SDK/OneSignalSDK/OneSignalOutcomes/Source/OutcomeEvents/OneSignalOutcomeEventsController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ - (void)sendSessionEndOutcomes:(NSNumber * _Nonnull)timeElapsed
109109
pushSubscriptionId:(NSString * _Nonnull)pushSubscriptionId
110110
onesignalId:(NSString * _Nonnull)onesignalId
111111
influenceParams:(NSArray<OSFocusInfluenceParam *> * _Nonnull)influenceParams {
112+
// Don't send influenced session with time < 1 seconds
113+
if ([timeElapsed intValue] < 1) {
114+
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"sendSessionEndOutcomes not sending active time %@", timeElapsed]];
115+
return;
116+
}
112117
// TODO: What to do onSuccess and onFailure
113118
[OneSignalClient.sharedClient executeRequest:[OSRequestSendSessionEndOutcomes
114119
withActiveTime:timeElapsed

0 commit comments

Comments
 (0)