Skip to content

Commit

Permalink
Merge pull request #1472 from WalletConnect/develop
Browse files Browse the repository at this point in the history
BOM_1.34.1
  • Loading branch information
jakubuid authored Aug 13, 2024
2 parents 572a761 + d569de5 commit 719c032
Show file tree
Hide file tree
Showing 20 changed files with 142 additions and 174 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_github_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PUSH_GITHUB_TOKEN }}

- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PUSH_GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_release_articacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ jobs:
./gradlew closeAndReleaseMultipleRepositories
- name: Push Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PUSH_GITHUB_TOKEN }}
run: |
./gradlew pushTagToMain
1 change: 1 addition & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies {

| BOM | [Core SDK](core/android) | [Sign SDK](protocol/sign) | [Auth SDK](protocol/auth) | [Chat SDK](protocol/chat) | [Notify SDK](protocol/notify) | [web3wallet](product/web3wallet) | [web3modal](product/web3modal) | [WalletConnectModal](product/walletconnectmodal) |
|-----------------------------------------------------------------------------------------|--------------------------|---------------------------|---------------------------|---------------------------|:------------------------------|----------------------------------|--------------------------------|--------------------------------------------------|
| 1.34.1 | 1.34.1 | 2.34.1 | 1.28.7 | 1.0.0.beta34 | 1.3.8 | 1.34.1 | 1.6.3 | 1.5.8 |
| 1.34.0 | 1.34.0 | 2.34.0 | 1.28.6 | 1.0.0.beta33 | 1.3.7 | 1.34.0 | 1.6.2 | 1.5.7 |
| 1.33.1 | 1.33.1 | 2.33.1 | 1.28.5 | 1.0.0.beta32 | 1.3.6 | 1.33.1 | 1.6.1 | 1.5.6 |
| 1.33.0 | 1.33.0 | 2.33.0 | 1.28.4 | 1.0.0.beta31 | 1.3.5 | 1.33.0 | 1.6.0 | 1.5.5 |
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ tasks.register<Exec>("createTag") {
tasks.register<Exec>("pushTagToMain") {
val tagName = "BOM_$BOM_VERSION"
val repoUrl = "https://github.com/WalletConnect/WalletConnectKotlinV2.git"
val token = System.getenv("PUSH_GITHUB_TOKEN") ?: throw GradleException("GITHUB_TOKEN environment variable is not set")
val token = System.getenv("PUSH_GITHUB_TOKEN") ?: throw GradleException("PUSH_GITHUB_TOKEN environment variable is not set")
dependsOn("createTag")
val authenticatedRepoUrl = repoUrl.replace("https://", "https://$token:@")
commandLine("git", "push", authenticatedRepoUrl, tagName, "refs/heads/main")
Expand Down
22 changes: 11 additions & 11 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ const val KEY_PUBLISH_ARTIFACT_ID = "PUBLISH_ARTIFACT_ID"
const val KEY_SDK_NAME = "SDK_NAME"

//Latest versions
const val BOM_VERSION = "1.34.0"
const val FOUNDATION_VERSION = "1.18.0"
const val CORE_VERSION = "1.34.0"
const val SIGN_VERSION = "2.34.0"
const val AUTH_VERSION = "1.28.6"
const val CHAT_VERSION = "1.0.0-beta33"
const val NOTIFY_VERSION = "1.3.7"
const val WEB_3_WALLET_VERSION = "1.34.0"
const val WEB_3_MODAL_VERSION = "1.6.2"
const val WC_MODAL_VERSION = "1.5.7"
const val MODAL_CORE_VERSION = "1.6.2"
const val BOM_VERSION = "1.34.1"
const val FOUNDATION_VERSION = "1.18.1"
const val CORE_VERSION = "1.34.1"
const val SIGN_VERSION = "2.34.1"
const val AUTH_VERSION = "1.28.7"
const val CHAT_VERSION = "1.0.0-beta34"
const val NOTIFY_VERSION = "1.3.8"
const val WEB_3_WALLET_VERSION = "1.34.1"
const val WEB_3_MODAL_VERSION = "1.6.3"
const val WC_MODAL_VERSION = "1.5.8"
const val MODAL_CORE_VERSION = "1.6.3"

//Artifact ids
const val ANDROID_BOM = "android-bom"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ internal object TestClient {
secondaryKoinApp.modules(overrideModule(Relay, Pairing, PairingController, "test_secondary", app.packageName))

// Necessary reinit of Relay, Pairing and PairingController
Relay.initialize { Timber.e(it) }
Relay.initialize(ConnectionType.MANUAL) { Timber.e(it) }
Pairing.initialize()
PairingController.initialize()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import com.walletconnect.android.relay.RelayConnectionInterface
import com.walletconnect.android.utils.isValidRelayServerUrl
import com.walletconnect.android.utils.plantTimber
import com.walletconnect.android.utils.projectId
import com.walletconnect.android.utils.toCommonConnectionType
import com.walletconnect.android.verify.client.VerifyClient
import com.walletconnect.android.verify.client.VerifyInterface
import org.koin.android.ext.koin.androidContext
Expand Down Expand Up @@ -145,13 +144,13 @@ class CoreProtocol(private val koinApp: KoinApplication = wcKoinApp) : CoreInter
modules(
module { single { ProjectId(projectId) } },
module { single(named(AndroidCommonDITags.TELEMETRY_ENABLED)) { TelemetryEnabled(telemetryEnabled) } },
coreAndroidNetworkModule(relayServerUrl, connectionType.toCommonConnectionType(), BuildConfig.SDK_VERSION, networkClientTimeout, bundleId),
coreAndroidNetworkModule(relayServerUrl, connectionType, BuildConfig.SDK_VERSION, networkClientTimeout, bundleId),
coreCommonModule(),
coreCryptoModule(),
)

if (relay == null) {
Relay.initialize { error -> onError(Core.Model.Error(error)) }
Relay.initialize(connectionType) { error -> onError(Core.Model.Error(error)) }
}

modules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,20 @@ package com.walletconnect.android.internal.common.connection

import com.tinder.scarlet.Lifecycle
import com.tinder.scarlet.lifecycle.LifecycleRegistry
import com.walletconnect.android.internal.common.scope
import com.walletconnect.foundation.network.data.ConnectionController
import com.walletconnect.foundation.network.data.ConnectionEvent
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach

internal class ManualConnectionLifecycle(
connectionController: ConnectionController,
private val lifecycleRegistry: LifecycleRegistry,
private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(),
) : Lifecycle by lifecycleRegistry {
fun connect() {
lifecycleRegistry.onNext(Lifecycle.State.Started)
}

fun disconnect() {
lifecycleRegistry.onNext(Lifecycle.State.Stopped.WithReason())
}

init {
if (connectionController is ConnectionController.Manual) {
connectionController.connectionEventFlow
.onEach { event ->
when (event) {
ConnectionEvent.CONNECT -> lifecycleRegistry.onNext(Lifecycle.State.Started)
ConnectionEvent.DISCONNECT -> lifecycleRegistry.onNext(Lifecycle.State.Stopped.WithReason())
}
}
.launchIn(scope)
}
fun restart() {
lifecycleRegistry.onNext(Lifecycle.State.Stopped.WithReason())
lifecycleRegistry.onNext(Lifecycle.State.Started)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ enum class AndroidCommonDITags {
RELAY_SERVICE,
SCARLET,
MSG_ADAPTER,
CONNECTION_CONTROLLER,
LIFECYCLE,
MANUAL_CONNECTION_LIFECYCLE,
AUTOMATIC_CONNECTION_LIFECYCLE,
LOGGER,
CONNECTIVITY_STATE,
PUSH_RETROFIT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.net.Uri
import android.os.Build
import com.pandulapeter.beagle.logOkHttp.BeagleOkHttpLogger
import com.squareup.moshi.Moshi
import com.tinder.scarlet.Lifecycle
import com.tinder.scarlet.Scarlet
import com.tinder.scarlet.lifecycle.LifecycleRegistry
import com.tinder.scarlet.lifecycle.android.AndroidLifecycle
import com.tinder.scarlet.messageadapter.moshi.MoshiMessageAdapter
import com.tinder.scarlet.retry.ExponentialBackoffStrategy
Expand All @@ -16,7 +16,6 @@ import com.walletconnect.android.internal.common.connection.ManualConnectionLife
import com.walletconnect.android.internal.common.jwt.clientid.GenerateJwtStoreClientIdUseCase
import com.walletconnect.android.relay.ConnectionType
import com.walletconnect.android.relay.NetworkClientTimeout
import com.walletconnect.foundation.network.data.ConnectionController
import com.walletconnect.foundation.network.data.adapter.FlowStreamAdapter
import com.walletconnect.foundation.network.data.service.RelayService
import okhttp3.Authenticator
Expand All @@ -25,6 +24,7 @@ import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import org.koin.android.ext.koin.androidApplication
import org.koin.core.qualifier.named
import org.koin.core.scope.Scope
import org.koin.dsl.module
import java.util.concurrent.TimeUnit

Expand Down Expand Up @@ -104,20 +104,12 @@ fun coreAndroidNetworkModule(serverUrl: String, connectionType: ConnectionType,

single(named(AndroidCommonDITags.MSG_ADAPTER)) { MoshiMessageAdapter.Factory(get<Moshi.Builder>(named(AndroidCommonDITags.MOSHI)).build()) }

single(named(AndroidCommonDITags.CONNECTION_CONTROLLER)) {
if (connectionType == ConnectionType.MANUAL) {
ConnectionController.Manual()
} else {
ConnectionController.Automatic
}
single<ManualConnectionLifecycle>(named(AndroidCommonDITags.MANUAL_CONNECTION_LIFECYCLE)) {
ManualConnectionLifecycle()
}

single(named(AndroidCommonDITags.LIFECYCLE)) {
if (connectionType == ConnectionType.MANUAL) {
ManualConnectionLifecycle(get(named(AndroidCommonDITags.CONNECTION_CONTROLLER)), LifecycleRegistry())
} else {
AndroidLifecycle.ofApplicationForeground(androidApplication())
}
single<Lifecycle>(named(AndroidCommonDITags.AUTOMATIC_CONNECTION_LIFECYCLE)) {
AndroidLifecycle.ofApplicationForeground(androidApplication())
}

single { ExponentialBackoffStrategy(INIT_BACKOFF_MILLIS, TimeUnit.SECONDS.toMillis(MAX_BACKOFF_SEC)) }
Expand All @@ -128,7 +120,7 @@ fun coreAndroidNetworkModule(serverUrl: String, connectionType: ConnectionType,
Scarlet.Builder()
.backoffStrategy(get<ExponentialBackoffStrategy>())
.webSocketFactory(get<OkHttpClient>(named(AndroidCommonDITags.OK_HTTP)).newWebSocketFactory(get<String>(named(AndroidCommonDITags.RELAY_URL))))
.lifecycle(get(named(AndroidCommonDITags.LIFECYCLE)))
.lifecycle(getLifecycle(connectionType))
.addMessageAdapterFactory(get<MoshiMessageAdapter.Factory>(named(AndroidCommonDITags.MSG_ADAPTER)))
.addStreamAdapterFactory(get<FlowStreamAdapter.Factory>())
.build()
Expand All @@ -141,4 +133,11 @@ fun coreAndroidNetworkModule(serverUrl: String, connectionType: ConnectionType,
single(named(AndroidCommonDITags.CONNECTIVITY_STATE)) {
ConnectivityState(androidApplication())
}
}
}

private fun Scope.getLifecycle(connectionType: ConnectionType) =
if (connectionType == ConnectionType.MANUAL) {
get<ManualConnectionLifecycle>(named(AndroidCommonDITags.MANUAL_CONNECTION_LIFECYCLE))
} else {
get<Lifecycle>(named(AndroidCommonDITags.AUTOMATIC_CONNECTION_LIFECYCLE))
}
Loading

0 comments on commit 719c032

Please sign in to comment.