Skip to content

Commit

Permalink
linter 2
Browse files Browse the repository at this point in the history
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
  • Loading branch information
rapterjet2004 committed Jan 29, 2025
1 parent 5bedd9f commit 034600c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 59 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ class ChatActivity :

private val onBackPressedCallback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
chatViewModel.handleChatOnBackPress()
val intent = Intent(this@ChatActivity, ConversationsListActivity::class.java)
intent.putExtras(Bundle())
startActivity(intent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@

import android.annotation.SuppressLint;

import com.nextcloud.talk.chat.viewmodels.MessageInputViewModel;
import com.nextcloud.talk.ui.PlaybackSpeed;

import java.util.List;

@SuppressLint("NonConstantResourceId")
public interface AppPreferences {

Expand Down Expand Up @@ -174,10 +171,6 @@ public interface AppPreferences {

int getLastKnownId(String internalConversationId, int defaultValue);

void saveMessageQueue(String internalConversationId, List<MessageInputViewModel.QueuedMessage> queue);

List<MessageInputViewModel.QueuedMessage> getMessageQueue(String internalConversationId);

void deleteAllMessageQueuesFor(String userId);

void savePreferredPlayback(String userId, PlaybackSpeed speed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package com.nextcloud.talk.utils.preferences

import android.content.Context
import android.util.Log
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
Expand Down Expand Up @@ -497,56 +496,6 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
return if (lastReadId.isNotEmpty()) lastReadId.toInt() else defaultValue
}

override fun saveMessageQueue(
internalConversationId: String,
queue: MutableList<MessageInputViewModel.QueuedMessage>?
) {
runBlocking<Unit> {
async {
var queueStr = ""
queue?.let {
for (msg in queue) {
val msgStr = "${msg.id},${msg.message},${msg.replyTo},${msg.displayName},${
msg
.sendWithoutNotification
}^"
queueStr += msgStr
}
}
writeString(internalConversationId + MESSAGE_QUEUE, queueStr)
}
}
}

@Suppress("Detekt.TooGenericExceptionCaught")
override fun getMessageQueue(internalConversationId: String): MutableList<MessageInputViewModel.QueuedMessage> {
val queueStr =
runBlocking { async { readString(internalConversationId + MESSAGE_QUEUE).first() } }.getCompleted()

val queue: MutableList<MessageInputViewModel.QueuedMessage> = mutableListOf()
if (queueStr.isEmpty()) return queue

for (msgStr in queueStr.split("^")) {
try {
if (msgStr.isNotEmpty()) {
val msgArray = msgStr.split(",")
val id = msgArray[ID].toInt()
val message = msgArray[MESSAGE_INDEX]
val replyTo = msgArray[REPLY_TO_INDEX].toInt()
val displayName = msgArray[DISPLAY_NAME_INDEX]
val silent = msgArray[SILENT_INDEX].toBoolean()

val qMsg = MessageInputViewModel.QueuedMessage(id, message, displayName, replyTo, silent)
queue.add(qMsg)
}
} catch (e: IndexOutOfBoundsException) {
Log.e(TAG, "Message string: $msgStr\n Queue String: $queueStr \n$e")
}
}

return queue
}

override fun deleteAllMessageQueuesFor(userId: String) {
runBlocking {
async {
Expand Down

0 comments on commit 034600c

Please sign in to comment.