Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
hadithmv committed Jan 8, 2025
1 parent 35833da commit e83553a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
4 changes: 2 additions & 2 deletions androidApp-kt/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
40 changes: 17 additions & 23 deletions books-uc/01 increment-version-hmv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion js/navbar.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions windowsApp-tauri/Hadithmv/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -13,7 +13,8 @@
"title": "Hadithmv",
"width": 800,
"height": 600,
"maximized": true
"maximized": true,
"zoomHotkeysEnabled": true
}
],
"security": {
Expand Down

0 comments on commit e83553a

Please sign in to comment.