Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a locally generated changelog. #1355

Merged
merged 4 commits into from
Feb 9, 2024
Merged

Adding a locally generated changelog. #1355

merged 4 commits into from
Feb 9, 2024

Conversation

dessalines
Copy link
Member

- Adds a last_version_code_viewed, that gets updated in the DB,
  and compared against the current version to show the changelog.
  This means we never have to manually update that column again.
- Add a generate_changelog.sh script that uses git-cliff. It copies
  the changelog into code assets, which can be done before the release.
- Fixes #1272
@@ -300,15 +300,6 @@ val MIGRATION_21_22 =
}
}

val MIGRATION_22_21 =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed all these down migrations since they were useless.

Comment on lines +1467 to +1468

fun Context.getVersionCode(): Int =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's one way to do it. Another is through BuildConfig, you can enable it in the gradle build it's a static class containing all the info of the build

@@ -24,6 +24,7 @@ data class AppSettings(
defaultValue = "0",
)
val themeColor: Int,
// TODO get rid of this column next time you regenerate the app
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why next time? why cant we drop it already?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

android SQLite can't drop columns, you have to regenerate the entire table. Should probably be done at some point, but probably when we go over all the columns and everything we need to refactor.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have done this before, see when I changed the default of a column

name = "last_version_code_viewed",
defaultValue = "0",
)
val lastVersionCodeViewed: Int,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably have made a separate table for this. It's not really a app setting. But this is fine

val res = API.httpClient.newCall(req).execute()
_changelog.value = res.body.string()
Log.d("jerboa", "Getting RELEASES.md from assets...")
val releasesStr = ctx.assets.open("RELEASES.md").bufferedReader().use { it.readText() }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rather have this logic in the viewmodel. Just pass a stream or string.

I see that we did this before but we shouldn't have

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to refactor that now.


@WorkerThread
suspend fun updateChangelog() {
withContext(Dispatchers.IO) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this withContext when I moved this to the viewmodel. It didn't seem to have any effect.

@dessalines dessalines requested a review from MV-GH February 9, 2024 18:07
@dessalines dessalines merged commit d91a0d2 into main Feb 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use last_version_code_viewed rather than changelog_viewed for showing the changelog
2 participants