You've already forked revanced-patcher
mirror of
https://github.com/revanced/revanced-patcher
synced 2025-09-06 16:38:50 +02:00
Compare commits
18 Commits
v18.0.0-de
...
v18.0.0-de
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0447fa9c28 | ||
![]() |
54ac1394a9 | ||
![]() |
0b04c73ac5 | ||
![]() |
079de45238 | ||
![]() |
56ce9ec2f9 | ||
![]() |
1b52e4b0f9 | ||
![]() |
098c2c1efa | ||
![]() |
64343e5a7c | ||
![]() |
0caf6caeb9 | ||
![]() |
55f6c2a9fc | ||
![]() |
c6095bc38a | ||
![]() |
09cd6aa568 | ||
![]() |
ebbaafb78e | ||
![]() |
e6de90d300 | ||
![]() |
c7922e90d0 | ||
![]() |
c1f4c0445a | ||
![]() |
caa634fac6 | ||
![]() |
f28bfe0dbd |
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,3 +1,38 @@
|
||||
# [18.0.0-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.3...v18.0.0-dev.4) (2023-10-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Use a map for `PatchOption#values` ([54ac139](https://github.com/ReVanced/revanced-patcher/commit/54ac1394a914d3eed7865ec697e8016834134911))
|
||||
|
||||
# [18.0.0-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.2...v18.0.0-dev.3) (2023-10-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Make `PatchOption#values` nullable ([56ce9ec](https://github.com/ReVanced/revanced-patcher/commit/56ce9ec2f98ff351c3d42df71b49e5c88f07e665))
|
||||
|
||||
# [18.0.0-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v18.0.0-dev.1...v18.0.0-dev.2) (2023-10-22)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* Change `PatchOption` from abstract to open class ([09cd6aa](https://github.com/ReVanced/revanced-patcher/commit/09cd6aa568988dd5241bfa6a2e12b7926a7b0683))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add function to reset options to their default value ([ebbaafb](https://github.com/ReVanced/revanced-patcher/commit/ebbaafb78e88f34faeafe9ff8532afe29231bd79))
|
||||
* Add function to reset options to their default value ([e6de90d](https://github.com/ReVanced/revanced-patcher/commit/e6de90d300bc9c82ca1696cb898db04c65a1cd5b))
|
||||
* Add getter for default option value ([c7922e9](https://github.com/ReVanced/revanced-patcher/commit/c7922e90d0c6ae83f513611c706ebea33c1a2b63))
|
||||
* Name patch option value validator property correctly ([caa634f](https://github.com/ReVanced/revanced-patcher/commit/caa634fac6d7a717f54e3b015827c8858fd637b9))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* This gets rid of the existing basic implementations of the `PatchOptions` type and moves extension functions.
|
||||
* This changes the getter name of the property.
|
||||
|
||||
# [18.0.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v17.0.1-dev.1...v18.0.0-dev.1) (2023-10-14)
|
||||
|
||||
|
||||
|
@@ -360,17 +360,45 @@ public abstract interface annotation class app/revanced/patcher/patch/annotation
|
||||
public abstract fun use ()Z
|
||||
}
|
||||
|
||||
public abstract class app/revanced/patcher/patch/options/PatchOption {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)V
|
||||
public class app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field PatchExtensions Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)V
|
||||
public final fun getDefault ()Ljava/lang/Object;
|
||||
public final fun getDescription ()Ljava/lang/String;
|
||||
public final fun getKey ()Ljava/lang/String;
|
||||
public final fun getRequired ()Z
|
||||
public final fun getTitle ()Ljava/lang/String;
|
||||
public final fun getValidate ()Lkotlin/jvm/functions/Function1;
|
||||
public final fun getValidator ()Lkotlin/jvm/functions/Function2;
|
||||
public final fun getValue ()Ljava/lang/Object;
|
||||
public final fun getValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
|
||||
public final fun getValues ()Ljava/util/Map;
|
||||
public fun reset ()V
|
||||
public final fun setValue (Ljava/lang/Object;)V
|
||||
public final fun setValue (Ljava/lang/Object;Lkotlin/reflect/KProperty;Ljava/lang/Object;)V
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/PatchOption$PatchExtensions {
|
||||
public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/PatchOption$PatchExtensions;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/PatchOption;
|
||||
}
|
||||
|
||||
public abstract class app/revanced/patcher/patch/options/PatchOptionException : java/lang/Exception {
|
||||
@@ -422,106 +450,6 @@ public final class app/revanced/patcher/patch/options/PatchOptions : java/util/M
|
||||
public final fun values ()Ljava/util/Collection;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/BooleanPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/BooleanPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/BooleanPatchOption$Companion {
|
||||
public final fun booleanPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/BooleanPatchOption;
|
||||
public static synthetic fun booleanPatchOption$default (Lapp/revanced/patcher/patch/options/types/BooleanPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/BooleanPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/FloatPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/FloatPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/FloatPatchOption$Companion {
|
||||
public final fun floatPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/FloatPatchOption;
|
||||
public static synthetic fun floatPatchOption$default (Lapp/revanced/patcher/patch/options/types/FloatPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/FloatPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/IntPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/IntPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/IntPatchOption$Companion {
|
||||
public final fun intPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/IntPatchOption;
|
||||
public static synthetic fun intPatchOption$default (Lapp/revanced/patcher/patch/options/types/IntPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/IntPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/LongPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/LongPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/LongPatchOption$Companion {
|
||||
public final fun longPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/LongPatchOption;
|
||||
public static synthetic fun longPatchOption$default (Lapp/revanced/patcher/patch/options/types/LongPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/LongPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/StringPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/StringPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/StringPatchOption$Companion {
|
||||
public final fun stringPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/StringPatchOption;
|
||||
public static synthetic fun stringPatchOption$default (Lapp/revanced/patcher/patch/options/types/StringPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/StringPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion {
|
||||
public final fun booleanArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption;
|
||||
public static synthetic fun booleanArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/BooleanArrayPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion {
|
||||
public final fun floatArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption;
|
||||
public static synthetic fun floatArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Float;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/FloatArrayPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/IntArrayPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion {
|
||||
public final fun intArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption;
|
||||
public static synthetic fun intArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/IntArrayPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/LongArrayPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion {
|
||||
public final fun longArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption;
|
||||
public static synthetic fun longArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/LongArrayPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/StringArrayPatchOption : app/revanced/patcher/patch/options/PatchOption {
|
||||
public static final field Companion Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion;
|
||||
public synthetic fun <init> (Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion {
|
||||
public final fun stringArrayPatchOption (Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption;
|
||||
public static synthetic fun stringArrayPatchOption$default (Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption$Companion;Lapp/revanced/patcher/patch/Patch;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/options/types/array/StringArrayPatchOption;
|
||||
}
|
||||
|
||||
public final class app/revanced/patcher/util/DomFileEditor : java/io/Closeable {
|
||||
public fun <init> (Ljava/io/File;)V
|
||||
public fun close ()V
|
||||
|
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "1.9.0"
|
||||
kotlin("jvm") version "1.9.10"
|
||||
alias(libs.plugins.binary.compatibility.validator)
|
||||
`maven-publish`
|
||||
signing
|
||||
|
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 18.0.0-dev.1
|
||||
version = 18.0.0-dev.4
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing a [Boolean].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class BooleanPatchOption private constructor(
|
||||
key: String,
|
||||
default: Boolean?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (Boolean?) -> Boolean
|
||||
) : PatchOption<Boolean>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [BooleanPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [BooleanPatchOption].
|
||||
*
|
||||
* @see BooleanPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.booleanPatchOption(
|
||||
key: String,
|
||||
default: Boolean? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (Boolean?) -> Boolean = { true }
|
||||
) = BooleanPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing a [Float].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class FloatPatchOption private constructor(
|
||||
key: String,
|
||||
default: Float?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (Float?) -> Boolean
|
||||
) : PatchOption<Float>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [FloatPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [FloatPatchOption].
|
||||
*
|
||||
* @see FloatPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.floatPatchOption(
|
||||
key: String,
|
||||
default: Float? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (Float?) -> Boolean = { true }
|
||||
) = FloatPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing an [Integer].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class IntPatchOption private constructor(
|
||||
key: String,
|
||||
default: Int?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (Int?) -> Boolean
|
||||
) : PatchOption<Int>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [IntPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [IntPatchOption].
|
||||
*
|
||||
* @see IntPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.intPatchOption(
|
||||
key: String,
|
||||
default: Int? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (Int?) -> Boolean = { true }
|
||||
) = IntPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing a [Long].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class LongPatchOption private constructor(
|
||||
key: String,
|
||||
default: Long?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (Long?) -> Boolean
|
||||
) : PatchOption<Long>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [LongPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [LongPatchOption].
|
||||
*
|
||||
* @see LongPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.longPatchOption(
|
||||
key: String,
|
||||
default: Long? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (Long?) -> Boolean = { true }
|
||||
) = LongPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing a [String].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class StringPatchOption private constructor(
|
||||
key: String,
|
||||
default: String?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (String?) -> Boolean
|
||||
) : PatchOption<String>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [StringPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [StringPatchOption].
|
||||
*
|
||||
* @see StringPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.stringPatchOption(
|
||||
key: String,
|
||||
default: String? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (String?) -> Boolean = { true }
|
||||
) = StringPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types.array
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing a [Boolean] array.
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class BooleanArrayPatchOption private constructor(
|
||||
key: String,
|
||||
default: Array<Boolean>?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (Array<Boolean>?) -> Boolean
|
||||
) : PatchOption<Array<Boolean>>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [BooleanArrayPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [BooleanArrayPatchOption].
|
||||
*
|
||||
* @see BooleanArrayPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.booleanArrayPatchOption(
|
||||
key: String,
|
||||
default: Array<Boolean>? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (Array<Boolean>?) -> Boolean = { true }
|
||||
) = BooleanArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types.array
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing a [Float] array.
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class FloatArrayPatchOption private constructor(
|
||||
key: String,
|
||||
default: Array<Float>?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (Array<Float>?) -> Boolean
|
||||
) : PatchOption<Array<Float>>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [FloatArrayPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [FloatArrayPatchOption].
|
||||
*
|
||||
* @see FloatArrayPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.floatArrayPatchOption(
|
||||
key: String,
|
||||
default: Array<Float>? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (Array<Float>?) -> Boolean = { true }
|
||||
) = FloatArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types.array
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing an [Integer] array.
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class IntArrayPatchOption private constructor(
|
||||
key: String,
|
||||
default: Array<Int>?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (Array<Int>?) -> Boolean
|
||||
) : PatchOption<Array<Int>>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [IntArrayPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [IntArrayPatchOption].
|
||||
*
|
||||
* @see IntArrayPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.intArrayPatchOption(
|
||||
key: String,
|
||||
default: Array<Int>? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (Array<Int>?) -> Boolean = { true }
|
||||
) = IntArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types.array
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing a [Long] array.
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class LongArrayPatchOption private constructor(
|
||||
key: String,
|
||||
default: Array<Long>?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (Array<Long>?) -> Boolean
|
||||
) : PatchOption<Array<Long>>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [LongArrayPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [LongArrayPatchOption].
|
||||
*
|
||||
* @see LongArrayPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.longArrayPatchOption(
|
||||
key: String,
|
||||
default: Array<Long>? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (Array<Long>?) -> Boolean = { true }
|
||||
) = LongArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package app.revanced.patcher.patch.options.types.array
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
|
||||
/**
|
||||
* A [PatchOption] representing a [String] array.
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
*
|
||||
* @see PatchOption
|
||||
*/
|
||||
class StringArrayPatchOption private constructor(
|
||||
key: String,
|
||||
default: Array<String>?,
|
||||
title: String?,
|
||||
description: String?,
|
||||
required: Boolean,
|
||||
validator: (Array<String>?) -> Boolean
|
||||
) : PatchOption<Array<String>>(key, default, title, description, required, validator) {
|
||||
companion object {
|
||||
/**
|
||||
* Create a new [StringArrayPatchOption] and add it to the current [Patch].
|
||||
*
|
||||
* @param key The identifier.
|
||||
* @param default The default value.
|
||||
* @param title The title.
|
||||
* @param description A description.
|
||||
* @param required Whether the option is required.
|
||||
* @return The created [StringArrayPatchOption].
|
||||
*
|
||||
* @see StringArrayPatchOption
|
||||
* @see PatchOption
|
||||
*/
|
||||
fun <T : Patch<*>> T.stringArrayPatchOption(
|
||||
key: String,
|
||||
default: Array<String>? = null,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
required: Boolean = false,
|
||||
validator: (Array<String>?) -> Boolean = { true }
|
||||
) = StringArrayPatchOption(key, default, title, description, required, validator).also { options.register(it) }
|
||||
}
|
||||
}
|
@@ -2,31 +2,43 @@ package app.revanced.patcher.patch.options
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.options.types.BooleanPatchOption.Companion.booleanPatchOption
|
||||
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
|
||||
import app.revanced.patcher.patch.options.types.array.StringArrayPatchOption.Companion.stringArrayPatchOption
|
||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption
|
||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringArrayPatchOption
|
||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||
import org.junit.jupiter.api.assertDoesNotThrow
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertNull
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
internal class PatchOptionsTest {
|
||||
@Test
|
||||
fun `should not fail because default value is unvalidated`() {
|
||||
assertDoesNotThrow {
|
||||
OptionsTestPatch.options["required"].value
|
||||
}
|
||||
assertDoesNotThrow { OptionsTestPatch.requiredStringOption }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `should not allow setting custom value with validation`() {
|
||||
// Getter validation on incorrect value.
|
||||
assertThrows<PatchOptionException.ValueValidationException> { OptionsTestPatch.validatedOption }
|
||||
|
||||
// Setter validation on incorrect value.
|
||||
assertThrows<PatchOptionException.ValueValidationException> { OptionsTestPatch.validatedOption = "invalid" }
|
||||
|
||||
// Setter validation on correct value.
|
||||
assertDoesNotThrow { OptionsTestPatch.validatedOption = "valid" }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `should throw due to incorrect type`() {
|
||||
assertThrows<PatchOptionException.InvalidValueTypeException> {
|
||||
OptionsTestPatch.options["bool"] = 0
|
||||
OptionsTestPatch.options["bool"] = "not a boolean"
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `should be nullable`() {
|
||||
OptionsTestPatch.options["bool"] = null
|
||||
OptionsTestPatch.booleanOption = null
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -46,13 +58,65 @@ internal class PatchOptionsTest {
|
||||
}
|
||||
}
|
||||
|
||||
private object OptionsTestPatch : BytecodePatch() {
|
||||
private var stringOption by stringPatchOption("string", "default")
|
||||
private var booleanOption by booleanPatchOption("bool", true)
|
||||
private var requiredStringOption by stringPatchOption("required", "default", required = true)
|
||||
private var nullDefaultRequiredOption by stringPatchOption("null", null, required = true)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Test
|
||||
fun `should allow setting value from values`() =
|
||||
with(OptionsTestPatch.options["choices"] as PatchOption<String>) {
|
||||
value = values!!.values.last()
|
||||
assertTrue(value == "valid")
|
||||
}
|
||||
|
||||
val stringArrayOption = stringArrayPatchOption("array", arrayOf("1", "2"))
|
||||
@Test
|
||||
fun `should allow setting custom value`() =
|
||||
assertDoesNotThrow { OptionsTestPatch.stringOptionWithChoices = "unknown" }
|
||||
|
||||
@Test
|
||||
fun `should allow resetting value`() = assertDoesNotThrow { OptionsTestPatch.stringOptionWithChoices = null }
|
||||
|
||||
@Test
|
||||
fun `reset should not fail`() {
|
||||
assertDoesNotThrow {
|
||||
OptionsTestPatch.resettableOption.value = "test"
|
||||
OptionsTestPatch.resettableOption.reset()
|
||||
}
|
||||
|
||||
assertThrows<PatchOptionException.ValueRequiredException> {
|
||||
OptionsTestPatch.resettableOption.value
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getting default value should work`() =
|
||||
assertDoesNotThrow { assertNull(OptionsTestPatch.resettableOption.default) }
|
||||
|
||||
private object OptionsTestPatch : BytecodePatch() {
|
||||
var booleanOption by booleanPatchOption(
|
||||
"bool",
|
||||
true
|
||||
)
|
||||
var requiredStringOption by stringPatchOption(
|
||||
"required",
|
||||
"default",
|
||||
required = true
|
||||
)
|
||||
var stringArrayOption = stringArrayPatchOption(
|
||||
"array",
|
||||
arrayOf("1", "2")
|
||||
)
|
||||
var stringOptionWithChoices by stringPatchOption(
|
||||
"choices",
|
||||
"value",
|
||||
values = mapOf("Valid option value" to "valid")
|
||||
)
|
||||
var validatedOption by stringPatchOption(
|
||||
|
||||
"validated",
|
||||
"default"
|
||||
) { it == "valid" }
|
||||
var resettableOption = stringPatchOption(
|
||||
"resettable", null,
|
||||
required = true
|
||||
)
|
||||
|
||||
override fun execute(context: BytecodeContext) {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user