@@ -169,50 +169,71 @@ sealed class Conversation {
169
169
*/
170
170
suspend fun messages (
171
171
limit : Int? = null,
172
- before : Date ? = null,
173
- after : Date ? = null,
172
+ beforeNs : Long ? = null,
173
+ afterNs : Long ? = null,
174
174
direction : PagingInfoSortDirection = MessageApiOuterClass .SortDirection .SORT_DIRECTION_DESCENDING ,
175
175
): List <DecodedMessage > {
176
176
return when (this ) {
177
177
is V1 -> conversationV1.messages(
178
178
limit = limit,
179
- before = before ,
180
- after = after ,
179
+ before = beforeNs?. let { Date (it / 1_000_000 ) } ,
180
+ after = afterNs?. let { Date (it / 1_000_000 ) } ,
181
181
direction = direction,
182
182
)
183
183
184
184
is V2 ->
185
185
conversationV2.messages(
186
186
limit = limit,
187
- before = before ,
188
- after = after ,
187
+ before = beforeNs?. let { Date (it / 1_000_000 ) } ,
188
+ after = afterNs?. let { Date (it / 1_000_000 ) } ,
189
189
direction = direction,
190
190
)
191
191
192
192
is Group -> {
193
193
group.messages(
194
194
limit = limit,
195
- before = before ,
196
- after = after ,
195
+ beforeNs = beforeNs ,
196
+ afterNs = afterNs ,
197
197
direction = direction,
198
198
)
199
199
}
200
200
201
- is Dm -> dm.messages(limit, before, after , direction)
201
+ is Dm -> dm.messages(limit, beforeNs, afterNs , direction)
202
202
}
203
203
}
204
204
205
205
suspend fun decryptedMessages (
206
206
limit : Int? = null,
207
- before : Date ? = null,
208
- after : Date ? = null,
207
+ beforeNs : Long ? = null,
208
+ afterNs : Long ? = null,
209
209
direction : PagingInfoSortDirection = MessageApiOuterClass .SortDirection .SORT_DIRECTION_DESCENDING ,
210
210
): List <DecryptedMessage > {
211
211
return when (this ) {
212
- is V1 -> conversationV1.decryptedMessages(limit, before, after, direction)
213
- is V2 -> conversationV2.decryptedMessages(limit, before, after, direction)
214
- is Group -> group.decryptedMessages(limit, before, after, direction)
215
- is Dm -> dm.decryptedMessages(limit, before, after, direction)
212
+ is V1 -> conversationV1.decryptedMessages(
213
+ limit = limit,
214
+ before = beforeNs?.let { Date (it / 1_000_000 ) },
215
+ after = afterNs?.let { Date (it / 1_000_000 ) },
216
+ direction = direction,
217
+ )
218
+
219
+ is V2 ->
220
+ conversationV2.decryptedMessages(
221
+ limit = limit,
222
+ before = beforeNs?.let { Date (it / 1_000_000 ) },
223
+ after = afterNs?.let { Date (it / 1_000_000 ) },
224
+ direction = direction,
225
+ )
226
+
227
+ is Group -> {
228
+ group.decryptedMessages(
229
+ limit = limit,
230
+ beforeNs = beforeNs,
231
+ afterNs = afterNs,
232
+ direction = direction,
233
+ )
234
+ }
235
+
236
+ is Dm -> dm.decryptedMessages(limit, beforeNs, afterNs, direction)
216
237
}
217
238
}
218
239
0 commit comments