io.appium.settings 5.13.0 → 5.14.1
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/CHANGELOG.md +12 -0
- package/apks/settings_apk-debug.apk +0 -0
- package/build/lib/commands/geolocation.d.ts +22 -4
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +26 -3
- package/build/lib/commands/geolocation.js.map +1 -1
- package/lib/commands/geolocation.js +26 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [5.14.1](https://github.com/appium/io.appium.settings/compare/v5.14.0...v5.14.1) (2025-02-26)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* crash while enabling/disabling bluetooth on API level >= 31 ([8fb4a11](https://github.com/appium/io.appium.settings/commit/8fb4a117fab9be81fafdf198087a8d5dca9a3d9a))
|
|
6
|
+
|
|
7
|
+
## [5.14.0](https://github.com/appium/io.appium.settings/compare/v5.13.0...v5.14.0) (2025-02-24)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add bearing and accuracy params into setGeoLocation ([#213](https://github.com/appium/io.appium.settings/issues/213)) ([a684a98](https://github.com/appium/io.appium.settings/commit/a684a98b3d919d7af4e9f5d2aeabdd09561ba0e8))
|
|
12
|
+
|
|
1
13
|
## [5.13.0](https://github.com/appium/io.appium.settings/compare/v5.12.24...v5.13.0) (2025-02-23)
|
|
2
14
|
|
|
3
15
|
### Features
|
|
Binary file
|
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
* @typedef {Object} Location
|
|
3
3
|
* @property {number|string} longitude - Valid longitude value.
|
|
4
4
|
* @property {number|string} latitude - Valid latitude value.
|
|
5
|
-
* @property {
|
|
6
|
-
* @property {
|
|
5
|
+
* @property {number|string|null} [altitude] - Valid altitude value.
|
|
6
|
+
* @property {number|string|null} [satellites=12] - Number of satellites being tracked (1-12).
|
|
7
7
|
* This value is ignored on real devices.
|
|
8
|
-
* @property {
|
|
8
|
+
* @property {number|string|null} [speed] - Valid speed value.
|
|
9
|
+
* https://developer.android.com/reference/android/location/Location#setSpeed(float)
|
|
10
|
+
* @property {number|string|null} [bearing] - Valid bearing value.
|
|
11
|
+
* https://developer.android.com/reference/android/location/Location#setBearing(float)
|
|
12
|
+
* @property {number|string|null} [accuracy] - Valid accuracy value.
|
|
13
|
+
* https://developer.android.com/reference/android/location/Location#setAccuracy(float),
|
|
14
|
+
* https://developer.android.com/reference/android/location/Criteria
|
|
9
15
|
* Should be greater than 0.0 meters/second for real devices or 0.0 knots
|
|
10
16
|
* for emulators.
|
|
11
17
|
*/
|
|
@@ -62,9 +68,21 @@ export type Location = {
|
|
|
62
68
|
satellites?: string | number | null | undefined;
|
|
63
69
|
/**
|
|
64
70
|
* - Valid speed value.
|
|
71
|
+
* https://developer.android.com/reference/android/location/Location#setSpeed(float)
|
|
72
|
+
*/
|
|
73
|
+
speed?: string | number | null | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* - Valid bearing value.
|
|
76
|
+
* https://developer.android.com/reference/android/location/Location#setBearing(float)
|
|
77
|
+
*/
|
|
78
|
+
bearing?: string | number | null | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* - Valid accuracy value.
|
|
81
|
+
* https://developer.android.com/reference/android/location/Location#setAccuracy(float),
|
|
82
|
+
* https://developer.android.com/reference/android/location/Criteria
|
|
65
83
|
* Should be greater than 0.0 meters/second for real devices or 0.0 knots
|
|
66
84
|
* for emulators.
|
|
67
85
|
*/
|
|
68
|
-
|
|
86
|
+
accuracy?: string | number | null | undefined;
|
|
69
87
|
};
|
|
70
88
|
//# sourceMappingURL=geolocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":"AAoBA
|
|
1
|
+
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;GAQG;AACH,gFALW,QAAQ,eAER,OAAO,iBAmFjB;AAED;;;;;;GAMG;AACH,uEAHa,OAAO,CAAC,QAAQ,CAAC,CAoB7B;AAED;;;;;;;;;;;;;GAaG;AACH,2FANW,MAAM,iBAwDhB;;;;;eArMa,MAAM,GAAC,MAAM;;;;cACb,MAAM,GAAC,MAAM"}
|
|
@@ -23,10 +23,16 @@ const GPS_COORDINATES_PATTERN = /data="(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)"/;
|
|
|
23
23
|
* @typedef {Object} Location
|
|
24
24
|
* @property {number|string} longitude - Valid longitude value.
|
|
25
25
|
* @property {number|string} latitude - Valid latitude value.
|
|
26
|
-
* @property {
|
|
27
|
-
* @property {
|
|
26
|
+
* @property {number|string|null} [altitude] - Valid altitude value.
|
|
27
|
+
* @property {number|string|null} [satellites=12] - Number of satellites being tracked (1-12).
|
|
28
28
|
* This value is ignored on real devices.
|
|
29
|
-
* @property {
|
|
29
|
+
* @property {number|string|null} [speed] - Valid speed value.
|
|
30
|
+
* https://developer.android.com/reference/android/location/Location#setSpeed(float)
|
|
31
|
+
* @property {number|string|null} [bearing] - Valid bearing value.
|
|
32
|
+
* https://developer.android.com/reference/android/location/Location#setBearing(float)
|
|
33
|
+
* @property {number|string|null} [accuracy] - Valid accuracy value.
|
|
34
|
+
* https://developer.android.com/reference/android/location/Location#setAccuracy(float),
|
|
35
|
+
* https://developer.android.com/reference/android/location/Criteria
|
|
30
36
|
* Should be greater than 0.0 meters/second for real devices or 0.0 knots
|
|
31
37
|
* for emulators.
|
|
32
38
|
*/
|
|
@@ -61,6 +67,8 @@ async function setGeoLocation(location, isEmulator = false) {
|
|
|
61
67
|
const latitude = /** @type {string} */ (formatLocationValue('latitude'));
|
|
62
68
|
const altitude = formatLocationValue('altitude', false);
|
|
63
69
|
const speed = formatLocationValue('speed', false);
|
|
70
|
+
const bearing = formatLocationValue('bearing', false);
|
|
71
|
+
const accuracy = formatLocationValue('accuracy', false);
|
|
64
72
|
if (isEmulator) {
|
|
65
73
|
/** @type {string[]} */
|
|
66
74
|
const args = [longitude, latitude];
|
|
@@ -98,8 +106,23 @@ async function setGeoLocation(location, isEmulator = false) {
|
|
|
98
106
|
args.push('-e', 'altitude', altitude);
|
|
99
107
|
}
|
|
100
108
|
if (!lodash_1.default.isNil(speed)) {
|
|
109
|
+
if (lodash_1.default.toNumber(speed) < 0) {
|
|
110
|
+
throw new Error(`${speed} is expected to be 0.0 or greater.`);
|
|
111
|
+
}
|
|
101
112
|
args.push('-e', 'speed', speed);
|
|
102
113
|
}
|
|
114
|
+
if (!lodash_1.default.isNil(bearing)) {
|
|
115
|
+
if (!lodash_1.default.inRange(lodash_1.default.toNumber(bearing), 0, 360)) {
|
|
116
|
+
throw new Error(`${accuracy} is expected to be in [0, 360) range.`);
|
|
117
|
+
}
|
|
118
|
+
args.push('-e', 'bearing', bearing);
|
|
119
|
+
}
|
|
120
|
+
if (!lodash_1.default.isNil(accuracy)) {
|
|
121
|
+
if (lodash_1.default.toNumber(accuracy) < 0) {
|
|
122
|
+
throw new Error(`${accuracy} is expected to be 0.0 or greater.`);
|
|
123
|
+
}
|
|
124
|
+
args.push('-e', 'accuracy', accuracy);
|
|
125
|
+
}
|
|
103
126
|
args.push(constants_js_1.LOCATION_SERVICE);
|
|
104
127
|
await this.adb.shell(args);
|
|
105
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":";;;;;AA+CA,wCAgFC;AASD,wCAiBC;AAgBD,0DAkDC;AA3ND,oDAAuB;AACvB,kDAIyB;AACzB,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;AACH,CAAC"}
|
|
@@ -22,10 +22,16 @@ const GPS_COORDINATES_PATTERN = /data="(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)"/;
|
|
|
22
22
|
* @typedef {Object} Location
|
|
23
23
|
* @property {number|string} longitude - Valid longitude value.
|
|
24
24
|
* @property {number|string} latitude - Valid latitude value.
|
|
25
|
-
* @property {
|
|
26
|
-
* @property {
|
|
25
|
+
* @property {number|string|null} [altitude] - Valid altitude value.
|
|
26
|
+
* @property {number|string|null} [satellites=12] - Number of satellites being tracked (1-12).
|
|
27
27
|
* This value is ignored on real devices.
|
|
28
|
-
* @property {
|
|
28
|
+
* @property {number|string|null} [speed] - Valid speed value.
|
|
29
|
+
* https://developer.android.com/reference/android/location/Location#setSpeed(float)
|
|
30
|
+
* @property {number|string|null} [bearing] - Valid bearing value.
|
|
31
|
+
* https://developer.android.com/reference/android/location/Location#setBearing(float)
|
|
32
|
+
* @property {number|string|null} [accuracy] - Valid accuracy value.
|
|
33
|
+
* https://developer.android.com/reference/android/location/Location#setAccuracy(float),
|
|
34
|
+
* https://developer.android.com/reference/android/location/Criteria
|
|
29
35
|
* Should be greater than 0.0 meters/second for real devices or 0.0 knots
|
|
30
36
|
* for emulators.
|
|
31
37
|
*/
|
|
@@ -61,6 +67,8 @@ export async function setGeoLocation (location, isEmulator = false) {
|
|
|
61
67
|
const latitude = /** @type {string} */ (formatLocationValue('latitude'));
|
|
62
68
|
const altitude = formatLocationValue('altitude', false);
|
|
63
69
|
const speed = formatLocationValue('speed', false);
|
|
70
|
+
const bearing = formatLocationValue('bearing', false);
|
|
71
|
+
const accuracy = formatLocationValue('accuracy', false);
|
|
64
72
|
if (isEmulator) {
|
|
65
73
|
/** @type {string[]} */
|
|
66
74
|
const args = [longitude, latitude];
|
|
@@ -97,8 +105,23 @@ export async function setGeoLocation (location, isEmulator = false) {
|
|
|
97
105
|
args.push('-e', 'altitude', altitude);
|
|
98
106
|
}
|
|
99
107
|
if (!_.isNil(speed)) {
|
|
108
|
+
if (_.toNumber(speed) < 0) {
|
|
109
|
+
throw new Error(`${speed} is expected to be 0.0 or greater.`);
|
|
110
|
+
}
|
|
100
111
|
args.push('-e', 'speed', speed);
|
|
101
112
|
}
|
|
113
|
+
if (!_.isNil(bearing)) {
|
|
114
|
+
if (!_.inRange(_.toNumber(bearing), 0, 360)) {
|
|
115
|
+
throw new Error(`${accuracy} is expected to be in [0, 360) range.`);
|
|
116
|
+
}
|
|
117
|
+
args.push('-e', 'bearing', bearing);
|
|
118
|
+
}
|
|
119
|
+
if (!_.isNil(accuracy)) {
|
|
120
|
+
if (_.toNumber(accuracy) < 0) {
|
|
121
|
+
throw new Error(`${accuracy} is expected to be 0.0 or greater.`);
|
|
122
|
+
}
|
|
123
|
+
args.push('-e', 'accuracy', accuracy);
|
|
124
|
+
}
|
|
102
125
|
args.push(LOCATION_SERVICE);
|
|
103
126
|
await this.adb.shell(args);
|
|
104
127
|
}
|