diff --git a/core/android/src/debug/kotlin/com/reown/android/di/CoreStorageModule.kt b/core/android/src/debug/kotlin/com/reown/android/di/CoreStorageModule.kt index 1e7722309..ede35c0bb 100644 --- a/core/android/src/debug/kotlin/com/reown/android/di/CoreStorageModule.kt +++ b/core/android/src/debug/kotlin/com/reown/android/di/CoreStorageModule.kt @@ -12,9 +12,9 @@ import org.koin.android.ext.koin.androidContext import org.koin.core.qualifier.named import org.koin.dsl.module -fun coreStorageModule(storagePrefix: String = String.Empty, bundleId: String) = module { +fun coreStorageModule(storagePrefix: String = String.Empty, packageName: String) = module { - includes(baseStorageModule(storagePrefix, bundleId)) + includes(baseStorageModule(storagePrefix, packageName)) single(named(AndroidBuildVariantDITags.ANDROID_CORE_DATABASE_DRIVER)) { AndroidSqliteDriver( diff --git a/core/android/src/main/kotlin/com/reown/android/CoreProtocol.kt b/core/android/src/main/kotlin/com/reown/android/CoreProtocol.kt index 4e3996dc0..2b89de32a 100644 --- a/core/android/src/main/kotlin/com/reown/android/CoreProtocol.kt +++ b/core/android/src/main/kotlin/com/reown/android/CoreProtocol.kt @@ -138,7 +138,7 @@ class CoreProtocol(private val koinApp: KoinApplication = wcKoinApp) : CoreInter metaData: Core.Model.AppMetaData, keyServerUrl: String? ) { - val bundleId: String = application.packageName + val packageName: String = application.packageName val relayServerUrl = if (serverUrl.isNullOrEmpty()) "wss://relay.walletconnect.org?projectId=$projectId" else serverUrl with(koinApp) { @@ -146,7 +146,7 @@ class CoreProtocol(private val koinApp: KoinApplication = wcKoinApp) : CoreInter modules( module { single { ProjectId(projectId) } }, module { single(named(AndroidCommonDITags.TELEMETRY_ENABLED)) { TelemetryEnabled(telemetryEnabled) } }, - coreAndroidNetworkModule(relayServerUrl, connectionType, BuildConfig.SDK_VERSION, networkClientTimeout, bundleId), + coreAndroidNetworkModule(relayServerUrl, connectionType, BuildConfig.SDK_VERSION, networkClientTimeout, packageName), coreCommonModule(), coreCryptoModule(), ) @@ -156,7 +156,7 @@ class CoreProtocol(private val koinApp: KoinApplication = wcKoinApp) : CoreInter } modules( - coreStorageModule(bundleId = bundleId), + coreStorageModule(packageName = packageName), module { single(named(AndroidCommonDITags.CLIENT_ID)) { requireNotNull(get().getString(KEY_CLIENT_ID, null)) } }, pushModule(), module { single { relay ?: Relay } }, @@ -181,7 +181,7 @@ class CoreProtocol(private val koinApp: KoinApplication = wcKoinApp) : CoreInter keyServerModule(keyServerUrl), explorerModule(), appKitModule(), - pulseModule(bundleId) + pulseModule(packageName) ) } diff --git a/core/android/src/main/kotlin/com/reown/android/internal/common/di/BaseStorageModule.kt b/core/android/src/main/kotlin/com/reown/android/internal/common/di/BaseStorageModule.kt index a1a5e8178..69e83dd3a 100644 --- a/core/android/src/main/kotlin/com/reown/android/internal/common/di/BaseStorageModule.kt +++ b/core/android/src/main/kotlin/com/reown/android/internal/common/di/BaseStorageModule.kt @@ -28,7 +28,7 @@ import org.koin.core.scope.Scope import org.koin.dsl.module import com.reown.android.internal.common.scope as wcScope -fun baseStorageModule(storagePrefix: String = String.Empty, bundleId: String) = module { +fun baseStorageModule(storagePrefix: String = String.Empty, packageName: String) = module { single, String>>(named(AndroidCommonDITags.COLUMN_ADAPTER_LIST)) { object : ColumnAdapter, String> { override fun decode(databaseValue: String): List = @@ -128,7 +128,7 @@ fun baseStorageModule(storagePrefix: String = String.Empty, bundleId: String) = single { PushMessagesRepository(pushMessageQueries = get()) } - single { EventsRepository(eventQueries = get(), bundleId = bundleId, telemetryEnabled = get(named(AndroidCommonDITags.TELEMETRY_ENABLED))) } + single { EventsRepository(eventQueries = get(), bundleId = packageName, telemetryEnabled = get(named(AndroidCommonDITags.TELEMETRY_ENABLED))) } single { DatabaseConfig(storagePrefix = storagePrefix) } } \ No newline at end of file diff --git a/core/android/src/main/kotlin/com/reown/android/internal/common/di/CoreNetworkModule.kt b/core/android/src/main/kotlin/com/reown/android/internal/common/di/CoreNetworkModule.kt index 52e3ce157..35ff56730 100644 --- a/core/android/src/main/kotlin/com/reown/android/internal/common/di/CoreNetworkModule.kt +++ b/core/android/src/main/kotlin/com/reown/android/internal/common/di/CoreNetworkModule.kt @@ -34,7 +34,7 @@ internal const val KEY_CLIENT_ID = "clientId" @Suppress("LocalVariableName") @JvmSynthetic -fun coreAndroidNetworkModule(serverUrl: String, connectionType: ConnectionType, sdkVersion: String, timeout: NetworkClientTimeout? = null, bundleId: String) = module { +fun coreAndroidNetworkModule(serverUrl: String, connectionType: ConnectionType, sdkVersion: String, timeout: NetworkClientTimeout? = null, packageName: String) = module { val networkClientTimeout = timeout ?: NetworkClientTimeout.getDefaultTimeout() factory(named(AndroidCommonDITags.RELAY_URL)) { val jwt = get().invoke(serverUrl) @@ -58,7 +58,7 @@ fun coreAndroidNetworkModule(serverUrl: String, connectionType: ConnectionType, Interceptor { chain -> val updatedRequest = chain.request().newBuilder() .addHeader("User-Agent", get(named(AndroidCommonDITags.USER_AGENT))) - .addHeader("Origin", bundleId) + .addHeader("packageName", packageName) .build() chain.proceed(updatedRequest) diff --git a/protocol/notify/src/androidTest/kotlin/com/reown/notify/di/OverrideModule.kt b/protocol/notify/src/androidTest/kotlin/com/reown/notify/di/OverrideModule.kt index 64549d500..066e69159 100644 --- a/protocol/notify/src/androidTest/kotlin/com/reown/notify/di/OverrideModule.kt +++ b/protocol/notify/src/androidTest/kotlin/com/reown/notify/di/OverrideModule.kt @@ -35,6 +35,6 @@ internal fun overrideModule( corePairingModule(pairing, pairingController), coreCryptoModule(sharedPrefsFile, keyStoreAlias), coreJsonRpcModule(), - coreAndroidNetworkModule(relayUrl, connectionType, "test_version", bundleId = bundleId) + coreAndroidNetworkModule(relayUrl, connectionType, "test_version", packageName = bundleId) ) } \ No newline at end of file diff --git a/protocol/sign/src/androidTest/kotlin/com/reown/sign/di/OverrideModule.kt b/protocol/sign/src/androidTest/kotlin/com/reown/sign/di/OverrideModule.kt index d781b64a8..dc49a9a50 100644 --- a/protocol/sign/src/androidTest/kotlin/com/reown/sign/di/OverrideModule.kt +++ b/protocol/sign/src/androidTest/kotlin/com/reown/sign/di/OverrideModule.kt @@ -34,7 +34,7 @@ internal fun overrideModule( coreStorageModule(storagePrefix, bundleId), corePairingModule(pairing, pairingController), coreCryptoModule(sharedPrefsFile, keyStoreAlias), - coreAndroidNetworkModule(relayUrl, connectionType, "test_version", bundleId = bundleId), + coreAndroidNetworkModule(relayUrl, connectionType, "test_version", packageName = bundleId), coreJsonRpcModule() ) } \ No newline at end of file