From f10de01b78560557895467350e3d17693a6fd153 Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Wed, 13 Apr 2022 09:54:30 +0000 Subject: [PATCH] adding preversion support to json answer --- src/Helpers/Build.php | 10 ++++++++++ src/Helpers/Builds.php | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Helpers/Build.php b/src/Helpers/Build.php index 937582b..376dbc9 100644 --- a/src/Helpers/Build.php +++ b/src/Helpers/Build.php @@ -90,6 +90,7 @@ $this->apiLevel = $this->getBuildPropValue('ro.build.version.sdk') ?? ''; $this->model = $this->getBuildPropValue('ro.lineage.device') ?? $this->getBuildPropValue('ro.cm.device') ?? ($tokens[1] == 'cm' ? $tokens[9] : $tokens[8]); $this->version = $tokens[2]; + $this->preversion = $tokens[3]; $this->displayVersion = $this->getBuildPropValue('ro.cm.display.version') ?? $this->getBuildPropValue('ro.lineage.display.version') ?? ''; $this->androidVersion = $this->getBuildPropValue('ro.build.version.release') ?? ''; $this->uid = hash('sha256', $this->timestamp.$this->model.$this->apiLevel, false); @@ -349,6 +350,15 @@ return $this->version; } + /** + * Get the preversion of the current build (alpha, beta.3, etc) + * @return string the preversion value + */ + public function getPreversion() + { + return $this->preversion; + } + /** * Get the version of the current build * @return string the version value diff --git a/src/Helpers/Builds.php b/src/Helpers/Builds.php index f4cdbe6..fc9d7f0 100644 --- a/src/Helpers/Builds.php +++ b/src/Helpers/Builds.php @@ -100,6 +100,7 @@ 'romtype' => $build->getChannel(), 'datetime' => $build->getTimestamp(), 'version' => $build->getVersion(), + 'pre_version' => $build->getPreversion(), 'display_version' => $build->getDisplayVersion(), 'android_version' => $build->getAndroidVersion(), 'id' => $build->getUid(), @@ -219,4 +220,4 @@ $this->logger->debug('Total execution time of getBuilds in seconds'); } -} \ No newline at end of file +} -- GitLab