Skip to content

Commit

Permalink
Broke up additional data serialization code
Browse files Browse the repository at this point in the history
  • Loading branch information
adamschlesinger committed Sep 14, 2021
1 parent 12948df commit aaa9436
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,12 @@ private static void HandleNotificationReceived(OSNotification notification) {
print("displayType: " + notification.displayType);
_logMessage = "Notification received with text: " + message;

print(payload.additionalData != null && Json.Serialize(payload.additionalData) is { } dataString
? $"[HandleNotificationReceived] message {message}, additionalData: {dataString}"
: "[HandleNotificationReceived] Additional Data == null"
);
if (payload.additionalData == null)
print("[HandleNotificationReceived] Additional Data == null");
else if (Json.Serialize(payload.additionalData) is { } dataString)
print($"[HandleNotificationReceived] message {message}, additionalData: {dataString}");
else
print("[HandleNotificationReceived] Additional Data could not be serialized");
}

/// <summary>
Expand All @@ -232,10 +234,12 @@ private static void HandleNotificationOpened(OSNotificationOpenedResult result)
print("GameControllerExample:HandleNotificationOpened: " + message);
_logMessage = "Notification opened with text: " + message;

print(payload.additionalData != null && Json.Serialize(payload.additionalData) is { } dataString
? $"[HandleNotificationOpened] message {message}, additionalData: {dataString}"
: "[HandleNotificationOpened] Additional Data == null"
);
if (payload.additionalData == null)
print("[HandleNotificationOpened] Additional Data == null");
else if (Json.Serialize(payload.additionalData) is { } dataString)
print($"[HandleNotificationOpened] message {message}, additionalData: {dataString}");
else
print("[HandleNotificationOpened] Additional Data could not be serialized");

if (actionID != null) {
// actionSelected equals the id on the button the user pressed.
Expand Down

0 comments on commit aaa9436

Please sign in to comment.