@@ -16,6 +16,7 @@ import com.mparticle.kits.KitIntegration.IdentityListener
16
16
import com.mparticle.kits.KitIntegration.RoktListener
17
17
import com.mparticle.rokt.RoktEmbeddedView
18
18
import com.rokt.roktsdk.Rokt
19
+ import com.rokt.roktsdk.RoktWidgetDimensionCallBack
19
20
import com.rokt.roktsdk.Widget
20
21
import java.lang.ref.WeakReference
21
22
import java.math.BigDecimal
@@ -38,7 +39,8 @@ class RoktKit : KitIntegration(), CommerceListener, IdentityListener, RoktListen
38
39
ctx : Context
39
40
): List <ReportingMessage > {
40
41
applicationContext = ctx.applicationContext
41
- val roktTagId = settings[ROKT_ACCOUNT_ID ]
42
+ // val roktTagId = settings[ROKT_ACCOUNT_ID]
43
+ val roktTagId = " 2754655826098840951"
42
44
if (KitUtils .isEmpty(roktTagId)) {
43
45
throwOnKitCreateError(NO_ROKT_ACCOUNT_ID )
44
46
}
@@ -127,12 +129,30 @@ class RoktKit : KitIntegration(), CommerceListener, IdentityListener, RoktListen
127
129
fontTypefaces : MutableMap <String , WeakReference <Typeface >>? ,
128
130
filterUser : FilteredMParticleUser ?
129
131
) {
130
- // Converting the placeholders to a Map<String, WeakReference<Widget>> by filtering and casting each entry
131
132
val placeholders: Map <String , WeakReference <Widget >>? = placeHolders?.mapNotNull { entry ->
132
- val weakRef = entry.value
133
- val widget = weakRef.get() as ? Widget // Safe cast to Widget
134
- widget?.let { entry.key to weakRef as WeakReference <Widget > } // Only include if it's a Widget
133
+ val widget = Widget (entry.value.get()?.context as Context )
134
+ entry.value.get()?.removeAllViews()
135
+ entry.value.get()?.addView(widget)
136
+ entry.value.get()?.dimensionCallBack?.let {
137
+ widget.registerDimensionListener(object : RoktWidgetDimensionCallBack {
138
+ override fun onHeightChanged (height : Int ) {
139
+ it.onHeightChanged(height)
140
+ }
141
+
142
+ override fun onMarginChanged (
143
+ start : Int ,
144
+ top : Int ,
145
+ end : Int ,
146
+ bottom : Int
147
+ ) {
148
+ it.onMarginChanged(start, top, end, bottom)
149
+ }
150
+
151
+ })
152
+ }
153
+ entry.key to WeakReference (widget)
135
154
}?.toMap()
155
+
136
156
this .mpRoktEventCallback = mpRoktEventCallback
137
157
val finalAttributes: HashMap <String , String > = HashMap <String , String >()
138
158
filterUser?.userAttributes?.let { userAttrs ->
@@ -141,11 +161,10 @@ class RoktKit : KitIntegration(), CommerceListener, IdentityListener, RoktListen
141
161
}
142
162
}
143
163
144
- filterUser?.id?.let { mpid ->
145
- finalAttributes.put(MPID , mpid.toString())
146
- } ? : run {
147
- Logger .warning(" RoktKit: No user ID available for placement" )
148
- }
164
+ filterUser?.id?.toString()?.let { mpid ->
165
+ finalAttributes[MPID ] = mpid
166
+ } ? : Logger .warning(" RoktKit: No user ID available for placement" )
167
+
149
168
addIdentityAttributes(finalAttributes, filterUser)
150
169
151
170
Rokt .execute(
0 commit comments