refactor: remove "" and other comments

This commit is contained in:
2023-09-27 18:17:45 +08:00
parent 418fd9de00
commit 18172145ef
47 changed files with 415 additions and 451 deletions

View File

@@ -327,7 +327,7 @@ The exclusion list determines whether these `Class` need to be loaded by the Mod
```kotlin
// Exclude Class names belonging to the Host App
// They will be loaded by the Host App's ClassLoader
// The following content is for demonstration only
// The following content is for demonstration only
// DO NOT USE IT DIRECTLY, please refer to your actual situation
ModuleClassLoader.excludeHostClasses(
"androidx.core.app.ActivityCompat",
@@ -335,7 +335,7 @@ ModuleClassLoader.excludeHostClasses(
)
// Exclude Class names belonging to the Module App
// They will be loaded by the ClassLoader of the Module App (the current Hook process)
// The following content is for demonstration only
// The following content is for demonstration only
// DO NOT USE IT DIRECTLY, please refer to your actual situation
ModuleClassLoader.excludeModuleClasses(
"com.demo.entry.HookEntry",

View File

@@ -1170,7 +1170,7 @@ instance.current {
name = "stop"
emptyParam()
}.call()
// Note that because current() returns the CurrentClass object itself
// Note that because current() returns the CurrentClass object itself
// It CANNOT BE CALLED like the following
instance.current().current()
```
@@ -1697,7 +1697,7 @@ In find conditions you can only use **index** function once except **order**.
method {
name = "test"
param(BooleanType).index(num = 2)
// Wrong usage, please keep only one index method
// Wrong usage, please keep only one index method
returnType(StringClass).index(num = 1)
}
```
@@ -1838,7 +1838,7 @@ The following is the wrong way to use it.
field {
name = "test"
type = BooleanType
}.get().string() // Wrong usage, must be cast to the bytecode target type
}.get().string() // Wrong usage, must be cast to the bytecode target type
```
The following is the correct way to use it.

View File

@@ -298,11 +298,11 @@ Below are two **error** examples.
```kotlin
encase {
// Wrong usage, can't start Hook directly
// Wrong usage, can't start Hook directly
findClass(name = "com.example.demo.DemoClass").hook {
// ...
}
// Wrong usage, can't start Hook directly
// Wrong usage, can't start Hook directly
resources().hook {
// ...
}
@@ -327,7 +327,7 @@ object HookEntry : IYukiHookXposedInit {
object CustomHooker : YukiBaseHooker() {
override fun onHook() {
// Wrong method of use
// Wrong method of use
// Because there is no judgment object in the outer layer, you cannot start Hook directly
findClass(name = "com.example.demo.DemoClass").hook {
// ...

View File

@@ -46,14 +46,14 @@ You try to load the `encase` method in the `onInit` or `onXposedEvent` method of
object HookEntry : IYukiHookXposedInit {
override fun onInit() {
// Wrong usage
// Wrong usage
YukiHookAPI.encase {
// Your code here.
}
}
override fun onXposedEvent() {
// Wrong usage
// Wrong usage
YukiHookAPI.encase {
// Your code here.
}
@@ -379,15 +379,15 @@ A disallowed parameter type was set when looking up methods, constructors, and v
```kotlin
// Find a method
method {
// Invalid type example is set
// Invalid type example is set
param(false, 1, 0)
// Invalid type example is set
// Invalid type example is set
returnType = false
}
// Find a variable
field {
// Invalid type example is set
// Invalid type example is set
type = false
}
```
@@ -941,7 +941,7 @@ Invalid parameters were filled in when injecting Module App's `Activity` using `
> The following example
```kotlin
// The content filled in here is just an example
// The content filled in here is just an example
// And the proxy is filled with invalid parameters that cannot be understood
registerModuleAppActivities(proxy = false)
```
@@ -1241,7 +1241,7 @@ class MyApplication : Application() {
override fun attachBaseContext(base: Context?) {
YukiHookAPI.encase(base) {
// Can't use prefs in this case
// Can't use prefs in this case
prefs.getBoolean("test_data")
}
super.attachBaseContext(base)
@@ -1299,7 +1299,7 @@ class MyApplication : Application() {
override fun attachBaseContext(base: Context?) {
YukiHookAPI.encase(base) {
// dataChannel cannot be used in this case
// dataChannel cannot be used in this case
dataChannel.wait(key = "test_data") {
// ...
}
@@ -1348,7 +1348,7 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Wrong usage
// Wrong usage
// Constructor has been set to private in API 1.0.88 and later
YukiHookPrefsBridge().getBoolean("test_data")
}

View File

@@ -44,7 +44,7 @@ Add the repositories and dependencies in your project's `SweetDependency` config
```yaml
repositories:
# Must be added when used as an Xposed Module, otherwise optional
# Must be added when used as an Xposed Module, otherwise optional
rovo89-xposed-api:
url: https://api.xposed.info/
# MavenCentral has a 2-hour cache,
@@ -52,13 +52,13 @@ repositories:
sonatype-oss-releases:
plugins:
# Must be added when used as an Xposed Module, otherwise optional
# Must be added when used as an Xposed Module, otherwise optional
com.google.devtools.ksp:
version: +
...
libraries:
# Must be added when used as an Xposed Module, otherwise optional
# Must be added when used as an Xposed Module, otherwise optional
de.robv.android.xposed:
api:
version: 82
@@ -67,7 +67,7 @@ libraries:
com.highcapable.yukihookapi:
api:
version: +
# Must be added when used as an Xposed Module, otherwise optional
# Must be added when used as an Xposed Module, otherwise optional
ksp-xposed:
version-ref: <this>::api
...
@@ -81,7 +81,7 @@ Next, deploy plugins in your project `build.gradle.kts`.
```kotlin
plugins {
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
autowire(libs.plugins.com.google.devtools.ksp)
// ...
}
@@ -95,9 +95,9 @@ Then, deploy dependencies in your project `build.gradle.kts`.
dependencies {
// Basic dependencies
implementation(com.highcapable.yukihookapi.api)
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
compileOnly(de.robv.android.xposed.api)
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
ksp(com.highcapable.yukihookapi.ksp.xposed)
}
```
@@ -112,7 +112,7 @@ Add repositories in your project `build.gradle.kts` or `build.gradle`.
repositories {
google()
mavenCentral()
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
maven { url("https://api.xposed.info/") }
// MavenCentral has a 2-hour cache, if the latest version cannot be integrated, please add this URL
maven { url("https://s01.oss.sonatype.org/content/repositories/releases/") }
@@ -125,7 +125,7 @@ repositories {
repositories {
google()
mavenCentral()
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
maven { url 'https://api.xposed.info/' }
// MavenCentral has a 2-hour cache, if the latest version cannot be integrated, please add this URL
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' }
@@ -138,7 +138,7 @@ Add plugins in your project `build.gradle.kts` or `build.gradle`.
```kotlin
plugins {
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
id("com.google.devtools.ksp") version "<ksp-version>"
}
```
@@ -147,7 +147,7 @@ plugins {
```groovy
plugins {
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
id 'com.google.devtools.ksp' version '<ksp-version>'
}
```
@@ -160,9 +160,9 @@ Add dependencies in your project `build.gradle.kts` or `build.gradle`.
dependencies {
// Basic dependency
implementation("com.highcapable.yukihookapi:api:<yuki-version>")
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
compileOnly("de.robv.android.xposed:api:82")
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
ksp("com.highcapable.yukihookapi:ksp-xposed:<yuki-version>")
}
```
@@ -173,9 +173,9 @@ dependencies {
dependencies {
// Basic dependency
implementation 'com.highcapable.yukihookapi:api:<yuki-version>'
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
compileOnly 'de.robv.android.xposed:api:82'
// Must be added when used as an Xposed Module, otherwise optional
// Must be added when used as an Xposed Module, otherwise optional
ksp 'com.highcapable.yukihookapi:ksp-xposed:<yuki-version>'
}
```

View File

@@ -311,14 +311,14 @@ injectMember {
```kotlin
// 排除属于宿主的 Class 类名
// 它们将会被宿主的 ClassLoader 装载
// 以下内容仅供演示,不要直接使用,请以你的实际情况为准
// 以下内容仅供演示,不要直接使用,请以你的实际情况为准
ModuleClassLoader.excludeHostClasses(
"androidx.core.app.ActivityCompat",
"com.demo.Test"
)
// 排除属于模块的 Class 类名
// 它们将会被模块 (当前 Hook 进程) 的 ClassLoader 装载
// 以下内容仅供演示,不要直接使用,请以你的实际情况为准
// 以下内容仅供演示,不要直接使用,请以你的实际情况为准
ModuleClassLoader.excludeModuleClasses(
"com.demo.entry.HookEntry",
"com.demo.controller.ModuleController"

View File

@@ -1120,7 +1120,7 @@ instance.current {
name = "stop"
emptyParam()
}.call()
// 注意,因为 current() 返回的是 CurrentClass 自身对象,所以不能像下面这样调用
// 注意,因为 current() 返回的是 CurrentClass 自身对象,所以不能像下面这样调用
instance.current().current()
```
@@ -1638,7 +1638,7 @@ TestGeneric::class.java.generic()?.argument()?.method {
method {
name = "test"
param(BooleanType).index(num = 2)
// 错误的使用方法,请仅保留一个 index 方法
// 错误的使用方法,请仅保留一个 index 方法
returnType(StringClass).index(num = 1)
}
```
@@ -1777,7 +1777,7 @@ TestFoo::class.java.constructor()
field {
name = "test"
type = BooleanType
}.get().string() // 错误的使用方法,必须 cast 为字节码目标类型
}.get().string() // 错误的使用方法,必须 cast 为字节码目标类型
```
以下是正确的使用方法。

View File

@@ -295,11 +295,11 @@ encase {
```kotlin
encase {
// 错误的使用方法,不能直接开始 Hook
// 错误的使用方法,不能直接开始 Hook
findClass(name = "com.example.demo.DemoClass").hook {
// ...
}
// 错误的使用方法,不能直接开始 Hook
// 错误的使用方法,不能直接开始 Hook
resources().hook {
// ...
}
@@ -324,7 +324,7 @@ object HookEntry : IYukiHookXposedInit {
object CustomHooker : YukiBaseHooker() {
override fun onHook() {
// 错误的使用方法,由于外层没有任何判断对象,不能直接开始 Hook
// 错误的使用方法,由于外层没有任何判断对象,不能直接开始 Hook
findClass(name = "com.example.demo.DemoClass").hook {
// ...
}

View File

@@ -46,14 +46,14 @@ You cannot load a hooker in "onInit" or "onXposedEvent" method! Aborted
object HookEntry : IYukiHookXposedInit {
override fun onInit() {
// 错误的使用方法
// 错误的使用方法
YukiHookAPI.encase {
// Your code here.
}
}
override fun onXposedEvent() {
// 错误的使用方法
// 错误的使用方法
YukiHookAPI.encase {
// Your code here.
}
@@ -363,15 +363,15 @@ Method/Constructor/Field match type "**TYPE**" not allowed
```kotlin
// 查找一个方法
method {
// 设置了无效的类型举例
// 设置了无效的类型举例
param(false, 1, 0)
// 设置了无效的类型举例
// 设置了无效的类型举例
returnType = false
}
// 查找一个变量
field {
// 设置了无效的类型举例
// 设置了无效的类型举例
type = false
}
```
@@ -893,7 +893,7 @@ This proxy \[**TYPE**\] type is not allowed
> 示例如下
```kotlin
// 这里填入的内容仅为举例,其中 proxy 填入了不能理解的无效参数
// 这里填入的内容仅为举例,其中 proxy 填入了不能理解的无效参数
registerModuleAppActivities(proxy = false)
```
@@ -1182,7 +1182,7 @@ class MyApplication : Application() {
override fun attachBaseContext(base: Context?) {
YukiHookAPI.encase(base) {
// 不能在这种情况下使用 prefs
// 不能在这种情况下使用 prefs
prefs.getBoolean("test_data")
}
super.attachBaseContext(base)
@@ -1238,7 +1238,7 @@ class MyApplication : Application() {
override fun attachBaseContext(base: Context?) {
YukiHookAPI.encase(base) {
// 不能在这种情况下使用 dataChannel
// 不能在这种情况下使用 dataChannel
dataChannel.wait(key = "test_data") {
// ...
}
@@ -1287,7 +1287,7 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// 错误的使用方法
// 错误的使用方法
// 构造方法已在 API 1.0.88 及以后的版本中设置为 private
YukiHookPrefsBridge().getBoolean("test_data")
}

View File

@@ -44,20 +44,20 @@
```yaml
repositories:
#作为 Xposed 模块使用务必添加,其它情况可选
# 作为 Xposed 模块使用务必添加,其它情况可选
rovo89-xposed-api:
url: https://api.xposed.info/
# MavenCentral 有 2 小时缓存,若无法集成最新版本请添加
sonatype-oss-releases:
plugins:
#作为 Xposed 模块使用务必添加,其它情况可选
# 作为 Xposed 模块使用务必添加,其它情况可选
com.google.devtools.ksp:
version: +
...
libraries:
#作为 Xposed 模块使用务必添加,其它情况可选
# 作为 Xposed 模块使用务必添加,其它情况可选
de.robv.android.xposed:
api:
version: 82
@@ -66,7 +66,7 @@ libraries:
com.highcapable.yukihookapi:
api:
version: +
#作为 Xposed 模块使用务必添加,其它情况可选
# 作为 Xposed 模块使用务必添加,其它情况可选
ksp-xposed:
version-ref: <this>::api
...
@@ -80,7 +80,7 @@ libraries:
```kotlin
plugins {
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
autowire(libs.plugins.com.google.devtools.ksp)
// ...
}
@@ -94,9 +94,9 @@ plugins {
dependencies {
// 基础依赖
implementation(com.highcapable.yukihookapi.api)
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
compileOnly(de.robv.android.xposed.api)
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
ksp(com.highcapable.yukihookapi.ksp.xposed)
}
```
@@ -111,7 +111,7 @@ dependencies {
repositories {
google()
mavenCentral()
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
maven { url("https://api.xposed.info/") }
// MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址
maven { url("https://s01.oss.sonatype.org/content/repositories/releases/") }
@@ -124,7 +124,7 @@ repositories {
repositories {
google()
mavenCentral()
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
maven { url 'https://api.xposed.info/' }
// MavenCentral 有 2 小时缓存,若无法集成最新版本请添加此地址
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' }
@@ -137,7 +137,7 @@ repositories {
```kotlin
plugins {
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
id("com.google.devtools.ksp") version "<ksp-version>"
}
```
@@ -146,7 +146,7 @@ plugins {
```groovy
plugins {
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
id 'com.google.devtools.ksp' version '<ksp-version>'
}
```
@@ -159,9 +159,9 @@ plugins {
dependencies {
// 基础依赖
implementation("com.highcapable.yukihookapi:api:<yuki-version>")
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
compileOnly("de.robv.android.xposed:api:82")
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
ksp("com.highcapable.yukihookapi:ksp-xposed:<yuki-version>")
}
```
@@ -172,9 +172,9 @@ dependencies {
dependencies {
// 基础依赖
implementation 'com.highcapable.yukihookapi:api:<yuki-version>'
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
compileOnly 'de.robv.android.xposed:api:82'
// 作为 Xposed 模块使用务必添加,其它情况可选
// 作为 Xposed 模块使用务必添加,其它情况可选
ksp 'com.highcapable.yukihookapi:ksp-xposed:<yuki-version>'
}
```