diff --git a/example/build.gradle b/example/build.gradle index 8d53208..3c67ea2 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -32,8 +32,7 @@ android { } dependencies { - implementation project(path: ':fcl-android') - + implementation project(path: ':fcl') implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'com.google.android.material:material:1.3.0' diff --git a/fcl-android/.gitignore b/fcl/.gitignore similarity index 100% rename from fcl-android/.gitignore rename to fcl/.gitignore diff --git a/fcl-android/build.gradle b/fcl/build.gradle similarity index 100% rename from fcl-android/build.gradle rename to fcl/build.gradle diff --git a/fcl-android/consumer-rules.pro b/fcl/consumer-rules.pro similarity index 100% rename from fcl-android/consumer-rules.pro rename to fcl/consumer-rules.pro diff --git a/fcl-android/proguard-rules.pro b/fcl/proguard-rules.pro similarity index 100% rename from fcl-android/proguard-rules.pro rename to fcl/proguard-rules.pro diff --git a/fcl-android/src/androidTest/java/io/outblock/fcl/ExampleInstrumentedTest.kt b/fcl/src/androidTest/java/io/outblock/fcl/ExampleInstrumentedTest.kt similarity index 94% rename from fcl-android/src/androidTest/java/io/outblock/fcl/ExampleInstrumentedTest.kt rename to fcl/src/androidTest/java/io/outblock/fcl/ExampleInstrumentedTest.kt index b7ac60b..da83fc8 100644 --- a/fcl-android/src/androidTest/java/io/outblock/fcl/ExampleInstrumentedTest.kt +++ b/fcl/src/androidTest/java/io/outblock/fcl/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package io.outblock.fcl -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * diff --git a/fcl-android/src/main/AndroidManifest.xml b/fcl/src/main/AndroidManifest.xml similarity index 100% rename from fcl-android/src/main/AndroidManifest.xml rename to fcl/src/main/AndroidManifest.xml diff --git a/fcl-android/src/main/java/io/outblock/fcl/Fcl.kt b/fcl/src/main/java/io/outblock/fcl/Fcl.kt similarity index 99% rename from fcl-android/src/main/java/io/outblock/fcl/Fcl.kt rename to fcl/src/main/java/io/outblock/fcl/Fcl.kt index 311e54a..2a5110d 100644 --- a/fcl-android/src/main/java/io/outblock/fcl/Fcl.kt +++ b/fcl/src/main/java/io/outblock/fcl/Fcl.kt @@ -161,7 +161,6 @@ object Fcl { fun verifyAccountProof(includeDomainTag: Boolean = false): FclResult { assert(Thread.currentThread() != Looper.getMainLooper().thread) { "can't call this method in main thread." } - return processResult { runBlocking { AccountProofRequest().request(includeDomainTag) } } diff --git a/fcl-android/src/main/java/io/outblock/fcl/FlowApi.kt b/fcl/src/main/java/io/outblock/fcl/FlowApi.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/FlowApi.kt rename to fcl/src/main/java/io/outblock/fcl/FlowApi.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/cadence/Cadences.kt b/fcl/src/main/java/io/outblock/fcl/cadence/Cadences.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/cadence/Cadences.kt rename to fcl/src/main/java/io/outblock/fcl/cadence/Cadences.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/config/Config.kt b/fcl/src/main/java/io/outblock/fcl/config/Config.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/config/Config.kt rename to fcl/src/main/java/io/outblock/fcl/config/Config.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/lifecycle/FCLContentProvider.kt b/fcl/src/main/java/io/outblock/fcl/lifecycle/FCLContentProvider.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/lifecycle/FCLContentProvider.kt rename to fcl/src/main/java/io/outblock/fcl/lifecycle/FCLContentProvider.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/lifecycle/LifecycleObserver.kt b/fcl/src/main/java/io/outblock/fcl/lifecycle/LifecycleObserver.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/lifecycle/LifecycleObserver.kt rename to fcl/src/main/java/io/outblock/fcl/lifecycle/LifecycleObserver.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/models/FclResult.kt b/fcl/src/main/java/io/outblock/fcl/models/FclResult.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/models/FclResult.kt rename to fcl/src/main/java/io/outblock/fcl/models/FclResult.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/models/Signable.kt b/fcl/src/main/java/io/outblock/fcl/models/Signable.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/models/Signable.kt rename to fcl/src/main/java/io/outblock/fcl/models/Signable.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/models/response/PollingResponse.kt b/fcl/src/main/java/io/outblock/fcl/models/response/PollingResponse.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/models/response/PollingResponse.kt rename to fcl/src/main/java/io/outblock/fcl/models/response/PollingResponse.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/models/response/ResponseStatus.kt b/fcl/src/main/java/io/outblock/fcl/models/response/ResponseStatus.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/models/response/ResponseStatus.kt rename to fcl/src/main/java/io/outblock/fcl/models/response/ResponseStatus.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/provider/Provider.kt b/fcl/src/main/java/io/outblock/fcl/provider/Provider.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/provider/Provider.kt rename to fcl/src/main/java/io/outblock/fcl/provider/Provider.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/AccountProofRequest.kt b/fcl/src/main/java/io/outblock/fcl/request/AccountProofRequest.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/AccountProofRequest.kt rename to fcl/src/main/java/io/outblock/fcl/request/AccountProofRequest.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/AuthnRequest.kt b/fcl/src/main/java/io/outblock/fcl/request/AuthnRequest.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/AuthnRequest.kt rename to fcl/src/main/java/io/outblock/fcl/request/AuthnRequest.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/AuthzRequest.kt b/fcl/src/main/java/io/outblock/fcl/request/AuthzRequest.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/AuthzRequest.kt rename to fcl/src/main/java/io/outblock/fcl/request/AuthzRequest.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/SignMessageRequest.kt b/fcl/src/main/java/io/outblock/fcl/request/SignMessageRequest.kt similarity index 94% rename from fcl-android/src/main/java/io/outblock/fcl/request/SignMessageRequest.kt rename to fcl/src/main/java/io/outblock/fcl/request/SignMessageRequest.kt index 8a3163e..e537eff 100644 --- a/fcl-android/src/main/java/io/outblock/fcl/request/SignMessageRequest.kt +++ b/fcl/src/main/java/io/outblock/fcl/request/SignMessageRequest.kt @@ -11,6 +11,7 @@ import io.outblock.fcl.utils.FclException internal class SignMessageRequest { suspend fun request(message: String): SignMessageResponse { + Fcl.currentUser ?: throw FclException(FclError.unauthenticated) val service = Fcl.currentUser?.services?.first { it.type == FCLServiceType.userSignature.value } ?: throw FclException(FclError.invaildService) diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/builder/FclBuilder.kt b/fcl/src/main/java/io/outblock/fcl/request/builder/FclBuilder.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/builder/FclBuilder.kt rename to fcl/src/main/java/io/outblock/fcl/request/builder/FclBuilder.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/resolver/AccountsResolver.kt b/fcl/src/main/java/io/outblock/fcl/request/resolver/AccountsResolver.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/resolver/AccountsResolver.kt rename to fcl/src/main/java/io/outblock/fcl/request/resolver/AccountsResolver.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/resolver/CadenceResolver.kt b/fcl/src/main/java/io/outblock/fcl/request/resolver/CadenceResolver.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/resolver/CadenceResolver.kt rename to fcl/src/main/java/io/outblock/fcl/request/resolver/CadenceResolver.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/resolver/RefBlockResolver.kt b/fcl/src/main/java/io/outblock/fcl/request/resolver/RefBlockResolver.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/resolver/RefBlockResolver.kt rename to fcl/src/main/java/io/outblock/fcl/request/resolver/RefBlockResolver.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/resolver/Resolver.kt b/fcl/src/main/java/io/outblock/fcl/request/resolver/Resolver.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/resolver/Resolver.kt rename to fcl/src/main/java/io/outblock/fcl/request/resolver/Resolver.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/resolver/SequenceNumberResolver.kt b/fcl/src/main/java/io/outblock/fcl/request/resolver/SequenceNumberResolver.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/resolver/SequenceNumberResolver.kt rename to fcl/src/main/java/io/outblock/fcl/request/resolver/SequenceNumberResolver.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/request/resolver/SignatureResolver.kt b/fcl/src/main/java/io/outblock/fcl/request/resolver/SignatureResolver.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/request/resolver/SignatureResolver.kt rename to fcl/src/main/java/io/outblock/fcl/request/resolver/SignatureResolver.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/strategies/HttpPostRpc.kt b/fcl/src/main/java/io/outblock/fcl/strategies/HttpPostRpc.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/strategies/HttpPostRpc.kt rename to fcl/src/main/java/io/outblock/fcl/strategies/HttpPostRpc.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/strategies/Strategies.kt b/fcl/src/main/java/io/outblock/fcl/strategies/Strategies.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/strategies/Strategies.kt rename to fcl/src/main/java/io/outblock/fcl/strategies/Strategies.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/Utils.kt b/fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/Utils.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/Utils.kt rename to fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/Utils.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnect.kt b/fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnect.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnect.kt rename to fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnect.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectDappDelegate.kt b/fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectDappDelegate.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectDappDelegate.kt rename to fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectDappDelegate.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectHook.kt b/fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectHook.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectHook.kt rename to fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectHook.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectMethod.kt b/fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectMethod.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectMethod.kt rename to fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectMethod.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectSession.kt b/fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectSession.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectSession.kt rename to fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WalletConnectSession.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WcRpc.kt b/fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WcRpc.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/strategies/walletconnect/WcRpc.kt rename to fcl/src/main/java/io/outblock/fcl/strategies/walletconnect/WcRpc.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/ContextUtils.kt b/fcl/src/main/java/io/outblock/fcl/utils/ContextUtils.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/utils/ContextUtils.kt rename to fcl/src/main/java/io/outblock/fcl/utils/ContextUtils.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/CoroutineUtils.kt b/fcl/src/main/java/io/outblock/fcl/utils/CoroutineUtils.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/utils/CoroutineUtils.kt rename to fcl/src/main/java/io/outblock/fcl/utils/CoroutineUtils.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/FclError.kt b/fcl/src/main/java/io/outblock/fcl/utils/FclError.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/utils/FclError.kt rename to fcl/src/main/java/io/outblock/fcl/utils/FclError.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/FclExtensions.kt b/fcl/src/main/java/io/outblock/fcl/utils/FclExtensions.kt similarity index 84% rename from fcl-android/src/main/java/io/outblock/fcl/utils/FclExtensions.kt rename to fcl/src/main/java/io/outblock/fcl/utils/FclExtensions.kt index e2e82c0..2ca42a0 100644 --- a/fcl-android/src/main/java/io/outblock/fcl/utils/FclExtensions.kt +++ b/fcl/src/main/java/io/outblock/fcl/utils/FclExtensions.kt @@ -1,5 +1,6 @@ package io.outblock.fcl.utils +import android.os.Looper import androidx.annotation.WorkerThread import com.nftco.flow.sdk.FlowBlock import com.nftco.flow.sdk.bytesToHex @@ -18,6 +19,9 @@ fun Fcl.getLatestBlock(sealed: Boolean = true): FlowBlock { @WorkerThread fun Fcl.verifyUserSignature(message: String, signatures: List): Boolean { + assert(Thread.currentThread() != Looper.getMainLooper().thread) { "can't call this method in main thread." } + currentUser ?: throw FclException(FclError.unauthenticated) + val result = query { cadence(CADENCE_VERIFY_USER_SIGNATURE) arg { address(signatures.firstOrNull()?.address.orEmpty()) } diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/FlowFieldUtils.kt b/fcl/src/main/java/io/outblock/fcl/utils/FlowFieldUtils.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/utils/FlowFieldUtils.kt rename to fcl/src/main/java/io/outblock/fcl/utils/FlowFieldUtils.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/JsonUtils.kt b/fcl/src/main/java/io/outblock/fcl/utils/JsonUtils.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/utils/JsonUtils.kt rename to fcl/src/main/java/io/outblock/fcl/utils/JsonUtils.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/Log.kt b/fcl/src/main/java/io/outblock/fcl/utils/Log.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/utils/Log.kt rename to fcl/src/main/java/io/outblock/fcl/utils/Log.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/SignableUtils.kt b/fcl/src/main/java/io/outblock/fcl/utils/SignableUtils.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/utils/SignableUtils.kt rename to fcl/src/main/java/io/outblock/fcl/utils/SignableUtils.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/StringExtensions.kt b/fcl/src/main/java/io/outblock/fcl/utils/StringExtensions.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/utils/StringExtensions.kt rename to fcl/src/main/java/io/outblock/fcl/utils/StringExtensions.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/utils/parse/FclResultParse.kt b/fcl/src/main/java/io/outblock/fcl/utils/parse/FclResultParse.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/utils/parse/FclResultParse.kt rename to fcl/src/main/java/io/outblock/fcl/utils/parse/FclResultParse.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/webview/FCLWebView.kt b/fcl/src/main/java/io/outblock/fcl/webview/FCLWebView.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/webview/FCLWebView.kt rename to fcl/src/main/java/io/outblock/fcl/webview/FCLWebView.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/webview/WebViewActivity.kt b/fcl/src/main/java/io/outblock/fcl/webview/WebViewActivity.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/webview/WebViewActivity.kt rename to fcl/src/main/java/io/outblock/fcl/webview/WebViewActivity.kt diff --git a/fcl-android/src/main/java/io/outblock/fcl/webview/WebViewUtils.kt b/fcl/src/main/java/io/outblock/fcl/webview/WebViewUtils.kt similarity index 100% rename from fcl-android/src/main/java/io/outblock/fcl/webview/WebViewUtils.kt rename to fcl/src/main/java/io/outblock/fcl/webview/WebViewUtils.kt diff --git a/fcl-android/src/main/res/values/themes.xml b/fcl/src/main/res/values/themes.xml similarity index 94% rename from fcl-android/src/main/res/values/themes.xml rename to fcl/src/main/res/values/themes.xml index 4470ba3..e9c1ae4 100644 --- a/fcl-android/src/main/res/values/themes.xml +++ b/fcl/src/main/res/values/themes.xml @@ -1,6 +1,6 @@ - - + + +