File tree Expand file tree Collapse file tree 1 file changed +4
-32
lines changed
model-provider/src/main/kotlin/com/flixclusive/model/provider Expand file tree Collapse file tree 1 file changed +4
-32
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ import kotlin.random.Random
3030@Serializable
3131data class ProviderMetadata (
3232 val authors : List <Author >,
33- val repositoryUrl : String? ,
34- val buildUrl : String? ,
33+ val repositoryUrl : String ,
34+ val buildUrl : String ,
3535 val changelog : String? = null ,
3636 val versionName : String ,
3737 val versionCode : Long ,
@@ -43,36 +43,8 @@ data class ProviderMetadata(
4343 val name : String ,
4444 val providerType : ProviderType ,
4545 val status : Status ,
46- val id : String? ,
47- ) {
48- companion object {
49- /* *
50- * Generates a 15-length string hash from the provider's data
51- * using the following properties:
52- * - [repositoryUrl]
53- * - [buildUrl]
54- *
55- * These two were chosen as they don't seem to change that often
56- * compare to the other properties.
57- *
58- * @return A 15-length string hash.
59- * */
60- fun generateIdHash (
61- providerMetadata : ProviderMetadata
62- ): String {
63- val dataToHash = listOfNotNull(
64- providerMetadata.buildUrl,
65- // ... add more
66- ).joinToString(" |" )
67-
68- val digest = MessageDigest .getInstance(" SHA-1" )
69- val hashBytes = digest.digest(dataToHash.toByteArray())
70- return hashBytes.toHexString().take(15 )
71- }
72-
73- private fun ByteArray.toHexString (): String = joinToString(" " ) { " %02x" .format(it) }
74- }
75- }
46+ val id : String ,
47+ )
7648
7749/* *
7850 * Represents the data associated with a provider.
You can’t perform that action at this time.
0 commit comments