OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
496 stars 263 forks source link

[v5] Fix crash with direct influence but nil direct id #1327

Closed nan-li closed 1 year ago

nan-li commented 1 year ago

Description

One Line Summary

Cherry-pick of https://github.com/OneSignal/OneSignal-iOS-SDK/pull/1311 from main.

Details

Motivation

Fixes a crash when a session has a direct influence but the direct id is nil.

This does not resolve getting into this situation in the first place since we should not have a direction session without a direct id, but this will at least prevent a crash when the issue happens. Instead we will log an error.

Testing

Unit testing

Unit test was also cherry-picked even though it will not run.

Manual testing

None on this PR

Affected code checklist

Checklist

Overview

Testing

Final pass


This change is Reviewable

nan-li commented 1 year ago

I think this was a change that we might've ended up reverting because it caused other issues. Could you check the current state of main? Is this change there or was it reverted?

Main contains these same changes. It was this PR https://github.com/OneSignal/OneSignal-iOS-SDK/pull/1240 that was reverted in https://github.com/OneSignal/OneSignal-iOS-SDK/pull/1251.