appium-adb
Advanced tools
Comparing version 12.0.1 to 12.0.2
@@ -180,2 +180,13 @@ export default apkUtilsMethods; | ||
}; | ||
export type ApkStrings = { | ||
/** | ||
* parsed resource file | ||
* represented as JSON object | ||
*/ | ||
apkStrings: import('@appium/types').StringRecord; | ||
/** | ||
* the path to the extracted file on the local file system | ||
*/ | ||
localPath?: string | undefined; | ||
}; | ||
export type AppInfo = { | ||
@@ -435,2 +446,8 @@ /** | ||
/** | ||
* @typedef {Object} ApkStrings | ||
* @property {import('@appium/types').StringRecord} apkStrings parsed resource file | ||
* represented as JSON object | ||
* @property {string} [localPath] the path to the extracted file on the local file system | ||
*/ | ||
/** | ||
* Extract string resources from the given package on local file system. | ||
@@ -440,11 +457,10 @@ * | ||
* @param {string} appPath - The full path to the .apk(s) package. | ||
* @param {string?} language - The name of the language to extract the resources for. | ||
* @param {string?} [language=null] - The name of the language to extract the resources for. | ||
* The default language is used if this equals to `null` | ||
* @param {string} out - The name of the destination folder on the local file system to | ||
* store the extracted file to. | ||
* @return {Promise<import('@appium/types').StringRecord>} A mapping object, where properties are: 'apkStrings', containing | ||
* parsed resource file represented as JSON object, and 'localPath', | ||
* containing the path to the extracted file on the local file system. | ||
* @param {string?} [outRoot=null] - The name of the destination folder on the local file system to | ||
* store the extracted file to. If not provided then the `localPath` property in the returned object | ||
* will be undefined. | ||
* @return {Promise<ApkStrings>} | ||
*/ | ||
function extractStringsFromApk(this: import("../adb.js").ADB, appPath: string, language: string | null, out: string): Promise<import("@appium/types").StringRecord<any>>; | ||
function extractStringsFromApk(this: import("../adb.js").ADB, appPath: string, language?: string | null | undefined, outRoot?: string | null | undefined): Promise<ApkStrings>; | ||
/** | ||
@@ -451,0 +467,0 @@ * Get the language name of the device under test. |
@@ -803,2 +803,8 @@ "use strict"; | ||
/** | ||
* @typedef {Object} ApkStrings | ||
* @property {import('@appium/types').StringRecord} apkStrings parsed resource file | ||
* represented as JSON object | ||
* @property {string} [localPath] the path to the extracted file on the local file system | ||
*/ | ||
/** | ||
* Extract string resources from the given package on local file system. | ||
@@ -808,11 +814,10 @@ * | ||
* @param {string} appPath - The full path to the .apk(s) package. | ||
* @param {string?} language - The name of the language to extract the resources for. | ||
* @param {string?} [language=null] - The name of the language to extract the resources for. | ||
* The default language is used if this equals to `null` | ||
* @param {string} out - The name of the destination folder on the local file system to | ||
* store the extracted file to. | ||
* @return {Promise<import('@appium/types').StringRecord>} A mapping object, where properties are: 'apkStrings', containing | ||
* parsed resource file represented as JSON object, and 'localPath', | ||
* containing the path to the extracted file on the local file system. | ||
* @param {string?} [outRoot=null] - The name of the destination folder on the local file system to | ||
* store the extracted file to. If not provided then the `localPath` property in the returned object | ||
* will be undefined. | ||
* @return {Promise<ApkStrings>} | ||
*/ | ||
apkUtilsMethods.extractStringsFromApk = async function extractStringsFromApk(appPath, language, out) { | ||
apkUtilsMethods.extractStringsFromApk = async function extractStringsFromApk(appPath, language = null, outRoot = null) { | ||
logger_js_1.default.debug(`Extracting strings from for language: ${language || 'default'}`); | ||
@@ -867,4 +872,7 @@ const originalAppPath = appPath; | ||
} | ||
const localPath = path_1.default.resolve(out, 'strings.json'); | ||
await (0, support_1.mkdirp)(out); | ||
if (!outRoot) { | ||
return { apkStrings }; | ||
} | ||
const localPath = path_1.default.resolve(outRoot, 'strings.json'); | ||
await (0, support_1.mkdirp)(outRoot); | ||
await support_1.fs.writeFile(localPath, JSON.stringify(apkStrings, null, 2), 'utf-8'); | ||
@@ -871,0 +879,0 @@ return { apkStrings, localPath }; |
@@ -0,1 +1,8 @@ | ||
## [12.0.2](https://github.com/appium/appium-adb/compare/v12.0.1...v12.0.2) (2024-01-25) | ||
### Miscellaneous Chores | ||
* Update the implementation of extractStringsFromApk API ([#720](https://github.com/appium/appium-adb/issues/720)) ([ef091f4](https://github.com/appium/appium-adb/commit/ef091f4aa835b6fdaec0d85ce06e7196788ccd9c)) | ||
## [12.0.1](https://github.com/appium/appium-adb/compare/v12.0.0...v12.0.1) (2024-01-17) | ||
@@ -2,0 +9,0 @@ |
@@ -854,2 +854,9 @@ import { | ||
/** | ||
* @typedef {Object} ApkStrings | ||
* @property {import('@appium/types').StringRecord} apkStrings parsed resource file | ||
* represented as JSON object | ||
* @property {string} [localPath] the path to the extracted file on the local file system | ||
*/ | ||
/** | ||
* Extract string resources from the given package on local file system. | ||
@@ -859,11 +866,14 @@ * | ||
* @param {string} appPath - The full path to the .apk(s) package. | ||
* @param {string?} language - The name of the language to extract the resources for. | ||
* @param {string?} [language=null] - The name of the language to extract the resources for. | ||
* The default language is used if this equals to `null` | ||
* @param {string} out - The name of the destination folder on the local file system to | ||
* store the extracted file to. | ||
* @return {Promise<import('@appium/types').StringRecord>} A mapping object, where properties are: 'apkStrings', containing | ||
* parsed resource file represented as JSON object, and 'localPath', | ||
* containing the path to the extracted file on the local file system. | ||
* @param {string?} [outRoot=null] - The name of the destination folder on the local file system to | ||
* store the extracted file to. If not provided then the `localPath` property in the returned object | ||
* will be undefined. | ||
* @return {Promise<ApkStrings>} | ||
*/ | ||
apkUtilsMethods.extractStringsFromApk = async function extractStringsFromApk (appPath, language, out) { | ||
apkUtilsMethods.extractStringsFromApk = async function extractStringsFromApk ( | ||
appPath, | ||
language = null, | ||
outRoot = null | ||
) { | ||
log.debug(`Extracting strings from for language: ${language || 'default'}`); | ||
@@ -923,4 +933,8 @@ const originalAppPath = appPath; | ||
const localPath = path.resolve(out, 'strings.json'); | ||
await mkdirp(out); | ||
if (!outRoot) { | ||
return {apkStrings}; | ||
} | ||
const localPath = path.resolve(outRoot, 'strings.json'); | ||
await mkdirp(outRoot); | ||
await fs.writeFile(localPath, JSON.stringify(apkStrings, null, 2), 'utf-8'); | ||
@@ -927,0 +941,0 @@ return {apkStrings, localPath}; |
{ | ||
"name": "appium-adb", | ||
"version": "12.0.1", | ||
"version": "12.0.2", | ||
"description": "Android Debug Bridge interface", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1013805
18642