Skip to content

Commit 24d41f0

Browse files
committed
creating OSInAppMessagePage class
1 parent 999ca8d commit 24d41f0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.onesignal
2+
3+
4+
import org.json.JSONException
5+
import org.json.JSONObject
6+
7+
const val PAGE_ID = "page_id"
8+
const val PAGE_INDEX = "page_index"
9+
10+
class OSInAppMessagePage constructor(jsonObject: JSONObject) {
11+
var pageId: String? = null
12+
var pageIndex: String? = null
13+
14+
init {
15+
pageId = jsonObject.optString(PAGE_ID, null)
16+
pageIndex = jsonObject.optString(PAGE_INDEX, null)
17+
}
18+
19+
fun toJSONObject(): JSONObject? {
20+
val mainObj = JSONObject()
21+
try {
22+
mainObj.put(PAGE_ID, pageId)
23+
mainObj.put(PAGE_INDEX, pageIndex)
24+
} catch (e: JSONException) {
25+
e.printStackTrace()
26+
}
27+
return mainObj
28+
}
29+
}

0 commit comments

Comments
 (0)