Compare commits

...
6 Commits
Author SHA1 Message Date
robin 792047eae4 README.md aktualisiert 2026-10-30 18:00:29 +00:00
robin 78fd859889 CHANGELOG update
Build & Release Android App / build (push) Successful in 17m52s
2026-10-30 18:52:26 +01:00
robin b93d23f31c feat: beta may take release notes from stable 2026-10-30 18:51:37 +01:00
robin 648da0fb37 Merge pull request 'feat: show changelog after update' (#41) from feat/changelog-after-update into main
Build & Release Android App / build (push) Successful in 11m15s
Reviewed-on: robin/WeekFocus#41
2026-10-30 17:34:31 +00:00
robin d8bb6f1671 feat: show changelog after update 2026-10-30 18:34:08 +01:00
robin 168c3eeedc README.md aktualisiert 2026-10-30 13:32:15 +00:00
10 changed files with 193 additions and 32 deletions

No files matched your search

+45 -31
View File
@@ -64,6 +64,51 @@ jobs:
echo "$KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.keystore" echo "$KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.keystore"
echo "KEYSTORE_PATH=$RUNNER_TEMP/release.keystore" >> $GITHUB_ENV echo "KEYSTORE_PATH=$RUNNER_TEMP/release.keystore" >> $GITHUB_ENV
- name: Release-Notes aus CHANGELOG.md extrahieren
run: |
VERSION="${GITHUB_REF_NAME#v}"
NOTES_FILE="$RUNNER_TEMP/release_notes.md"
extract_notes() {
awk -v ver="$1" '
/^##[[:space:]]/ {
if (found) exit
line = $0
sub(/^##[[:space:]]+/, "", line)
sub(/^\[?v?/, "", line)
if (substr(line, 1, length(ver)) == ver) {
rest = substr(line, length(ver) + 1)
if (rest ~ /^([^0-9.]|$)/) { found = 1 }
}
next
}
found { print }
' CHANGELOG.md
}
if [ -f CHANGELOG.md ]; then
extract_notes "$VERSION" > "$NOTES_FILE"
# Kein eigener Eintrag für die Beta? Dann den der Basisversion nehmen.
BASE="${VERSION%%-*}"
if ! grep -q '[^[:space:]]' "$NOTES_FILE" && [ "$BASE" != "$VERSION" ]; then
extract_notes "$BASE" > "$NOTES_FILE"
fi
else
: > "$NOTES_FILE"
fi
# In die APK einbetten, aber nur, wenn es echte Notes gibt
mkdir -p app/src/main/assets
if grep -q '[^[:space:]]' "$NOTES_FILE"; then
cp "$NOTES_FILE" app/src/main/assets/release_notes.md
else
echo "Keine Release-Notes für Version $VERSION vorhanden." > "$NOTES_FILE"
fi
echo "Release-Notes:"
cat "$NOTES_FILE"
- name: Android Release APK bauen - name: Android Release APK bauen
run: | run: |
set -euo pipefail set -euo pipefail
@@ -101,37 +146,6 @@ jobs:
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
- name: Release-Notes aus CHANGELOG.md extrahieren
run: |
VERSION="${GITHUB_REF_NAME#v}"
NOTES_FILE="$RUNNER_TEMP/release_notes.md"
if [ -f CHANGELOG.md ]; then
awk -v ver="$VERSION" '
/^##[[:space:]]/ {
if (found) exit
line = $0
sub(/^##[[:space:]]+/, "", line)
sub(/^\[?v?/, "", line)
if (substr(line, 1, length(ver)) == ver) {
rest = substr(line, length(ver) + 1)
if (rest ~ /^([^0-9.]|$)/) { found = 1 }
}
next
}
found { print }
' CHANGELOG.md > "$NOTES_FILE"
else
: > "$NOTES_FILE"
fi
if ! grep -q '[^[:space:]]' "$NOTES_FILE"; then
echo "Keine Release-Notes für Version $VERSION vorhanden." > "$NOTES_FILE"
fi
echo "Release-Notes:"
cat "$NOTES_FILE"
- name: Release in Gitea erstellen und APK hochladen - name: Release in Gitea erstellen und APK hochladen
env: env:
TOKEN: ${{ secrets.GITHUB_TOKEN }} TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1
View File
@@ -15,3 +15,4 @@
.externalNativeBuild .externalNativeBuild
.cxx .cxx
local.properties local.properties
app/src/main/assets/release_notes.md
+4
View File
@@ -1,5 +1,9 @@
# Changelog # Changelog
## [1.4.2] - 2026-10-30
### New
* show changelog after update
## [1.4.1] - 2026-10-30 ## [1.4.1] - 2026-10-30
### New ### New
* about screen * about screen
+1 -1
View File
@@ -7,7 +7,7 @@
**One word. One week. One quality to grow.** **One word. One week. One quality to grow.**
<a href="https://apps.obtainium.imranr.dev/redirect?r=obtainium://app/%7B%22id%22%3A%22de.schanbro.weekfocus%22%2C%22url%22%3A%22https%3A%2F%2Fgit.schamagusa.de%2FSchanbro%2FWeekFocus%22%2C%22author%22%3A%22Schanbro%22%2C%22name%22%3A%22WeekFocus%22%2C%22overrideSource%22%3A%22Codeberg%22%7D"> <a href="https://apps.obtainium.imranr.dev/redirect?r=obtainium://app/%7B%22id%22%3A%22de.schanbro.weekfocus%22%2C%22url%22%3A%22https%3A%2F%2Fgit.schamagusa.de%Schanbro%2FWeekFocus%22%2C%22author%22%3A%Schanbro%22%2C%22name%22%3A%22WeekFocus%22%2C%22overrideSource%22%3A%22Codeberg%22%7D">
<img src="https://raw.githubusercontent.com/ImranR98/Obtainium/main/assets/graphics/badge_obtainium.png" alt="Get it on Obtainium" height="64"> <img src="https://raw.githubusercontent.com/ImranR98/Obtainium/main/assets/graphics/badge_obtainium.png" alt="Get it on Obtainium" height="64">
</a> </a>
@@ -32,6 +32,7 @@ import de.schanbro.weekfocus.settings.ThemeMode
import de.schanbro.weekfocus.ui.theme.WeekFocusTheme import de.schanbro.weekfocus.ui.theme.WeekFocusTheme
import de.schanbro.weekfocus.update.NetworkPermissionGate import de.schanbro.weekfocus.update.NetworkPermissionGate
import de.schanbro.weekfocus.update.UpdateHandler import de.schanbro.weekfocus.update.UpdateHandler
import de.schanbro.weekfocus.update.WhatsNewHandler
private object Routes { private object Routes {
const val HOME = "home" const val HOME = "home"
@@ -55,6 +56,7 @@ class MainActivity : ComponentActivity() {
WeekFocusTheme(darkTheme = darkTheme) { WeekFocusTheme(darkTheme = darkTheme) {
MainScreen() MainScreen()
WhatsNewHandler()
NetworkPermissionGate { NetworkPermissionGate {
UpdateHandler() UpdateHandler()
} }
@@ -7,6 +7,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.* import androidx.compose.material3.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@@ -18,7 +19,11 @@ import androidx.compose.ui.unit.dp
import de.schanbro.weekfocus.R import de.schanbro.weekfocus.R
import de.schanbro.weekfocus.components.ClickRow import de.schanbro.weekfocus.components.ClickRow
import de.schanbro.weekfocus.components.SectionTitle import de.schanbro.weekfocus.components.SectionTitle
import de.schanbro.weekfocus.update.ReleaseNotes
import de.schanbro.weekfocus.update.UpdateChecker import de.schanbro.weekfocus.update.UpdateChecker
import de.schanbro.weekfocus.update.WhatsNewDialog
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
private const val REPO_URL = "https://git.schamagusa.de/robin/WeekFocus" private const val REPO_URL = "https://git.schamagusa.de/robin/WeekFocus"
@@ -81,6 +86,25 @@ fun AboutScreen(
onClick = { uriHandler.openUri("$REPO_URL/releases") } onClick = { uriHandler.openUri("$REPO_URL/releases") }
) )
HorizontalDivider()
SectionTitle(stringResource(R.string.about_whats_new_section_title))
var showNotes by remember { mutableStateOf(false) }
val notes = remember { ReleaseNotes.load(context) }
if (notes != null) {
ClickRow(
title = stringResource(R.string.about_whats_new_title),
summary = stringResource(R.string.about_whats_new_summary),
onClick = { showNotes = true }
)
}
if (showNotes && notes != null) {
WhatsNewDialog(version = version, notes = notes, onDismiss = { showNotes = false })
}
Spacer(Modifier.height(16.dp)) Spacer(Modifier.height(16.dp))
} }
} }
@@ -0,0 +1,29 @@
package de.schanbro.weekfocus.update
import android.content.Context
import java.io.IOException
object ReleaseNotes {
/** Liefert die eingebetteten Notes oder null (z. B. bei lokalen Builds). */
fun load(context: Context): String? = try {
context.assets.open("release_notes.md")
.bufferedReader().use { it.readText() }
.trim()
.ifEmpty { null }
} catch (e: IOException) {
null
}
/** Einfache Markdown-Bereinigung für die Anzeige als Text. */
fun format(markdown: String): String =
markdown.lines()
.joinToString("\n") { line ->
line.trimEnd()
.replace(Regex("^#{1,6}\\s*"), "")
.replace(Regex("^\\s*[-*]\\s+"), "• ")
.replace("**", "")
}
.replace(Regex("\n{3,}"), "\n\n")
.trim()
}
@@ -0,0 +1,75 @@
package de.schanbro.weekfocus.update
import android.content.Context
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import de.schanbro.weekfocus.R
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
private const val KEY_LAST_SEEN = "last_seen_version"
@Composable
fun WhatsNewHandler() {
val context = LocalContext.current
val prefs = remember {
context.getSharedPreferences("WeekFocusPrefs", Context.MODE_PRIVATE)
}
val current = remember { UpdateChecker.currentVersion(context) }
var notes by remember { mutableStateOf<String?>(null) }
fun markSeen() = prefs.edit().putString(KEY_LAST_SEEN, current).apply()
LaunchedEffect(Unit) {
val lastSeen = prefs.getString(KEY_LAST_SEEN, null)
// Erster Start nach Neuinstallation: nichts anzeigen, nur merken
if (lastSeen == null) {
markSeen()
return@LaunchedEffect
}
if (UpdateChecker.isNewer(current, lastSeen)) {
val loaded = withContext(Dispatchers.IO) { ReleaseNotes.load(context) }
if (loaded != null) notes = loaded else markSeen()
}
}
notes?.let {
WhatsNewDialog(
version = current,
notes = it,
onDismiss = {
markSeen()
notes = null
}
)
}
}
@Composable
fun WhatsNewDialog(version: String, notes: String, onDismiss: () -> Unit) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text(stringResource(R.string.whats_new_title, version)) },
text = {
Column(Modifier.verticalScroll(rememberScrollState())) {
Text(
text = ReleaseNotes.format(notes),
style = MaterialTheme.typography.bodyMedium
)
}
},
confirmButton = {
TextButton(onClick = onDismiss) {
Text(stringResource(R.string.whats_new_close))
}
}
)
}
+6
View File
@@ -64,4 +64,10 @@
<string name="about_issues_summary">Bugs and requests in the issue tracker</string> <string name="about_issues_summary">Bugs and requests in the issue tracker</string>
<string name="about_releases_title">Releases</string> <string name="about_releases_title">Releases</string>
<string name="about_releases_summary">See all releases and changes</string> <string name="about_releases_summary">See all releases and changes</string>
<string name="whats_new_title">What’s new in version %1$s</string>
<string name="whats_new_close">Got it</string>
<string name="about_whats_new_title">What’s new</string>
<string name="about_whats_new_summary">See the changes in this version</string>
<string name="about_whats_new_section_title">Changes</string>
</resources> </resources>
+6
View File
@@ -71,4 +71,10 @@
<string name="about_issues_summary">Probleme und Wünsche im Issue-Tracker</string> <string name="about_issues_summary">Probleme und Wünsche im Issue-Tracker</string>
<string name="about_releases_title">Versionen</string> <string name="about_releases_title">Versionen</string>
<string name="about_releases_summary">Alle Releases und Änderungen ansehen</string> <string name="about_releases_summary">Alle Releases und Änderungen ansehen</string>
<string name="whats_new_title">Neu in Version %1$s</string>
<string name="whats_new_close">Alles klar</string>
<string name="about_whats_new_title">Was ist neu</string>
<string name="about_whats_new_summary">Änderungen dieser Version ansehen</string>
<string name="about_whats_new_section_title">Änderungen</string>
</resources> </resources>