From 50f7b7d391998b06a902507a6950938ffbc4e048 Mon Sep 17 00:00:00 2001 From: Julius Linus Date: Mon, 11 Dec 2023 11:10:01 -0600 Subject: [PATCH] WIP - trying to debug a glitch with DatabaseStorageModule Signed-off-by: rapterjet2004 --- .../conversationinfo/ConversationInfoActivity.kt | 2 +- .../data/storage/ArbitraryStoragesRepositoryImpl.kt | 7 ++++++- .../preferencestorage/DatabaseStorageModule.java | 13 +++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/conversationinfo/ConversationInfoActivity.kt b/app/src/main/java/com/nextcloud/talk/conversationinfo/ConversationInfoActivity.kt index e04bd2ac6f6..e4377dacf3d 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationinfo/ConversationInfoActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationinfo/ConversationInfoActivity.kt @@ -166,10 +166,10 @@ class ConversationInfoActivity : override fun onResume() { super.onResume() - if (databaseStorageModule == null) { databaseStorageModule = DatabaseStorageModule(conversationUser, conversationToken) } + Log.d("Julius", "DatabaseModule is $databaseStorageModule") setUpNotificationSettings(databaseStorageModule!!) binding.deleteConversationAction.setOnClickListener { showDeleteConversationDialog() } binding.leaveConversationAction.setOnClickListener { leaveConversation() } diff --git a/app/src/main/java/com/nextcloud/talk/data/storage/ArbitraryStoragesRepositoryImpl.kt b/app/src/main/java/com/nextcloud/talk/data/storage/ArbitraryStoragesRepositoryImpl.kt index 6eb07cf7614..7423a51df01 100644 --- a/app/src/main/java/com/nextcloud/talk/data/storage/ArbitraryStoragesRepositoryImpl.kt +++ b/app/src/main/java/com/nextcloud/talk/data/storage/ArbitraryStoragesRepositoryImpl.kt @@ -20,6 +20,7 @@ package com.nextcloud.talk.data.storage +import android.util.Log import com.nextcloud.talk.data.storage.model.ArbitraryStorage import com.nextcloud.talk.data.storage.model.ArbitraryStorageEntity import io.reactivex.Maybe @@ -33,7 +34,11 @@ class ArbitraryStoragesRepositoryImpl(private val arbitraryStoragesDao: Arbitrar ): Maybe { return arbitraryStoragesDao .getStorageSetting(accountIdentifier, key, objectString) - .map { ArbitraryStorageMapper.toModel(it) } + .map { + // TODO debug why changing one conversations storage settings overrides another??? + Log.d("Julius", "Arbitary Storage is $it") + ArbitraryStorageMapper.toModel(it) + } } override fun getAll(): Maybe> { diff --git a/app/src/main/java/com/nextcloud/talk/utils/preferences/preferencestorage/DatabaseStorageModule.java b/app/src/main/java/com/nextcloud/talk/utils/preferences/preferencestorage/DatabaseStorageModule.java index cc4365c55bc..b7dc2cfd28a 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/preferences/preferencestorage/DatabaseStorageModule.java +++ b/app/src/main/java/com/nextcloud/talk/utils/preferences/preferencestorage/DatabaseStorageModule.java @@ -215,10 +215,13 @@ public boolean getBoolean(String key, boolean defaultVal) { if ("lobby_switch".equals(key)) { return lobbyValue; } else { - return arbitraryStorageManager + boolean result = arbitraryStorageManager .getStorageSetting(accountIdentifier, key, conversationToken) - .map(arbitraryStorage -> Boolean.parseBoolean(arbitraryStorage.getValue())) + .map(arbitraryStorage -> { + return Boolean.parseBoolean(arbitraryStorage.getValue()); + }) .blockingGet(defaultVal); + return result; } } @@ -251,4 +254,10 @@ public String getString(String key, String defaultVal) { public void setMessageExpiration(int messageExpiration) { this.messageExpiration = messageExpiration; } + + @androidx.annotation.NonNull + public String toString() { + return "Conversation token: " + conversationToken + + "\nAccount Number: " + accountIdentifier; + } }