Skip to content

Commit

Permalink
adding toJSONObject for push subscription changed event parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
emawby authored and jinliu9508 committed Jan 31, 2024
1 parent 0ae35e4 commit dd3feaa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
package com.onesignal.user.subscriptions

import org.json.JSONObject

class PushSubscriptionChangedState(
val previous: PushSubscriptionState,
val current: PushSubscriptionState
)
) {
fun toJSONObject(): JSONObject {
return JSONObject()
.put("previous", previous.toJSONObject())
.put("current", current.toJSONObject())
}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.onesignal.user.subscriptions

import org.json.JSONObject

/**
* A subscription state.
*/
Expand All @@ -24,5 +26,14 @@ class PushSubscriptionState(
* user will not receive notifications through this subscription (even when the user has
* granted app permission).
*/
val optedIn: Boolean
)
val optedIn: Boolean,
) {
fun toJSONObject(): JSONObject {
return JSONObject()
.put("id", id)
.put("token", token)
.put("optedIn", optedIn)
}
}


0 comments on commit dd3feaa

Please sign in to comment.