|
1 | 1 | package com.iterable.iterableapi |
2 | 2 |
|
3 | | -import android.content.Context |
4 | 3 | import android.os.Handler |
5 | 4 | import android.os.Looper |
6 | 5 | import androidx.lifecycle.LiveData |
@@ -38,7 +37,6 @@ public class IterableEmbeddedManager: IterableActivityMonitor.AppStateCallback{ |
38 | 37 |
|
39 | 38 | //Constructor of this class with actionHandler and updateHandler |
40 | 39 | public constructor( |
41 | | - context: Context, |
42 | 40 | autoFetchInterval: Double, |
43 | 41 | actionHandler: EmbeddedMessageActionHandler?, |
44 | 42 | updateHandler: EmbeddedMessageUpdateHandler? |
@@ -130,27 +128,14 @@ public class IterableEmbeddedManager: IterableActivityMonitor.AppStateCallback{ |
130 | 128 | for (i in 0 until jsonArray.length()) { |
131 | 129 | val messageJson = jsonArray.optJSONObject(i) |
132 | 130 | val message = IterableEmbeddedMessage.fromJSONObject(messageJson) |
133 | | - if (message != null) { |
134 | | - remoteMessageList.add(message) |
135 | | - } else { |
136 | | - IterableLogger.e(TAG, "message turned out to be null") |
137 | | - } |
| 131 | + remoteMessageList.add(message) |
138 | 132 | } |
139 | 133 | } else { |
140 | 134 | IterableLogger.e(TAG, "Array not found in embedded message response. Probably a parsing failure") |
141 | 135 | } |
142 | | -// //Directly saving the messages to the list |
143 | | -// //TODO: Check and make note of the changes and call the updateHandler accordinly |
144 | | -// //TODO: Check for new messages and call delivery on the new ones |
145 | | - |
146 | 136 | updateLocalMessages(remoteMessageList) |
147 | 137 | IterableLogger.v(TAG, "$localMessages") |
148 | 138 |
|
149 | | -// //Saving the time of last sync |
150 | | - IterableLogger.v(TAG, "Resetting last sync time") |
151 | | - |
152 | | - //TODO: Is this line necessary? Because we are updating it at the end anyways. |
153 | | -// lastSync = IterableUtil.currentTimeMillis() |
154 | 139 | } catch (e: JSONException) { |
155 | 140 | IterableLogger.e(TAG, e.toString()) |
156 | 141 | } |
@@ -206,10 +191,6 @@ public class IterableEmbeddedManager: IterableActivityMonitor.AppStateCallback{ |
206 | 191 | //TODO: Make a call to the updateHandler to notify that the message list has been updated |
207 | 192 | updateHandleListeners.forEach { |
208 | 193 | IterableLogger.d(TAG, "Calling updateHandler") |
209 | | - if(it == null) { |
210 | | - IterableLogger.d(TAG, "updateHandler is null") |
211 | | - return |
212 | | - } |
213 | 194 | it.onMessageUpdate() |
214 | 195 | } |
215 | 196 | } |
|
0 commit comments