Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.automattic.android.tracks.crashlogging.CrashLoggingDataProvider
import com.automattic.android.tracks.crashlogging.CrashLoggingUser
import com.automattic.android.tracks.crashlogging.EventLevel
import com.automattic.android.tracks.crashlogging.ExtraKnownKey
import com.automattic.android.tracks.crashlogging.ReleaseName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.flowOf
Expand Down Expand Up @@ -48,7 +49,11 @@ class WPCrashLoggingDataProvider @Inject constructor(
override val enableCrashLoggingLogs: Boolean = false
override val locale: Locale
get() = localeManager.getLocale()
override val releaseName: String = BuildConfig.VERSION_NAME
override val releaseName: ReleaseName = if (buildConfig.isDebug()) {
ReleaseName.SetByApplication("debug")
} else {
ReleaseName.SetByTracksLibrary
}
override val sentryDSN: String = BuildConfig.SENTRY_DSN

override val applicationContextProvider = flowOf(mapOf(WEBVIEW_VERSION to webviewVersionProvider.getVersion()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.wordpress.android.util.crashlogging
import android.content.SharedPreferences
import com.automattic.android.tracks.crashlogging.EventLevel.DEBUG
import com.automattic.android.tracks.crashlogging.PerformanceMonitoringConfig
import com.automattic.android.tracks.crashlogging.ReleaseName
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest
Expand Down Expand Up @@ -201,6 +202,22 @@ class WPCrashLoggingDataProviderTest : BaseUnitTest() {
assertThat(sut.crashLoggingEnabled()).isTrue
}

@Test
fun `should assign debug release in debug`() {
whenever(buildConfig.isDebug()).thenReturn(true)
reinitialize()

assertThat(sut.releaseName).isEqualTo(ReleaseName.SetByApplication("debug"))
}

@Test
fun `should delegate release name creation to tracks in release`() {
whenever(buildConfig.isDebug()).thenReturn(false)
reinitialize()

assertThat(sut.releaseName).isEqualTo(ReleaseName.SetByTracksLibrary)
}

companion object {
val TEST_ACCOUNT = AccountModel().apply {
userId = 123L
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ext {
// libs
automatticAboutVersion = '1.4.0'
automatticRestVersion = '1.0.8'
automatticTracksVersion = '3.6.0'
automatticTracksVersion = '4.0.2'
gutenbergMobileVersion = 'v1.116.0'
wordPressAztecVersion = 'v2.1.1'
wordPressFluxCVersion = '2.72.0'
Expand Down