Skip to content

Commit b5ecfc4

Browse files
committed
breaking: Drop support for the windows platform
1 parent eaf7da2 commit b5ecfc4

File tree

6 files changed

+1
-144
lines changed

6 files changed

+1
-144
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ description: Access accelerometer data.
2727

2828
# Usage Notice
2929

30-
With the [W3C Device Orientation API](https://www.w3.org/TR/orientation-event/), Android, iOS, and Windows devices may not need this plugin anymore.
30+
With the [W3C Device Orientation API](https://www.w3.org/TR/orientation-event/), Android and iOS devices may not need this plugin anymore.
3131

3232
However, on iOS 13+, potential issues with permissions and secure contexts can arise. Therefore it is recommended to use this plugin as it uses a native implementation.
3333

@@ -61,7 +61,6 @@ Report issues with this plugin on the [Apache Cordova issue tracker](https://iss
6161
- Android
6262
- Browser
6363
- iOS
64-
- Windows
6564

6665
## Methods
6766

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"platforms": [
99
"android",
1010
"ios",
11-
"windows",
1211
"browser"
1312
]
1413
},
@@ -21,7 +20,6 @@
2120
"ecosystem:cordova",
2221
"cordova-android",
2322
"cordova-ios",
24-
"cordova-windows",
2523
"cordova-browser"
2624
],
2725
"scripts": {

plugin.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@
6363
<framework src="CoreMotion.framework" />
6464
</platform>
6565

66-
<!-- windows -->
67-
<platform name="windows">
68-
<js-module src="src/windows/AccelerometerProxy.js" name="AccelerometerProxy">
69-
<runs />
70-
</js-module>
71-
</platform>
72-
7366
<!-- browser -->
7467
<platform name="browser">
7568
<js-module src="src/browser/AccelerometerProxy.js" name="AccelerometerProxy">

src/windows/AccelerometerProxy.js

Lines changed: 0 additions & 74 deletions
This file was deleted.

tests/tests.js

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,7 @@
1919
*
2020
*/
2121

22-
/* global cordova, Windows */
23-
2422
exports.defineAutoTests = function () {
25-
const isWindows = cordova.platformId === 'windows';
26-
// Checking existence of accelerometer for windows platform
27-
// Assumed that accelerometer always exists on other platforms. Extend
28-
// condition to support accelerometer check on other platforms
29-
let isAccelExist = isWindows ? Windows.Devices.Sensors.Accelerometer.getDefault() !== null : true;
30-
3123
describe('Accelerometer (navigator.accelerometer)', function () {
3224
const fail = function (done) {
3325
expect(true).toBe(false);
@@ -53,10 +45,6 @@ exports.defineAutoTests = function () {
5345
});
5446

5547
it('accelerometer.spec.3 success callback should be called with an Acceleration object', function (done) {
56-
// skip the test if Accelerometer doesn't exist on this device
57-
if (!isAccelExist) {
58-
pending();
59-
}
6048
const win = function (a) {
6149
expect(a).toBeDefined();
6250
expect(a.x).toBeDefined();
@@ -73,7 +61,6 @@ exports.defineAutoTests = function () {
7361
const onError = function (err) {
7462
console.log(err);
7563
console.log('Skipping gyroscope tests, marking all as pending.');
76-
isAccelExist = false;
7764
expect(true).toBe(true);
7865
done();
7966
};
@@ -82,10 +69,6 @@ exports.defineAutoTests = function () {
8269
});
8370

8471
it('accelerometer.spec.4 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2', function (done) {
85-
// skip the test if Accelerometer doesn't exist on this device
86-
if (!isAccelExist) {
87-
pending();
88-
}
8972
const reasonableThreshold = 15;
9073
const win = function (a) {
9174
expect(a.x).toBeLessThan(reasonableThreshold);
@@ -101,10 +84,6 @@ exports.defineAutoTests = function () {
10184
});
10285

10386
it('accelerometer.spec.5 success callback Acceleration object should return a recent timestamp', function (done) {
104-
// skip the test if Accelerometer doesn't exist on this device
105-
if (!isAccelExist) {
106-
pending();
107-
}
10887
const veryRecently = new Date().getTime();
10988
// Need to check that dates returned are not vastly greater than a recent time stamp.
11089
// In case the timestamps returned are ridiculously high
@@ -137,10 +116,6 @@ exports.defineAutoTests = function () {
137116
});
138117

139118
it('accelerometer.spec.7 success callback should be called with an Acceleration object', function (done) {
140-
// skip the test if Accelerometer doesn't exist on this device
141-
if (!isAccelExist) {
142-
pending();
143-
}
144119
const win = function (a) {
145120
expect(a).toBeDefined();
146121
expect(a.x).toBeDefined();
@@ -158,10 +133,6 @@ exports.defineAutoTests = function () {
158133
});
159134

160135
it('accelerometer.spec.8 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2', function (done) {
161-
// skip the test if Accelerometer doesn't exist on this device
162-
if (!isAccelExist) {
163-
pending();
164-
}
165136
const reasonableThreshold = 15;
166137
const win = function (a) {
167138
expect(a.x).toBeLessThan(reasonableThreshold);
@@ -177,10 +148,6 @@ exports.defineAutoTests = function () {
177148
});
178149

179150
it('accelerometer.spec.9 success callback Acceleration object should return a recent timestamp', function (done) {
180-
// skip the test if Accelerometer doesn't exist on this device
181-
if (!isAccelExist) {
182-
pending();
183-
}
184151
const veryRecently = new Date().getTime();
185152
// Need to check that dates returned are not vastly greater than a recent time stamp.
186153
// In case the timestamps returned are ridiculously high
@@ -195,10 +162,6 @@ exports.defineAutoTests = function () {
195162
});
196163

197164
it('accelerometer.spec.12 success callback should be preserved and called several times', function (done) {
198-
// skip the test if Accelerometer doesn't exist on this device
199-
if (!isAccelExist) {
200-
pending();
201-
}
202165
let callbacksCallCount = 0;
203166
const callbacksCallTestCount = 3;
204167

@@ -221,11 +184,6 @@ exports.defineAutoTests = function () {
221184
});
222185

223186
it('accelerometer.spec.11 should clear an existing watch', function (done) {
224-
// skip the test if Accelerometer doesn't exist on this device
225-
if (!isAccelExist) {
226-
pending();
227-
}
228-
229187
// expect win to get called exactly once
230188
let win = function (a) {
231189
// clear watch on first call

www/accelerometer.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,6 @@ var accelerometer = {
102102
getCurrentAcceleration: function (successCallback, errorCallback, options) {
103103
argscheck.checkArgs('fFO', 'accelerometer.getCurrentAcceleration', arguments);
104104

105-
if (cordova.platformId === 'windowsphone') {
106-
exec(
107-
function (a) {
108-
accel = new Acceleration(a.x, a.y, a.z, a.timestamp);
109-
successCallback(accel);
110-
},
111-
function (e) {
112-
errorCallback(e);
113-
},
114-
'Accelerometer',
115-
'getCurrentAcceleration',
116-
[]
117-
);
118-
119-
return;
120-
}
121-
122105
if (cordova.platformId === 'browser' && !eventTimerId) {
123106
// fire devicemotion event once
124107
var devicemotionEvent = new Event('devicemotion');

0 commit comments

Comments
 (0)