Skip to content

Commit 7f7b8e9

Browse files
committed
Update api-exception documentation
1 parent 390ee9e commit 7f7b8e9

File tree

2 files changed

+74
-24
lines changed

2 files changed

+74
-24
lines changed

docs-source/src/en/config/api-exception.md

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,13 +1226,13 @@ This situation basically does not exist, because `appContext` is assigned in `on
12261226

12271227
::: danger IllegalStateException
12281228

1229-
YukiHookModulePrefs not allowed in Custom Hook API
1229+
YukiHookPrefsBridge not allowed in Custom Hook API
12301230

12311231
:::
12321232

12331233
**Abnormal**
12341234

1235-
`YukiHookModulePrefs` is used in Hook's own app (not Xposed Module).
1235+
`YukiHookPrefsBridge` is used in Hook's own app (not Xposed Module).
12361236

12371237
> The following example
12381238
@@ -1251,7 +1251,7 @@ class MyApplication : Application() {
12511251

12521252
**Solution**
12531253

1254-
You can only use `YukiHookModulePrefs` when [Use as Xposed Module Configs](../config/xposed-using), please use the native `Sp` storage in the Hook's own app.
1254+
You can only use `YukiHookPrefsBridge` when [Use as Xposed Module Configs](../config/xposed-using), please use the native `Sp` storage in the Hook's own app.
12551255

12561256
###### exception
12571257

@@ -1263,7 +1263,7 @@ Cannot load the XSharedPreferences, maybe is your Hook Framework not support it
12631263

12641264
**Abnormal**
12651265

1266-
Using `YukiHookModulePrefs` in (Xposed) Host environment but unable to get `XSharedPreferences` object.
1266+
Using `YukiHookPrefsBridge` in (Xposed) Host environment but unable to get `XSharedPreferences` object.
12671267

12681268
> The following example
12691269
@@ -1323,7 +1323,7 @@ Xposed modulePackageName load failed, please reset and rebuild it
13231323

13241324
**Abnormal**
13251325

1326-
When using `YukiHookModulePrefs` or `YukiHookDataChannel` in the Hook process, the `modulePackageName` at load time cannot be read, resulting in the package name of the own Module App cannot be determined.
1326+
When using `YYukiHookPrefsBridge` or `YukiHookDataChannel` in the Hook process, the `modulePackageName` at load time cannot be read, resulting in the package name of the own Module App cannot be determined.
13271327

13281328
**Solution**
13291329

@@ -1333,13 +1333,13 @@ Please read the help document [here](../config/xposed-using#modulepackagename-pa
13331333

13341334
::: danger IllegalStateException
13351335

1336-
YukiHookModulePrefs missing Context instance
1336+
YukiHookPrefsBridge missing Context instance
13371337

13381338
:::
13391339

13401340
**Abnormal**
13411341

1342-
`YukiHookModulePrefs` is used in the Module App to store data but no `Context` instance is passed in.
1342+
`YukiHookPrefsBridge` is used in the Module App to store data but no `Context` instance is passed in.
13431343

13441344
> The following example
13451345
@@ -1350,14 +1350,14 @@ class MainActivity : AppCompatActivity() {
13501350
super.onCreate(savedInstanceState)
13511351
// ❗ Wrong usage
13521352
// Constructor has been set to private in API 1.0.88 and later
1353-
YukiHookModulePrefs().getBoolean("test_data")
1353+
YukiHookPrefsBridge().getBoolean("test_data")
13541354
}
13551355
}
13561356
```
13571357

13581358
**Solution**
13591359

1360-
It is recommended to use the `modulePrefs` method to load `YukiHookModulePrefs` in `Activity`.
1360+
It is recommended to use the `prefs(...)` method to load `YukiHookPrefsBridge` in `Activity`.
13611361

13621362
> The following example
13631363
@@ -1367,7 +1367,7 @@ class MainActivity : AppCompatActivity() {
13671367
override fun onCreate(savedInstanceState: Bundle?) {
13681368
super.onCreate(savedInstanceState)
13691369
// ✅ Correct usage
1370-
modulePrefs.getBoolean("test_data")
1370+
prefs().getBoolean("test_data")
13711371
}
13721372
}
13731373
```
@@ -1376,17 +1376,42 @@ class MainActivity : AppCompatActivity() {
13761376

13771377
::: danger IllegalStateException
13781378

1379+
The Host App's Context has not yet initialized successfully, the native function cannot be used at this time
1380+
1381+
:::
1382+
1383+
**Abnormal**
1384+
1385+
In the (Xposed) Host environment `PackageParam`, `YukiHookPrefsBridge` is used and the `native` method is called, but the lifecycle of the Host App is not initialized at this time.
1386+
1387+
> The following example
1388+
1389+
```kotlin
1390+
encase {
1391+
// This method was called
1392+
prefs.native()
1393+
}
1394+
```
1395+
1396+
**Solution**
1397+
1398+
The `native` method requires an existing `Context` object to store data in, and you can use this method in listening to the Host App lifecycle state.
1399+
1400+
###### exception
1401+
1402+
::: danger IllegalStateException
1403+
13791404
Key-Value type **TYPE** is not allowed
13801405

13811406
:::
13821407

13831408
**Abnormal**
13841409

1385-
An unsupported storage type was passed in when using the `get` or `put` methods of `YukiHookModulePrefs` or the `wait` or `put` methods of `YukiHookDataChannel`.
1410+
An unsupported storage type was passed in when using the `get` or `put` methods of `YukiHookPrefsBridge` or the `wait` or `put` methods of `YukiHookDataChannel`.
13861411

13871412
**Solution**
13881413

1389-
The supported types of `YukiHookModulePrefs` are only `String`, `Set<String>`, `Int`, `Float`, `Long`, `Boolean`, please pass in the supported types.
1414+
The supported types of `YukiHookPrefsBridge` are only `String`, `Set<String>`, `Int`, `Float`, `Long`, `Boolean`, please pass in the supported types.
13901415

13911416
The supported types of `YukiHookDataChannel` are the types restricted by `Intent.putExtra`, please pass in the supported types.
13921417

docs-source/src/zh-cn/config/api-exception.md

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,13 +1167,13 @@ ModuleApplication.appContext...
11671167

11681168
::: danger IllegalStateException
11691169

1170-
YukiHookModulePrefs not allowed in Custom Hook API
1170+
YukiHookPrefsBridge not allowed in Custom Hook API
11711171

11721172
:::
11731173

11741174
**异常原因**
11751175

1176-
在 Hook 自身 APP(非 Xposed 模块) 中使用了 `YukiHookModulePrefs`
1176+
在 Hook 自身 APP(非 Xposed 模块) 中使用了 `YukiHookPrefsBridge`
11771177

11781178
> 示例如下
11791179
@@ -1192,7 +1192,7 @@ class MyApplication : Application() {
11921192

11931193
**解决方案**
11941194

1195-
你只能在 [作为 Xposed 模块使用](../config/xposed-using) 时使用 `YukiHookModulePrefs`,在 Hook 自身 APP 中请使用原生的 `Sp` 存储。
1195+
你只能在 [作为 Xposed 模块使用](../config/xposed-using) 时使用 `YukiHookPrefsBridge`,在 Hook 自身 APP 中请使用原生的 `Sp` 存储。
11961196

11971197
###### exception
11981198

@@ -1204,7 +1204,7 @@ Cannot load the XSharedPreferences, maybe is your Hook Framework not support it
12041204

12051205
**异常原因**
12061206

1207-
在 (Xposed) 宿主环境使用了 `YukiHookModulePrefs` 但是无法得到 `XSharedPreferences` 对象。
1207+
在 (Xposed) 宿主环境使用了 `YukiHookPrefsBridge` 但是无法得到 `XSharedPreferences` 对象。
12081208

12091209
> 示例如下
12101210
@@ -1262,7 +1262,7 @@ Xposed modulePackageName load failed, please reset and rebuild it
12621262

12631263
**异常原因**
12641264

1265-
在 Hook 过程中使用 `YukiHookModulePrefs``YukiHookDataChannel` 时无法读取装载时的 `modulePackageName` 导致不能确定自身模块的包名。
1265+
在 Hook 过程中使用 `YukiHookPrefsBridge``YukiHookDataChannel` 时无法读取装载时的 `modulePackageName` 导致不能确定自身模块的包名。
12661266

12671267
**解决方案**
12681268

@@ -1272,13 +1272,13 @@ Xposed modulePackageName load failed, please reset and rebuild it
12721272

12731273
::: danger IllegalStateException
12741274

1275-
YukiHookModulePrefs missing Context instance
1275+
YukiHookPrefsBridge missing Context instance
12761276

12771277
:::
12781278

12791279
**异常原因**
12801280

1281-
在模块中使用了 `YukiHookModulePrefs` 存储数据但并未传入 `Context` 实例。
1281+
在模块中使用了 `YukiHookPrefsBridge` 存储数据但并未传入 `Context` 实例。
12821282

12831283
> 示例如下
12841284
@@ -1289,14 +1289,14 @@ class MainActivity : AppCompatActivity() {
12891289
super.onCreate(savedInstanceState)
12901290
// ❗错误的使用方法
12911291
// 构造方法已在 API 1.0.88 及以后的版本中设置为 private
1292-
YukiHookModulePrefs().getBoolean("test_data")
1292+
YukiHookPrefsBridge().getBoolean("test_data")
12931293
}
12941294
}
12951295
```
12961296

12971297
**解决方案**
12981298

1299-
`Activity` 中推荐使用 `modulePrefs` 方法来装载 `YukiHookModulePrefs`
1299+
`Activity` 中推荐使用 `prefs(...)` 方法来装载 `YukiHookPrefsBridge`
13001300

13011301
> 示例如下
13021302
@@ -1306,7 +1306,7 @@ class MainActivity : AppCompatActivity() {
13061306
override fun onCreate(savedInstanceState: Bundle?) {
13071307
super.onCreate(savedInstanceState)
13081308
// ✅ 正确的使用方法
1309-
modulePrefs.getBoolean("test_data")
1309+
prefs().getBoolean("test_data")
13101310
}
13111311
}
13121312
```
@@ -1315,17 +1315,42 @@ class MainActivity : AppCompatActivity() {
13151315

13161316
::: danger IllegalStateException
13171317

1318+
The Host App's Context has not yet initialized successfully, the native function cannot be used at this time
1319+
1320+
:::
1321+
1322+
**异常原因**
1323+
1324+
在 (Xposed) 宿主环境 `PackageParam` 中使用了 `YukiHookPrefsBridge` 并调用了 `native` 方法但此时宿主的生命周期并未初始化。
1325+
1326+
> 示例如下
1327+
1328+
```kotlin
1329+
encase {
1330+
// 调用了此方法
1331+
prefs.native()
1332+
}
1333+
```
1334+
1335+
**解决方案**
1336+
1337+
`native` 方法需要一个存在的 `Context` 对象用于存储数据,你可以在监听宿主生命周期状态中使用此方法。
1338+
1339+
###### exception
1340+
1341+
::: danger IllegalStateException
1342+
13181343
Key-Value type **TYPE** is not allowed
13191344

13201345
:::
13211346

13221347
**异常原因**
13231348

1324-
在使用 `YukiHookModulePrefs``get``put` 方法或 `YukiHookDataChannel``wait``put` 方法时传入了不支持的存储类型。
1349+
在使用 `YukiHookPrefsBridge``get``put` 方法或 `YukiHookDataChannel``wait``put` 方法时传入了不支持的存储类型。
13251350

13261351
**解决方案**
13271352

1328-
`YukiHookModulePrefs` 支持的类型只有 `String``Set<String>``Int``Float``Long``Boolean`,请传入支持的类型。
1353+
`YukiHookPrefsBridge` 支持的类型只有 `String``Set<String>``Int``Float``Long``Boolean`,请传入支持的类型。
13291354

13301355
`YukiHookDataChannel` 支持的类型为 `Intent.putExtra` 限制的类型,请传入支持的类型。
13311356

0 commit comments

Comments
 (0)