-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(offline-backends): users and conversations without metadata refe…
…tch pt1. (AR-3123) (#1736) * feat: adjust query to hide 1:1 convos without metadata * feat: adjustment query to consider deleted users logic as it is now * feat: tests for query conversations details * feat: persistence for getting users out of sync * feat: persistence for getting users out of sync * feat: pr comments single quotes * feat: invok operator * feat: persist failed convos * feat: cleanup * feat: tests cov * feat: tests cov * feat: tests cov * feat: tests cov * feat: refactor, persist users withoutmetadata with dedicated field * feat: refactor, relay on missing metadata field for refetch usres * feat: refactor, relay on missing metadata field for refetch conversations * feat: refactor, relay on missing metadata field for refetch conversations * feat: refactor, relay on missing metadata field for refetch conversations * feat: refactor, fixing tests * chore: add migration tests
1 parent
2c3998d
commit 53114bd
Showing
18 changed files
with
373 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...ain/kotlin/com/wire/kalium/logic/feature/publicuser/RefreshUsersWithoutMetadataUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2023 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
package com.wire.kalium.logic.feature.publicuser | ||
|
||
import com.wire.kalium.logic.data.user.UserRepository | ||
import com.wire.kalium.logic.functional.fold | ||
import com.wire.kalium.logic.kaliumLogger | ||
import com.wire.kalium.util.KaliumDispatcher | ||
import com.wire.kalium.util.KaliumDispatcherImpl | ||
import kotlinx.coroutines.withContext | ||
|
||
/** | ||
* Refresh users without metadata, only if necessary. | ||
*/ | ||
interface RefreshUsersWithoutMetadataUseCase { | ||
suspend operator fun invoke() | ||
} | ||
|
||
internal class RefreshUsersWithoutMetadataUseCaseImpl( | ||
private val userRepository: UserRepository, | ||
private val dispatchers: KaliumDispatcher = KaliumDispatcherImpl | ||
) : RefreshUsersWithoutMetadataUseCase { | ||
|
||
override suspend fun invoke() = withContext(dispatchers.io) { | ||
kaliumLogger.d("Started syncing users without metadata") | ||
userRepository.syncUsersWithoutMetadata() | ||
.fold({ | ||
kaliumLogger.w("Error while syncing users without metadata $it") | ||
}) { | ||
kaliumLogger.d("Finished syncing users without metadata") | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.