forked from upstream-mirrors/quik
Fix release notes generation and add Realm migration for sendAsGroup fields
Co-authored-by: octoshrimpy <7097172+octoshrimpy@users.noreply.github.com>
This commit is contained in:
@@ -174,25 +174,10 @@ jobs:
|
|||||||
const tagName = 'v${{ steps.version.outputs.version_name }}';
|
const tagName = 'v${{ steps.version.outputs.version_name }}';
|
||||||
const {owner, repo} = context.repo;
|
const {owner, repo} = context.repo;
|
||||||
|
|
||||||
const {data: tags} = await github.rest.repos.listTags({
|
const {data: releases} = await github.rest.repos.listReleases({ owner, repo, per_page: 100 });
|
||||||
owner,
|
const previousRelease = releases.find(r => r.tag_name && /^v\d/.test(r.tag_name) && r.tag_name !== tagName);
|
||||||
repo,
|
const payload = { owner, repo, tag_name: tagName, target_commitish: '${{ env.RELEASE_REF }}' };
|
||||||
per_page: 100,
|
if (previousRelease) { payload.previous_tag_name = previousRelease.tag_name; }
|
||||||
});
|
|
||||||
|
|
||||||
const previousTag = tags.find(tag => /^v\d/.test(tag.name) && tag.name !== tagName)?.name;
|
|
||||||
|
|
||||||
const payload = {
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
tag_name: tagName,
|
|
||||||
target_commitish: '${{ env.RELEASE_REF }}',
|
|
||||||
};
|
|
||||||
|
|
||||||
if (previousTag) {
|
|
||||||
payload.previous_tag_name = previousTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await github.request('POST /repos/{owner}/{repo}/releases/generate-notes', payload);
|
const response = await github.request('POST /repos/{owner}/{repo}/releases/generate-notes', payload);
|
||||||
const notes = response.data.body || '';
|
const notes = response.data.body || '';
|
||||||
core.setOutput('release_notes', notes);
|
core.setOutput('release_notes', notes);
|
||||||
|
|||||||
@@ -99,28 +99,11 @@ jobs:
|
|||||||
const newTag = `v${process.env.NEW_VERSION_NAME}`;
|
const newTag = `v${process.env.NEW_VERSION_NAME}`;
|
||||||
const {owner, repo} = context.repo;
|
const {owner, repo} = context.repo;
|
||||||
|
|
||||||
const {data: tags} = await github.rest.repos.listTags({
|
const {data: releases} = await github.rest.repos.listReleases({ owner, repo, per_page: 100 });
|
||||||
owner,
|
const previousRelease = releases.find(r => r.tag_name && /^v\d/.test(r.tag_name) && r.tag_name !== newTag);
|
||||||
repo,
|
const requestPayload = { owner, repo, tag_name: newTag, target_commitish: 'master' };
|
||||||
per_page: 100,
|
if (previousRelease) { requestPayload.previous_tag_name = previousRelease.tag_name; }
|
||||||
});
|
|
||||||
|
|
||||||
const previousTagEntry = tags.find(tag => /^v\d/.test(tag.name));
|
|
||||||
const previousTag = previousTagEntry ? previousTagEntry.name : undefined;
|
|
||||||
|
|
||||||
const requestPayload = {
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
tag_name: newTag,
|
|
||||||
target_commitish: 'master',
|
|
||||||
};
|
|
||||||
|
|
||||||
if (previousTag) {
|
|
||||||
requestPayload.previous_tag_name = previousTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await github.request('POST /repos/{owner}/{repo}/releases/generate-notes', requestPayload);
|
const response = await github.request('POST /repos/{owner}/{repo}/releases/generate-notes', requestPayload);
|
||||||
|
|
||||||
const notes = response.data.body || '';
|
const notes = response.data.body || '';
|
||||||
core.exportVariable('RELEASE_NOTES', notes);
|
core.exportVariable('RELEASE_NOTES', notes);
|
||||||
core.setOutput('release_notes', notes);
|
core.setOutput('release_notes', notes);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import dev.octoshrimpy.quik.manager.BillingManager
|
|||||||
import dev.octoshrimpy.quik.manager.ReferralManager
|
import dev.octoshrimpy.quik.manager.ReferralManager
|
||||||
import dev.octoshrimpy.quik.migration.QkMigration
|
import dev.octoshrimpy.quik.migration.QkMigration
|
||||||
import dev.octoshrimpy.quik.migration.QkRealmMigration
|
import dev.octoshrimpy.quik.migration.QkRealmMigration
|
||||||
|
import dev.octoshrimpy.quik.realm.RealmConfig
|
||||||
import dev.octoshrimpy.quik.util.NightModeManager
|
import dev.octoshrimpy.quik.util.NightModeManager
|
||||||
import dev.octoshrimpy.quik.worker.HousekeepingWorker
|
import dev.octoshrimpy.quik.worker.HousekeepingWorker
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
@@ -77,16 +78,11 @@ class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverIn
|
|||||||
// set translated "no messages" string for speakThreads interactor
|
// set translated "no messages" string for speakThreads interactor
|
||||||
SpeakThreads.setNoMessagesString(getString(R.string.speak_no_messages))
|
SpeakThreads.setNoMessagesString(getString(R.string.speak_no_messages))
|
||||||
|
|
||||||
|
RealmConfig.init(this)
|
||||||
|
|
||||||
AppComponentManager.init(this)
|
AppComponentManager.init(this)
|
||||||
appComponent.inject(this)
|
appComponent.inject(this)
|
||||||
|
|
||||||
Realm.init(this)
|
|
||||||
Realm.setDefaultConfiguration(RealmConfiguration.Builder()
|
|
||||||
.compactOnLaunch()
|
|
||||||
.migration(realmMigration)
|
|
||||||
.schemaVersion(QkRealmMigration.SCHEMA_VERSION)
|
|
||||||
.build())
|
|
||||||
|
|
||||||
qkMigration.performMigration()
|
qkMigration.performMigration()
|
||||||
|
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package dev.octoshrimpy.quik.realm
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import io.realm.Realm
|
||||||
|
import io.realm.RealmConfiguration
|
||||||
|
import dev.octoshrimpy.quik.repository.migrations.AppRealmMigration
|
||||||
|
|
||||||
|
object RealmConfig {
|
||||||
|
|
||||||
|
private val config: RealmConfiguration by lazy {
|
||||||
|
RealmConfiguration.Builder()
|
||||||
|
.schemaVersion(AppRealmMigration.SCHEMA_VERSION)
|
||||||
|
.migration(AppRealmMigration())
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun init(context: Context) {
|
||||||
|
Realm.init(context)
|
||||||
|
Realm.setDefaultConfiguration(config)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package dev.octoshrimpy.quik.repository.migrations
|
||||||
|
|
||||||
|
import io.realm.DynamicRealm
|
||||||
|
import io.realm.FieldAttribute
|
||||||
|
import io.realm.RealmMigration
|
||||||
|
|
||||||
|
class AppRealmMigration : RealmMigration {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val SCHEMA_VERSION: Long = 15
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
|
||||||
|
var version = oldVersion
|
||||||
|
|
||||||
|
if (version < 11L) {
|
||||||
|
realm.schema.get("Conversation")
|
||||||
|
?.addField("sendAsGroup", Boolean::class.java, FieldAttribute.REQUIRED)
|
||||||
|
?.transform { obj ->
|
||||||
|
val list = obj.getList("recipients")
|
||||||
|
obj.setBoolean("sendAsGroup", list != null && list.size > 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
realm.schema.get("Message")
|
||||||
|
?.addField("sendAsGroup", Boolean::class.java, FieldAttribute.REQUIRED)
|
||||||
|
|
||||||
|
version = 11L
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version < SCHEMA_VERSION) {
|
||||||
|
version = SCHEMA_VERSION
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user