Skip to content

Commit 719c032

Browse files
authored
Merge pull request #1472 from WalletConnect/develop
BOM_1.34.1
2 parents 572a761 + d569de5 commit 719c032

20 files changed

Lines changed: 142 additions & 174 deletions

File tree

.github/workflows/ci_github_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
with:
2020
config-name: release-drafter.yml
2121
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
GITHUB_TOKEN: ${{ secrets.PUSH_GITHUB_TOKEN }}
2323

2424
- name: Create GitHub Release
2525
uses: actions/create-release@v1
2626
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
GITHUB_TOKEN: ${{ secrets.PUSH_GITHUB_TOKEN }}
2828
with:
2929
tag_name: ${{ github.ref }}
3030
release_name: ${{ github.ref }}

.github/workflows/ci_release_articacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ jobs:
8686
./gradlew closeAndReleaseMultipleRepositories
8787
- name: Push Tag
8888
env:
89-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
GITHUB_TOKEN: ${{ secrets.PUSH_GITHUB_TOKEN }}
9090
run: |
9191
./gradlew pushTagToMain

ReadMe.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies {
2323

2424
| 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) |
2525
|-----------------------------------------------------------------------------------------|--------------------------|---------------------------|---------------------------|---------------------------|:------------------------------|----------------------------------|--------------------------------|--------------------------------------------------|
26+
| 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 |
2627
| 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 |
2728
| 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 |
2829
| 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 |

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ tasks.register<Exec>("createTag") {
335335
tasks.register<Exec>("pushTagToMain") {
336336
val tagName = "BOM_$BOM_VERSION"
337337
val repoUrl = "https://github.com/WalletConnect/WalletConnectKotlinV2.git"
338-
val token = System.getenv("PUSH_GITHUB_TOKEN") ?: throw GradleException("GITHUB_TOKEN environment variable is not set")
338+
val token = System.getenv("PUSH_GITHUB_TOKEN") ?: throw GradleException("PUSH_GITHUB_TOKEN environment variable is not set")
339339
dependsOn("createTag")
340340
val authenticatedRepoUrl = repoUrl.replace("https://", "https://$token:@")
341341
commandLine("git", "push", authenticatedRepoUrl, tagName, "refs/heads/main")

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ const val KEY_PUBLISH_ARTIFACT_ID = "PUBLISH_ARTIFACT_ID"
55
const val KEY_SDK_NAME = "SDK_NAME"
66

77
//Latest versions
8-
const val BOM_VERSION = "1.34.0"
9-
const val FOUNDATION_VERSION = "1.18.0"
10-
const val CORE_VERSION = "1.34.0"
11-
const val SIGN_VERSION = "2.34.0"
12-
const val AUTH_VERSION = "1.28.6"
13-
const val CHAT_VERSION = "1.0.0-beta33"
14-
const val NOTIFY_VERSION = "1.3.7"
15-
const val WEB_3_WALLET_VERSION = "1.34.0"
16-
const val WEB_3_MODAL_VERSION = "1.6.2"
17-
const val WC_MODAL_VERSION = "1.5.7"
18-
const val MODAL_CORE_VERSION = "1.6.2"
8+
const val BOM_VERSION = "1.34.1"
9+
const val FOUNDATION_VERSION = "1.18.1"
10+
const val CORE_VERSION = "1.34.1"
11+
const val SIGN_VERSION = "2.34.1"
12+
const val AUTH_VERSION = "1.28.7"
13+
const val CHAT_VERSION = "1.0.0-beta34"
14+
const val NOTIFY_VERSION = "1.3.8"
15+
const val WEB_3_WALLET_VERSION = "1.34.1"
16+
const val WEB_3_MODAL_VERSION = "1.6.3"
17+
const val WC_MODAL_VERSION = "1.5.8"
18+
const val MODAL_CORE_VERSION = "1.6.3"
1919

2020
//Artifact ids
2121
const val ANDROID_BOM = "android-bom"

core/android/src/androidTest/kotlin/com/walletconnect/android/test/utils/TestClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ internal object TestClient {
8181
secondaryKoinApp.modules(overrideModule(Relay, Pairing, PairingController, "test_secondary", app.packageName))
8282

8383
// Necessary reinit of Relay, Pairing and PairingController
84-
Relay.initialize { Timber.e(it) }
84+
Relay.initialize(ConnectionType.MANUAL) { Timber.e(it) }
8585
Pairing.initialize()
8686
PairingController.initialize()
8787

core/android/src/main/kotlin/com/walletconnect/android/CoreProtocol.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import com.walletconnect.android.relay.RelayConnectionInterface
3333
import com.walletconnect.android.utils.isValidRelayServerUrl
3434
import com.walletconnect.android.utils.plantTimber
3535
import com.walletconnect.android.utils.projectId
36-
import com.walletconnect.android.utils.toCommonConnectionType
3736
import com.walletconnect.android.verify.client.VerifyClient
3837
import com.walletconnect.android.verify.client.VerifyInterface
3938
import org.koin.android.ext.koin.androidContext
@@ -145,13 +144,13 @@ class CoreProtocol(private val koinApp: KoinApplication = wcKoinApp) : CoreInter
145144
modules(
146145
module { single { ProjectId(projectId) } },
147146
module { single(named(AndroidCommonDITags.TELEMETRY_ENABLED)) { TelemetryEnabled(telemetryEnabled) } },
148-
coreAndroidNetworkModule(relayServerUrl, connectionType.toCommonConnectionType(), BuildConfig.SDK_VERSION, networkClientTimeout, bundleId),
147+
coreAndroidNetworkModule(relayServerUrl, connectionType, BuildConfig.SDK_VERSION, networkClientTimeout, bundleId),
149148
coreCommonModule(),
150149
coreCryptoModule(),
151150
)
152151

153152
if (relay == null) {
154-
Relay.initialize { error -> onError(Core.Model.Error(error)) }
153+
Relay.initialize(connectionType) { error -> onError(Core.Model.Error(error)) }
155154
}
156155

157156
modules(

core/android/src/main/kotlin/com/walletconnect/android/internal/common/connection/ManualConnectionLifecycle.kt

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,20 @@ package com.walletconnect.android.internal.common.connection
44

55
import com.tinder.scarlet.Lifecycle
66
import com.tinder.scarlet.lifecycle.LifecycleRegistry
7-
import com.walletconnect.android.internal.common.scope
8-
import com.walletconnect.foundation.network.data.ConnectionController
9-
import com.walletconnect.foundation.network.data.ConnectionEvent
10-
import kotlinx.coroutines.flow.launchIn
11-
import kotlinx.coroutines.flow.onEach
127

138
internal class ManualConnectionLifecycle(
14-
connectionController: ConnectionController,
15-
private val lifecycleRegistry: LifecycleRegistry,
9+
private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(),
1610
) : Lifecycle by lifecycleRegistry {
11+
fun connect() {
12+
lifecycleRegistry.onNext(Lifecycle.State.Started)
13+
}
14+
15+
fun disconnect() {
16+
lifecycleRegistry.onNext(Lifecycle.State.Stopped.WithReason())
17+
}
1718

18-
init {
19-
if (connectionController is ConnectionController.Manual) {
20-
connectionController.connectionEventFlow
21-
.onEach { event ->
22-
when (event) {
23-
ConnectionEvent.CONNECT -> lifecycleRegistry.onNext(Lifecycle.State.Started)
24-
ConnectionEvent.DISCONNECT -> lifecycleRegistry.onNext(Lifecycle.State.Stopped.WithReason())
25-
}
26-
}
27-
.launchIn(scope)
28-
}
19+
fun restart() {
20+
lifecycleRegistry.onNext(Lifecycle.State.Stopped.WithReason())
21+
lifecycleRegistry.onNext(Lifecycle.State.Started)
2922
}
3023
}

core/android/src/main/kotlin/com/walletconnect/android/internal/common/di/AndroidCommonDITags.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ enum class AndroidCommonDITags {
99
RELAY_SERVICE,
1010
SCARLET,
1111
MSG_ADAPTER,
12-
CONNECTION_CONTROLLER,
13-
LIFECYCLE,
12+
MANUAL_CONNECTION_LIFECYCLE,
13+
AUTOMATIC_CONNECTION_LIFECYCLE,
1414
LOGGER,
1515
CONNECTIVITY_STATE,
1616
PUSH_RETROFIT,

core/android/src/main/kotlin/com/walletconnect/android/internal/common/di/CoreNetworkModule.kt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import android.net.Uri
44
import android.os.Build
55
import com.pandulapeter.beagle.logOkHttp.BeagleOkHttpLogger
66
import com.squareup.moshi.Moshi
7+
import com.tinder.scarlet.Lifecycle
78
import com.tinder.scarlet.Scarlet
8-
import com.tinder.scarlet.lifecycle.LifecycleRegistry
99
import com.tinder.scarlet.lifecycle.android.AndroidLifecycle
1010
import com.tinder.scarlet.messageadapter.moshi.MoshiMessageAdapter
1111
import com.tinder.scarlet.retry.ExponentialBackoffStrategy
@@ -16,7 +16,6 @@ import com.walletconnect.android.internal.common.connection.ManualConnectionLife
1616
import com.walletconnect.android.internal.common.jwt.clientid.GenerateJwtStoreClientIdUseCase
1717
import com.walletconnect.android.relay.ConnectionType
1818
import com.walletconnect.android.relay.NetworkClientTimeout
19-
import com.walletconnect.foundation.network.data.ConnectionController
2019
import com.walletconnect.foundation.network.data.adapter.FlowStreamAdapter
2120
import com.walletconnect.foundation.network.data.service.RelayService
2221
import okhttp3.Authenticator
@@ -25,6 +24,7 @@ import okhttp3.OkHttpClient
2524
import okhttp3.logging.HttpLoggingInterceptor
2625
import org.koin.android.ext.koin.androidApplication
2726
import org.koin.core.qualifier.named
27+
import org.koin.core.scope.Scope
2828
import org.koin.dsl.module
2929
import java.util.concurrent.TimeUnit
3030

@@ -104,20 +104,12 @@ fun coreAndroidNetworkModule(serverUrl: String, connectionType: ConnectionType,
104104

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

107-
single(named(AndroidCommonDITags.CONNECTION_CONTROLLER)) {
108-
if (connectionType == ConnectionType.MANUAL) {
109-
ConnectionController.Manual()
110-
} else {
111-
ConnectionController.Automatic
112-
}
107+
single<ManualConnectionLifecycle>(named(AndroidCommonDITags.MANUAL_CONNECTION_LIFECYCLE)) {
108+
ManualConnectionLifecycle()
113109
}
114110

115-
single(named(AndroidCommonDITags.LIFECYCLE)) {
116-
if (connectionType == ConnectionType.MANUAL) {
117-
ManualConnectionLifecycle(get(named(AndroidCommonDITags.CONNECTION_CONTROLLER)), LifecycleRegistry())
118-
} else {
119-
AndroidLifecycle.ofApplicationForeground(androidApplication())
120-
}
111+
single<Lifecycle>(named(AndroidCommonDITags.AUTOMATIC_CONNECTION_LIFECYCLE)) {
112+
AndroidLifecycle.ofApplicationForeground(androidApplication())
121113
}
122114

123115
single { ExponentialBackoffStrategy(INIT_BACKOFF_MILLIS, TimeUnit.SECONDS.toMillis(MAX_BACKOFF_SEC)) }
@@ -128,7 +120,7 @@ fun coreAndroidNetworkModule(serverUrl: String, connectionType: ConnectionType,
128120
Scarlet.Builder()
129121
.backoffStrategy(get<ExponentialBackoffStrategy>())
130122
.webSocketFactory(get<OkHttpClient>(named(AndroidCommonDITags.OK_HTTP)).newWebSocketFactory(get<String>(named(AndroidCommonDITags.RELAY_URL))))
131-
.lifecycle(get(named(AndroidCommonDITags.LIFECYCLE)))
123+
.lifecycle(getLifecycle(connectionType))
132124
.addMessageAdapterFactory(get<MoshiMessageAdapter.Factory>(named(AndroidCommonDITags.MSG_ADAPTER)))
133125
.addStreamAdapterFactory(get<FlowStreamAdapter.Factory>())
134126
.build()
@@ -141,4 +133,11 @@ fun coreAndroidNetworkModule(serverUrl: String, connectionType: ConnectionType,
141133
single(named(AndroidCommonDITags.CONNECTIVITY_STATE)) {
142134
ConnectivityState(androidApplication())
143135
}
144-
}
136+
}
137+
138+
private fun Scope.getLifecycle(connectionType: ConnectionType) =
139+
if (connectionType == ConnectionType.MANUAL) {
140+
get<ManualConnectionLifecycle>(named(AndroidCommonDITags.MANUAL_CONNECTION_LIFECYCLE))
141+
} else {
142+
get<Lifecycle>(named(AndroidCommonDITags.AUTOMATIC_CONNECTION_LIFECYCLE))
143+
}

0 commit comments

Comments
 (0)