Skip to content

Commit 35170e0

Browse files
authored
retrieve the legacy build number as an integer instead of a string. (#156)
1 parent d7e6d4b commit 35170e0

File tree

1 file changed

+11
-0
lines changed
  • android/src/main/java/com/segment/analytics/kotlin/android

1 file changed

+11
-0
lines changed

android/src/main/java/com/segment/analytics/kotlin/android/Storage.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ class AndroidStorage(
7171
Storage.Constants.Events -> {
7272
eventsFile.read().joinToString()
7373
}
74+
Storage.Constants.LegacyAppBuild -> {
75+
// The legacy app build number was stored as an integer so we have to get it
76+
// as an integer and convert it to a String.
77+
val noBuild = -1
78+
val build = sharedPreferences.getInt(key.rawVal, noBuild)
79+
if (build != noBuild) {
80+
return build.toString()
81+
} else {
82+
return null
83+
}
84+
}
7485
else -> {
7586
sharedPreferences.getString(key.rawVal, null)
7687
}

0 commit comments

Comments
 (0)