User model/fix subscription state predicates #1032
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Type Predicates
Summary
This update fixes issues with type predicates in the OneSignal code. It replaces type with optional chaining to prevent the function from throwing if the passed object is undefined/null. Additionally, it corrects the bug with the
pushSubscriptionOSModel
var type and updates it to be able to accept undefined values.Overview
The update fixes type predicates in the OneSignal code to prevent the function from throwing if the passed object is undefined/null. This is achieved by using optional chaining since the type predicate accepts type. If the passed in obj is null or undefined, the predicate returns the corresponding boolean value.
Moreover, the
pushSubscriptionOSModel
var type has been corrected to be able to accept undefined values. This update fixes the issue with the type predicate checking the model data instead of the OSModel instance. Additionally, thepushSubscriptionOSModel
var type is set here since we're not importing theOneSignal
class.Details
pushSubscriptionOSModel
var type to be able to accept undefined valuespushSubscriptionOSModel
var type set here since we're not importing theOneSignal
classThese updates were made by @rgomezp.
This change is