mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-12-18 06:32:08 +03:00
got deleting working and added attempts logic again
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
2e7c662237
commit
4e4eafd2a2
3 changed files with 9 additions and 4 deletions
|
@ -147,7 +147,6 @@ class MessageInputViewModel @Inject constructor(
|
|||
dataStore.saveMessageQueue(internalId, messageQueue)
|
||||
_messageQueueSizeFlow.update { messageQueue.size }
|
||||
val id = internalId.substringBefore('@')
|
||||
dataStore.deleteAllMessageQueuesFor(id)
|
||||
_messageQueueFlow.postValue(listOf(qMsg))
|
||||
return
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ public class AccountRemovalWorker extends Worker {
|
|||
if (user.getId() != null) {
|
||||
String username = user.getUsername();
|
||||
try {
|
||||
// appPreferences.deleteAllMessageQueuesFor(user.getUserId()); // TODO uncomment this when done
|
||||
appPreferences.deleteAllMessageQueuesFor(user.getUserId());
|
||||
userManager.deleteUser(user.getId());
|
||||
Log.d(TAG, "deleted user: " + username);
|
||||
} catch (Throwable e) {
|
||||
|
|
|
@ -527,11 +527,17 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||
override fun deleteAllMessageQueuesFor(userId: String) {
|
||||
runBlocking {
|
||||
async {
|
||||
val keyList = mutableListOf<Preferences.Key<*>>()
|
||||
val preferencesMap = context.dataStore.data.first().asMap()
|
||||
for (preference in preferencesMap) {
|
||||
if (preference.key.name.contains("$userId@")) {
|
||||
Log.d("Julius", "found: ${preference.key} :\n ${preference.value}\n")
|
||||
// TODO remove it somehow
|
||||
keyList.add(preference.key)
|
||||
}
|
||||
}
|
||||
|
||||
for (key in keyList) {
|
||||
context.dataStore.edit {
|
||||
it.remove(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue