From 90c6a94b45e218d703c31b085b5648a4b1dfc858 Mon Sep 17 00:00:00 2001 From: kubel Date: Mon, 23 Sep 2024 12:05:25 +0200 Subject: [PATCH 1/4] Update universal links --- .../GetSamplesWalletsUseCaseInterface.kt | 34 +++++++++++++------ sample/dapp/build.gradle.kts | 6 ++-- sample/dapp/src/main/AndroidManifest.xml | 2 +- .../com/reown/sample/dapp/DappSampleApp.kt | 4 +-- .../chain_selection/ChainSelectionRoute.kt | 6 ++-- sample/modal/build.gradle.kts | 6 ++-- sample/modal/src/main/AndroidManifest.xml | 3 +- .../com/reown/sample/modal/AppKitApp.kt | 2 +- sample/wallet/build.gradle.kts | 6 ++-- sample/wallet/src/main/AndroidManifest.xml | 2 +- .../sample/wallet/WalletKitApplication.kt | 2 +- 11 files changed, 44 insertions(+), 29 deletions(-) diff --git a/core/android/src/main/kotlin/com/reown/android/internal/common/modal/domain/usecase/GetSamplesWalletsUseCaseInterface.kt b/core/android/src/main/kotlin/com/reown/android/internal/common/modal/domain/usecase/GetSamplesWalletsUseCaseInterface.kt index 41cd42757..f2720afb7 100644 --- a/core/android/src/main/kotlin/com/reown/android/internal/common/modal/domain/usecase/GetSamplesWalletsUseCaseInterface.kt +++ b/core/android/src/main/kotlin/com/reown/android/internal/common/modal/domain/usecase/GetSamplesWalletsUseCaseInterface.kt @@ -16,7 +16,8 @@ internal class GetSampleWalletsUseCase( "com.reown.sample.wallet.debug" to SampleWalletDebug, "com.reown.sample.wallet.internal" to SampleWalletInternal, "com.reown.sample.wallet" to SampleWalletRelease, - "com.walletconnect.web3wallet.rnsample.internal" to RNSampleWallet, + "com.walletconnect.web3wallet.rnsample.internal" to RNSampleWalletInternal, + "com.walletconnect.web3wallet.rnsample" to RNSampleWallet, "com.walletconnect.flutterwallet" to FLSampleWallet, "com.walletconnect.flutterwallet.internal" to FLSampleWalletInternal ) @@ -39,7 +40,7 @@ private val SampleWalletDebug = Wallet( mobileLink = "kotlin-web3wallet://", playStore = null, webAppLink = null, - linkMode = "https://dev.lab.web3modal.com/wallet_debug", + linkMode = "https://appkit-lab.reown.com/wallet_debug", true ) @@ -52,7 +53,7 @@ private val SampleWalletInternal = Wallet( mobileLink = "kotlin-web3wallet://", playStore = null, webAppLink = null, - linkMode = "https://dev.lab.web3modal.com/wallet_internal", + linkMode = "https://appkit-lab.reown.com/wallet_internal", true ) @@ -65,11 +66,11 @@ private val SampleWalletRelease = Wallet( mobileLink = "kotlin-web3wallet://", playStore = null, webAppLink = null, - linkMode = "https://dev.lab.web3modal.com/wallet_release", + linkMode = "https://appkit-lab.reown.com/wallet_release", true ) -private val RNSampleWallet = Wallet( +private val RNSampleWalletInternal = Wallet( id = "RNSampleWallet", name = "RN Sample", homePage = "https://walletconnect.com", @@ -78,7 +79,20 @@ private val RNSampleWallet = Wallet( mobileLink = "rn-web3wallet://", playStore = null, webAppLink = null, - linkMode = "https://lab.web3modal.com/rn_walletkit", + linkMode = "https://appkit-lab.reown.com/rn_walletkit_internal", + true +) + +private val RNSampleWallet = Wallet( + id = "RNSampleWalletInternal", + name = "RN Sample Internal", + homePage = "https://walletconnect.com", + imageUrl = "https://raw.githubusercontent.com/WalletConnect/WalletConnectKotlinV2/develop/sample/wallet/src/main/res/drawable-xxxhdpi/wc_icon.png", + order = "5", + mobileLink = "rn-web3wallet://", + playStore = null, + webAppLink = null, + linkMode = "https://appkit-lab.reown.com/rn_walletkit", true ) @@ -87,11 +101,11 @@ private val FLSampleWallet = Wallet( name = "FL Sample", homePage = "https://walletconnect.com", imageUrl = "https://raw.githubusercontent.com/WalletConnect/WalletConnectKotlinV2/develop/sample/wallet/src/main/res/drawable-xxxhdpi/wc_icon.png", - order = "5", + order = "6", mobileLink = "wcflutterwallet://", playStore = null, webAppLink = null, - linkMode = "https://lab.web3modal.com/flutter_walletkit", + linkMode = "https://appkit-lab.reown.com/flutter_walletkit", true ) @@ -100,10 +114,10 @@ private val FLSampleWalletInternal = Wallet( name = "FL Sample Internal", homePage = "https://walletconnect.com", imageUrl = "https://raw.githubusercontent.com/WalletConnect/WalletConnectKotlinV2/develop/sample/wallet/src/main/res/drawable-xxxhdpi/wc_icon.png", - order = "6", + order = "7", mobileLink = "wcflutterwallet-internal://", playStore = null, webAppLink = null, - linkMode = "https://dev.lab.web3modal.com/flutter_walletkit_internal", + linkMode = "https://appkit-lab.reown.com/flutter_walletkit_internal", true ) \ No newline at end of file diff --git a/sample/dapp/build.gradle.kts b/sample/dapp/build.gradle.kts index 1cf769692..cd66a3b40 100644 --- a/sample/dapp/build.gradle.kts +++ b/sample/dapp/build.gradle.kts @@ -29,18 +29,18 @@ android { buildTypes { getByName("release") { manifestPlaceholders["pathPrefix"] = "/dapp_release" - buildConfigField("String", "DAPP_APP_LINK", "\"https://dev.lab.web3modal.com/dapp_release\"") + buildConfigField("String", "DAPP_APP_LINK", "\"https://appkit-lab.reown.com/dapp_release\"") } getByName("internal") { manifestPlaceholders["pathPrefix"] = "/dapp_internal" - buildConfigField("String", "DAPP_APP_LINK", "\"https://dev.lab.web3modal.com/dapp_internal\"") + buildConfigField("String", "DAPP_APP_LINK", "\"https://appkit-lab.reown.com/dapp_internal\"") } getByName("debug") { manifestPlaceholders["pathPrefix"] = "/dapp_debug" - buildConfigField("String", "DAPP_APP_LINK", "\"https://dev.lab.web3modal.com/dapp_debug\"") + buildConfigField("String", "DAPP_APP_LINK", "\"https://appkit-lab.reown.com/dapp_debug\"") } } diff --git a/sample/dapp/src/main/AndroidManifest.xml b/sample/dapp/src/main/AndroidManifest.xml index 1aac7378d..30deb794c 100644 --- a/sample/dapp/src/main/AndroidManifest.xml +++ b/sample/dapp/src/main/AndroidManifest.xml @@ -47,7 +47,7 @@ diff --git a/sample/dapp/src/main/kotlin/com/reown/sample/dapp/DappSampleApp.kt b/sample/dapp/src/main/kotlin/com/reown/sample/dapp/DappSampleApp.kt index 1315a7bef..c1b8fc2a8 100644 --- a/sample/dapp/src/main/kotlin/com/reown/sample/dapp/DappSampleApp.kt +++ b/sample/dapp/src/main/kotlin/com/reown/sample/dapp/DappSampleApp.kt @@ -24,7 +24,7 @@ class DappSampleApp : Application() { val appMetaData = Core.Model.AppMetaData( name = "Kotlin Dapp", description = "Kotlin Dapp Implementation", - url = "https://dev.lab.web3modal.com", + url = "https://appkit-lab.reown.com", icons = listOf("https://gblobscdn.gitbook.com/spaces%2F-LJJeCjcLrr53DcT1Ml7%2Favatar.png?alt=media"), redirect = "kotlin-dapp-wc://request", appLink = BuildConfig.DAPP_APP_LINK, @@ -44,7 +44,7 @@ class DappSampleApp : Application() { } AppKit.setChains(AppKitChainsPresets.ethChains.values.toList()) -// + // val authParams = Modal.Model.AuthPayloadParams( // chains = AppKitChainsPresets.ethChains.values.toList().map { it.id }, // domain = "sample.kotlin.modal", diff --git a/sample/dapp/src/main/kotlin/com/reown/sample/dapp/ui/routes/composable_routes/chain_selection/ChainSelectionRoute.kt b/sample/dapp/src/main/kotlin/com/reown/sample/dapp/ui/routes/composable_routes/chain_selection/ChainSelectionRoute.kt index 19d5f16a4..57d83200d 100644 --- a/sample/dapp/src/main/kotlin/com/reown/sample/dapp/ui/routes/composable_routes/chain_selection/ChainSelectionRoute.kt +++ b/sample/dapp/src/main/kotlin/com/reown/sample/dapp/ui/routes/composable_routes/chain_selection/ChainSelectionRoute.kt @@ -271,9 +271,9 @@ private fun ChainSelectionScreen( text = "1-CA Link Mode (Kotlin Sample Wallet)", onClick = { val applink = when { - context.packageManager.isPackageInstalled(SAMPLE_WALLET_DEBUG_PACKAGE) -> "https://dev.lab.web3modal.com/wallet_debug" - context.packageManager.isPackageInstalled(SAMPLE_WALLET_INTERNAL_PACKAGE) -> "https://dev.lab.web3modal.com/wallet_internal" - context.packageManager.isPackageInstalled(SAMPLE_WALLET_RELEASE_PACKAGE) -> "https://dev.lab.web3modal.com/wallet_release" + context.packageManager.isPackageInstalled(SAMPLE_WALLET_DEBUG_PACKAGE) -> "https://appkit-lab.reown.com/wallet_debug" + context.packageManager.isPackageInstalled(SAMPLE_WALLET_INTERNAL_PACKAGE) -> "https://appkit-lab.reown.com/wallet_internal" + context.packageManager.isPackageInstalled(SAMPLE_WALLET_RELEASE_PACKAGE) -> "https://appkit-lab.reown.com/wallet_release" else -> "" } onAuthenticateLinkMode(applink) diff --git a/sample/modal/build.gradle.kts b/sample/modal/build.gradle.kts index ac9c78032..5d87656cf 100644 --- a/sample/modal/build.gradle.kts +++ b/sample/modal/build.gradle.kts @@ -28,18 +28,18 @@ android { buildTypes { getByName("release") { manifestPlaceholders["pathPrefix"] = "/lab_release" - buildConfigField("String", "LAB_APP_LINK", "\"https://dev.lab.web3modal.com/lab_release\"") + buildConfigField("String", "LAB_APP_LINK", "\"https://appkit-lab.reown.com/lab_release\"") } getByName("internal") { manifestPlaceholders["pathPrefix"] = "/lab_internal" - buildConfigField("String", "LAB_APP_LINK", "\"https://dev.lab.web3modal.com/lab_internal\"") + buildConfigField("String", "LAB_APP_LINK", "\"https://appkit-lab.reown.com/lab_internal\"") } getByName("debug") { manifestPlaceholders["pathPrefix"] = "/lab_debug" - buildConfigField("String", "LAB_APP_LINK", "\"https://dev.lab.web3modal.com/lab_debug\"") + buildConfigField("String", "LAB_APP_LINK", "\"https://appkit-lab.reown.com/lab_debug\"") } } diff --git a/sample/modal/src/main/AndroidManifest.xml b/sample/modal/src/main/AndroidManifest.xml index 34a43b4e0..9dd512e6a 100644 --- a/sample/modal/src/main/AndroidManifest.xml +++ b/sample/modal/src/main/AndroidManifest.xml @@ -48,6 +48,7 @@ + @@ -77,7 +78,7 @@ diff --git a/sample/modal/src/main/kotlin/com/reown/sample/modal/AppKitApp.kt b/sample/modal/src/main/kotlin/com/reown/sample/modal/AppKitApp.kt index 185be13f8..55607647d 100644 --- a/sample/modal/src/main/kotlin/com/reown/sample/modal/AppKitApp.kt +++ b/sample/modal/src/main/kotlin/com/reown/sample/modal/AppKitApp.kt @@ -24,7 +24,7 @@ class AppKitApp : Application() { val appMetaData = Core.Model.AppMetaData( name = "AppKit Lab Sample", description = "Kotlin AppKit Lab Sample", - url = "https://dev.lab.web3modal.com", + url = "https://appkit-lab.reown.com", icons = listOf("https://gblobscdn.gitbook.com/spaces%2F-LJJeCjcLrr53DcT1Ml7%2Favatar.png?alt=media"), redirect = "kotlin-modal-wc://request", linkMode = true, diff --git a/sample/wallet/build.gradle.kts b/sample/wallet/build.gradle.kts index 8ebdab27e..c835b4d95 100644 --- a/sample/wallet/build.gradle.kts +++ b/sample/wallet/build.gradle.kts @@ -28,18 +28,18 @@ android { buildTypes { getByName("release") { manifestPlaceholders["pathPrefix"] = "/wallet_release" - buildConfigField("String", "WALLET_APP_LINK", "\"https://dev.lab.web3modal.com/wallet_release\"") + buildConfigField("String", "WALLET_APP_LINK", "\"https://appkit-lab.reown.com/wallet_release\"") } getByName("internal") { manifestPlaceholders["pathPrefix"] = "/wallet_internal" - buildConfigField("String", "WALLET_APP_LINK", "\"https://dev.lab.web3modal.com/wallet_internal\"") + buildConfigField("String", "WALLET_APP_LINK", "\"https://appkit-lab.reown.com/wallet_internal\"") } getByName("debug") { manifestPlaceholders["pathPrefix"] = "/wallet_debug" - buildConfigField("String", "WALLET_APP_LINK", "\"https://dev.lab.web3modal.com/wallet_debug\"") + buildConfigField("String", "WALLET_APP_LINK", "\"https://appkit-lab.reown.com/wallet_debug\"") } } diff --git a/sample/wallet/src/main/AndroidManifest.xml b/sample/wallet/src/main/AndroidManifest.xml index 79fca02d9..c07d86445 100644 --- a/sample/wallet/src/main/AndroidManifest.xml +++ b/sample/wallet/src/main/AndroidManifest.xml @@ -64,7 +64,7 @@ diff --git a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt index 32ed5ed8a..dbb41ffaf 100644 --- a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt +++ b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt @@ -47,7 +47,7 @@ class WalletKitApplication : Application() { val appMetaData = Core.Model.AppMetaData( name = "Kotlin Wallet", description = "Kotlin Wallet Implementation", - url = "https://dev.lab.web3modal.com", + url = "https://appkit-lab.reown.com", icons = listOf("https://raw.githubusercontent.com/WalletConnect/walletconnect-assets/master/Icon/Gradient/Icon.png"), redirect = "kotlin-web3wallet://request", appLink = BuildConfig.WALLET_APP_LINK, From 351ac100857e40e8c9934baff8be6e363c621010 Mon Sep 17 00:00:00 2001 From: kubel Date: Tue, 8 Oct 2024 16:00:45 +0200 Subject: [PATCH 2/4] Firebase token --- .../com/reown/sample/wallet/WalletKitApplication.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt index 32ed5ed8a..918970b5c 100644 --- a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt +++ b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt @@ -1,9 +1,11 @@ package com.reown.sample.wallet import android.app.Application +import com.google.firebase.FirebaseApp import com.google.firebase.appdistribution.FirebaseAppDistribution import com.google.firebase.crashlytics.ktx.crashlytics import com.google.firebase.ktx.Firebase +import com.google.firebase.messaging.FirebaseMessaging import com.mixpanel.android.mpmetrics.MixpanelAPI import com.pandulapeter.beagle.Beagle import com.pandulapeter.beagle.common.configuration.Behavior @@ -92,6 +94,17 @@ class WalletKitApplication : Application() { initializeBeagle() + FirebaseMessaging.getInstance().token.addOnSuccessListener { token -> + WalletKit.registerDeviceToken(firebaseAccessToken = token, enableEncrypted = true, + onSuccess = { + println("kobe; Successfully registered firebase token for Web3Wallet: $token") + }, + onError = { + println("kobe; Error while registering firebase token for Web3Wallet: ${it.throwable}") + } + ) + } + scope.launch { supervisorScope { wcKoinApp.koin.get().plant(object : Timber.Tree() { From 9eea75683a001d0dbe91d4d334a55bddcd080a9a Mon Sep 17 00:00:00 2001 From: kubel Date: Tue, 29 Oct 2024 07:28:21 +0100 Subject: [PATCH 3/4] Remove initialization counter --- .../com/reown/walletkit/client/WalletKit.kt | 30 ++----------------- .../sample/wallet/WalletKitApplication.kt | 4 +-- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt index d881f99b8..f7c377919 100644 --- a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt +++ b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt @@ -97,17 +97,13 @@ object WalletKit { @Throws(IllegalStateException::class) fun initialize(params: Wallet.Params.Init, onSuccess: () -> Unit = {}, onError: (Wallet.Model.Error) -> Unit) { coreClient = params.core - var clientInitCounter = 0 - val onSuccessfulInitialization: () -> Unit = { clientInitCounter++ } - - SignClient.initialize(Sign.Params.Init(params.core), onSuccess = onSuccessfulInitialization) { error -> + SignClient.initialize(Sign.Params.Init(params.core), onSuccess = onSuccess) { error -> if (error.throwable is SignClientAlreadyInitializedException) { - onSuccessfulInitialization() + onSuccess() } else { onError(Wallet.Model.Error(error.throwable)) } } - validateInitializationCount(clientInitCounter, onSuccess, onError) } @Throws(IllegalStateException::class) @@ -340,24 +336,4 @@ object WalletKit { fun getListOfVerifyContexts(): List { return SignClient.getListOfVerifyContexts().map { verifyContext -> verifyContext.toWallet() } } - - private fun validateInitializationCount(clientInitCounter: Int, onSuccess: () -> Unit, onError: (Wallet.Model.Error) -> Unit) { - scope.launch { - try { - withTimeout(TIMEOUT) { - while (true) { - if (clientInitCounter == 2) { - onSuccess() - return@withTimeout - } - delay(100) - } - } - } catch (e: Exception) { - onError(Wallet.Model.Error(e)) - } - } - } - - private const val TIMEOUT: Long = 10000 -} +} \ No newline at end of file diff --git a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt index 50f42386d..a1f48fafd 100644 --- a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt +++ b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt @@ -97,10 +97,10 @@ class WalletKitApplication : Application() { FirebaseMessaging.getInstance().token.addOnSuccessListener { token -> WalletKit.registerDeviceToken(firebaseAccessToken = token, enableEncrypted = true, onSuccess = { - println("kobe; Successfully registered firebase token for Web3Wallet: $token") + println("Successfully registered firebase token for Web3Wallet: $token") }, onError = { - println("kobe; Error while registering firebase token for Web3Wallet: ${it.throwable}") + println("Error while registering firebase token for Web3Wallet: ${it.throwable}") } ) } From 8bafdc183913de7f3592da2aa799f67c359ccfbb Mon Sep 17 00:00:00 2001 From: kubel Date: Wed, 30 Oct 2024 06:59:15 +0100 Subject: [PATCH 4/4] Versions bump --- buildSrc/src/main/kotlin/Versions.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index e00f7b501..fb8613d55 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -5,14 +5,14 @@ const val KEY_PUBLISH_ARTIFACT_ID = "PUBLISH_ARTIFACT_ID" const val KEY_SDK_NAME = "SDK_NAME" //Latest versions -const val BOM_VERSION = "1.0.0" -const val FOUNDATION_VERSION = "1.0.0" -const val CORE_VERSION = "1.0.0" -const val SIGN_VERSION = "1.0.0" -const val NOTIFY_VERSION = "1.0.0" -const val WALLETKIT_VERSION = "1.0.0" -const val APPKIT_VERSION = "1.0.0" -const val MODAL_CORE_VERSION = "1.0.0" +const val BOM_VERSION = "1.0.1" +const val FOUNDATION_VERSION = "1.0.1" +const val CORE_VERSION = "1.0.1" +const val SIGN_VERSION = "1.0.1" +const val NOTIFY_VERSION = "1.0.1" +const val WALLETKIT_VERSION = "1.0.1" +const val APPKIT_VERSION = "1.0.1" +const val MODAL_CORE_VERSION = "1.0.1" //Artifact ids const val ANDROID_BOM = "android-bom"