From a9ff44de8cd2d71edcd48fc73359f67381ca0220 Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:01:45 -0500 Subject: [PATCH 01/12] remove reportAsync in favor of reportAsyncQuery --- .../main/java/network/xyo/client/XyoPanel.kt | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/sdk/src/main/java/network/xyo/client/XyoPanel.kt b/sdk/src/main/java/network/xyo/client/XyoPanel.kt index 3facb9e..1a12c14 100644 --- a/sdk/src/main/java/network/xyo/client/XyoPanel.kt +++ b/sdk/src/main/java/network/xyo/client/XyoPanel.kt @@ -17,7 +17,6 @@ import network.xyo.client.node.client.NodeClient import network.xyo.client.node.client.PostQueryResult import network.xyo.client.payload.XyoPayload -data class XyoPanelReportResult(val bw: XyoBoundWitnessJson, val apiResults: List) data class XyoPanelReportQueryResult(val bw: XyoBoundWitnessJson, val apiResults: List?, val payloads: List?) @RequiresApi(Build.VERSION_CODES.M) @@ -99,18 +98,6 @@ class XyoPanel( } } - @kotlinx.coroutines.ExperimentalCoroutinesApi - fun event() { - xyoScope.launch { - this@XyoPanel.eventAsync() - } - } - - @kotlinx.coroutines.ExperimentalCoroutinesApi - suspend fun eventAsync(): XyoPanelReportResult { - return this.reportAsync() - } - @kotlinx.coroutines.ExperimentalCoroutinesApi suspend fun eventAsyncQuery(event: String): XyoPanelReportQueryResult { val adhocWitnessList = listOf( @@ -121,13 +108,6 @@ class XyoPanel( return reportAsyncQuery(adhocWitnessList) } - @kotlinx.coroutines.ExperimentalCoroutinesApi - fun report() { - xyoScope.launch { - reportAsync() - } - } - @kotlinx.coroutines.ExperimentalCoroutinesApi fun reportQuery(adhocWitnesses: List> = emptyList()) { xyoScope.launch { @@ -153,17 +133,6 @@ class XyoPanel( return payloads.mapNotNull { payload -> payload }.flatten() } - @Deprecated("use reportAsyncQuery instead") - @kotlinx.coroutines.ExperimentalCoroutinesApi - suspend fun reportAsync(): XyoPanelReportResult { - val bw = generateBoundWitnessJson() - val results = mutableListOf() - archivists?.forEach { archivist -> - results.add(archivist.postBoundWitnessAsync(bw)) - } - return XyoPanelReportResult(bw, results) - } - @kotlinx.coroutines.ExperimentalCoroutinesApi suspend fun reportAsyncQuery(adhocWitnesses: List> = emptyList()): XyoPanelReportQueryResult { if (nodes == null) resolveNodes() From 3efd8628e2ed338e7d87d809ffad95f127be4c49 Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:03:55 -0500 Subject: [PATCH 02/12] remove deprecated ArchivistApi and Archive related code --- .../main/java/network/xyo/client/XyoPanel.kt | 35 ------- .../archivist/api/XyoArchivistApiClient.kt | 98 ------------------- .../archivist/api/XyoArchivistApiConfig.kt | 6 -- 3 files changed, 139 deletions(-) delete mode 100644 sdk/src/main/java/network/xyo/client/archivist/api/XyoArchivistApiClient.kt delete mode 100644 sdk/src/main/java/network/xyo/client/archivist/api/XyoArchivistApiConfig.kt diff --git a/sdk/src/main/java/network/xyo/client/XyoPanel.kt b/sdk/src/main/java/network/xyo/client/XyoPanel.kt index 1a12c14..90004f2 100644 --- a/sdk/src/main/java/network/xyo/client/XyoPanel.kt +++ b/sdk/src/main/java/network/xyo/client/XyoPanel.kt @@ -7,9 +7,6 @@ import androidx.annotation.RequiresApi import kotlinx.coroutines.launch import network.xyo.client.account.Account import network.xyo.client.account.model.AccountInstance -import network.xyo.client.archivist.api.PostBoundWitnessesResult -import network.xyo.client.archivist.api.XyoArchivistApiClient -import network.xyo.client.archivist.api.XyoArchivistApiConfig import network.xyo.client.archivist.wrapper.ArchivistWrapper import network.xyo.client.boundwitness.XyoBoundWitnessBuilder import network.xyo.client.boundwitness.XyoBoundWitnessJson @@ -23,35 +20,11 @@ data class XyoPanelReportQueryResult(val bw: XyoBoundWitnessJson, val apiResults class XyoPanel( val context: Context, val account: AccountInstance, - private val archivists: List?, private val witnesses: List>?, private val nodeUrlsAndAccounts: ArrayList>? ) { private var nodes: MutableList? = null - @Deprecated("use constructors without deprecated archive field") - constructor( - context: Context, - account: AccountInstance, - archive: String? = null, - apiDomain: String? = null, - witnesses: List>? = null - ) : - this( - context, - account, - listOf( - XyoArchivistApiClient.get( - XyoArchivistApiConfig( - archive ?: DefaultArchive, - apiDomain ?: DefaultApiDomain - ) - ) - ), - witnesses, - null - ) - constructor( context: Context, account: AccountInstance, @@ -61,14 +34,6 @@ class XyoPanel( ): this( context, account, - listOf( - XyoArchivistApiClient.get( - XyoArchivistApiConfig( - DefaultArchive, - DefaultApiDomain - ) - ) - ), witnesses, nodeUrlsAndAccounts ) diff --git a/sdk/src/main/java/network/xyo/client/archivist/api/XyoArchivistApiClient.kt b/sdk/src/main/java/network/xyo/client/archivist/api/XyoArchivistApiClient.kt deleted file mode 100644 index 7f771d2..0000000 --- a/sdk/src/main/java/network/xyo/client/archivist/api/XyoArchivistApiClient.kt +++ /dev/null @@ -1,98 +0,0 @@ -package network.xyo.client.archivist.api - -import android.util.Log -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.suspendCancellableCoroutine -import kotlinx.coroutines.withContext -import network.xyo.client.boundwitness.XyoBoundWitnessJson -import okhttp3.MediaType.Companion.toMediaType -import okhttp3.OkHttpClient -import okhttp3.Request -import okhttp3.RequestBody.Companion.toRequestBody -import okio.IOException - -import network.xyo.client.XyoSerializable -import network.xyo.client.payload.XyoPayload - -@Deprecated("Use PostQueryResult instead") -open class PostBoundWitnessesResult ( - val count: Int, - val errors: ArrayList? = null - ): XyoSerializable() - -@Deprecated("Use NodeClient instead") -open class XyoArchivistApiClient(private val config: XyoArchivistApiConfig) { - - private val okHttp = OkHttpClient() - - val authenticated: Boolean - get() { - return this.token != null - } - - var token: String? - get() { - return this.config.token - } - set(value) { - this.config.token = value - } - - @ExperimentalCoroutinesApi - private suspend fun postBoundWitnessesAsync ( - entries: List - ): PostBoundWitnessesResult { - val bodyString = XyoSerializable.toJson(entries) - val apiDomain = config.apiDomain - val archive = config.archive - - val request = Request.Builder() - .url("$apiDomain/archive/$archive/block") - .post(bodyString.toRequestBody(MEDIA_TYPE_JSON)) - .build() - - return withContext(Dispatchers.IO) { - return@withContext suspendCancellableCoroutine { continuation -> - try { - okHttp.newCall(request).execute().use { response -> - if (!response.isSuccessful) { - continuation.resume( - PostBoundWitnessesResult( - 0, - arrayListOf(Error(response.message)) - ) - ) { cause, _, _ -> null?.let { it(cause) } } - } else { - continuation.resume(PostBoundWitnessesResult(1)) { cause, _, _ -> - Log.w("postBoundWitnessesAsync", cause) - } - } - } - } catch (ex: IOException) { - Log.e("xyoClient", ex.message ?: ex.toString()) - continuation.resume( - PostBoundWitnessesResult( - 0, - arrayListOf(Error(ex.message)) - ) - ) { cause, _, _ -> Log.w("postBoundWitnessesAsync", cause) } - } - } - } - } - - @kotlinx.coroutines.ExperimentalCoroutinesApi - suspend fun postBoundWitnessAsync( - entry: XyoBoundWitnessJson - ): PostBoundWitnessesResult { - return postBoundWitnessesAsync(listOf(entry)) - } - - companion object { - val MEDIA_TYPE_JSON = "application/json; charset=utf-8".toMediaType() - fun get(config: XyoArchivistApiConfig): XyoArchivistApiClient { - return XyoArchivistApiClient(config) - } - } -} \ No newline at end of file diff --git a/sdk/src/main/java/network/xyo/client/archivist/api/XyoArchivistApiConfig.kt b/sdk/src/main/java/network/xyo/client/archivist/api/XyoArchivistApiConfig.kt deleted file mode 100644 index 2e81740..0000000 --- a/sdk/src/main/java/network/xyo/client/archivist/api/XyoArchivistApiConfig.kt +++ /dev/null @@ -1,6 +0,0 @@ -package network.xyo.client.archivist.api - -import network.xyo.client.XyoApiConfig - -@Deprecated("Use NodeClient.class instead") -class XyoArchivistApiConfig(val archive: String, apiDomain: String, token: String? = null): XyoApiConfig(apiDomain, token) \ No newline at end of file From 416088dacac47d5c0bd2fcb7185ca1d163c04324 Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:06:36 -0500 Subject: [PATCH 03/12] remove remaining deprecated reporting methods and ApiConfig --- .../java/network/xyo/client/XyoApiConfig.kt | 4 --- .../main/java/network/xyo/client/XyoPanel.kt | 27 +------------------ 2 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 sdk/src/main/java/network/xyo/client/XyoApiConfig.kt diff --git a/sdk/src/main/java/network/xyo/client/XyoApiConfig.kt b/sdk/src/main/java/network/xyo/client/XyoApiConfig.kt deleted file mode 100644 index 289a6e2..0000000 --- a/sdk/src/main/java/network/xyo/client/XyoApiConfig.kt +++ /dev/null @@ -1,4 +0,0 @@ -package network.xyo.client - -@Deprecated("Use NodeClient.class instead") -open class XyoApiConfig(val apiDomain: String, var token: String? = null) \ No newline at end of file diff --git a/sdk/src/main/java/network/xyo/client/XyoPanel.kt b/sdk/src/main/java/network/xyo/client/XyoPanel.kt index 90004f2..1a8ff71 100644 --- a/sdk/src/main/java/network/xyo/client/XyoPanel.kt +++ b/sdk/src/main/java/network/xyo/client/XyoPanel.kt @@ -4,8 +4,6 @@ import android.content.Context import android.os.Build import android.util.Log import androidx.annotation.RequiresApi -import kotlinx.coroutines.launch -import network.xyo.client.account.Account import network.xyo.client.account.model.AccountInstance import network.xyo.client.archivist.wrapper.ArchivistWrapper import network.xyo.client.boundwitness.XyoBoundWitnessBuilder @@ -28,7 +26,6 @@ class XyoPanel( constructor( context: Context, account: AccountInstance, - // ArrayList to not cause compiler confusion with other class constructor signatures nodeUrlsAndAccounts: ArrayList>, witnesses: List>? = null ): this( @@ -45,8 +42,8 @@ class XyoPanel( ): this( context, account, - arrayListOf(Pair("$DefaultApiDomain/Archivist", Account.random())), listOf(XyoWitness(observe)), + null, ) fun resolveNodes(resetNodes: Boolean = false) { @@ -63,23 +60,6 @@ class XyoPanel( } } - @kotlinx.coroutines.ExperimentalCoroutinesApi - suspend fun eventAsyncQuery(event: String): XyoPanelReportQueryResult { - val adhocWitnessList = listOf( - XyoWitness({ - _, -> listOf(XyoEventPayload(event)) - }) - ) - return reportAsyncQuery(adhocWitnessList) - } - - @kotlinx.coroutines.ExperimentalCoroutinesApi - fun reportQuery(adhocWitnesses: List> = emptyList()) { - xyoScope.launch { - reportAsyncQuery(adhocWitnesses) - } - } - private suspend fun generateBoundWitnessJson(): XyoBoundWitnessJson { val payloads = generatePayloads() return XyoBoundWitnessBuilder(context) @@ -117,9 +97,4 @@ class XyoPanel( } return XyoPanelReportQueryResult(bw, results, payloads) } - - companion object { - const val DefaultApiDomain = "https://api.archivist.xyo.network" - const val DefaultArchive = "temp" - } } \ No newline at end of file From 80053c81438101f446b6045b926e82002eaab72d Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:07:53 -0500 Subject: [PATCH 04/12] migrate hasPermission to lib --- sdk/src/main/java/network/xyo/client/{ => lib}/hasPermission.kt | 2 +- .../xyo/client/witness/system/info/XyoSystemInfoNetworkWifi.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename sdk/src/main/java/network/xyo/client/{ => lib}/hasPermission.kt (94%) diff --git a/sdk/src/main/java/network/xyo/client/hasPermission.kt b/sdk/src/main/java/network/xyo/client/lib/hasPermission.kt similarity index 94% rename from sdk/src/main/java/network/xyo/client/hasPermission.kt rename to sdk/src/main/java/network/xyo/client/lib/hasPermission.kt index f2bab16..3ca706a 100644 --- a/sdk/src/main/java/network/xyo/client/hasPermission.kt +++ b/sdk/src/main/java/network/xyo/client/lib/hasPermission.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.lib import android.content.Context import android.content.pm.PackageManager diff --git a/sdk/src/main/java/network/xyo/client/witness/system/info/XyoSystemInfoNetworkWifi.kt b/sdk/src/main/java/network/xyo/client/witness/system/info/XyoSystemInfoNetworkWifi.kt index dede49b..869025a 100644 --- a/sdk/src/main/java/network/xyo/client/witness/system/info/XyoSystemInfoNetworkWifi.kt +++ b/sdk/src/main/java/network/xyo/client/witness/system/info/XyoSystemInfoNetworkWifi.kt @@ -12,7 +12,7 @@ import android.net.wifi.WifiInfo import android.os.Build import androidx.annotation.RequiresApi import com.squareup.moshi.JsonClass -import network.xyo.client.hasPermission +import network.xyo.client.lib.hasPermission import java.net.NetworkInterface import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit From dff94055287cb9f6324266ca88bb8eb073c41c1a Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:08:33 -0500 Subject: [PATCH 05/12] migrate XyoWitness to witness package --- sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt | 1 + sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt | 1 + sdk/src/main/java/network/xyo/client/XyoPanel.kt | 1 + .../main/java/network/xyo/client/{ => witness}/XyoWitness.kt | 2 +- .../xyo/client/witness/location/info/XyoLocationWitness.kt | 4 ++-- .../xyo/client/witness/system/info/XyoSystemInfoWitness.kt | 2 +- 6 files changed, 7 insertions(+), 4 deletions(-) rename sdk/src/main/java/network/xyo/client/{ => witness}/XyoWitness.kt (97%) diff --git a/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt b/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt index d9b61ae..bbbd13a 100644 --- a/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt @@ -11,6 +11,7 @@ import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessJson import network.xyo.client.datastore.previous_hash_store.PreviousHashStorePrefsRepository import network.xyo.client.payload.XyoPayload +import network.xyo.client.witness.XyoWitness import network.xyo.client.witness.location.info.LocationActivity import network.xyo.client.witness.location.info.XyoLocationWitness import network.xyo.client.witness.system.info.XyoSystemInfoPayload diff --git a/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt b/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt index d97ffa8..9e8373b 100644 --- a/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt @@ -9,6 +9,7 @@ import kotlinx.coroutines.launch import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessBuilder import network.xyo.client.payload.XyoPayload +import network.xyo.client.witness.XyoWitness import org.junit.Before import org.junit.Rule import org.junit.Test diff --git a/sdk/src/main/java/network/xyo/client/XyoPanel.kt b/sdk/src/main/java/network/xyo/client/XyoPanel.kt index 1a8ff71..78e3ab7 100644 --- a/sdk/src/main/java/network/xyo/client/XyoPanel.kt +++ b/sdk/src/main/java/network/xyo/client/XyoPanel.kt @@ -11,6 +11,7 @@ import network.xyo.client.boundwitness.XyoBoundWitnessJson import network.xyo.client.node.client.NodeClient import network.xyo.client.node.client.PostQueryResult import network.xyo.client.payload.XyoPayload +import network.xyo.client.witness.XyoWitness data class XyoPanelReportQueryResult(val bw: XyoBoundWitnessJson, val apiResults: List?, val payloads: List?) diff --git a/sdk/src/main/java/network/xyo/client/XyoWitness.kt b/sdk/src/main/java/network/xyo/client/witness/XyoWitness.kt similarity index 97% rename from sdk/src/main/java/network/xyo/client/XyoWitness.kt rename to sdk/src/main/java/network/xyo/client/witness/XyoWitness.kt index 59050d7..226716c 100644 --- a/sdk/src/main/java/network/xyo/client/XyoWitness.kt +++ b/sdk/src/main/java/network/xyo/client/witness/XyoWitness.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.witness import android.content.Context import android.os.Build diff --git a/sdk/src/main/java/network/xyo/client/witness/location/info/XyoLocationWitness.kt b/sdk/src/main/java/network/xyo/client/witness/location/info/XyoLocationWitness.kt index 9cd33be..5dc4c81 100644 --- a/sdk/src/main/java/network/xyo/client/witness/location/info/XyoLocationWitness.kt +++ b/sdk/src/main/java/network/xyo/client/witness/location/info/XyoLocationWitness.kt @@ -4,8 +4,8 @@ import android.content.Context import android.os.Build import android.util.Log import androidx.annotation.RequiresApi -import network.xyo.client.DeferredObserver -import network.xyo.client.XyoWitness +import network.xyo.client.witness.DeferredObserver +import network.xyo.client.witness.XyoWitness import network.xyo.client.account.Account import network.xyo.client.account.model.AccountInstance import network.xyo.client.payload.XyoPayload diff --git a/sdk/src/main/java/network/xyo/client/witness/system/info/XyoSystemInfoWitness.kt b/sdk/src/main/java/network/xyo/client/witness/system/info/XyoSystemInfoWitness.kt index 1193cee..783e364 100644 --- a/sdk/src/main/java/network/xyo/client/witness/system/info/XyoSystemInfoWitness.kt +++ b/sdk/src/main/java/network/xyo/client/witness/system/info/XyoSystemInfoWitness.kt @@ -3,7 +3,7 @@ package network.xyo.client.witness.system.info import android.content.Context import android.os.Build import androidx.annotation.RequiresApi -import network.xyo.client.XyoWitness +import network.xyo.client.witness.XyoWitness import network.xyo.client.account.Account import network.xyo.client.account.model.AccountInstance From 4a1d562c058aac661458571c7217ffc4f4a3ce24 Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:08:57 -0500 Subject: [PATCH 06/12] migrate XyoClientCoroutineScope to lib --- .../xyo/client/datastore/accounts/AccountPrefsRepository.kt | 2 +- .../previous_hash_store/PreviousHashStorePrefsRepository.kt | 2 +- .../network/xyo/client/{ => lib}/XyoClientCoroutineScope.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename sdk/src/main/java/network/xyo/client/{ => lib}/XyoClientCoroutineScope.kt (94%) diff --git a/sdk/src/main/java/network/xyo/client/datastore/accounts/AccountPrefsRepository.kt b/sdk/src/main/java/network/xyo/client/datastore/accounts/AccountPrefsRepository.kt index 10e5e3f..905094a 100644 --- a/sdk/src/main/java/network/xyo/client/datastore/accounts/AccountPrefsRepository.kt +++ b/sdk/src/main/java/network/xyo/client/datastore/accounts/AccountPrefsRepository.kt @@ -13,7 +13,7 @@ import network.xyo.client.account.model.AccountInstance import network.xyo.client.settings.AccountPreferences import network.xyo.client.settings.SettingsInterface import network.xyo.client.settings.defaultXyoSdkSettings -import network.xyo.client.xyoScope +import network.xyo.client.lib.xyoScope class AccountPrefsRepository(context: Context, settings: SettingsInterface = defaultXyoSdkSettings) { diff --git a/sdk/src/main/java/network/xyo/client/datastore/previous_hash_store/PreviousHashStorePrefsRepository.kt b/sdk/src/main/java/network/xyo/client/datastore/previous_hash_store/PreviousHashStorePrefsRepository.kt index 2bb4e88..b1f212c 100644 --- a/sdk/src/main/java/network/xyo/client/datastore/previous_hash_store/PreviousHashStorePrefsRepository.kt +++ b/sdk/src/main/java/network/xyo/client/datastore/previous_hash_store/PreviousHashStorePrefsRepository.kt @@ -9,7 +9,7 @@ import network.xyo.client.account.model.PreviousHashStore import network.xyo.client.settings.PreviousHashStorePreferences import network.xyo.client.settings.SettingsInterface import network.xyo.client.settings.defaultXyoSdkSettings -import network.xyo.client.xyoScope +import network.xyo.client.lib.xyoScope import network.xyo.data.PreviousHashPrefsDataStoreProtos.PreviousHashPrefsDataStore diff --git a/sdk/src/main/java/network/xyo/client/XyoClientCoroutineScope.kt b/sdk/src/main/java/network/xyo/client/lib/XyoClientCoroutineScope.kt similarity index 94% rename from sdk/src/main/java/network/xyo/client/XyoClientCoroutineScope.kt rename to sdk/src/main/java/network/xyo/client/lib/XyoClientCoroutineScope.kt index 1b52e64..d67d8b6 100644 --- a/sdk/src/main/java/network/xyo/client/XyoClientCoroutineScope.kt +++ b/sdk/src/main/java/network/xyo/client/lib/XyoClientCoroutineScope.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.lib import kotlinx.coroutines.* import kotlin.coroutines.CoroutineContext From 68c02466f8cfb85546eb9de3e6903fbafad952a2 Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:09:20 -0500 Subject: [PATCH 07/12] migrate XyoSerializable to lib --- .../java/network/xyo/client/XyoBoundWitnessTest.kt | 1 + sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt | 1 + .../xyo/client/boundwitness/QueryBoundWitnessBuilder.kt | 2 +- .../xyo/client/boundwitness/XyoBoundWitnessBodyJson.kt | 1 - .../network/xyo/client/boundwitness/XyoBoundWitnessBuilder.kt | 2 +- .../main/java/network/xyo/client/{ => lib}/XyoSerializable.kt | 4 ++-- .../main/java/network/xyo/client/node/client/NodeClient.kt | 2 +- .../java/network/xyo/client/node/client/PostQueryResult.kt | 2 +- sdk/src/main/java/network/xyo/client/payload/XyoPayload.kt | 2 +- .../xyo/client/witness/location/info/XyoLocationCurrent.kt | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) rename sdk/src/main/java/network/xyo/client/{ => lib}/XyoSerializable.kt (98%) diff --git a/sdk/src/androidTest/java/network/xyo/client/XyoBoundWitnessTest.kt b/sdk/src/androidTest/java/network/xyo/client/XyoBoundWitnessTest.kt index d7a2c22..a9b2053 100644 --- a/sdk/src/androidTest/java/network/xyo/client/XyoBoundWitnessTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/XyoBoundWitnessTest.kt @@ -8,6 +8,7 @@ import kotlinx.coroutines.runBlocking import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessBuilder import network.xyo.client.datastore.previous_hash_store.PreviousHashStorePrefsRepository +import network.xyo.client.lib.XyoSerializable import network.xyo.client.node.client.NodeClient import network.xyo.client.payload.XyoPayload import org.junit.Before diff --git a/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt b/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt index 9e8373b..65247a1 100644 --- a/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt @@ -8,6 +8,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessBuilder +import network.xyo.client.lib.XyoSerializable import network.xyo.client.payload.XyoPayload import network.xyo.client.witness.XyoWitness import org.junit.Before diff --git a/sdk/src/main/java/network/xyo/client/boundwitness/QueryBoundWitnessBuilder.kt b/sdk/src/main/java/network/xyo/client/boundwitness/QueryBoundWitnessBuilder.kt index d485e65..ef24213 100644 --- a/sdk/src/main/java/network/xyo/client/boundwitness/QueryBoundWitnessBuilder.kt +++ b/sdk/src/main/java/network/xyo/client/boundwitness/QueryBoundWitnessBuilder.kt @@ -3,7 +3,7 @@ package network.xyo.client.boundwitness import android.content.Context import android.os.Build import androidx.annotation.RequiresApi -import network.xyo.client.XyoSerializable +import network.xyo.client.lib.XyoSerializable import network.xyo.client.account.model.AccountInstance import network.xyo.client.payload.XyoPayload diff --git a/sdk/src/main/java/network/xyo/client/boundwitness/XyoBoundWitnessBodyJson.kt b/sdk/src/main/java/network/xyo/client/boundwitness/XyoBoundWitnessBodyJson.kt index 1c96be6..492091e 100644 --- a/sdk/src/main/java/network/xyo/client/boundwitness/XyoBoundWitnessBodyJson.kt +++ b/sdk/src/main/java/network/xyo/client/boundwitness/XyoBoundWitnessBodyJson.kt @@ -1,7 +1,6 @@ package network.xyo.client.boundwitness import com.squareup.moshi.JsonClass -import network.xyo.client.XyoSerializable import network.xyo.client.payload.XyoPayload @JsonClass(generateAdapter = true) diff --git a/sdk/src/main/java/network/xyo/client/boundwitness/XyoBoundWitnessBuilder.kt b/sdk/src/main/java/network/xyo/client/boundwitness/XyoBoundWitnessBuilder.kt index f5bfd63..644fb0f 100644 --- a/sdk/src/main/java/network/xyo/client/boundwitness/XyoBoundWitnessBuilder.kt +++ b/sdk/src/main/java/network/xyo/client/boundwitness/XyoBoundWitnessBuilder.kt @@ -3,7 +3,7 @@ package network.xyo.client.boundwitness import android.content.Context import android.os.Build import androidx.annotation.RequiresApi -import network.xyo.client.XyoSerializable +import network.xyo.client.lib.XyoSerializable import network.xyo.client.account.hexStringToByteArray import network.xyo.client.account.model.AccountInstance import network.xyo.client.datastore.previous_hash_store.PreviousHashStorePrefsRepository diff --git a/sdk/src/main/java/network/xyo/client/XyoSerializable.kt b/sdk/src/main/java/network/xyo/client/lib/XyoSerializable.kt similarity index 98% rename from sdk/src/main/java/network/xyo/client/XyoSerializable.kt rename to sdk/src/main/java/network/xyo/client/lib/XyoSerializable.kt index c1cef29..1720f18 100644 --- a/sdk/src/main/java/network/xyo/client/XyoSerializable.kt +++ b/sdk/src/main/java/network/xyo/client/lib/XyoSerializable.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.lib import com.squareup.moshi.Moshi import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory @@ -69,7 +69,7 @@ abstract class XyoSerializable: Serializable { .addLast(KotlinJsonAdapterFactory()) .build() val adapter = moshi.adapter(obj.first().javaClass) - val items = obj.map {item -> sortJson(adapter.toJson(item), removeMeta)} + val items = obj.map {item -> sortJson(adapter.toJson(item), removeMeta) } return items.joinToString(",", "[", "]") } diff --git a/sdk/src/main/java/network/xyo/client/node/client/NodeClient.kt b/sdk/src/main/java/network/xyo/client/node/client/NodeClient.kt index 648a0f6..df9fdda 100644 --- a/sdk/src/main/java/network/xyo/client/node/client/NodeClient.kt +++ b/sdk/src/main/java/network/xyo/client/node/client/NodeClient.kt @@ -8,7 +8,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.withContext -import network.xyo.client.XyoSerializable +import network.xyo.client.lib.XyoSerializable import network.xyo.client.account.Account import network.xyo.client.account.model.AccountInstance import network.xyo.client.boundwitness.QueryBoundWitnessBuilder diff --git a/sdk/src/main/java/network/xyo/client/node/client/PostQueryResult.kt b/sdk/src/main/java/network/xyo/client/node/client/PostQueryResult.kt index 39fec6d..f270708 100644 --- a/sdk/src/main/java/network/xyo/client/node/client/PostQueryResult.kt +++ b/sdk/src/main/java/network/xyo/client/node/client/PostQueryResult.kt @@ -1,6 +1,6 @@ package network.xyo.client.node.client -import network.xyo.client.XyoSerializable +import network.xyo.client.lib.XyoSerializable class PostQueryResult( val response: QueryResponseWrapper?, diff --git a/sdk/src/main/java/network/xyo/client/payload/XyoPayload.kt b/sdk/src/main/java/network/xyo/client/payload/XyoPayload.kt index 7b7e399..f175f88 100644 --- a/sdk/src/main/java/network/xyo/client/payload/XyoPayload.kt +++ b/sdk/src/main/java/network/xyo/client/payload/XyoPayload.kt @@ -1,7 +1,7 @@ package network.xyo.client.payload import com.squareup.moshi.JsonClass -import network.xyo.client.XyoSerializable +import network.xyo.client.lib.XyoSerializable open class XyoException(message: String): Throwable(message) open class XyoValidationException(message: String): XyoException(message) diff --git a/sdk/src/main/java/network/xyo/client/witness/location/info/XyoLocationCurrent.kt b/sdk/src/main/java/network/xyo/client/witness/location/info/XyoLocationCurrent.kt index 3c8bb22..23a9b26 100644 --- a/sdk/src/main/java/network/xyo/client/witness/location/info/XyoLocationCurrent.kt +++ b/sdk/src/main/java/network/xyo/client/witness/location/info/XyoLocationCurrent.kt @@ -9,7 +9,7 @@ import androidx.annotation.RequiresApi import com.google.android.gms.location.LocationServices import com.squareup.moshi.JsonClass import kotlinx.coroutines.suspendCancellableCoroutine -import network.xyo.client.XyoSerializable +import network.xyo.client.lib.XyoSerializable import kotlin.coroutines.resumeWithException @JsonClass(generateAdapter = true) From 9b25369d4cb35e95fe12bce60fc69722a72279fa Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:11:24 -0500 Subject: [PATCH 08/12] migrate XyoEventPayload to test package --- .../java/network/xyo/client/XyoEventPayload.kt | 0 sdk/src/main/java/network/xyo/client/XyoPanel.kt | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename sdk/src/{main => androidTest}/java/network/xyo/client/XyoEventPayload.kt (100%) diff --git a/sdk/src/main/java/network/xyo/client/XyoEventPayload.kt b/sdk/src/androidTest/java/network/xyo/client/XyoEventPayload.kt similarity index 100% rename from sdk/src/main/java/network/xyo/client/XyoEventPayload.kt rename to sdk/src/androidTest/java/network/xyo/client/XyoEventPayload.kt diff --git a/sdk/src/main/java/network/xyo/client/XyoPanel.kt b/sdk/src/main/java/network/xyo/client/XyoPanel.kt index 78e3ab7..8c08368 100644 --- a/sdk/src/main/java/network/xyo/client/XyoPanel.kt +++ b/sdk/src/main/java/network/xyo/client/XyoPanel.kt @@ -39,7 +39,7 @@ class XyoPanel( constructor( context: Context, account: AccountInstance, - observe: ((context: Context) -> List?)? + observe: ((context: Context) -> List?)? ): this( context, account, From c0d0cdd1614911ff76f860d90775b7130500cc54 Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:14:43 -0500 Subject: [PATCH 09/12] migrate XyoPanel to witness package --- sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt | 1 + .../network/xyo/client/prefs/AccountPrefsRepositoryTest.kt | 2 +- .../androidTest/java/network/xyo/client/settings/XyoSdkTest.kt | 2 +- sdk/src/main/java/network/xyo/client/{ => witness}/XyoPanel.kt | 3 +-- .../java/network/xyo/client/witness/location/info/Handler.kt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename sdk/src/main/java/network/xyo/client/{ => witness}/XyoPanel.kt (97%) diff --git a/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt b/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt index bbbd13a..1aa0cb3 100644 --- a/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt @@ -11,6 +11,7 @@ import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessJson import network.xyo.client.datastore.previous_hash_store.PreviousHashStorePrefsRepository import network.xyo.client.payload.XyoPayload +import network.xyo.client.witness.XyoPanel import network.xyo.client.witness.XyoWitness import network.xyo.client.witness.location.info.LocationActivity import network.xyo.client.witness.location.info.XyoLocationWitness diff --git a/sdk/src/androidTest/java/network/xyo/client/prefs/AccountPrefsRepositoryTest.kt b/sdk/src/androidTest/java/network/xyo/client/prefs/AccountPrefsRepositoryTest.kt index 1bc6ba0..cab38da 100644 --- a/sdk/src/androidTest/java/network/xyo/client/prefs/AccountPrefsRepositoryTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/prefs/AccountPrefsRepositoryTest.kt @@ -4,7 +4,7 @@ import android.content.Context import androidx.test.platform.app.InstrumentationRegistry import kotlinx.coroutines.runBlocking import network.xyo.client.TestConstants -import network.xyo.client.XyoPanel +import network.xyo.client.witness.XyoPanel import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessBuilder import network.xyo.client.datastore.accounts.AccountPrefsRepository diff --git a/sdk/src/androidTest/java/network/xyo/client/settings/XyoSdkTest.kt b/sdk/src/androidTest/java/network/xyo/client/settings/XyoSdkTest.kt index f32b294..0c442d2 100644 --- a/sdk/src/androidTest/java/network/xyo/client/settings/XyoSdkTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/settings/XyoSdkTest.kt @@ -5,7 +5,7 @@ import androidx.test.platform.app.InstrumentationRegistry import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import network.xyo.client.XyoEventPayload -import network.xyo.client.XyoPanel +import network.xyo.client.witness.XyoPanel import network.xyo.client.account.model.AccountInstance import org.junit.Before import org.junit.Test diff --git a/sdk/src/main/java/network/xyo/client/XyoPanel.kt b/sdk/src/main/java/network/xyo/client/witness/XyoPanel.kt similarity index 97% rename from sdk/src/main/java/network/xyo/client/XyoPanel.kt rename to sdk/src/main/java/network/xyo/client/witness/XyoPanel.kt index 8c08368..e0b5611 100644 --- a/sdk/src/main/java/network/xyo/client/XyoPanel.kt +++ b/sdk/src/main/java/network/xyo/client/witness/XyoPanel.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.witness import android.content.Context import android.os.Build @@ -11,7 +11,6 @@ import network.xyo.client.boundwitness.XyoBoundWitnessJson import network.xyo.client.node.client.NodeClient import network.xyo.client.node.client.PostQueryResult import network.xyo.client.payload.XyoPayload -import network.xyo.client.witness.XyoWitness data class XyoPanelReportQueryResult(val bw: XyoBoundWitnessJson, val apiResults: List?, val payloads: List?) diff --git a/sdk/src/main/java/network/xyo/client/witness/location/info/Handler.kt b/sdk/src/main/java/network/xyo/client/witness/location/info/Handler.kt index 9286b08..8f303d6 100644 --- a/sdk/src/main/java/network/xyo/client/witness/location/info/Handler.kt +++ b/sdk/src/main/java/network/xyo/client/witness/location/info/Handler.kt @@ -8,7 +8,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.withContext import network.xyo.client.witness.types.WitnessHandlerInterface import network.xyo.client.witness.types.WitnessResult -import network.xyo.client.XyoPanel +import network.xyo.client.witness.XyoPanel import network.xyo.client.account.model.AccountInstance import network.xyo.client.boundwitness.XyoBoundWitnessBodyJson import network.xyo.client.payload.XyoPayload From 08cde354455340a20709b8598d071b2b5fe56ad9 Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:18:52 -0500 Subject: [PATCH 10/12] migrate elliptical curve files to package --- sdk/src/main/java/network/xyo/client/{ => ec}/EcConstants.kt | 2 +- sdk/src/main/java/network/xyo/client/{ => ec}/EcCurve.kt | 2 +- sdk/src/main/java/network/xyo/client/{ => ec}/EcPoint.kt | 2 +- sdk/src/main/java/network/xyo/client/{ => ec}/EcPointMath.kt | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename sdk/src/main/java/network/xyo/client/{ => ec}/EcConstants.kt (91%) rename sdk/src/main/java/network/xyo/client/{ => ec}/EcCurve.kt (99%) rename sdk/src/main/java/network/xyo/client/{ => ec}/EcPoint.kt (95%) rename sdk/src/main/java/network/xyo/client/{ => ec}/EcPointMath.kt (94%) diff --git a/sdk/src/main/java/network/xyo/client/EcConstants.kt b/sdk/src/main/java/network/xyo/client/ec/EcConstants.kt similarity index 91% rename from sdk/src/main/java/network/xyo/client/EcConstants.kt rename to sdk/src/main/java/network/xyo/client/ec/EcConstants.kt index bc52eb6..f60aca8 100644 --- a/sdk/src/main/java/network/xyo/client/EcConstants.kt +++ b/sdk/src/main/java/network/xyo/client/ec/EcConstants.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.ec import java.math.BigInteger diff --git a/sdk/src/main/java/network/xyo/client/EcCurve.kt b/sdk/src/main/java/network/xyo/client/ec/EcCurve.kt similarity index 99% rename from sdk/src/main/java/network/xyo/client/EcCurve.kt rename to sdk/src/main/java/network/xyo/client/ec/EcCurve.kt index ed5ddda..a73fad2 100644 --- a/sdk/src/main/java/network/xyo/client/EcCurve.kt +++ b/sdk/src/main/java/network/xyo/client/ec/EcCurve.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.ec import java.math.BigInteger import java.security.spec.ECFieldFp diff --git a/sdk/src/main/java/network/xyo/client/EcPoint.kt b/sdk/src/main/java/network/xyo/client/ec/EcPoint.kt similarity index 95% rename from sdk/src/main/java/network/xyo/client/EcPoint.kt rename to sdk/src/main/java/network/xyo/client/ec/EcPoint.kt index 3dbcfbc..63a5f46 100644 --- a/sdk/src/main/java/network/xyo/client/EcPoint.kt +++ b/sdk/src/main/java/network/xyo/client/ec/EcPoint.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.ec import java.math.BigInteger import java.security.spec.ECPoint diff --git a/sdk/src/main/java/network/xyo/client/EcPointMath.kt b/sdk/src/main/java/network/xyo/client/ec/EcPointMath.kt similarity index 94% rename from sdk/src/main/java/network/xyo/client/EcPointMath.kt rename to sdk/src/main/java/network/xyo/client/ec/EcPointMath.kt index 416fac5..ed15277 100644 --- a/sdk/src/main/java/network/xyo/client/EcPointMath.kt +++ b/sdk/src/main/java/network/xyo/client/ec/EcPointMath.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.ec import java.math.BigInteger @@ -39,7 +39,7 @@ object EcPointMath { * @return The slope of the tangent line at the point */ fun tangent (point: EcPoint, curve: EcCurve) : BigInteger { - return divide(point.affineX * point.affineX*EcConstants.THREE+curve.a, point.affineY * EcConstants.TWO, curve.p) + return divide(point.affineX * point.affineX* EcConstants.THREE +curve.a, point.affineY * EcConstants.TWO, curve.p) } /** From 85222727a5b76afb4ef6c8935ebaf1e274fcae96 Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:19:11 -0500 Subject: [PATCH 11/12] move tests into package that mirror sdk package layout --- .../{ => boundwitness}/XyoBoundWitnessTest.kt | 17 ++++++++++++----- .../network/xyo/client/{ => lib}/Constants.kt | 2 +- .../client/{ => node/client}/NodeClientTest.kt | 7 ++++--- .../client}/QueryResponseWrapperTest.kt | 4 ++-- .../xyo/client/{ => payload}/XyoEventPayload.kt | 3 +-- .../xyo/client/{ => payload}/XyoPayloadTest.kt | 5 +++-- .../client/prefs/AccountPrefsRepositoryTest.kt | 2 +- .../PreviousHashStorePrefsRepositoryTest.kt | 2 +- .../network/xyo/client/settings/XyoSdkTest.kt | 2 +- .../witness/WitnessLocationHandlerTest.kt | 2 +- .../xyo/client/{ => witness}/XyoPanelTest.kt | 7 ++++--- 11 files changed, 31 insertions(+), 22 deletions(-) rename sdk/src/androidTest/java/network/xyo/client/{ => boundwitness}/XyoBoundWitnessTest.kt (88%) rename sdk/src/androidTest/java/network/xyo/client/{ => lib}/Constants.kt (98%) rename sdk/src/androidTest/java/network/xyo/client/{ => node/client}/NodeClientTest.kt (95%) rename sdk/src/androidTest/java/network/xyo/client/{ => node/client}/QueryResponseWrapperTest.kt (83%) rename sdk/src/androidTest/java/network/xyo/client/{ => payload}/XyoEventPayload.kt (76%) rename sdk/src/androidTest/java/network/xyo/client/{ => payload}/XyoPayloadTest.kt (96%) rename sdk/src/androidTest/java/network/xyo/client/{ => witness}/XyoPanelTest.kt (96%) diff --git a/sdk/src/androidTest/java/network/xyo/client/XyoBoundWitnessTest.kt b/sdk/src/androidTest/java/network/xyo/client/boundwitness/XyoBoundWitnessTest.kt similarity index 88% rename from sdk/src/androidTest/java/network/xyo/client/XyoBoundWitnessTest.kt rename to sdk/src/androidTest/java/network/xyo/client/boundwitness/XyoBoundWitnessTest.kt index a9b2053..0643d5d 100644 --- a/sdk/src/androidTest/java/network/xyo/client/XyoBoundWitnessTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/boundwitness/XyoBoundWitnessTest.kt @@ -1,12 +1,13 @@ -package network.xyo.client +package network.xyo.client.boundwitness import android.content.Context import androidx.test.platform.app.InstrumentationRegistry import androidx.test.rule.GrantPermissionRule import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking +import network.xyo.client.payload.TestPayload1 import network.xyo.client.account.Account -import network.xyo.client.boundwitness.XyoBoundWitnessBuilder +import network.xyo.client.node.client.DiscoverPayload import network.xyo.client.datastore.previous_hash_store.PreviousHashStorePrefsRepository import network.xyo.client.lib.XyoSerializable import network.xyo.client.node.client.NodeClient @@ -72,7 +73,9 @@ class XyoBoundWitnessTest { @Test fun testBoundWitnessHash() { runBlocking { - val bw = XyoBoundWitnessBuilder(appContext).signer(Account.random()).payloads(listOf(TestPayload1())).build() + val bw = XyoBoundWitnessBuilder(appContext).signer(Account.random()).payloads(listOf( + TestPayload1() + )).build() val hashableFields = bw.getBodyJson() assert(bw._hash !== null) assert(bw._hash!! == XyoSerializable.sha256String(hashableFields)) @@ -84,8 +87,12 @@ class XyoBoundWitnessTest { fun testBoundWitnessPreviousHash() { runBlocking { val testAccount = Account.random() - val bw = XyoBoundWitnessBuilder(appContext).signer(testAccount).payloads(listOf(TestPayload1())).build() - val bw2 = XyoBoundWitnessBuilder(appContext).signer(testAccount).payloads(listOf(TestPayload1())).build() + val bw = XyoBoundWitnessBuilder(appContext).signer(testAccount).payloads(listOf( + TestPayload1() + )).build() + val bw2 = XyoBoundWitnessBuilder(appContext).signer(testAccount).payloads(listOf( + TestPayload1() + )).build() assert(bw2.previous_hashes.first() == bw._hash) } } diff --git a/sdk/src/androidTest/java/network/xyo/client/Constants.kt b/sdk/src/androidTest/java/network/xyo/client/lib/Constants.kt similarity index 98% rename from sdk/src/androidTest/java/network/xyo/client/Constants.kt rename to sdk/src/androidTest/java/network/xyo/client/lib/Constants.kt index 6f0435a..22143c2 100644 --- a/sdk/src/androidTest/java/network/xyo/client/Constants.kt +++ b/sdk/src/androidTest/java/network/xyo/client/lib/Constants.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.lib import network.xyo.client.account.Account import network.xyo.client.payload.XyoPayload diff --git a/sdk/src/androidTest/java/network/xyo/client/NodeClientTest.kt b/sdk/src/androidTest/java/network/xyo/client/node/client/NodeClientTest.kt similarity index 95% rename from sdk/src/androidTest/java/network/xyo/client/NodeClientTest.kt rename to sdk/src/androidTest/java/network/xyo/client/node/client/NodeClientTest.kt index f648600..7467451 100644 --- a/sdk/src/androidTest/java/network/xyo/client/NodeClientTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/node/client/NodeClientTest.kt @@ -1,12 +1,12 @@ -package network.xyo.client +package network.xyo.client.node.client import android.content.Context import androidx.test.platform.app.InstrumentationRegistry import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking +import network.xyo.client.lib.TestConstants import network.xyo.client.account.Account import network.xyo.client.archivist.wrapper.ArchivistWrapper -import network.xyo.client.node.client.NodeClient import network.xyo.client.payload.XyoPayload import org.junit.Before import org.junit.Test @@ -57,7 +57,8 @@ class NodeClientTest { @Test fun archivistInsertTest() { - val archivist = ArchivistWrapper(NodeClient(apiDomainBeta, TestConstants.TestAccount, appContext)) + val archivist = ArchivistWrapper(NodeClient(apiDomainBeta, + TestConstants.TestAccount, appContext)) val payloads = arrayListOf(TestConstants.debugPayload) diff --git a/sdk/src/androidTest/java/network/xyo/client/QueryResponseWrapperTest.kt b/sdk/src/androidTest/java/network/xyo/client/node/client/QueryResponseWrapperTest.kt similarity index 83% rename from sdk/src/androidTest/java/network/xyo/client/QueryResponseWrapperTest.kt rename to sdk/src/androidTest/java/network/xyo/client/node/client/QueryResponseWrapperTest.kt index c3beccd..269c469 100644 --- a/sdk/src/androidTest/java/network/xyo/client/QueryResponseWrapperTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/node/client/QueryResponseWrapperTest.kt @@ -1,6 +1,6 @@ -package network.xyo.client +package network.xyo.client.node.client -import network.xyo.client.node.client.QueryResponseWrapper +import network.xyo.client.lib.TestConstants import org.junit.Test import org.junit.jupiter.api.Assertions.* diff --git a/sdk/src/androidTest/java/network/xyo/client/XyoEventPayload.kt b/sdk/src/androidTest/java/network/xyo/client/payload/XyoEventPayload.kt similarity index 76% rename from sdk/src/androidTest/java/network/xyo/client/XyoEventPayload.kt rename to sdk/src/androidTest/java/network/xyo/client/payload/XyoEventPayload.kt index 4c74153..96c852e 100644 --- a/sdk/src/androidTest/java/network/xyo/client/XyoEventPayload.kt +++ b/sdk/src/androidTest/java/network/xyo/client/payload/XyoEventPayload.kt @@ -1,7 +1,6 @@ -package network.xyo.client +package network.xyo.client.payload import com.squareup.moshi.JsonClass -import network.xyo.client.payload.XyoPayload import java.util.* @JsonClass(generateAdapter = true) diff --git a/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt b/sdk/src/androidTest/java/network/xyo/client/payload/XyoPayloadTest.kt similarity index 96% rename from sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt rename to sdk/src/androidTest/java/network/xyo/client/payload/XyoPayloadTest.kt index 65247a1..d4ff0ca 100644 --- a/sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/payload/XyoPayloadTest.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.payload import android.content.Context import androidx.test.platform.app.InstrumentationRegistry @@ -6,10 +6,11 @@ import androidx.test.rule.GrantPermissionRule import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import network.xyo.client.lib.BasicPayload +import network.xyo.client.lib.TestConstants import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessBuilder import network.xyo.client.lib.XyoSerializable -import network.xyo.client.payload.XyoPayload import network.xyo.client.witness.XyoWitness import org.junit.Before import org.junit.Rule diff --git a/sdk/src/androidTest/java/network/xyo/client/prefs/AccountPrefsRepositoryTest.kt b/sdk/src/androidTest/java/network/xyo/client/prefs/AccountPrefsRepositoryTest.kt index cab38da..9538518 100644 --- a/sdk/src/androidTest/java/network/xyo/client/prefs/AccountPrefsRepositoryTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/prefs/AccountPrefsRepositoryTest.kt @@ -3,7 +3,7 @@ package network.xyo.client.prefs import android.content.Context import androidx.test.platform.app.InstrumentationRegistry import kotlinx.coroutines.runBlocking -import network.xyo.client.TestConstants +import network.xyo.client.lib.TestConstants import network.xyo.client.witness.XyoPanel import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessBuilder diff --git a/sdk/src/androidTest/java/network/xyo/client/prefs/PreviousHashStorePrefsRepositoryTest.kt b/sdk/src/androidTest/java/network/xyo/client/prefs/PreviousHashStorePrefsRepositoryTest.kt index 48c0f5d..3600bf2 100644 --- a/sdk/src/androidTest/java/network/xyo/client/prefs/PreviousHashStorePrefsRepositoryTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/prefs/PreviousHashStorePrefsRepositoryTest.kt @@ -3,7 +3,7 @@ package network.xyo.client.prefs import android.content.Context import androidx.test.platform.app.InstrumentationRegistry import kotlinx.coroutines.runBlocking -import network.xyo.client.TestConstants +import network.xyo.client.lib.TestConstants import network.xyo.client.account.Account import network.xyo.client.account.hexStringToByteArray import network.xyo.client.datastore.previous_hash_store.PreviousHashStorePrefsRepository diff --git a/sdk/src/androidTest/java/network/xyo/client/settings/XyoSdkTest.kt b/sdk/src/androidTest/java/network/xyo/client/settings/XyoSdkTest.kt index 0c442d2..63fbf06 100644 --- a/sdk/src/androidTest/java/network/xyo/client/settings/XyoSdkTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/settings/XyoSdkTest.kt @@ -4,7 +4,7 @@ import android.content.Context import androidx.test.platform.app.InstrumentationRegistry import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking -import network.xyo.client.XyoEventPayload +import network.xyo.client.payload.XyoEventPayload import network.xyo.client.witness.XyoPanel import network.xyo.client.account.model.AccountInstance import org.junit.Before diff --git a/sdk/src/androidTest/java/network/xyo/client/witness/WitnessLocationHandlerTest.kt b/sdk/src/androidTest/java/network/xyo/client/witness/WitnessLocationHandlerTest.kt index 64644fc..ac2d535 100644 --- a/sdk/src/androidTest/java/network/xyo/client/witness/WitnessLocationHandlerTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/witness/WitnessLocationHandlerTest.kt @@ -7,7 +7,7 @@ import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.platform.app.InstrumentationRegistry import androidx.test.rule.GrantPermissionRule import kotlinx.coroutines.runBlocking -import network.xyo.client.TestConstants +import network.xyo.client.lib.TestConstants import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessBodyJson import network.xyo.client.datastore.previous_hash_store.PreviousHashStorePrefsRepository diff --git a/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt b/sdk/src/androidTest/java/network/xyo/client/witness/XyoPanelTest.kt similarity index 96% rename from sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt rename to sdk/src/androidTest/java/network/xyo/client/witness/XyoPanelTest.kt index 1aa0cb3..f6a91e3 100644 --- a/sdk/src/androidTest/java/network/xyo/client/XyoPanelTest.kt +++ b/sdk/src/androidTest/java/network/xyo/client/witness/XyoPanelTest.kt @@ -1,4 +1,4 @@ -package network.xyo.client +package network.xyo.client.witness import android.Manifest import android.content.Context @@ -7,12 +7,13 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.rule.GrantPermissionRule import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking +import network.xyo.client.lib.BasicPayload +import network.xyo.client.lib.TestConstants +import network.xyo.client.payload.XyoEventPayload import network.xyo.client.account.Account import network.xyo.client.boundwitness.XyoBoundWitnessJson import network.xyo.client.datastore.previous_hash_store.PreviousHashStorePrefsRepository import network.xyo.client.payload.XyoPayload -import network.xyo.client.witness.XyoPanel -import network.xyo.client.witness.XyoWitness import network.xyo.client.witness.location.info.LocationActivity import network.xyo.client.witness.location.info.XyoLocationWitness import network.xyo.client.witness.system.info.XyoSystemInfoPayload From 851dcc2465a8c93bc8535df178614f01cf624780 Mon Sep 17 00:00:00 2001 From: Matt Jones <885417+jonesmac@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:20:18 -0500 Subject: [PATCH 12/12] remove unused test constant --- sdk/src/androidTest/java/network/xyo/client/lib/Constants.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/src/androidTest/java/network/xyo/client/lib/Constants.kt b/sdk/src/androidTest/java/network/xyo/client/lib/Constants.kt index 22143c2..bc01136 100644 --- a/sdk/src/androidTest/java/network/xyo/client/lib/Constants.kt +++ b/sdk/src/androidTest/java/network/xyo/client/lib/Constants.kt @@ -26,6 +26,5 @@ class TestConstants { const val nodeUrlBeta = "https://beta.api.archivist.xyo.network" const val queryResponseJson = "{\"data\":[{\"addresses\":[\"cddaa9e8922142dfd53e5067f5b9e5de5c2ea0cf\",\"6cfeb02624f01112892e02f18a5e3409ae0a0739\"],\"payload_hashes\":[\"09a4dda042973bcb69f7a7f63a8a79763760e0e2ca9b0d486d7edf72ac2288be\"],\"payload_schemas\":[\"network.xyo.boundwitness\"],\"previous_hashes\":[\"09a4dda042973bcb69f7a7f63a8a79763760e0e2ca9b0d486d7edf72ac2288be\",null],\"schema\":\"network.xyo.boundwitness\",\"timestamp\":1682101895916,\"_signatures\":[\"5c94a98e2da7a4d3750c54c6a3a539900d7722c49419555f0563227876fc7eb3c67718b20bce7ba84913754557eea1a7864a1bc60aa5de5184f1e711a5b54637\",\"02910768ebb01049ccc10e957cbc70c32b71d1891bee66dcb71bedee284f796ca82c791e0efd361d49b34c10afce2aecacf9f27655c3496c91a83f5ad6ed8398\"]},[{\"addresses\":[\"cddaa9e8922142dfd53e5067f5b9e5de5c2ea0cf\"],\"payload_hashes\":[\"a83df3b9d9e92a391d6e172817762a90f1f6ca19da226e7a4679284d6af91f9b\",\"89dafadc4fa4249d73fce1bae21fe14ecff36175564fcbb8dc343982402f4d7e\",\"3cef5677c2f800d6603cebebab17e1cb459e086b81a50fd8d154a5dd5f279d2d\"],\"payload_schemas\":[\"network.xyo.boundwitness\",\"network.xyo.system.info\",\"network.xyo.query.archivist.insert\"],\"previous_hashes\":[null],\"schema\":\"network.xyo.boundwitness\",\"timestamp\":1682101895915,\"_signatures\":[\"5cd4359570fd0273f79a9181c3345aa034481e62c01e6f29e29861eeb167fbf0c2451fc9096c2c9d99b2a5e1ad3e53318fb6a47647fb083842cc82ead6d7c58c\"]}]],\"meta\":{\"profile\":{\"duration\":37,\"endTime\":1682101895919,\"startTime\":1682101895882}}}" const val queryResponseBWHash = "eb5bcbf881e5f91f8b10bb360bcb660b6e70b9ed429ac3c5c0f9b74150b59a07" - const val panelBwHash = "09a4dda042973bcb69f7a7f63a8a79763760e0e2ca9b0d486d7edf72ac2288be" } }