io.appium.settings 5.9.2 → 5.10.0

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [5.10.0](https://github.com/appium/io.appium.settings/compare/v5.9.2...v5.10.0) (2024-05-27)
2
+
3
+
4
+ ### Features
5
+
6
+ * use adb settings method to set animation for newer than api level 26 ([#176](https://github.com/appium/io.appium.settings/issues/176)) ([d0e5d4f](https://github.com/appium/io.appium.settings/commit/d0e5d4f3b7441d98402828a65717b2fddc6fa3e9))
7
+
1
8
  ## [5.9.2](https://github.com/appium/io.appium.settings/compare/v5.9.1...v5.9.2) (2024-05-18)
2
9
 
3
10
 
package/README.md CHANGED
@@ -133,12 +133,16 @@ To turn on `animation`:
133
133
  $ adb shell am broadcast -a io.appium.settings.animation --es setstatus enable
134
134
  ```
135
135
 
136
+ (Note that [Restrictions on non-SDK interfaces](https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces) affects this animation command.)
137
+
136
138
  To turn off `animation`:
137
139
 
138
140
  ```shell
139
141
  $ adb shell am broadcast -a io.appium.settings.animation --es setstatus disable
140
142
  ```
141
143
 
144
+ (Note that [Restrictions on non-SDK interfaces](https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces) affects this animation command.)
145
+
142
146
  Set particular locale:
143
147
 
144
148
  ```shell
Binary file
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Change the state of animation on the device under test.
2
+ * Change the state of animation on the device under test via adb settings command (for API level 26+) or settings app (for API level 25 and lower).
3
3
  * Animation on the device is controlled by the following global properties:
4
4
  * [ANIMATOR_DURATION_SCALE]{@link https://developer.android.com/reference/android/provider/Settings.Global.html#ANIMATOR_DURATION_SCALE},
5
5
  * [TRANSITION_ANIMATION_SCALE]{@link https://developer.android.com/reference/android/provider/Settings.Global.html#TRANSITION_ANIMATION_SCALE},
@@ -1 +1 @@
1
- {"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../lib/commands/animation.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,6EAFW,OAAO,iBAQjB"}
1
+ {"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../lib/commands/animation.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,6EAFW,OAAO,iBAejB"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setAnimationState = void 0;
4
4
  const constants_js_1 = require("../constants.js");
5
5
  /**
6
- * Change the state of animation on the device under test.
6
+ * Change the state of animation on the device under test via adb settings command (for API level 26+) or settings app (for API level 25 and lower).
7
7
  * Animation on the device is controlled by the following global properties:
8
8
  * [ANIMATOR_DURATION_SCALE]{@link https://developer.android.com/reference/android/provider/Settings.Global.html#ANIMATOR_DURATION_SCALE},
9
9
  * [TRANSITION_ANIMATION_SCALE]{@link https://developer.android.com/reference/android/provider/Settings.Global.html#TRANSITION_ANIMATION_SCALE},
@@ -17,11 +17,19 @@ const constants_js_1 = require("../constants.js");
17
17
  * @param {boolean} on - True to enable and false to disable it.
18
18
  */
19
19
  async function setAnimationState(on) {
20
+ if (await this.adb.getApiLevel() >= 26) {
21
+ await this.adb.setAnimationScale(Number(on));
22
+ return;
23
+ }
24
+ ;
25
+ // TODO: Please delete AnimationSettingHandler.java implementation also to avoid non-sdk https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces
26
+ // error in settings app for Android 9 and over when we drop api level 25 and lower.
27
+ const statusToSet = on ? 'enable' : 'disable';
20
28
  await this.checkBroadcast([
21
29
  '-a', constants_js_1.ANIMATION_SETTING_ACTION,
22
30
  '-n', constants_js_1.ANIMATION_SETTING_RECEIVER,
23
- '--es', 'setstatus', on ? 'enable' : 'disable'
24
- ], `${on ? 'enable' : 'disable'} animation`);
31
+ '--es', 'setstatus', statusToSet
32
+ ], `${statusToSet} animation`);
25
33
  }
26
34
  exports.setAnimationState = setAnimationState;
27
35
  //# sourceMappingURL=animation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"animation.js","sourceRoot":"","sources":["../../../lib/commands/animation.js"],"names":[],"mappings":";;;AAAA,kDAAuF;AAEvF;;;;;;;;;;;;;GAaG;AACI,KAAK,UAAU,iBAAiB,CAAE,EAAE;IACzC,MAAM,IAAI,CAAC,cAAc,CAAC;QACxB,IAAI,EAAE,uCAAwB;QAC9B,IAAI,EAAE,yCAA0B;QAChC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;KAC/C,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAAY,CAAC,CAAC;AAC/C,CAAC;AAND,8CAMC"}
1
+ {"version":3,"file":"animation.js","sourceRoot":"","sources":["../../../lib/commands/animation.js"],"names":[],"mappings":";;;AAAA,kDAAuF;AAEvF;;;;;;;;;;;;;GAaG;AACI,KAAK,UAAU,iBAAiB,CAAE,EAAE;IACzC,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC;QACvC,MAAM,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7C,OAAO;IACT,CAAC;IAAA,CAAC;IACF,8KAA8K;IAC9K,oFAAoF;IACpF,MAAM,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9C,MAAM,IAAI,CAAC,cAAc,CAAC;QACxB,IAAI,EAAE,uCAAwB;QAC9B,IAAI,EAAE,yCAA0B;QAChC,MAAM,EAAE,WAAW,EAAE,WAAW;KACjC,EAAE,GAAG,WAAW,YAAY,CAAC,CAAC;AACjC,CAAC;AAbD,8CAaC"}
@@ -1,7 +1,7 @@
1
1
  import { ANIMATION_SETTING_ACTION, ANIMATION_SETTING_RECEIVER } from '../constants.js';
2
2
 
3
3
  /**
4
- * Change the state of animation on the device under test.
4
+ * Change the state of animation on the device under test via adb settings command (for API level 26+) or settings app (for API level 25 and lower).
5
5
  * Animation on the device is controlled by the following global properties:
6
6
  * [ANIMATOR_DURATION_SCALE]{@link https://developer.android.com/reference/android/provider/Settings.Global.html#ANIMATOR_DURATION_SCALE},
7
7
  * [TRANSITION_ANIMATION_SCALE]{@link https://developer.android.com/reference/android/provider/Settings.Global.html#TRANSITION_ANIMATION_SCALE},
@@ -15,9 +15,16 @@ import { ANIMATION_SETTING_ACTION, ANIMATION_SETTING_RECEIVER } from '../constan
15
15
  * @param {boolean} on - True to enable and false to disable it.
16
16
  */
17
17
  export async function setAnimationState (on) {
18
+ if (await this.adb.getApiLevel() >= 26) {
19
+ await this.adb.setAnimationScale(Number(on));
20
+ return;
21
+ };
22
+ // TODO: Please delete AnimationSettingHandler.java implementation also to avoid non-sdk https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces
23
+ // error in settings app for Android 9 and over when we drop api level 25 and lower.
24
+ const statusToSet = on ? 'enable' : 'disable';
18
25
  await this.checkBroadcast([
19
26
  '-a', ANIMATION_SETTING_ACTION,
20
27
  '-n', ANIMATION_SETTING_RECEIVER,
21
- '--es', 'setstatus', on ? 'enable' : 'disable'
22
- ], `${on ? 'enable' : 'disable'} animation`);
28
+ '--es', 'setstatus', statusToSet
29
+ ], `${statusToSet} animation`);
23
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "io.appium.settings",
3
- "version": "5.9.2",
3
+ "version": "5.10.0",
4
4
  "description": "App for dealing with Android settings",
5
5
  "main": "./build/lib/index.js",
6
6
  "types": "./build/lib/index.d.ts",
@@ -66,7 +66,7 @@
66
66
  "@types/lodash": "^4.14.196",
67
67
  "@types/node": "^20.4.7",
68
68
  "@types/teen_process": "^2.0.2",
69
- "appium-adb": "^12.0.0",
69
+ "appium-adb": "^12.4.0",
70
70
  "chai": "^4.1.2",
71
71
  "chai-as-promised": "^7.1.1",
72
72
  "conventional-changelog-conventionalcommits": "^7.0.1",