Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Adding a locally generated changelog.#1355

Merged
dessalines merged 4 commits into
mainfrom
changelog_local
Feb 9, 2024
Merged

Adding a locally generated changelog.#1355
dessalines merged 4 commits into
mainfrom
changelog_local

Conversation

@dessalines

Copy link
Copy Markdown
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
}
}

val MIGRATION_22_21 =

Copy link
Copy Markdown
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
Copy Markdown
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

defaultValue = "0",
)
val themeColor: Int,
// TODO get rid of this column next time you regenerate the app

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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