formatting

This commit is contained in:
Vitor Pamplona
2023-06-22 15:11:55 -04:00
parent 9b1c47f4a5
commit f62716a226
2 changed files with 5 additions and 2 deletions
@@ -2,6 +2,7 @@ package com.vitorpamplona.amethyst.ui.components
import android.content.Context import android.content.Context
import android.net.Uri import android.net.Uri
import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.graphics.toArgb
import coil.ImageLoader import coil.ImageLoader
@@ -31,6 +32,8 @@ private fun bytesToRGB(b1: Byte, b2: Byte, b3: Byte): Color {
} }
private fun svgString(msg: String): String { private fun svgString(msg: String): String {
checkNotInMainThread()
val hash = MessageDigest.getInstance("SHA-256").digest(msg.toByteArray()) val hash = MessageDigest.getInstance("SHA-256").digest(msg.toByteArray())
val hashHex = hash.joinToString(separator = "") { b -> "%02x".format(b) } val hashHex = hash.joinToString(separator = "") { b -> "%02x".format(b) }
val bgColor = bytesToRGB(hash[0], hash[1], hash[2]) val bgColor = bytesToRGB(hash[0], hash[1], hash[2])
@@ -93,6 +96,7 @@ object Robohash {
} }
} }
@Immutable
private data class Part(val style: String, val paths: String) private data class Part(val style: String, val paths: String)
private const val background = """<polyline class="cls-bg" points="150.3 7.4 55.1 97.9 55.1 203.1 150.3 293.6 245.9 203.1 245.9 97.9 150.3 7.4"/>""" private const val background = """<polyline class="cls-bg" points="150.3 7.4 55.1 97.9 55.1 203.1 150.3 293.6 245.9 203.1 245.9 97.9 150.3 7.4"/>"""
@@ -405,8 +405,7 @@ fun NormalNote(
channelNote = baseNote, channelNote = baseNote,
showVideo = !makeItShort, showVideo = !makeItShort,
showBottomDiviser = true, showBottomDiviser = true,
accountViewModel = accountViewModel = accountViewModel,
accountViewModel,
nav = nav nav = nav
) )
} else if (noteEvent is BadgeDefinitionEvent) { } else if (noteEvent is BadgeDefinitionEvent) {