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)
|
dataStore.saveMessageQueue(internalId, messageQueue)
|
||||||
_messageQueueSizeFlow.update { messageQueue.size }
|
_messageQueueSizeFlow.update { messageQueue.size }
|
||||||
val id = internalId.substringBefore('@')
|
val id = internalId.substringBefore('@')
|
||||||
dataStore.deleteAllMessageQueuesFor(id)
|
|
||||||
_messageQueueFlow.postValue(listOf(qMsg))
|
_messageQueueFlow.postValue(listOf(qMsg))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ public class AccountRemovalWorker extends Worker {
|
||||||
if (user.getId() != null) {
|
if (user.getId() != null) {
|
||||||
String username = user.getUsername();
|
String username = user.getUsername();
|
||||||
try {
|
try {
|
||||||
// appPreferences.deleteAllMessageQueuesFor(user.getUserId()); // TODO uncomment this when done
|
appPreferences.deleteAllMessageQueuesFor(user.getUserId());
|
||||||
userManager.deleteUser(user.getId());
|
userManager.deleteUser(user.getId());
|
||||||
Log.d(TAG, "deleted user: " + username);
|
Log.d(TAG, "deleted user: " + username);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
|
@ -527,11 +527,17 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
||||||
override fun deleteAllMessageQueuesFor(userId: String) {
|
override fun deleteAllMessageQueuesFor(userId: String) {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
async {
|
async {
|
||||||
|
val keyList = mutableListOf<Preferences.Key<*>>()
|
||||||
val preferencesMap = context.dataStore.data.first().asMap()
|
val preferencesMap = context.dataStore.data.first().asMap()
|
||||||
for (preference in preferencesMap) {
|
for (preference in preferencesMap) {
|
||||||
if (preference.key.name.contains("$userId@")) {
|
if (preference.key.name.contains("$userId@")) {
|
||||||
Log.d("Julius", "found: ${preference.key} :\n ${preference.value}\n")
|
keyList.add(preference.key)
|
||||||
// TODO remove it somehow
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (key in keyList) {
|
||||||
|
context.dataStore.edit {
|
||||||
|
it.remove(key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue