Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MOBILE-4239] Fix Airship Actions running #557

Merged
merged 7 commits into from
Apr 8, 2024
Merged

[MOBILE-4239] Fix Airship Actions running #557

merged 7 commits into from
Apr 8, 2024

Conversation

Ulrico972
Copy link
Contributor

@Ulrico972 Ulrico972 commented Apr 5, 2024

What do these changes do?

Update the actions running code to encapsulate the action into a dictionary as the React conversion can't handle dynamic type like JsonValue directly.

Why are these changes necessary?

To handle actions with different value types.

How did you verify these changes?

Tested several actions making sure I test every values types possible.
New arch and old arch are working fine on Android. iOS is fine too.

actionName,
value: try AirshipJSON.wrap(actionValue)
action["_name"] as! String,
value: action["_value"] is NSNull ? nil : try AirshipJSON.wrap(action["_value"])
Copy link
Contributor Author

@Ulrico972 Ulrico972 Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to make sure I pass nil if it's a NSNull.
Otherwise the JSON wrapping fails: the NSNull Object don't go through the guard else, is that normal @crow ?

public static func wrap(_ value: Any?, encoder: JSONEncoder = AirshipJSON.defaultEncoder) throws -> AirshipJSON {
    guard let value = value else {
        return .null
    }
    .
    .
    .
}

Copy link
Contributor

@jyaganeh jyaganeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

src/Action.ts Outdated Show resolved Hide resolved
/**
* Gets the event's interaction ID.
*/
get interactionId(): string | undefined {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not particularly, I noticed we handle those in the proxy so I just added them

@Ulrico972 Ulrico972 merged commit 33dd0be into main Apr 8, 2024
1 check passed
@Ulrico972 Ulrico972 deleted the MOBILE-4239 branch April 8, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants