Skip to content

Commit 7638190

Browse files
committed
Versions
1 parent 66428a4 commit 7638190

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

firebase-sessions/src/main/kotlin/com/google/firebase/sessions/ApplicationInfo.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ internal data class AndroidApplicationInfo(
3737
/** The package name of the application/bundle name. */
3838
val packageName: String,
3939

40-
/** The version of the application. */
40+
/** The display version of the application. */
4141
val versionName: String,
42+
43+
/** The build version of the application. */
44+
val buildVersion: String,
4245
)
4346

4447
internal data class ApplicationInfo(

firebase-sessions/src/main/kotlin/com/google/firebase/sessions/SessionEvents.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ internal object SessionEvents {
134134
osDisplayVersion = Build.VERSION.RELEASE,
135135
logEnvironment = LogEnvironment.LOG_ENVIRONMENT_PROD,
136136
androidAppInfo =
137-
AndroidApplicationInfo(packageName = packageName, versionName = packageInfo.versionName)
137+
AndroidApplicationInfo(
138+
packageName = packageName,
139+
versionName = packageInfo.versionName,
140+
buildVersion = packageInfo.versionCode.toString()
141+
)
138142
)
139143
}
140144
}

firebase-sessions/src/test/kotlin/com/google/firebase/sessions/ApplicationInfoTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class ApplicationInfoTest {
4343
logEnvironment = LogEnvironment.LOG_ENVIRONMENT_PROD,
4444
AndroidApplicationInfo(
4545
packageName = ApplicationProvider.getApplicationContext<Context>().packageName,
46-
versionName = FakeFirebaseApp.MOCK_APP_VERSION
46+
versionName = FakeFirebaseApp.MOCK_APP_VERSION,
47+
buildVersion = FakeFirebaseApp.MOCK_APP_BUILD_VERSION,
4748
)
4849
)
4950
)

firebase-sessions/src/test/kotlin/com/google/firebase/sessions/SessionEventEncoderTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class SessionEventEncoderTest {
104104
sessionSdkVersion = "",
105105
osDisplayVersion = "",
106106
logEnvironment = LogEnvironment.LOG_ENVIRONMENT_PROD,
107-
AndroidApplicationInfo(packageName = "", versionName = ""),
107+
AndroidApplicationInfo(packageName = "", versionName = "", buildVersion = ""),
108108
)
109109
)
110110

firebase-sessions/src/test/kotlin/com/google/firebase/sessions/testing/FakeFirebaseApp.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ internal class FakeFirebaseApp(metadata: Bundle? = null) {
5757
internal const val MOCK_APP_ID = "1:12345:android:app"
5858
internal const val MOCK_API_KEY = "RANDOM_APIKEY_FOR_TESTING"
5959
internal const val MOCK_APP_VERSION = "1.0.0"
60+
internal const val MOCK_APP_BUILD_VERSION = "0"
6061
}
6162
}

firebase-sessions/src/test/kotlin/com/google/firebase/sessions/testing/TestSessionEventData.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ internal object TestSessionEventData {
6161
logEnvironment = LogEnvironment.LOG_ENVIRONMENT_PROD,
6262
AndroidApplicationInfo(
6363
packageName = ApplicationProvider.getApplicationContext<Context>().packageName,
64-
versionName = FakeFirebaseApp.MOCK_APP_VERSION
64+
versionName = FakeFirebaseApp.MOCK_APP_VERSION,
65+
buildVersion = FakeFirebaseApp.MOCK_APP_BUILD_VERSION,
6566
),
6667
)
6768
)

0 commit comments

Comments
 (0)