Skip to content

Commit

Permalink
breaking: Drop support for the windows platform
Browse files Browse the repository at this point in the history
  • Loading branch information
breautek committed Jul 4, 2024
1 parent 1a1c435 commit f5d6a2b
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 143 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ Report issues with this plugin on the [Apache Cordova issue tracker](https://iss
- Android
- Browser
- iOS
- Windows

## Methods

Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"platforms": [
"android",
"ios",
"windows",
"browser"
]
},
Expand All @@ -21,7 +20,6 @@
"ecosystem:cordova",
"cordova-android",
"cordova-ios",
"cordova-windows",
"cordova-browser"
],
"scripts": {
Expand Down
7 changes: 0 additions & 7 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@
<framework src="CoreMotion.framework" />
</platform>

<!-- windows -->
<platform name="windows">
<js-module src="src/windows/AccelerometerProxy.js" name="AccelerometerProxy">
<runs />
</js-module>
</platform>

<!-- browser -->
<platform name="browser">
<js-module src="src/browser/AccelerometerProxy.js" name="AccelerometerProxy">
Expand Down
74 changes: 0 additions & 74 deletions src/windows/AccelerometerProxy.js

This file was deleted.

42 changes: 0 additions & 42 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@
*
*/

/* global cordova, Windows */

exports.defineAutoTests = function () {
const isWindows = cordova.platformId === 'windows';
// Checking existence of accelerometer for windows platform
// Assumed that accelerometer always exists on other platforms. Extend
// condition to support accelerometer check on other platforms
let isAccelExist = isWindows ? Windows.Devices.Sensors.Accelerometer.getDefault() !== null : true;

describe('Accelerometer (navigator.accelerometer)', function () {
const fail = function (done) {
expect(true).toBe(false);
Expand All @@ -53,10 +45,6 @@ exports.defineAutoTests = function () {
});

it('accelerometer.spec.3 success callback should be called with an Acceleration object', function (done) {
// skip the test if Accelerometer doesn't exist on this device
if (!isAccelExist) {
pending();
}
const win = function (a) {
expect(a).toBeDefined();
expect(a.x).toBeDefined();
Expand All @@ -73,7 +61,6 @@ exports.defineAutoTests = function () {
const onError = function (err) {
console.log(err);
console.log('Skipping gyroscope tests, marking all as pending.');
isAccelExist = false;
expect(true).toBe(true);
done();
};
Expand All @@ -82,10 +69,6 @@ exports.defineAutoTests = function () {
});

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

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

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

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

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

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

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

it('accelerometer.spec.11 should clear an existing watch', function (done) {
// skip the test if Accelerometer doesn't exist on this device
if (!isAccelExist) {
pending();
}

// expect win to get called exactly once
let win = function (a) {
// clear watch on first call
Expand Down
17 changes: 0 additions & 17 deletions www/accelerometer.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,6 @@ var accelerometer = {
getCurrentAcceleration: function (successCallback, errorCallback, options) {
argscheck.checkArgs('fFO', 'accelerometer.getCurrentAcceleration', arguments);

if (cordova.platformId === 'windowsphone') {
exec(
function (a) {
accel = new Acceleration(a.x, a.y, a.z, a.timestamp);
successCallback(accel);
},
function (e) {
errorCallback(e);
},
'Accelerometer',
'getCurrentAcceleration',
[]
);

return;
}

if (cordova.platformId === 'browser' && !eventTimerId) {
// fire devicemotion event once
var devicemotionEvent = new Event('devicemotion');
Expand Down

0 comments on commit f5d6a2b

Please sign in to comment.