Skip to content

Commit

Permalink
Merge branch 'main' into coroutines
Browse files Browse the repository at this point in the history
  • Loading branch information
wzieba committed Nov 7, 2023
2 parents dafdc62 + b9c449d commit 80454a8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@ internal open class LocalStorageRepository(private val context: Context) {
@Synchronized
open fun persistQueue(inMemoryQueue: List<Map<String, Any?>?>) {
ParselyTracker.PLog("Persisting event queue")
val storedQueue = getStoredQueue()
val hs = HashSet<Map<String, Any?>?>()
hs.addAll(storedQueue)
hs.addAll(inMemoryQueue)
storedQueue.clear()
storedQueue.addAll(hs)
persistObject(storedQueue)
persistObject((inMemoryQueue + getStoredQueue()).distinct())
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public void resetVideo() {
* Place a data structure representing the event into the in-memory queue for later use.
* <p>
* **Note**: Events placed into this queue will be discarded if the size of the persistent queue
* store exceeds {@link #STORAGE_SIZE_LIMIT}.
* store exceeds {@link QueueManager#STORAGE_SIZE_LIMIT}.
*
* @param event The event Map to enqueue.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package com.parsely.parselyandroid

import android.os.AsyncTask

@Suppress("DEPRECATION")
internal class QueueManager(
private val parselyTracker: ParselyTracker,
private val localStorageRepository: LocalStorageRepository
) : AsyncTask<Void?, Void?, Void?>() {

@Deprecated("Deprecated in Java")
override fun doInBackground(vararg params: Void?): Void? {
// if event queue is too big, push to persisted storage
if (parselyTracker.inMemoryQueue.size > QUEUE_SIZE_LIMIT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.LooperMode
import org.robolectric.shadows.ShadowLooper.shadowMainLooper

@Suppress("DEPRECATION")
@RunWith(RobolectricTestRunner::class)
@LooperMode(LooperMode.Mode.PAUSED)
internal class QueueManagerTest {
Expand Down

0 comments on commit 80454a8

Please sign in to comment.