aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/BuildUtils.kt25
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Const.kt9
2 files changed, 26 insertions, 8 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/BuildUtils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/BuildUtils.kt
new file mode 100644
index 00000000..76af5359
--- /dev/null
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/BuildUtils.kt
@@ -0,0 +1,25 @@
+package com.pitchedapps.frost.utils
+
+object BuildUtils {
+
+ data class Data(val versionName: String, val tail: String)
+
+ // Builds
+ const val BUILD_PRODUCTION = "production"
+ const val BUILD_TEST = "releaseTest"
+ const val BUILD_GITHUB = "github"
+ const val BUILD_RELEASE = "release"
+ const val BUILD_UNNAMED = "unnamed"
+
+ fun match(version: String): Data? {
+ val regex = Regex("([0-9]+\\.[0-9]+\\.[0-9]+)-?([0-9]*-?[0-9a-zA-Z]*)")
+ val result = regex.matchEntire(version)?.groupValues ?: return null
+ return Data(result[1], result[2])
+ }
+
+ fun getAllStages(): Array<String> =
+ arrayOf(BUILD_PRODUCTION, BUILD_TEST, BUILD_GITHUB, BUILD_RELEASE, BUILD_UNNAMED)
+
+ fun getStage(build: String): String = build.takeIf { it in getAllStages() } ?: BUILD_UNNAMED
+
+} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Const.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Const.kt
index 7909f125..0cb57ed5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Const.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Const.kt
@@ -15,11 +15,4 @@ const val REQUEST_TEXT_ZOOM = 1 shl 14
const val REQUEST_NAV = 1 shl 15
const val REQUEST_SEARCH = 1 shl 16
-const val MAIN_TIMEOUT_DURATION = 30 * 60 * 1000 // 30 min
-
-// Flavours
-const val FLAVOUR_PRODUCTION = "production"
-const val FLAVOUR_TEST = "releaseTest"
-const val FLAVOUR_GITHUB = "github"
-const val FLAVOUR_RELEASE = "release"
-const val FLAVOUR_UNNAMED = "unnamed" \ No newline at end of file
+const val MAIN_TIMEOUT_DURATION = 30 * 60 * 1000 // 30 min \ No newline at end of file