mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-04-30 05:14:26 +02:00
feat: Make PatchOption#values
nullable
There is no difference semantically, but this change allows passing null as a parameter which is simpler than having to use `emptySet()`.
This commit is contained in:
parent
1b52e4b0f9
commit
56ce9ec2f9
@ -19,7 +19,7 @@ import kotlin.reflect.KProperty
|
|||||||
open class PatchOption<T>(
|
open class PatchOption<T>(
|
||||||
val key: String,
|
val key: String,
|
||||||
val default: T?,
|
val default: T?,
|
||||||
val values: Set<T>,
|
val values: Set<T>?,
|
||||||
val title: String?,
|
val title: String?,
|
||||||
val description: String?,
|
val description: String?,
|
||||||
val required: Boolean,
|
val required: Boolean,
|
||||||
@ -105,7 +105,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.stringPatchOption(
|
fun <P : Patch<*>> P.stringPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: String? = null,
|
default: String? = null,
|
||||||
values: Set<String> = emptySet(),
|
values: Set<String>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
@ -130,7 +130,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.intPatchOption(
|
fun <P : Patch<*>> P.intPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: Int? = null,
|
default: Int? = null,
|
||||||
values: Set<Int> = emptySet(),
|
values: Set<Int>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
@ -155,7 +155,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.booleanPatchOption(
|
fun <P : Patch<*>> P.booleanPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: Boolean? = null,
|
default: Boolean? = null,
|
||||||
values: Set<Boolean> = emptySet(),
|
values: Set<Boolean>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
@ -180,7 +180,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.floatPatchOption(
|
fun <P : Patch<*>> P.floatPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: Float? = null,
|
default: Float? = null,
|
||||||
values: Set<Float> = emptySet(),
|
values: Set<Float>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
@ -205,7 +205,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.longPatchOption(
|
fun <P : Patch<*>> P.longPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: Long? = null,
|
default: Long? = null,
|
||||||
values: Set<Long> = emptySet(),
|
values: Set<Long>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
@ -230,7 +230,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.stringArrayPatchOption(
|
fun <P : Patch<*>> P.stringArrayPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: Array<String>? = null,
|
default: Array<String>? = null,
|
||||||
values: Set<Array<String>> = emptySet(),
|
values: Set<Array<String>>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
@ -255,7 +255,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.intArrayPatchOption(
|
fun <P : Patch<*>> P.intArrayPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: Array<Int>? = null,
|
default: Array<Int>? = null,
|
||||||
values: Set<Array<Int>> = emptySet(),
|
values: Set<Array<Int>>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
@ -280,7 +280,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.booleanArrayPatchOption(
|
fun <P : Patch<*>> P.booleanArrayPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: Array<Boolean>? = null,
|
default: Array<Boolean>? = null,
|
||||||
values: Set<Array<Boolean>> = emptySet(),
|
values: Set<Array<Boolean>>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
@ -305,7 +305,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.floatArrayPatchOption(
|
fun <P : Patch<*>> P.floatArrayPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: Array<Float>? = null,
|
default: Array<Float>? = null,
|
||||||
values: Set<Array<Float>> = emptySet(),
|
values: Set<Array<Float>>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
@ -330,7 +330,7 @@ open class PatchOption<T>(
|
|||||||
fun <P : Patch<*>> P.longArrayPatchOption(
|
fun <P : Patch<*>> P.longArrayPatchOption(
|
||||||
key: String,
|
key: String,
|
||||||
default: Array<Long>? = null,
|
default: Array<Long>? = null,
|
||||||
values: Set<Array<Long>> = emptySet(),
|
values: Set<Array<Long>>? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
required: Boolean = false,
|
required: Boolean = false,
|
||||||
|
@ -62,7 +62,7 @@ internal class PatchOptionsTest {
|
|||||||
@Test
|
@Test
|
||||||
fun `should allow setting value from values`() =
|
fun `should allow setting value from values`() =
|
||||||
with(OptionsTestPatch.options["choices"] as PatchOption<String>) {
|
with(OptionsTestPatch.options["choices"] as PatchOption<String>) {
|
||||||
value = values.last()
|
value = values!!.last()
|
||||||
assertTrue(value == "valid")
|
assertTrue(value == "valid")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user