From d3cc130678a850b5fca01af85ecfd8251637cf23 Mon Sep 17 00:00:00 2001 From: ElJaviLuki Date: Fri, 26 May 2023 17:57:24 +0200 Subject: [PATCH] A more idiomatic Kotlin way --- app/src/main/java/com/grindrplus/Hooks.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/grindrplus/Hooks.kt b/app/src/main/java/com/grindrplus/Hooks.kt index 40598a37..ba69fb92 100644 --- a/app/src/main/java/com/grindrplus/Hooks.kt +++ b/app/src/main/java/com/grindrplus/Hooks.kt @@ -939,7 +939,7 @@ object Hooks { GApp.api.PhrasesRestService_.getSavedPhrases -> { val phrases = Hooker.sharedPref.getStringSet("phrases", emptySet())!! - .map { id -> + .associateWith { id -> val text = Hooker.sharedPref.getString( "phrase_${id}_text", "" @@ -952,14 +952,13 @@ object Hooks { "phrase_${id}_frequency", 0 ) - id to constructor_Phrase.newInstance( + constructor_Phrase.newInstance( id, text, timestamp, frequency ) } - .toMap() val phrasesResponse = constructor_PhrasesResponse.newInstance(phrases) createSuccessResult.invoke(null, phrasesResponse)