From e83553a1208d6e73f13541446bce5b860dbf5734 Mon Sep 17 00:00:00 2001 From: Mohamed Ashraaf Ibrahim Date: Thu, 9 Jan 2025 02:58:30 +0500 Subject: [PATCH] u --- androidApp-kt/app/build.gradle | 4 +- books-uc/01 increment-version-hmv.ps1 | 40 ++++++++----------- js/navbar.js | 2 +- .../Hadithmv/src-tauri/tauri.conf.json | 5 ++- 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/androidApp-kt/app/build.gradle b/androidApp-kt/app/build.gradle index b56fce692..b81f7c61d 100644 --- a/androidApp-kt/app/build.gradle +++ b/androidApp-kt/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId "com.hadithmv.hmv" minSdk 24 targetSdk 35 - versionCode 86 - versionName "4.03" + versionCode 85 + versionName "4.1.2" // https://stackoverflow.com/questions/39654620/android-how-to-change-specific-name-of-the-generated-apk-file-in-android-studio/55333735#55333735 archivesBaseName = "hadithmv" diff --git a/books-uc/01 increment-version-hmv.ps1 b/books-uc/01 increment-version-hmv.ps1 index 12f9635f3..0e0715c64 100644 --- a/books-uc/01 increment-version-hmv.ps1 +++ b/books-uc/01 increment-version-hmv.ps1 @@ -30,22 +30,23 @@ try { throw "File is empty" } - # Extract the current version number - if ($content -match 'var hmvVersionNo = (\d+\.\d+);') { - $currentVersion = [double]$matches[1] + # Extract the current version number (now handling quoted semver format) + if ($content -match 'var hmvVersionNo = "(\d+\.\d+\.\d+)";') { + $currentVersion = $matches[1] try { - # Increment the version by 0.01 - $newVersion = [math]::Round($currentVersion + 0.01, 2) - $newVersion = $newVersion.ToString("F2") - - # Validate new version is greater than current version - if ([double]$newVersion -le $currentVersion) { - throw "New version ($newVersion) is not greater than current version ($currentVersion)" - } + # Parse semver components + $versionParts = $currentVersion.Split('.') + $major = [int]$versionParts[0] + $minor = [int]$versionParts[1] + $patch = [int]$versionParts[2] - # Update navbar.js - $newContent = $content -replace 'var hmvVersionNo = \d+\.\d+;', "var hmvVersionNo = $newVersion;" + # Increment the patch version + $patch += 1 + $newVersion = "$major.$minor.$patch" + + # Update navbar.js with semver format (including quotes) + $newContent = $content -replace 'var hmvVersionNo = "\d+\.\d+\.\d+";', "var hmvVersionNo = `"$newVersion`";" if ($newContent -eq $content) { throw "Version replacement failed in navbar.js" } @@ -59,7 +60,7 @@ try { $tauriContent = Get-Content $tauriPath -Raw $newTauriContent = $tauriContent -replace '"version": "\d+\.\d+\.\d+"', "`"version`": `"$newVersion`"" $newTauriContent | Set-Content $tauriPath -NoNewline - Write-Output "✅ tauri.conf.json version updated to $newVersion" + Write-Output "✅ tauri.conf.json version updated to version: $newVersion" } else { Write-Warning "⚠️ tauri.conf.json not found at $tauriPath" @@ -70,17 +71,10 @@ try { if (Test-Path $gradlePath) { $gradleContent = Get-Content $gradlePath -Raw - # Extract and increment versionCode - if ($gradleContent -match 'versionCode\s+(\d+)') { - $versionCode = [int]$matches[1] - $newVersionCode = $versionCode + 1 - $gradleContent = $gradleContent -replace 'versionCode\s+\d+', "versionCode $newVersionCode" - } - - # Update versionName (keeping the decimal point) + # Update versionName with semver $gradleContent = $gradleContent -replace 'versionName\s+"[^"]+"', "versionName `"$newVersion`"" $gradleContent | Set-Content $gradlePath -NoNewline - Write-Output "✅ build.gradle updated (versionName: $newVersion, versionCode: $newVersionCode)" + Write-Output "✅ build.gradle updated to versionName: $newVersion" } else { Write-Warning "⚠️ build.gradle not found at $gradlePath" diff --git a/js/navbar.js b/js/navbar.js index dd43c37ad..e133255e0 100644 --- a/js/navbar.js +++ b/js/navbar.js @@ -1,6 +1,6 @@ // this was initially just navbar code, but then i added other snippets i needed on every page, but not the dt stuff -var hmvVersionNo = 4.03; +var hmvVersionNo = "4.1.2"; // cant be 4.0, has to be like 4.1 or 4.01, as empty zeros will get removes // above is version no var for hmv, shown in sidemenu and maybe main index page diff --git a/windowsApp-tauri/Hadithmv/src-tauri/tauri.conf.json b/windowsApp-tauri/Hadithmv/src-tauri/tauri.conf.json index d148cb862..1fcbea042 100644 --- a/windowsApp-tauri/Hadithmv/src-tauri/tauri.conf.json +++ b/windowsApp-tauri/Hadithmv/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "hadithmv", - "version": "4.03", + "version": "4.1.2", "identifier": "com.hadithmv.app", "build": { "frontendDist": "../src" @@ -13,7 +13,8 @@ "title": "Hadithmv", "width": 800, "height": 600, - "maximized": true + "maximized": true, + "zoomHotkeysEnabled": true } ], "security": {