Skip to content

Commit

Permalink
[battery] Remove deprecated isSupported
Browse files Browse the repository at this point in the history
  • Loading branch information
bbarthec committed Feb 27, 2020
1 parent 130d2c5 commit 64b00ea
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 48 deletions.
6 changes: 0 additions & 6 deletions apps/test-suite/tests/Battery.js
Expand Up @@ -19,12 +19,6 @@ export async function test({ describe, it, expect, jasmine }) {
);
});

describe(`isSupported (deprecated)`, () => {
it('should be equal to the result of isAvailableAsync()', async () => {
expect(await Battery.isAvailableAsync()).toEqual(Battery.isSupported);
});
});

const isAvailable = await Battery.isAvailableAsync();

if (isAvailable) {
Expand Down
4 changes: 0 additions & 4 deletions packages/expo-battery/build/Battery.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 1 addition & 16 deletions packages/expo-battery/build/Battery.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-battery/build/Battery.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 1 addition & 21 deletions packages/expo-battery/src/Battery.ts
@@ -1,4 +1,4 @@
import { EventEmitter, Subscription, deprecate } from '@unimodules/core';
import { EventEmitter, Subscription } from '@unimodules/core';

import {
BatteryLevelEvent,
Expand All @@ -14,26 +14,6 @@ import ExpoBattery from './ExpoBattery';

const BatteryEventEmitter = new EventEmitter(ExpoBattery);

/**
* Deprecated
*/
export declare const isSupported: boolean;
if (typeof module !== 'undefined' && module.exports) {
Object.defineProperties(module.exports, {
isSupported: {
enumerable: true,
get() {
deprecate('expo-battery', 'Battery.isSupported', {
replacement: 'Battery.isAvailableAsync',
currentVersion: require('../package.json').version,
versionToRemove: '3.0.0',
});
return (ExpoBattery && ExpoBattery.isSupported) || false;
},
},
});
}

export async function isAvailableAsync(): Promise<boolean> {
return Promise.resolve((ExpoBattery && ExpoBattery.isSupported) || false);
}
Expand Down

0 comments on commit 64b00ea

Please sign in to comment.