capacitor-dex-editor 0.0.51 → 0.0.53

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.
package/README.md CHANGED
@@ -174,6 +174,8 @@ MIT
174
174
  * [`openSmaliEditor(...)`](#opensmalieditor)
175
175
  * [`openXmlEditor(...)`](#openxmleditor)
176
176
  * [`openCodeEditor(...)`](#opencodeeditor)
177
+ * [`addListener('compileProgress', ...)`](#addlistenercompileprogress-)
178
+ * [`removeAllListeners()`](#removealllisteners)
177
179
  * [Interfaces](#interfaces)
178
180
  * [Type Aliases](#type-aliases)
179
181
 
@@ -253,6 +255,35 @@ openCodeEditor(options: OpenCodeEditorOptions) => Promise<OpenEditorResult>
253
255
  --------------------
254
256
 
255
257
 
258
+ ### addListener('compileProgress', ...)
259
+
260
+ ```typescript
261
+ addListener(eventName: 'compileProgress', listenerFunc: (event: CompileProgressEvent) => void) => Promise<PluginListenerHandle>
262
+ ```
263
+
264
+ 监听编译进度事件
265
+
266
+ | Param | Type |
267
+ | ------------------ | ----------------------------------------------------------------------------------------- |
268
+ | **`eventName`** | <code>'compileProgress'</code> |
269
+ | **`listenerFunc`** | <code>(event: <a href="#compileprogressevent">CompileProgressEvent</a>) =&gt; void</code> |
270
+
271
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
272
+
273
+ --------------------
274
+
275
+
276
+ ### removeAllListeners()
277
+
278
+ ```typescript
279
+ removeAllListeners() => Promise<void>
280
+ ```
281
+
282
+ 移除所有监听器
283
+
284
+ --------------------
285
+
286
+
256
287
  ### Interfaces
257
288
 
258
289
 
@@ -314,6 +345,27 @@ openCodeEditor(options: OpenCodeEditorOptions) => Promise<OpenEditorResult>
314
345
  | **`syntaxFile`** | <code>string</code> |
315
346
 
316
347
 
348
+ #### PluginListenerHandle
349
+
350
+ | Prop | Type |
351
+ | ------------ | ----------------------------------------- |
352
+ | **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
353
+
354
+
355
+ #### CompileProgressEvent
356
+
357
+ 编译进度事件数据
358
+
359
+ | Prop | Type |
360
+ | ------------- | ----------------------------------------------- |
361
+ | **`type`** | <code>'message' \| 'progress' \| 'title'</code> |
362
+ | **`current`** | <code>number</code> |
363
+ | **`total`** | <code>number</code> |
364
+ | **`percent`** | <code>number</code> |
365
+ | **`message`** | <code>string</code> |
366
+ | **`title`** | <code>string</code> |
367
+
368
+
317
369
  ### Type Aliases
318
370
 
319
371
 
@@ -68,8 +68,6 @@ dependencies {
68
68
  // APK Signer - V1/V2/V3/V4 签名支持 (Android 7.0+)
69
69
  api 'com.android.tools.build:apksig:8.7.2'
70
70
 
71
- // 移除 ARSCLib,使用内置 AXML 解析器
72
-
73
71
  testImplementation "junit:junit:$junitVersion"
74
72
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
75
73
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -34,6 +34,35 @@ public class DexEditorPluginPlugin extends Plugin {
34
34
  public void load() {
35
35
  super.load();
36
36
  apkManager.setContext(getContext());
37
+
38
+ // 设置编译进度回调
39
+ dexManager.setProgressCallback(new DexManager.CompileProgress() {
40
+ @Override
41
+ public void onProgress(int current, int total) {
42
+ JSObject data = new JSObject();
43
+ data.put("type", "progress");
44
+ data.put("current", current);
45
+ data.put("total", total);
46
+ data.put("percent", total > 0 ? (current * 100 / total) : 0);
47
+ notifyListeners("compileProgress", data);
48
+ }
49
+
50
+ @Override
51
+ public void onMessage(String message) {
52
+ JSObject data = new JSObject();
53
+ data.put("type", "message");
54
+ data.put("message", message);
55
+ notifyListeners("compileProgress", data);
56
+ }
57
+
58
+ @Override
59
+ public void onTitle(String title) {
60
+ JSObject data = new JSObject();
61
+ data.put("type", "title");
62
+ data.put("title", title);
63
+ notifyListeners("compileProgress", data);
64
+ }
65
+ });
37
66
  }
38
67
 
39
68
  /**
@@ -59,6 +59,40 @@ public class DexManager {
59
59
 
60
60
  private static final String TAG = "DexManager";
61
61
 
62
+ /**
63
+ * 编译进度回调接口
64
+ */
65
+ public interface CompileProgress {
66
+ void onProgress(int current, int total);
67
+ void onMessage(String message);
68
+ void onTitle(String title);
69
+ }
70
+
71
+ // 当前进度回调
72
+ private CompileProgress progressCallback;
73
+
74
+ public void setProgressCallback(CompileProgress callback) {
75
+ this.progressCallback = callback;
76
+ }
77
+
78
+ private void reportProgress(int current, int total) {
79
+ if (progressCallback != null) {
80
+ progressCallback.onProgress(current, total);
81
+ }
82
+ }
83
+
84
+ private void reportMessage(String message) {
85
+ if (progressCallback != null) {
86
+ progressCallback.onMessage(message);
87
+ }
88
+ }
89
+
90
+ private void reportTitle(String title) {
91
+ if (progressCallback != null) {
92
+ progressCallback.onTitle(title);
93
+ }
94
+ }
95
+
62
96
  // 存储活跃的 DEX 会话
63
97
  private final Map<String, DexSession> sessions = new HashMap<>();
64
98
 
@@ -1971,17 +2005,29 @@ public class DexManager {
1971
2005
  }
1972
2006
 
1973
2007
  // 创建新 DEX
2008
+ reportTitle("编译 " + dexName);
2009
+ reportMessage("正在编译类...");
2010
+
1974
2011
  java.io.File tempDex = java.io.File.createTempFile("dex_", ".dex");
1975
2012
  DexPool dexPool = new DexPool(Opcodes.getDefault());
2013
+ int total = allClasses.size();
2014
+ int current = 0;
1976
2015
  for (ClassDef c : allClasses) {
1977
2016
  dexPool.internClass(c);
2017
+ current++;
2018
+ reportProgress(current, total);
1978
2019
  }
2020
+
2021
+ reportMessage("正在写入文件...");
1979
2022
  dexPool.writeTo(new FileDataStore(tempDex));
1980
2023
 
1981
2024
  newDexData.put(dexName, readFileBytes(tempDex));
1982
2025
  tempDex.delete();
1983
2026
  }
1984
2027
 
2028
+ reportTitle("更新 APK");
2029
+ reportMessage("正在替换 DEX 文件...");
2030
+
1985
2031
  // 替换 APK 中的 DEX
1986
2032
  java.io.File apkFile = new java.io.File(session.apkPath);
1987
2033
  java.io.File tempApk = new java.io.File(session.apkPath + ".tmp");
@@ -127,18 +127,19 @@ public class SmaliEditorActivity extends AppCompatActivity {
127
127
 
128
128
  setContentView(root);
129
129
 
130
- // 处理安全区域
130
+ // 处理安全区域和键盘
131
131
  ViewCompat.setOnApplyWindowInsetsListener(root, (v, windowInsets) -> {
132
- Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
132
+ Insets systemBars = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
133
+ Insets ime = windowInsets.getInsets(WindowInsetsCompat.Type.ime());
133
134
 
134
135
  // 更新顶部占位高度
135
136
  ViewGroup.LayoutParams topParams = topSpacer.getLayoutParams();
136
- topParams.height = insets.top;
137
+ topParams.height = systemBars.top;
137
138
  topSpacer.setLayoutParams(topParams);
138
139
 
139
- // 更新底部占位高度
140
+ // 更新底部占位高度(考虑键盘)
140
141
  ViewGroup.LayoutParams bottomParams = bottomSpacer.getLayoutParams();
141
- bottomParams.height = insets.bottom;
142
+ bottomParams.height = Math.max(systemBars.bottom, ime.bottom);
142
143
  bottomSpacer.setLayoutParams(bottomParams);
143
144
 
144
145
  return WindowInsetsCompat.CONSUMED;
package/dist/docs.json CHANGED
@@ -89,6 +89,40 @@
89
89
  "OpenCodeEditorOptions"
90
90
  ],
91
91
  "slug": "opencodeeditor"
92
+ },
93
+ {
94
+ "name": "addListener",
95
+ "signature": "(eventName: 'compileProgress', listenerFunc: (event: CompileProgressEvent) => void) => Promise<PluginListenerHandle>",
96
+ "parameters": [
97
+ {
98
+ "name": "eventName",
99
+ "docs": "",
100
+ "type": "'compileProgress'"
101
+ },
102
+ {
103
+ "name": "listenerFunc",
104
+ "docs": "",
105
+ "type": "(event: CompileProgressEvent) => void"
106
+ }
107
+ ],
108
+ "returns": "Promise<PluginListenerHandle>",
109
+ "tags": [],
110
+ "docs": "监听编译进度事件",
111
+ "complexTypes": [
112
+ "PluginListenerHandle",
113
+ "CompileProgressEvent"
114
+ ],
115
+ "slug": "addlistenercompileprogress-"
116
+ },
117
+ {
118
+ "name": "removeAllListeners",
119
+ "signature": "() => Promise<void>",
120
+ "parameters": [],
121
+ "returns": "Promise<void>",
122
+ "tags": [],
123
+ "docs": "移除所有监听器",
124
+ "complexTypes": [],
125
+ "slug": "removealllisteners"
92
126
  }
93
127
  ],
94
128
  "properties": []
@@ -305,6 +339,73 @@
305
339
  "type": "string | undefined"
306
340
  }
307
341
  ]
342
+ },
343
+ {
344
+ "name": "PluginListenerHandle",
345
+ "slug": "pluginlistenerhandle",
346
+ "docs": "",
347
+ "tags": [],
348
+ "methods": [],
349
+ "properties": [
350
+ {
351
+ "name": "remove",
352
+ "tags": [],
353
+ "docs": "",
354
+ "complexTypes": [],
355
+ "type": "() => Promise<void>"
356
+ }
357
+ ]
358
+ },
359
+ {
360
+ "name": "CompileProgressEvent",
361
+ "slug": "compileprogressevent",
362
+ "docs": "编译进度事件数据",
363
+ "tags": [],
364
+ "methods": [],
365
+ "properties": [
366
+ {
367
+ "name": "type",
368
+ "tags": [],
369
+ "docs": "",
370
+ "complexTypes": [],
371
+ "type": "'message' | 'progress' | 'title'"
372
+ },
373
+ {
374
+ "name": "current",
375
+ "tags": [],
376
+ "docs": "",
377
+ "complexTypes": [],
378
+ "type": "number | undefined"
379
+ },
380
+ {
381
+ "name": "total",
382
+ "tags": [],
383
+ "docs": "",
384
+ "complexTypes": [],
385
+ "type": "number | undefined"
386
+ },
387
+ {
388
+ "name": "percent",
389
+ "tags": [],
390
+ "docs": "",
391
+ "complexTypes": [],
392
+ "type": "number | undefined"
393
+ },
394
+ {
395
+ "name": "message",
396
+ "tags": [],
397
+ "docs": "",
398
+ "complexTypes": [],
399
+ "type": "string | undefined"
400
+ },
401
+ {
402
+ "name": "title",
403
+ "tags": [],
404
+ "docs": "",
405
+ "complexTypes": [],
406
+ "type": "string | undefined"
407
+ }
408
+ ]
308
409
  }
309
410
  ],
310
411
  "enums": [],
@@ -1,3 +1,15 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ /**
3
+ * 编译进度事件数据
4
+ */
5
+ export interface CompileProgressEvent {
6
+ type: 'progress' | 'message' | 'title';
7
+ current?: number;
8
+ total?: number;
9
+ percent?: number;
10
+ message?: string;
11
+ title?: string;
12
+ }
1
13
  /**
2
14
  * DEX编辑器插件 - 通用执行器接口
3
15
  * 通过 action 参数调用 dexlib2 的全部功能
@@ -21,6 +33,14 @@ export interface DexEditorPluginPlugin {
21
33
  * 打开通用代码编辑器
22
34
  */
23
35
  openCodeEditor(options: OpenCodeEditorOptions): Promise<OpenEditorResult>;
36
+ /**
37
+ * 监听编译进度事件
38
+ */
39
+ addListener(eventName: 'compileProgress', listenerFunc: (event: CompileProgressEvent) => void): Promise<PluginListenerHandle>;
40
+ /**
41
+ * 移除所有监听器
42
+ */
43
+ removeAllListeners(): Promise<void>;
24
44
  }
25
45
  export interface OpenSmaliEditorOptions {
26
46
  content: string;
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * DEX编辑器插件 - 通用执行器接口\n * 通过 action 参数调用 dexlib2 的全部功能\n */\nexport interface DexEditorPluginPlugin {\n /**\n * 通用执行器 - 调用任意 dexlib2 功能\n * @param options.action 操作名称\n * @param options.params 操作参数\n */\n execute(options: DexExecuteOptions): Promise<DexExecuteResult>;\n\n /**\n * 打开原生 Smali 编辑器\n */\n openSmaliEditor(options: OpenSmaliEditorOptions): Promise<OpenEditorResult>;\n\n /**\n * 打开原生 XML 编辑器\n */\n openXmlEditor(options: OpenXmlEditorOptions): Promise<OpenEditorResult>;\n\n /**\n * 打开通用代码编辑器\n */\n openCodeEditor(options: OpenCodeEditorOptions): Promise<OpenEditorResult>;\n}\n\nexport interface OpenSmaliEditorOptions {\n content: string;\n title?: string;\n className?: string;\n readOnly?: boolean;\n}\n\nexport interface OpenXmlEditorOptions {\n content: string;\n title?: string;\n filePath?: string;\n readOnly?: boolean;\n}\n\nexport interface OpenCodeEditorOptions {\n content: string;\n title?: string;\n filePath?: string;\n readOnly?: boolean;\n syntaxFile?: string; // 语法文件: smali.json, xml.json, java.json, json.json 等\n}\n\nexport interface OpenEditorResult {\n success: boolean;\n content?: string;\n modified?: boolean;\n cancelled?: boolean;\n}\n\n// 保持向后兼容\nexport type OpenSmaliEditorResult = OpenEditorResult;\n\nexport interface DexExecuteOptions {\n action: DexAction;\n params?: Record<string, any>;\n}\n\nexport interface DexExecuteResult {\n success: boolean;\n data?: any;\n error?: string;\n}\n\n/**\n * 支持的操作类型\n */\nexport type DexAction =\n // DEX文件操作\n | 'loadDex' // 加载DEX文件\n | 'saveDex' // 保存DEX文件\n | 'closeDex' // 关闭DEX文件\n | 'getDexInfo' // 获取DEX文件信息\n \n // 类操作\n | 'getClasses' // 获取所有类列表\n | 'getClassInfo' // 获取类详细信息\n | 'addClass' // 添加类\n | 'removeClass' // 删除类\n | 'renameClass' // 重命名类\n \n // 方法操作\n | 'getMethods' // 获取类的所有方法\n | 'getMethodInfo' // 获取方法详细信息\n | 'getMethodSmali' // 获取方法的Smali代码\n | 'setMethodSmali' // 设置方法的Smali代码\n | 'addMethod' // 添加方法\n | 'removeMethod' // 删除方法\n \n // 字段操作\n | 'getFields' // 获取类的所有字段\n | 'getFieldInfo' // 获取字段详细信息\n | 'addField' // 添加字段\n | 'removeField' // 删除字段\n \n // Smali操作\n | 'classToSmali' // 将类转换为Smali代码\n | 'smaliToClass' // 将Smali代码编译为类\n | 'disassemble' // 反汇编整个DEX\n | 'assemble' // 汇编Smali目录为DEX\n \n // 搜索操作\n | 'searchString' // 搜索字符串\n | 'searchCode' // 搜索代码\n | 'searchMethod' // 搜索方法\n | 'searchField' // 搜索字段\n \n // 工具操作\n | 'fixDex' // 修复DEX文件\n | 'mergeDex' // 合并多个DEX\n | 'splitDex' // 拆分DEX\n | 'getStrings' // 获取字符串常量池\n | 'modifyString' // 修改字符串\n \n // APK操作\n | 'openApk' // 打开APK文件(解压)\n | 'closeApk' // 关闭APK会话\n | 'getApkInfo' // 获取APK信息\n | 'listApkContents' // 列出APK内容\n | 'extractFile' // 提取APK中的文件\n | 'replaceFile' // 替换APK中的文件\n | 'addFile' // 添加文件到APK\n | 'deleteFile' // 删除APK中的文件\n | 'repackApk' // 重新打包APK\n | 'signApk' // 签名APK\n | 'signApkWithTestKey'// 使用测试密钥签名\n | 'getApkSignature' // 获取APK签名信息\n | 'getSessionDexFiles';// 获取会话中的DEX文件\n\n/**\n * 常用参数类型定义\n */\nexport interface LoadDexParams {\n path: string; // DEX文件路径\n sessionId?: string; // 可选的会话ID\n}\n\nexport interface SaveDexParams {\n sessionId: string; // 会话ID\n outputPath: string; // 输出路径\n}\n\nexport interface ClassInfoParams {\n sessionId: string;\n className: string; // 类名 (如 Lcom/example/Test;)\n}\n\nexport interface MethodSmaliParams {\n sessionId: string;\n className: string;\n methodName: string;\n methodSignature: string; // 方法签名 (如 (I)V)\n}\n\nexport interface SetMethodSmaliParams extends MethodSmaliParams {\n smaliCode: string; // 新的Smali代码\n}\n\nexport interface SearchParams {\n sessionId: string;\n query: string;\n regex?: boolean; // 是否使用正则表达式\n caseSensitive?: boolean;\n}\n\nexport interface DisassembleParams {\n sessionId: string;\n outputDir: string; // 输出Smali目录\n}\n\nexport interface AssembleParams {\n smaliDir: string; // Smali目录\n outputPath: string; // 输出DEX路径\n}\n\n// ============ APK 操作参数 ============\n\nexport interface OpenApkParams {\n apkPath: string; // APK文件路径\n extractDir?: string; // 解压目录(可选)\n}\n\nexport interface ApkInfoParams {\n apkPath: string;\n}\n\nexport interface ExtractFileParams {\n apkPath: string;\n entryName: string; // ZIP内文件路径\n outputPath: string;\n}\n\nexport interface ReplaceFileParams {\n sessionId: string;\n entryName: string; // ZIP内文件路径\n newFilePath: string; // 新文件路径\n}\n\nexport interface RepackApkParams {\n sessionId: string;\n outputPath: string; // 输出APK路径\n}\n\nexport interface SignApkParams {\n apkPath: string;\n outputPath: string;\n keystorePath: string; // 密钥库路径\n keystorePassword: string;\n keyAlias: string; // 密钥别名\n keyPassword: string;\n}\n\nexport interface SignApkTestParams {\n apkPath: string;\n outputPath: string;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * 编译进度事件数据\n */\nexport interface CompileProgressEvent {\n type: 'progress' | 'message' | 'title';\n current?: number;\n total?: number;\n percent?: number;\n message?: string;\n title?: string;\n}\n\n/**\n * DEX编辑器插件 - 通用执行器接口\n * 通过 action 参数调用 dexlib2 的全部功能\n */\nexport interface DexEditorPluginPlugin {\n /**\n * 通用执行器 - 调用任意 dexlib2 功能\n * @param options.action 操作名称\n * @param options.params 操作参数\n */\n execute(options: DexExecuteOptions): Promise<DexExecuteResult>;\n\n /**\n * 打开原生 Smali 编辑器\n */\n openSmaliEditor(options: OpenSmaliEditorOptions): Promise<OpenEditorResult>;\n\n /**\n * 打开原生 XML 编辑器\n */\n openXmlEditor(options: OpenXmlEditorOptions): Promise<OpenEditorResult>;\n\n /**\n * 打开通用代码编辑器\n */\n openCodeEditor(options: OpenCodeEditorOptions): Promise<OpenEditorResult>;\n\n /**\n * 监听编译进度事件\n */\n addListener(\n eventName: 'compileProgress',\n listenerFunc: (event: CompileProgressEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * 移除所有监听器\n */\n removeAllListeners(): Promise<void>;\n}\n\nexport interface OpenSmaliEditorOptions {\n content: string;\n title?: string;\n className?: string;\n readOnly?: boolean;\n}\n\nexport interface OpenXmlEditorOptions {\n content: string;\n title?: string;\n filePath?: string;\n readOnly?: boolean;\n}\n\nexport interface OpenCodeEditorOptions {\n content: string;\n title?: string;\n filePath?: string;\n readOnly?: boolean;\n syntaxFile?: string; // 语法文件: smali.json, xml.json, java.json, json.json 等\n}\n\nexport interface OpenEditorResult {\n success: boolean;\n content?: string;\n modified?: boolean;\n cancelled?: boolean;\n}\n\n// 保持向后兼容\nexport type OpenSmaliEditorResult = OpenEditorResult;\n\nexport interface DexExecuteOptions {\n action: DexAction;\n params?: Record<string, any>;\n}\n\nexport interface DexExecuteResult {\n success: boolean;\n data?: any;\n error?: string;\n}\n\n/**\n * 支持的操作类型\n */\nexport type DexAction =\n // DEX文件操作\n | 'loadDex' // 加载DEX文件\n | 'saveDex' // 保存DEX文件\n | 'closeDex' // 关闭DEX文件\n | 'getDexInfo' // 获取DEX文件信息\n \n // 类操作\n | 'getClasses' // 获取所有类列表\n | 'getClassInfo' // 获取类详细信息\n | 'addClass' // 添加类\n | 'removeClass' // 删除类\n | 'renameClass' // 重命名类\n \n // 方法操作\n | 'getMethods' // 获取类的所有方法\n | 'getMethodInfo' // 获取方法详细信息\n | 'getMethodSmali' // 获取方法的Smali代码\n | 'setMethodSmali' // 设置方法的Smali代码\n | 'addMethod' // 添加方法\n | 'removeMethod' // 删除方法\n \n // 字段操作\n | 'getFields' // 获取类的所有字段\n | 'getFieldInfo' // 获取字段详细信息\n | 'addField' // 添加字段\n | 'removeField' // 删除字段\n \n // Smali操作\n | 'classToSmali' // 将类转换为Smali代码\n | 'smaliToClass' // 将Smali代码编译为类\n | 'disassemble' // 反汇编整个DEX\n | 'assemble' // 汇编Smali目录为DEX\n \n // 搜索操作\n | 'searchString' // 搜索字符串\n | 'searchCode' // 搜索代码\n | 'searchMethod' // 搜索方法\n | 'searchField' // 搜索字段\n \n // 工具操作\n | 'fixDex' // 修复DEX文件\n | 'mergeDex' // 合并多个DEX\n | 'splitDex' // 拆分DEX\n | 'getStrings' // 获取字符串常量池\n | 'modifyString' // 修改字符串\n \n // APK操作\n | 'openApk' // 打开APK文件(解压)\n | 'closeApk' // 关闭APK会话\n | 'getApkInfo' // 获取APK信息\n | 'listApkContents' // 列出APK内容\n | 'extractFile' // 提取APK中的文件\n | 'replaceFile' // 替换APK中的文件\n | 'addFile' // 添加文件到APK\n | 'deleteFile' // 删除APK中的文件\n | 'repackApk' // 重新打包APK\n | 'signApk' // 签名APK\n | 'signApkWithTestKey'// 使用测试密钥签名\n | 'getApkSignature' // 获取APK签名信息\n | 'getSessionDexFiles';// 获取会话中的DEX文件\n\n/**\n * 常用参数类型定义\n */\nexport interface LoadDexParams {\n path: string; // DEX文件路径\n sessionId?: string; // 可选的会话ID\n}\n\nexport interface SaveDexParams {\n sessionId: string; // 会话ID\n outputPath: string; // 输出路径\n}\n\nexport interface ClassInfoParams {\n sessionId: string;\n className: string; // 类名 (如 Lcom/example/Test;)\n}\n\nexport interface MethodSmaliParams {\n sessionId: string;\n className: string;\n methodName: string;\n methodSignature: string; // 方法签名 (如 (I)V)\n}\n\nexport interface SetMethodSmaliParams extends MethodSmaliParams {\n smaliCode: string; // 新的Smali代码\n}\n\nexport interface SearchParams {\n sessionId: string;\n query: string;\n regex?: boolean; // 是否使用正则表达式\n caseSensitive?: boolean;\n}\n\nexport interface DisassembleParams {\n sessionId: string;\n outputDir: string; // 输出Smali目录\n}\n\nexport interface AssembleParams {\n smaliDir: string; // Smali目录\n outputPath: string; // 输出DEX路径\n}\n\n// ============ APK 操作参数 ============\n\nexport interface OpenApkParams {\n apkPath: string; // APK文件路径\n extractDir?: string; // 解压目录(可选)\n}\n\nexport interface ApkInfoParams {\n apkPath: string;\n}\n\nexport interface ExtractFileParams {\n apkPath: string;\n entryName: string; // ZIP内文件路径\n outputPath: string;\n}\n\nexport interface ReplaceFileParams {\n sessionId: string;\n entryName: string; // ZIP内文件路径\n newFilePath: string; // 新文件路径\n}\n\nexport interface RepackApkParams {\n sessionId: string;\n outputPath: string; // 输出APK路径\n}\n\nexport interface SignApkParams {\n apkPath: string;\n outputPath: string;\n keystorePath: string; // 密钥库路径\n keystorePassword: string;\n keyAlias: string; // 密钥别名\n keyPassword: string;\n}\n\nexport interface SignApkTestParams {\n apkPath: string;\n outputPath: string;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-dex-editor",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "description": "Capacitor-plugin-for-editing-DEX-files-in-APK",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",