From 22bb9893af7480cff54b99c69d5734ebe7755929 Mon Sep 17 00:00:00 2001 From: Ahmed Moussa Date: Tue, 19 Mar 2024 05:23:55 +0200 Subject: [PATCH] chore: update Apollo version Signed-off-by: Ahmed Moussa --- .../atala/prism/walletsdk/domain/models/Errors.kt | 6 +++--- .../atala/prism/walletsdk/prismagent/PrismAgent.kt | 10 ++++++---- .../atala/prism/walletsdk/mercury/PlutoMock.kt | 5 ++--- .../prism/walletsdk/prismagent/PrismAgentTests.kt | 5 ++--- .../iohk/atala/prism/walletsdk/prismagent/Test.kt | 14 -------------- build.gradle.kts | 2 +- gradle.properties | 2 +- protosLib/build.gradle.kts | 4 +++- .../atala/prism/sampleapp/db/DatabaseClient.kt | 10 +++++----- .../sampleapp/ui/messages/MessagesViewModel.kt | 3 ++- 10 files changed, 25 insertions(+), 36 deletions(-) delete mode 100644 atala-prism-sdk/src/jvmTest/kotlin/io/iohk/atala/prism/walletsdk/prismagent/Test.kt diff --git a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/Errors.kt b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/Errors.kt index c254ad41b..0b7f77340 100644 --- a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/Errors.kt +++ b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/Errors.kt @@ -557,9 +557,9 @@ constructor( customUnderlyingErrors: Array ) : MercuryError( message = "DIDComm error has occurred with message: $customMessage\nErrors: ${ - customUnderlyingErrors.joinToString( - separator = "\n" - ) { it.errorDescription ?: "" } + customUnderlyingErrors.joinToString( + separator = "\n" + ) { it.errorDescription ?: "" } }" ) { override val code: Int diff --git a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgent.kt b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgent.kt index a428a2037..d7e497cd6 100644 --- a/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgent.kt +++ b/atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgent.kt @@ -1,6 +1,7 @@ +@file:Suppress("ktlint:standard:import-ordering") + package io.iohk.atala.prism.walletsdk.prismagent -/* ktlint-disable import-ordering */ import anoncreds_wrapper.CredentialOffer import anoncreds_wrapper.CredentialRequestMetadata import anoncreds_wrapper.LinkSecret @@ -84,8 +85,6 @@ import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.jsonObject -/* ktlint-disable import-ordering */ - /** * Check if the passed URL is valid or not. * @param str string to check its URL validity @@ -1015,6 +1014,9 @@ class PrismAgent { * Enumeration representing the current state of the agent. */ enum class State { - STOPPED, STARTING, RUNNING, STOPPING + STOPPED, + STARTING, + RUNNING, + STOPPING } } diff --git a/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/mercury/PlutoMock.kt b/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/mercury/PlutoMock.kt index 455f03687..7c2d09d30 100644 --- a/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/mercury/PlutoMock.kt +++ b/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/mercury/PlutoMock.kt @@ -1,6 +1,7 @@ +@file:Suppress("ktlint:standard:import-ordering") + package io.iohk.atala.prism.walletsdk.mercury -/* ktlint-disable import-ordering */ import io.iohk.atala.prism.walletsdk.domain.buildingblocks.Pluto import io.iohk.atala.prism.walletsdk.domain.models.DID import io.iohk.atala.prism.walletsdk.domain.models.DIDPair @@ -16,8 +17,6 @@ import io.iohk.atala.prism.walletsdk.pluto.CredentialRecovery import io.iohk.atala.prism.walletsdk.pluto.data.AvailableClaims import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow -/* ktlint-disable import-ordering */ - class PlutoMock : Pluto { var privateKeys = mutableListOf() diff --git a/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgentTests.kt b/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgentTests.kt index 46358bf69..0af60048a 100644 --- a/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgentTests.kt +++ b/atala-prism-sdk/src/commonTest/kotlin/io/iohk/atala/prism/walletsdk/prismagent/PrismAgentTests.kt @@ -1,6 +1,7 @@ +@file:Suppress("ktlint:standard:import-ordering") + package io.iohk.atala.prism.walletsdk.prismagent -/* ktlint-disable import-ordering */ import anoncreds_wrapper.LinkSecret import io.iohk.atala.prism.apollo.derivation.MnemonicHelper import io.iohk.atala.prism.walletsdk.apollo.ApolloImpl @@ -39,8 +40,6 @@ import kotlin.test.assertFailsWith import kotlin.test.assertFalse import kotlin.test.assertTrue -/* ktlint-disable import-ordering */ - @OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class) class PrismAgentTests { diff --git a/atala-prism-sdk/src/jvmTest/kotlin/io/iohk/atala/prism/walletsdk/prismagent/Test.kt b/atala-prism-sdk/src/jvmTest/kotlin/io/iohk/atala/prism/walletsdk/prismagent/Test.kt deleted file mode 100644 index 459a3c7fb..000000000 --- a/atala-prism-sdk/src/jvmTest/kotlin/io/iohk/atala/prism/walletsdk/prismagent/Test.kt +++ /dev/null @@ -1,14 +0,0 @@ -package io.iohk.atala.prism.walletsdk -import kotlin.test.BeforeTest -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith -import kotlin.test.assertFalse -import kotlin.test.assertTrue - -class Test { - @Test - fun test() { - - } -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 83f1b140d..02a5e59af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { id("com.android.library") version "8.1.4" apply false kotlin("jvm") version "1.9.22" kotlin("plugin.serialization") version "1.8.20" - id("org.jlleitschuh.gradle.ktlint") version "11.5.1" + id("org.jlleitschuh.gradle.ktlint") version "12.1.0" id("org.jetbrains.dokka") version "1.9.0" id("org.jetbrains.kotlin.kapt") version "1.9.10" id("maven-publish") diff --git a/gradle.properties b/gradle.properties index d0a91c09e..a554e0f65 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style = official android.useAndroidX = true kotlin.mpp.enableCInteropCommonization = true kotlin.native.cacheKind.iosSimulatorArm64 = none -apollo_version = 1.2.11 +apollo_version = 1.2.12 didpeer_version = 1.1.2 kotlin.mpp.androidSourceSetLayoutVersion = 2 kotlinx.atomicfu.enableJvmIrTransformation = true diff --git a/protosLib/build.gradle.kts b/protosLib/build.gradle.kts index f5b6d2ddf..3c9e8086d 100644 --- a/protosLib/build.gradle.kts +++ b/protosLib/build.gradle.kts @@ -1,4 +1,6 @@ -import com.google.protobuf.gradle.* // ktlint-disable no-wildcard-imports +@file:Suppress("ktlint:standard:no-wildcard-imports") + +import com.google.protobuf.gradle.* import org.gradle.internal.os.OperatingSystem val os: OperatingSystem = OperatingSystem.current() diff --git a/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/db/DatabaseClient.kt b/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/db/DatabaseClient.kt index aeaeb140d..cb5d3ad87 100644 --- a/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/db/DatabaseClient.kt +++ b/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/db/DatabaseClient.kt @@ -5,13 +5,13 @@ import androidx.room.Room object DatabaseClient { @Volatile - private var INSTANCE: AppDatabase? = null + private var instance: AppDatabase? = null fun initializeInstance(context: Context) { - if (INSTANCE == null) { + if (instance == null) { synchronized(AppDatabase::class.java) { - if (INSTANCE == null) { - INSTANCE = Room.databaseBuilder( + if (instance == null) { + instance = Room.databaseBuilder( context.applicationContext, AppDatabase::class.java, "database-name" @@ -22,6 +22,6 @@ object DatabaseClient { } fun getInstance(): AppDatabase { - return INSTANCE ?: throw IllegalStateException("Database has not been initialized.") + return instance ?: throw IllegalStateException("Database has not been initialized.") } } diff --git a/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/ui/messages/MessagesViewModel.kt b/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/ui/messages/MessagesViewModel.kt index 9148f4fdd..3661373ba 100644 --- a/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/ui/messages/MessagesViewModel.kt +++ b/sampleapp/src/main/java/io/iohk/atala/prism/sampleapp/ui/messages/MessagesViewModel.kt @@ -74,7 +74,8 @@ class MessagesViewModel(application: Application) : AndroidViewModel(application ) val time = LocalDateTime.now() val message = Message( - piuri = "https://didcomm.org/basicmessage/2.0/message", // TODO: This should be on ProtocolTypes as an enum + // TODO: This should be on ProtocolTypes as an enum + piuri = "https://didcomm.org/basicmessage/2.0/message", from = did, to = did, body = "{\"msg\":\"This is a new test message ${time}\"}"