package com.rosetta.messenger.data

/**
 * Release notes for "Rosetta Updates" system messages.
 *
 * When releasing a new version, update [RELEASE_NOTICE] below.
 * The text will be sent once to each user after they update the app.
 */
object ReleaseNotes {

    /**
     * Current release notice shown to users after update.
     * [VERSION_PLACEHOLDER] will be replaced with the actual version from BuildConfig.
     */
    const val VERSION_PLACEHOLDER = "{version}"

    val RELEASE_NOTICE = """
        Update v$VERSION_PLACEHOLDER

        Оптимизация sync и protocol logging
        - Устранены лаги при CONNECTING/SYNCING: heartbeat-логи ограничены и больше не забивают UI
        - Добавлен fail-safe для handshake state: поврежденное/неизвестное значение больше не трактуется как успешный handshake
    """.trimIndent()

    fun getNotice(version: String): String =
        RELEASE_NOTICE.replace(VERSION_PLACEHOLDER, version)

    /** Hash of current notice text — used to re-send if text changed within the same version */
    val noticeHash: String
        get() = RELEASE_NOTICE.hashCode().toString(16)
}
