1
+ package com.onesignal
2
+
3
+ import org.json.JSONObject
4
+
5
+ const val HTML = " html"
6
+ const val STYLES = " styles"
7
+ const val DISPLAY_DURATION = " display_duration"
8
+ const val TOP_MARGIN = " top_margin"
9
+ const val BOTTOM_MARGIN = " bottom_margin"
10
+ const val LEFT_MARGIN = " left_margin"
11
+ const val RIGHT_MARGIN = " right_margin"
12
+
13
+ internal open class OSInAppMessageContent constructor(jsonObject : JSONObject ) {
14
+ var contentHtml: String? = null
15
+ var topMargin: Int? = 1
16
+ var bottomMargin: Int? = 1
17
+ var leftMargin: Int? = 1
18
+ var rightMargin: Int? = 1
19
+ // The following properties are populated from Javascript events
20
+ var displayLocation: WebViewManager .Position ? = null
21
+ var dismissDuration: Double? = null
22
+ var pageHeight: Int = 0
23
+
24
+ init {
25
+ contentHtml = jsonObject.optString(HTML )
26
+ displayDuration = jsonObject.optDouble(DISPLAY_DURATION )
27
+ var styles: JSONObject ? = jsonObject.optJSONObject(STYLES )
28
+ topMargin = styles?.optInt(TOP_MARGIN , 1 )
29
+ bottomMargin = styles?.optInt(BOTTOM_MARGIN , 1 )
30
+ leftMargin = styles?.optInt(LEFT_MARGIN , 1 )
31
+ rightMargin = styles?.optInt(RIGHT_MARGIN ,1 )
32
+ }
33
+ }
0 commit comments