mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
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 {owner, repo} = context.repo;
|
||||
|
||||
const {data: tags} = await github.rest.repos.listTags({
|
||||
owner,
|
||||
repo,
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
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 {data: releases} = await github.rest.repos.listReleases({ owner, repo, per_page: 100 });
|
||||
const previousRelease = releases.find(r => r.tag_name && /^v\d/.test(r.tag_name) && r.tag_name !== tagName);
|
||||
const payload = { owner, repo, tag_name: tagName, target_commitish: '${{ env.RELEASE_REF }}' };
|
||||
if (previousRelease) { payload.previous_tag_name = previousRelease.tag_name; }
|
||||
const response = await github.request('POST /repos/{owner}/{repo}/releases/generate-notes', payload);
|
||||
const notes = response.data.body || '';
|
||||
core.setOutput('release_notes', notes);
|
||||
|
||||
@@ -99,28 +99,11 @@ jobs:
|
||||
const newTag = `v${process.env.NEW_VERSION_NAME}`;
|
||||
const {owner, repo} = context.repo;
|
||||
|
||||
const {data: tags} = await github.rest.repos.listTags({
|
||||
owner,
|
||||
repo,
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
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 {data: releases} = await github.rest.repos.listReleases({ owner, repo, per_page: 100 });
|
||||
const previousRelease = releases.find(r => r.tag_name && /^v\d/.test(r.tag_name) && r.tag_name !== newTag);
|
||||
const requestPayload = { owner, repo, tag_name: newTag, target_commitish: 'master' };
|
||||
if (previousRelease) { requestPayload.previous_tag_name = previousRelease.tag_name; }
|
||||
const response = await github.request('POST /repos/{owner}/{repo}/releases/generate-notes', requestPayload);
|
||||
|
||||
const notes = response.data.body || '';
|
||||
core.exportVariable('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.migration.QkMigration
|
||||
import dev.octoshrimpy.quik.migration.QkRealmMigration
|
||||
import dev.octoshrimpy.quik.realm.RealmConfig
|
||||
import dev.octoshrimpy.quik.util.NightModeManager
|
||||
import dev.octoshrimpy.quik.worker.HousekeepingWorker
|
||||
import io.realm.Realm
|
||||
@@ -77,16 +78,11 @@ class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverIn
|
||||
// set translated "no messages" string for speakThreads interactor
|
||||
SpeakThreads.setNoMessagesString(getString(R.string.speak_no_messages))
|
||||
|
||||
RealmConfig.init(this)
|
||||
|
||||
AppComponentManager.init(this)
|
||||
appComponent.inject(this)
|
||||
|
||||
Realm.init(this)
|
||||
Realm.setDefaultConfiguration(RealmConfiguration.Builder()
|
||||
.compactOnLaunch()
|
||||
.migration(realmMigration)
|
||||
.schemaVersion(QkRealmMigration.SCHEMA_VERSION)
|
||||
.build())
|
||||
|
||||
qkMigration.performMigration()
|
||||
|
||||
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