Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appium-adb

Package Overview
Dependencies
Maintainers
6
Versions
442
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appium-adb - npm Package Compare versions

Comparing version 2.0.0-beta4 to 2.0.0-beta5

.package.json.un~

8

lib/adb.js

@@ -6,2 +6,3 @@ import _ from 'lodash';

const JAR_PATH = path.resolve(rootDir, 'jars');
const DEFAULTS_OPTS = {

@@ -26,3 +27,3 @@ sdkRoot: null,

jars: {},
helperJarPath: path.resolve(rootDir, 'jars')
helperJarPath: JAR_PATH
};

@@ -51,7 +52,6 @@

for (let jarName of tempJars) {
this.jars[jarName] = path.resolve(__dirname, '../jars', jarName);
this.jars[jarName] = path.resolve(JAR_PATH, jarName);
}
if (!this.javaVersion || parseFloat(this.javaVersion) < 1.7) {
this.jars['appium_apk_tools.jar'] = path.resolve(__dirname,
'../jars',
this.jars['appium_apk_tools.jar'] = path.resolve(JAR_PATH,
'appium_apk_tools_1.6.jar');

@@ -58,0 +58,0 @@ }

import { buildStartCmd, getActivityRelativeName } from '../helpers.js';
import { exec } from 'teen_process';
import log from '../logger.js';
import path from 'path';
import _ from 'lodash';
import { sleep } from 'asyncbox';
import { fs } from '../utils';

@@ -160,2 +163,35 @@ let apkUtilsMethods = {};

apkUtilsMethods.extractStringsFromApk = async function (apk, language, out) {
log.debug("Extracting strings for language: " + (language || "default"));
let stringsJson = 'strings.json';
if (!language) {
language = await this.getDeviceLanguage();
}
let apkTools = this.jars['appium_apk_tools.jar'];
let args = ['-jar', apkTools, 'stringsFromApk', apk, out, language];
let fileData, apkStrings;
try {
await exec('java', args);
} catch (e) {
log.debug(`No strings.xml for language '${language}', getting default ` +
`strings.xml`);
args.pop();
await exec('java', args);
}
try {
log.debug("Reading strings from converted strings.json");
fileData = await fs.readFile(path.join(out, stringsJson), 'utf8');
apkStrings = JSON.parse(fileData);
} catch (e) {
if (fileData) {
log.debug("Content started with: " + fileData.slice(0, 300));
}
let msg = `Could not parse strings from strings.json. Original ` +
`error: ${e.message}`;
log.errorAndThrow(msg);
}
return apkStrings;
};
export default apkUtilsMethods;

@@ -16,3 +16,4 @@ import _mv from 'mv';

readdir: B.promisify(_fs.readdir),
writeFile: B.promisify(_fs.writeFile)
writeFile: B.promisify(_fs.writeFile),
readFile: B.promisify(_fs.readFile)
},

@@ -19,0 +20,0 @@ rootDir = path.resolve(__dirname, process.env.NO_PRECOMPILE ? '..' : '../..'),

{
"name": "appium-adb",
"version": "2.0.0-beta4",
"version": "2.0.0-beta5",
"description": "appium-adb",

@@ -5,0 +5,0 @@ "main": "./build/index.js",

@@ -72,2 +72,6 @@ import chai from 'chai';

});
it('extractStringsFromApk should get strings for default language', async () => {
let strings = await adb.extractStringsFromApk(contactManagerPath, null, '/tmp');
strings.save.should.equal('Save');
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc