ms-types 0.10.14 → 0.10.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,79 @@
1
+ ---@meta
2
+ --- 清理模块。仅越狱包提供,免越狱包没有该对象。
3
+
4
+ ---@class JbClear
5
+ local _JbClear = {}
6
+
7
+ --- 按关联名清理钥匙串。空串返回 false。
8
+ ---@param identifier string 钥匙串关联名,例如 `"demo.sample.app"`
9
+ ---@return boolean 成功返回 true
10
+ ---@example jbclear.keychain("demo.sample.app")
11
+ function _JbClear.keychain(identifier) return false end
12
+
13
+ --- 清理第三方应用钥匙串。不清理本 App。
14
+ ---@return boolean 成功返回 true
15
+ ---@example jbclear.allKeychain()
16
+ function _JbClear.allKeychain() return false end
17
+
18
+ --- 清理 Safari Cookies。
19
+ ---@return boolean 成功返回 true
20
+ ---@example jbclear.cookies()
21
+ function _JbClear.cookies() return false end
22
+
23
+ ---@class JbClearCachesOptions
24
+ ---@field noUicache boolean|nil 为 true 时跳过重建图标缓存
25
+
26
+ --- 清理系统缓存。必须传表,默认会重建图标缓存。
27
+ ---@param options JbClearCachesOptions 传入 `{ noUicache = true }` 时跳过重建图标缓存;默认传 `{}`
28
+ ---@return boolean 成功返回 true
29
+ ---@example jbclear.caches({})
30
+ function _JbClear.caches(options) return false end
31
+
32
+ --- 删除本机相册里的本地照片。不影响 iCloud 照片。
33
+ ---@return boolean 成功返回 true
34
+ ---@example jbclear.photos()
35
+ function _JbClear.photos() return false end
36
+
37
+ --- 先结束该应用进程,再清数据容器、App Group、扩展数据和该应用钥匙串,不卸载。空包名或本 App 及其扩展返回 false。
38
+ ---@param bundleId string 应用包标识符,例如 `"demo.sample.app"`
39
+ ---@return boolean 成功返回 true
40
+ ---@example jbclear.appData("demo.sample.app")
41
+ function _JbClear.appData(bundleId) return false end
42
+
43
+ --- 读取整机广告标识(IDFA)。
44
+ ---@return string|nil UUID 字符串;读不到返回 nil
45
+ ---@example local idfa = jbclear.getIdfa()
46
+ function _JbClear.getIdfa() return nil end
47
+
48
+ --- 重置整机广告标识(IDFA)。之后所有 App 读到的都会变。
49
+ ---@return string|nil 重置前的 UUID;失败返回 nil
50
+ ---@example local old = jbclear.resetIdfa()
51
+ function _JbClear.resetIdfa() return nil end
52
+
53
+ --- 写入整机广告标识(IDFA)。
54
+ ---@param value string UUID 字符串
55
+ ---@return string|nil 写入前的 UUID;失败返回 nil
56
+ ---@example jbclear.setIdfa(old)
57
+ function _JbClear.setIdfa(value) return nil end
58
+
59
+ --- 读取指定应用所属开发商的供应商标识(IDFV)。
60
+ ---@param bundleId string 应用包标识符,例如 `"demo.sample.app"`
61
+ ---@return string|nil UUID 字符串;读不到返回 nil
62
+ ---@example local idfv = jbclear.getIdfv("demo.sample.app")
63
+ function _JbClear.getIdfv(bundleId) return nil end
64
+
65
+ --- 重置指定应用所属开发商的 IDFV。同一开发商的 App 会一起变。
66
+ ---@param bundleId string 应用包标识符,例如 `"demo.sample.app"`
67
+ ---@return string|nil 重置前的 UUID;失败返回 nil
68
+ ---@example local old = jbclear.resetIdfv("demo.sample.app")
69
+ function _JbClear.resetIdfv(bundleId) return nil end
70
+
71
+ --- 写入指定应用所属开发商的 IDFV。
72
+ ---@param bundleId string 应用包标识符,例如 `"demo.sample.app"`
73
+ ---@param value string UUID 字符串
74
+ ---@return string|nil 写入前的 UUID;失败返回 nil
75
+ ---@example jbclear.setIdfv("demo.sample.app", old)
76
+ function _JbClear.setIdfv(bundleId, value) return nil end
77
+
78
+ ---@type JbClear
79
+ jbclear = _JbClear
@@ -0,0 +1,157 @@
1
+ ---@meta
2
+ --- 越狱设备模块。仅越狱包提供,免越狱包没有该对象。
3
+ --- 可设置自动锁屏分钟数(0 为不自动锁屏)并还原,读取序列号和 Wi-Fi 信息 / MAC,
4
+ --- 打开或关闭 Wi-Fi / 蓝牙 / 蜂窝数据 / 飞行模式,读取开关,扫描附近或列出已保存无线网,
5
+ --- 加入或遗忘无线网,设置和获取音量与背光亮度。
6
+
7
+ ---@class JbWifiInfo
8
+ ---@field ssid string 无线网名称
9
+ ---@field bssid string BSSID
10
+ ---@field password string 已保存密码;开放网络为空串
11
+ ---@field encryption string 加密方式:WEP / WPA / EAP / NONE
12
+ ---@field channel integer 信道
13
+ ---@field hidden boolean 是否隐藏网络
14
+
15
+ ---@class JbDevice
16
+ local _JbDevice = {}
17
+
18
+ --- 设置自动锁屏分钟数。0 表示不自动锁屏。
19
+ ---@param minutes integer 锁屏分钟数;<= 0 视为不自动锁屏
20
+ ---@return boolean 成功返回 true
21
+ ---@example jbdevice.setAutoLockMinutes(0)
22
+ function _JbDevice.setAutoLockMinutes(minutes) return false end
23
+
24
+ --- 还原自动锁屏分钟数。没有可还原的值则失败。
25
+ ---@return boolean 成功返回 true
26
+ ---@example jbdevice.restoreAutoLock()
27
+ function _JbDevice.restoreAutoLock() return false end
28
+
29
+ --- 读取当前自动锁屏分钟数。0 表示不自动锁屏。
30
+ ---@return integer|nil 分钟数;读不到返回 nil
31
+ ---@example jbdevice.getAutoLockMinutes()
32
+ function _JbDevice.getAutoLockMinutes() return 0 end
33
+
34
+ --- 读取设备序列号。
35
+ ---@return string|nil 序列号;读不到返回 nil
36
+ ---@example jbdevice.serialNumber()
37
+ function _JbDevice.serialNumber() return "" end
38
+
39
+ --- 读取本机 Wi-Fi MAC。
40
+ ---@return string|nil aa:bb:cc:dd:ee:ff 形式;读不到返回 nil
41
+ ---@example jbdevice.wifiMac()
42
+ function _JbDevice.wifiMac() return "" end
43
+
44
+ --- 读取当前已连接无线网信息。没连上返回 nil。
45
+ ---@return JbWifiInfo|nil Wi-Fi 信息;没连上返回 nil
46
+ ---@example jbdevice.wifiInfo()
47
+ function _JbDevice.wifiInfo() return {} end
48
+
49
+ --- 打开 Wi-Fi。
50
+ ---@return boolean 成功返回 true
51
+ ---@example jbdevice.wifiOn()
52
+ function _JbDevice.wifiOn() return false end
53
+
54
+ --- 关闭 Wi-Fi。
55
+ ---@return boolean 成功返回 true
56
+ ---@example jbdevice.wifiOff()
57
+ function _JbDevice.wifiOff() return false end
58
+
59
+ --- 读取 Wi-Fi 是否打开。
60
+ ---@return boolean|nil 当前是否打开;读不到返回 nil
61
+ ---@example jbdevice.isWifiOn()
62
+ function _JbDevice.isWifiOn() return false end
63
+
64
+ --- 打开蓝牙。
65
+ ---@return boolean 成功返回 true
66
+ ---@example jbdevice.bluetoothOn()
67
+ function _JbDevice.bluetoothOn() return false end
68
+
69
+ --- 关闭蓝牙。
70
+ ---@return boolean 成功返回 true
71
+ ---@example jbdevice.bluetoothOff()
72
+ function _JbDevice.bluetoothOff() return false end
73
+
74
+ --- 读取蓝牙是否打开。
75
+ ---@return boolean|nil 当前是否打开;读不到返回 nil
76
+ ---@example jbdevice.isBluetoothOn()
77
+ function _JbDevice.isBluetoothOn() return false end
78
+
79
+ --- 打开蜂窝数据。
80
+ ---@return boolean 成功返回 true
81
+ ---@example jbdevice.cellularOn()
82
+ function _JbDevice.cellularOn() return false end
83
+
84
+ --- 关闭蜂窝数据。
85
+ ---@return boolean 成功返回 true
86
+ ---@example jbdevice.cellularOff()
87
+ function _JbDevice.cellularOff() return false end
88
+
89
+ --- 读取蜂窝数据是否打开。没有蜂窝能力时失败。
90
+ ---@return boolean|nil 当前是否打开;读不到返回 nil
91
+ ---@example jbdevice.isCellularOn()
92
+ function _JbDevice.isCellularOn() return false end
93
+
94
+ --- 打开飞行模式。
95
+ ---@return boolean 成功返回 true
96
+ ---@example jbdevice.airplaneOn()
97
+ function _JbDevice.airplaneOn() return false end
98
+
99
+ --- 关闭飞行模式。
100
+ ---@return boolean 成功返回 true
101
+ ---@example jbdevice.airplaneOff()
102
+ function _JbDevice.airplaneOff() return false end
103
+
104
+ --- 读取飞行模式是否打开。
105
+ ---@return boolean|nil 当前是否打开;读不到返回 nil
106
+ ---@example jbdevice.isAirplaneOn()
107
+ function _JbDevice.isAirplaneOn() return false end
108
+
109
+ --- 加入一个无线网。开放网络密码传空串。有密码时至少 8 位。
110
+ ---@param ssid string 无线网名称,也可传 BSSID
111
+ ---@param password? string 密码;开放网络传空串
112
+ ---@param timeoutMs? integer 等待上限毫秒;省略或 <= 0 时用 15000,最短 5000,最长 120000
113
+ ---@return boolean 连上目标网为 true
114
+ ---@example jbdevice.joinWifi("Office", "password123")
115
+ function _JbDevice.joinWifi(ssid, password, timeoutMs) return false end
116
+
117
+ --- 遗忘一个已保存的无线网。可传 SSID 或 BSSID。
118
+ ---@param ssid string 无线网名称或 BSSID
119
+ ---@return boolean 找到并删掉为 true
120
+ ---@example jbdevice.forgetWifi("Office")
121
+ function _JbDevice.forgetWifi(ssid) return false end
122
+
123
+ --- 列出已保存的无线网。没有已存网络时是空数组。
124
+ ---@return JbWifiInfo[]|nil Wi-Fi 信息数组;读失败返回 nil
125
+ ---@example jbdevice.listWifi()
126
+ function _JbDevice.listWifi() return {} end
127
+
128
+ --- 扫描附近无线网。会先打开 Wi-Fi。
129
+ ---@param timeoutMs? integer 等待上限毫秒;省略或 <= 0 时用 15000,最短 5000,最长 120000
130
+ ---@return JbWifiInfo[]|nil Wi-Fi 信息数组;扫失败返回 nil。附近没有网时是空数组
131
+ ---@example jbdevice.scanWifi()
132
+ function _JbDevice.scanWifi(timeoutMs) return {} end
133
+
134
+ --- 设置系统音量,范围 0.0-1.0。
135
+ ---@param volume number 目标音量
136
+ ---@return boolean 成功返回 true
137
+ ---@example jbdevice.setVolume(0.5)
138
+ function _JbDevice.setVolume(volume) return false end
139
+
140
+ --- 读取系统音量,范围 0.0-1.0。
141
+ ---@return number|nil 当前音量;读不到返回 nil
142
+ ---@example jbdevice.getVolume()
143
+ function _JbDevice.getVolume() return 0 end
144
+
145
+ --- 设置背光亮度,范围 0.0-1.0。
146
+ ---@param brightness number 目标亮度
147
+ ---@return boolean 成功返回 true
148
+ ---@example jbdevice.setBrightness(0.5)
149
+ function _JbDevice.setBrightness(brightness) return false end
150
+
151
+ --- 读取背光亮度,范围 0.0-1.0。
152
+ ---@return number|nil 当前亮度;读不到返回 nil
153
+ ---@example jbdevice.getBrightness()
154
+ function _JbDevice.getBrightness() return 0 end
155
+
156
+ ---@type JbDevice
157
+ jbdevice = _JbDevice
@@ -0,0 +1,52 @@
1
+ ---@meta
2
+ --- 动态库模块。仅越狱包提供,免越狱包没有该对象。
3
+ --- 先 `open` 加载 `res` 里的库并得到库对象,再用 `define` / `defineAll` 绑定 C 函数签名,
4
+ --- 之后按符号名直接调用,例如 `lib.mylib_add(1, 2)`。
5
+ ---@class JbDylibLib
6
+ local _JbDylibLib = {}
7
+
8
+ --- 绑定一个导出函数的返回类型和参数类型。成功后可按符号名直接调用。
9
+ ---@param symbol string 导出符号名,例如 `"mylib_add"`。不能与 `define` / `call` 等库对象方法重名
10
+ ---@param retType string 返回类型,如 `"void"` `"int"` `"string"` `"pointer"`
11
+ ---@param argTypes string[]|nil 每个参数的类型,无参数时可省略
12
+ ---@return boolean 签名合法且符号存在返回 true
13
+ ---@example lib:define("mylib_add", "int", {"int", "int"}); local sum = lib.mylib_add(1, 2)
14
+ function _JbDylibLib.define(symbol, retType, argTypes) return false end
15
+
16
+ --- 批量绑定导出函数。
17
+ ---@param specs table 键为符号名,值为 `"int"` 或 `{ "int" }` 或 `{ "int", { "int", "int" } }`
18
+ ---@return boolean 全部成功返回 true;失败项会跳过,其余仍会绑定
19
+ ---@example lib:defineAll({ mylib_add = { "int", { "int", "int" } }, mylib_touch = { "void" } })
20
+ function _JbDylibLib.defineAll(specs) return false end
21
+
22
+ --- 按已经 `define` 的签名调用导出函数。
23
+ ---@param symbol string 已绑定的导出符号名
24
+ ---@param ... any 与定义时参数类型对应的实参
25
+ ---@return any 调用成功返回结果;`void` 成功返回 true;失败返回 nil
26
+ ---@example local sum = lib:call("mylib_add", 1, 2)
27
+ function _JbDylibLib.call(symbol, ...) return nil end
28
+
29
+ --- 解析导出符号地址。
30
+ ---@param name string 导出符号名
31
+ ---@return string|nil 成功返回 `"0x..."` 地址字符串,失败返回 nil
32
+ ---@example local addr = lib:symbol("mylib_add")
33
+ function _JbDylibLib.symbol(name) return nil end
34
+
35
+ ---@class JbDylib
36
+ local _JbDylib = {}
37
+
38
+ --- 从脚本项目 `res` 目录加载动态库,返回库对象。
39
+ ---@param name string 相对 `res` 的动态库路径,例如 `"mylib.dylib"` 或 `"libs/mylib.dylib"`
40
+ ---@param defs table|nil 可选;打开后立刻批量绑定的函数表
41
+ ---@return JbDylibLib|nil 加载成功返回库对象,失败返回 nil
42
+ ---@example local lib = jbdylib.open("mylib.dylib", { mylib_add = { "int", { "int", "int" } } })
43
+ function _JbDylib.open(name, defs) return nil end
44
+
45
+ --- 查询动态库是否已加载进当前脚本进程。
46
+ ---@param name string 相对 `res` 的动态库路径,须与 `open` 使用的名字一致
47
+ ---@return boolean 已加载返回 true,否则 false
48
+ ---@example local ready = jbdylib.isLoaded("mylib.dylib")
49
+ function _JbDylib.isLoaded(name) return false end
50
+
51
+ ---@type JbDylib
52
+ jbdylib = _JbDylib
@@ -0,0 +1,20 @@
1
+ ---@meta
2
+ --- 终端模块。仅越狱包提供,免越狱包没有该对象。
3
+ --- 用 `exec` 执行一条 shell 命令,同步返回退出码和标准输出、标准错误。
4
+ ---@class JbShellResult
5
+ ---@field code integer 退出码;超时为 -1;被信号结束后为 128 + 信号
6
+ ---@field stdout string 标准输出文本
7
+ ---@field stderr string 标准错误文本
8
+
9
+ ---@class JbShell
10
+ local _JbShell = {}
11
+
12
+ --- 执行一条 shell 命令,等到结束或超时。
13
+ ---@param command string 交给 `sh -c` 的命令
14
+ ---@param timeoutMs integer|nil 等待上限毫秒;省略或 `<= 0` 时为 30000,最长 3600000
15
+ ---@return JbShellResult|nil 启动成功返回结果;空命令或启动失败返回 nil。超时仍返回已捕获输出,code 为 -1
16
+ ---@example local r = jbshell.exec("printf hello"); logi(r.stdout)
17
+ function _JbShell.exec(command, timeoutMs) return nil end
18
+
19
+ ---@type JbShell
20
+ jbshell = _JbShell
@@ -0,0 +1,58 @@
1
+ ---@meta
2
+ --- 越狱系统模块。仅越狱包提供,免越狱包没有该对象。
3
+ --- `respring` 重启 SpringBoard。`reboot` 重启用户空间,不是重启整机。
4
+ --- `restartSelf` 重启当前 App 进程。
5
+ --- 还可读写「允许 App 请求跟踪」「个性化广告」和定位服务总开关。
6
+ ---@class JbSystem
7
+ local _JbSystem = {}
8
+
9
+ --- 重启 SpringBoard(Respring)。调用后当前 App 和脚本通常会被系统结束。
10
+ ---@return boolean 成功返回 true
11
+ ---@example jbsystem.respring()
12
+ function _JbSystem.respring() return false end
13
+
14
+ --- 重启用户空间,不是重启整机。调用后当前进程会被系统结束。
15
+ ---@return boolean 成功返回 true
16
+ ---@example jbsystem.reboot()
17
+ function _JbSystem.reboot() return false end
18
+
19
+ --- 重启当前 App 进程。调用后当前脚本会结束,App 随后会被重新拉起。
20
+ ---@return boolean 成功返回 true
21
+ ---@example jbsystem.restartSelf()
22
+ function _JbSystem.restartSelf() return false end
23
+
24
+ --- 读取「允许 App 请求跟踪」总开关。对应 `设置 > 隐私与安全性 > 跟踪 > 允许 App 请求跟踪`。
25
+ ---@return boolean|nil 当前是否允许;读失败返回 nil
26
+ ---@example local allow = jbsystem.getUserTracking()
27
+ function _JbSystem.getUserTracking() return nil end
28
+
29
+ --- 设置「允许 App 请求跟踪」总开关。
30
+ ---@param enabled boolean `true` 允许 App 弹跟踪请求,`false` 不允许
31
+ ---@return boolean 成功返回 true
32
+ ---@example jbsystem.setUserTracking(false)
33
+ function _JbSystem.setUserTracking(enabled) return false end
34
+
35
+ --- 读取「个性化广告」开关。对应 `设置 > 隐私与安全性 > Apple 广告 > 个性化广告`。
36
+ ---@return boolean|nil 当前是否允许;读失败返回 nil
37
+ ---@example local allow = jbsystem.getPersonalizedAdvertising()
38
+ function _JbSystem.getPersonalizedAdvertising() return nil end
39
+
40
+ --- 设置「个性化广告」开关。
41
+ ---@param enabled boolean `true` 允许个性化广告,`false` 不允许
42
+ ---@return boolean 成功返回 true
43
+ ---@example jbsystem.setPersonalizedAdvertising(false)
44
+ function _JbSystem.setPersonalizedAdvertising(enabled) return false end
45
+
46
+ --- 读取定位服务总开关。对应 `设置 > 隐私与安全性 > 定位服务` 总开关。
47
+ ---@return boolean|nil 当前是否开启;读失败返回 nil
48
+ ---@example local enabled = jbsystem.getLocationServices()
49
+ function _JbSystem.getLocationServices() return nil end
50
+
51
+ --- 设置定位服务总开关。
52
+ ---@param enabled boolean `true` 开启定位服务,`false` 关闭
53
+ ---@return boolean 成功返回 true
54
+ ---@example jbsystem.setLocationServices(false)
55
+ function _JbSystem.setLocationServices(enabled) return false end
56
+
57
+ ---@type JbSystem
58
+ jbsystem = _JbSystem
@@ -0,0 +1,76 @@
1
+ ---@meta
2
+ --- 越狱 VPN 模块。仅越狱包提供,免越狱包没有该对象。
3
+ --- 管理系统 VPN 配置:创建、列出、读取当前选中、选中、删除、连接、断开,以及读取当前选中配置的状态。
4
+ --- 类型支持 L2TP、IPSec、IKEv2。
5
+
6
+ ---@class JbVpnConfig
7
+ ---@field name string 显示名
8
+ ---@field type string 类型:L2TP / IPSec / IKEv2
9
+ ---@field server string 服务器地址
10
+ ---@field account? string 账号
11
+ ---@field password? string 密码
12
+ ---@field secret? string 共享密钥。L2TP / IPSec 常用
13
+ ---@field group? string 群组名称
14
+ ---@field sendAllTraffic? boolean 是否发送所有流量。省略时为 true
15
+ ---@field encryptionLevel? integer 加密级别。省略时为 1
16
+ ---@field localId? string 本端标识。IKEv2 可用
17
+ ---@field remoteId? string 对端标识。IKEv2 可用
18
+
19
+ ---@class JbVpnItem
20
+ ---@field name string 显示名
21
+ ---@field id string 配置 ID。同名时用这个精确操作
22
+
23
+ ---@class JbVpnStatus
24
+ ---@field text string 状态文字
25
+ ---@field connected boolean 是否已经连上
26
+
27
+ ---@class JbVpn
28
+ local _JbVpn = {}
29
+
30
+ --- 创建一条系统 VPN 配置。必填 name、type、server。
31
+ ---@param config JbVpnConfig 配置
32
+ ---@return boolean 成功返回 true
33
+ ---@example jbvpn.create({ name = "Demo", type = "L2TP", server = "vpn.example.com", account = "user", password = "pass", secret = "psk" })
34
+ function _JbVpn.create(config) return false end
35
+
36
+ --- 列出当前系统 VPN 配置。没有配置时是空数组。
37
+ ---@return JbVpnItem[]|nil 配置列表;读失败返回 nil
38
+ ---@example jbvpn.list()
39
+ function _JbVpn.list() return {} end
40
+
41
+ --- 读取当前选中的 VPN 配置。没有选中配置返回 nil。
42
+ ---@return JbVpnItem|nil { name, id };没有选中配置返回 nil
43
+ ---@example jbvpn.current()
44
+ function _JbVpn.current() return {} end
45
+
46
+ --- 选中一条 VPN 配置。可传显示名或 list 返回的 id。同名时不保证选中哪一条。
47
+ ---@param nameOrId string 显示名或 VPN ID
48
+ ---@return boolean 找到并选中为 true
49
+ ---@example jbvpn.select("Demo")
50
+ function _JbVpn.select(nameOrId) return false end
51
+
52
+ --- 删除一条 VPN 配置。可传显示名或 id。同名时不保证删除哪一条。
53
+ ---@param nameOrId string 显示名或 VPN ID
54
+ ---@return boolean 找到并删除为 true
55
+ ---@example jbvpn.remove("Demo")
56
+ function _JbVpn.remove(nameOrId) return false end
57
+
58
+ --- 连接 VPN。传入显示名或 id 时先选中再连接;省略则连接当前选中的配置。
59
+ --- 返回 true 只表示已经开始连接,不表示已经连上。用 status 看是否连上。
60
+ ---@param nameOrId? string 显示名或 VPN ID
61
+ ---@return boolean 开始连接为 true
62
+ ---@example jbvpn.connect("Demo")
63
+ function _JbVpn.connect(nameOrId) return false end
64
+
65
+ --- 断开当前 VPN 连接。返回 true 只表示已经开始断开,不表示已经断开。
66
+ ---@return boolean 开始断开为 true
67
+ ---@example jbvpn.disconnect()
68
+ function _JbVpn.disconnect() return false end
69
+
70
+ --- 读取当前选中 VPN 的状态。没有选中配置返回 nil。
71
+ ---@return JbVpnStatus|nil 状态;没有选中配置返回 nil
72
+ ---@example jbvpn.status()
73
+ function _JbVpn.status() return {} end
74
+
75
+ ---@type JbVpn
76
+ jbvpn = _JbVpn
package/types/lua/pip.lua CHANGED
@@ -28,13 +28,22 @@ function _Pip.switchToCustomMode() return true end
28
28
  ---@example pip.closeWindow()
29
29
  function _Pip.closeWindow() return true end
30
30
 
31
- --- 设置日志/自定义模式内容宽高比(不是最终像素)
32
- ---@param width number 宽度方向比例值(与 height 共同决定宽高比,不是像素)
33
- ---@param height number 高度方向比例值(与 width 共同决定宽高比,不是像素)
31
+ --- 设置日志/自定义模式内容尺寸
32
+ --- 系统画中画为宽高比;越狱包为窗口宽高(像素)
33
+ ---@param width number 宽度。系统画中画为比例值;越狱包为窗口宽度(像素)
34
+ ---@param height number 高度。系统画中画为比例值;越狱包为窗口高度(像素)
34
35
  ---@return boolean true代表尺寸已提交,false代表当前模式不允许设置或宽高无效
35
- ---@example pip.setContentSize(200, 120)
36
+ ---@example pip.setContentSize(560, 240)
36
37
  function _Pip.setContentSize(width, height) return true end
37
38
 
39
+ --- 设置悬浮窗位置。仅越狱包生效;系统画中画返回 false
40
+ --- 只对日志窗口和自定义文本窗口生效;保活模式不接受设置位置
41
+ ---@param x number 窗口左上角逻辑 X
42
+ ---@param y number 窗口左上角逻辑 Y
43
+ ---@return boolean true代表位置已提交,false代表当前不能设置位置
44
+ ---@example pip.setPosition(24, 120)
45
+ function _Pip.setPosition(x, y) return true end
46
+
38
47
  --- 设置日志字号;缺省 8
39
48
  ---@param fontSize number|nil 日志字号,必须是有效数字
40
49
  ---@return boolean true代表日志文字大小已提交,false代表字号无效
@@ -0,0 +1,50 @@
1
+ ---@meta
2
+ --- 属性列表模块。路径为绝对路径。XML 和二进制都能读。
3
+ --- write 默认 XML,可传 "binary"。set / remove 保持原文件格式。
4
+ --- get / set / remove 参数个数固定。key 是字符串或字符串数组,不要再跟额外参数。
5
+ ---@class Plist
6
+ local _Plist = {}
7
+
8
+ --- 读取整个 plist。XML 和二进制都能读。
9
+ ---@param path string 文件绝对路径
10
+ ---@return any|nil 根对象;路径空、文件不存在或不是 plist 返回 nil
11
+ ---@example plist.read(file.getInternalDir("documents") .. "/info.plist")
12
+ function _Plist.read(path) return nil end
13
+
14
+ --- 把对象写成 plist。默认 XML。会创建父目录。
15
+ ---@param path string 文件绝对路径
16
+ ---@param value any 字典、数组、字符串、数字或布尔
17
+ ---@param format? string `xml` 或 `binary`,默认 xml
18
+ ---@return boolean 写入成功为 true
19
+ ---@example plist.write(path, { name = "kuaijs", count = 1 })
20
+ function _Plist.write(path, value, format) return true end
21
+
22
+ --- 按键读取。参数固定两个。key 是字符串,或字符串数组表示嵌套路径。
23
+ ---@param path string 文件绝对路径
24
+ ---@param key string|string[] 根字典上的键,或嵌套键数组
25
+ ---@return any|nil 该键的值;文件/键不存在或中间不是字典返回 nil
26
+ ---@example plist.get(path, "name")
27
+ ---@example plist.get(path, { "a", "b" })
28
+ function _Plist.get(path, key) return nil end
29
+
30
+ --- 按键写入。参数固定三个。key 是字符串,或字符串数组表示嵌套路径。
31
+ --- 文件不存在则新建 XML 字典;已有文件保持原 xml/binary。中间缺的字典会补上。
32
+ --- 已有文件不是合法 plist,或中间键已有值但不是字典时失败,不覆盖。
33
+ ---@param path string 文件绝对路径
34
+ ---@param key string|string[] 根字典上的键,或嵌套键数组
35
+ ---@param value any 可写入 plist 的值
36
+ ---@return boolean 写入成功为 true
37
+ ---@example plist.set(path, "name", "kuaijs")
38
+ ---@example plist.set(path, { "a", "b" }, 1)
39
+ function _Plist.set(path, key, value) return true end
40
+
41
+ --- 按键删除。参数固定两个。key 是字符串,或字符串数组表示嵌套路径。
42
+ ---@param path string 文件绝对路径
43
+ ---@param key string|string[] 根字典上的键,或嵌套键数组
44
+ ---@return boolean 写回成功为 true
45
+ ---@example plist.remove(path, "name")
46
+ ---@example plist.remove(path, { "a", "b" })
47
+ function _Plist.remove(path, key) return true end
48
+
49
+ ---@type Plist
50
+ plist = _Plist
package/types/pip.d.ts CHANGED
@@ -35,14 +35,24 @@ declare namespace pip {
35
35
  function closeWindow(): boolean;
36
36
  /**
37
37
  * 设置日志模式或自定义模式的悬浮窗内容尺寸
38
- * 传入的宽高表示宽高比,不是最终像素尺寸;实际显示宽高由系统决定
38
+ * 系统画中画:传入宽高比,实际显示尺寸由系统决定
39
+ * 越狱包:传入窗口宽高(像素)
39
40
  * 日志模式和自定义模式会分别持久化尺寸;保活模式返回 false
40
- * @param width 宽度方向比例值(与 height 共同决定宽高比,不是像素)
41
- * @param height 高度方向比例值(与 width 共同决定宽高比,不是像素)
41
+ * @param width 宽度。系统画中画为比例值;越狱包为窗口宽度(像素)
42
+ * @param height 高度。系统画中画为比例值;越狱包为窗口高度(像素)
42
43
  * @returns true代表尺寸已提交,false代表当前模式不允许设置或宽高无效
43
- * @example pip.setContentSize(200, 120)
44
+ * @example pip.setContentSize(560, 240)
44
45
  */
45
46
  function setContentSize(width: number, height: number): boolean;
47
+ /**
48
+ * 设置悬浮窗位置。仅越狱包生效;系统画中画由 iOS 管理位置,调用返回 false
49
+ * 只对日志窗口和自定义文本窗口生效;保活模式不接受设置位置
50
+ * @param x 窗口左上角逻辑 X
51
+ * @param y 窗口左上角逻辑 Y
52
+ * @returns true代表位置已提交,false代表当前不能设置位置
53
+ * @example pip.setPosition(24, 120)
54
+ */
55
+ function setPosition(x: number, y: number): boolean;
46
56
  /**
47
57
  * 设置日志模式显示文本的文字大小
48
58
  * @param fontSize 日志字号,必须是有效数字
@@ -0,0 +1,59 @@
1
+ /**
2
+ * 属性列表模块
3
+ */
4
+ declare namespace plist {
5
+ /**
6
+ * 读取整个 plist。XML 和二进制都能读。
7
+ * @param path 文件绝对路径
8
+ * @returns 根对象;路径空、文件不存在或不是 plist 返回 null
9
+ * @example
10
+ * const path = file.getInternalDir("documents") + "/info.plist";
11
+ * const info = plist.read(path);
12
+ */
13
+ function read(path: string): any | null;
14
+ /**
15
+ * 把对象写成 plist。默认 XML。会创建父目录。
16
+ * @param path 文件绝对路径
17
+ * @param value 字典、数组、字符串、数字或布尔
18
+ * @param format `xml` 或 `binary`,默认 `xml`
19
+ * @returns 写入成功为 true
20
+ * @example
21
+ * const path = file.getInternalDir("documents") + "/info.plist";
22
+ * plist.write(path, { name: "kuaijs", count: 1 });
23
+ * plist.write(path, { name: "kuaijs" }, "binary");
24
+ */
25
+ function write(
26
+ path: string,
27
+ value: any,
28
+ format?: "xml" | "binary",
29
+ ): boolean;
30
+ /**
31
+ * 按键读取。参数固定两个。`key` 是字符串,或字符串数组表示嵌套路径。
32
+ * @param path 文件绝对路径
33
+ * @param key 根字典上的键,或嵌套键数组
34
+ * @returns 该键的值;文件/键不存在或中间不是字典返回 null
35
+ * @example plist.get(path, "name")
36
+ * @example plist.get(path, ["a", "b"])
37
+ */
38
+ function get(path: string, key: string | string[]): any | null;
39
+ /**
40
+ * 按键写入。参数固定三个。`key` 是字符串,或字符串数组表示嵌套路径。
41
+ * 文件不存在则新建 XML 字典;已有文件保持原 xml/binary。中间缺的字典会补上。
42
+ * 已有文件不是合法 plist,或中间键已有值但不是字典时失败,不覆盖。
43
+ * @param path 文件绝对路径
44
+ * @param key 根字典上的键,或嵌套键数组
45
+ * @param value 可写入 plist 的值
46
+ * @example plist.set(path, "name", "kuaijs")
47
+ * @example plist.set(path, ["a", "b"], 1)
48
+ */
49
+ function set(path: string, key: string | string[], value: any): boolean;
50
+ /**
51
+ * 按键删除。参数固定两个。`key` 是字符串,或字符串数组表示嵌套路径。
52
+ * @param path 文件绝对路径
53
+ * @param key 根字典上的键,或嵌套键数组
54
+ * @returns 写回成功为 true
55
+ * @example plist.remove(path, "name")
56
+ * @example plist.remove(path, ["a", "b"])
57
+ */
58
+ function remove(path: string, key: string | string[]): boolean;
59
+ }
package/types/ui.d.ts CHANGED
@@ -38,6 +38,17 @@ declare namespace ui {
38
38
  */
39
39
  function call(key: string, data: Record<string, any>): void;
40
40
 
41
+ /**
42
+ * 调用越狱悬浮窗网页中的 JavaScript 函数,不影响主界面 WebView
43
+ * @param key 函数名 悬浮窗页面 registerUIFunc 注册的函数名
44
+ * @param data 传递的数据
45
+ * @example
46
+ * ui.callFloatingWindow("jsMethod", {
47
+ * name: "快点JS",
48
+ * })
49
+ */
50
+ function callFloatingWindow(key: string, data: Record<string, any>): void;
51
+
41
52
  /**
42
53
  * 执行JavaScript代码
43
54
  * @param code JavaScript代码字符串
@@ -46,6 +57,14 @@ declare namespace ui {
46
57
  */
47
58
  function eval(code: string): void;
48
59
 
60
+ /**
61
+ * 在越狱悬浮窗网页中执行 JavaScript,不影响主界面 WebView
62
+ * @param code JavaScript代码字符串
63
+ * @example
64
+ * ui.evalFloatingWindow("console.log('float')")
65
+ */
66
+ function evalFloatingWindow(code: string): void;
67
+
49
68
  /**
50
69
  * 显示Toast提示消息
51
70
  * @param message 提示消息内容