Skip to content
Merged
Show file tree
Hide file tree
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 @@ -100,7 +100,15 @@
Dispatchers.Default {
val crossAppLogin = CrossAppLogin.forContext(context = appCtx, coroutineScope = this)
crossAppLogin.sharedDeviceIdFlow.collectLatest { currentCrossAppDeviceId ->
val userIdsFlow = UserDatabase().userDao().allUsers.map { users -> users.map { it.id } }.distinctUntilChanged()

// We need to check for updates when the set of users changes, or when any of their token changes.
// When the token is refreshed, the corresponding file is supposed to have been cleared,
// so that the up-to-date check triggers a new schedule.
//TODO[Core-associated-user-data]: Factorize this duplicate code, and possibly the common logic.

Check warning on line 107 in CrossAppLogin/Back/src/main/kotlin/com/infomaniak/core/crossapplogin/back/internal/deviceinfo/DeviceInfoUpdateManager.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this TODO comment.

See more on https://sonarcloud.io/project/issues?id=Infomaniak_android-core&issues=AZ4Ba7OOC5to97isADbh&open=AZ4Ba7OOC5to97isADbh&pullRequest=762
val userIdsFlow = UserDatabase().userDao().allUsers.map { users ->
users.map { it.id to it.apiToken }
}.distinctUntilChanged().map { it.map { (id, _) -> id } }
Comment thread
LouisCAD marked this conversation as resolved.

userIdsFlow.collect { userIds ->
val isEverythingUpToDate = userIds.allConcurrent { isUpToDate(currentCrossAppDeviceId, it.toLong()) }
if (isEverythingUpToDate) return@collect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@
emit(token)
}.stateIn(this)

val userIdsFlow = UserDatabase().userDao().allUsers.map { users -> users.map { it.id } }.distinctUntilChanged()
// We need to check for updates when the set of users changes, or when any of their token changes.
// When the token is refreshed, the corresponding file is supposed to have been cleared,
// so that the up-to-date check triggers a new schedule.
//TODO[Core-associated-user-data]: Factorize this duplicate code, and possibly the common logic.

Check warning on line 116 in Notifications/Registration/src/main/kotlin/NotificationsRegistrationManager.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this TODO comment.

See more on https://sonarcloud.io/project/issues?id=Infomaniak_android-core&issues=AZ4Ba7Q_C5to97isADbi&open=AZ4Ba7Q_C5to97isADbi&pullRequest=762
val userIdsFlow = UserDatabase().userDao().allUsers.map { users ->
users.map { it.id to it.apiToken }
}.distinctUntilChanged().map { it.map { (id, _) -> id } }
Comment thread
tevincent marked this conversation as resolved.

latestFcmToken.collectLatest { fcmToken ->
userIdsFlow.collectLatest { userIds ->
Expand Down
Loading