Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Quest/Malawi Core] Android App : Sync Inactive recently changed Resources which are being filtered #74

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ constructor(

private val syncConfig by lazy { configurationRegistry.getSyncConfigs() }

private fun isInitialSync() =
sharedPreferencesHelper.read(SharedPreferenceKey.LAST_SYNC_TIMESTAMP.name, null).isNullOrBlank()

private val _onSyncListeners = mutableListOf<WeakReference<OnSyncListener>>()
val onSyncListeners: List<OnSyncListener>
get() = _onSyncListeners.mapNotNull { it.get() }
Expand Down Expand Up @@ -132,11 +135,14 @@ constructor(
}
}

filterBasedOnPerResourceType().forEach { (type, filters) ->
resourceTypeParamsMap.merge(type, filters) { list1, list2 ->
return@merge list1.toMutableList().apply { addAll(list2) }
if (isInitialSync()) {
filterBasedOnPerResourceType().forEach { (type, filters) ->
resourceTypeParamsMap.merge(type, filters) { list1, list2 ->
return@merge list1.toMutableList().apply { addAll(list2) }
}
}
}

val filterByLocationParams =
sharedPreferencesHelper.filterByResourceLocation(resourceTypeParamsMap)

Expand Down
Loading