-
-
Notifications
You must be signed in to change notification settings - Fork 996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(deps): bump web from 0.5.1 to 1.0.0 in /packages/battery_plus/battery_plus #3103
chore(deps): bump web from 0.5.1 to 1.0.0 in /packages/battery_plus/battery_plus #3103
Conversation
Closes #3093 |
I am having issues with compilation while trying to test this PR. Getting same errors as our test workflow. |
Don't forget to remove this extension if it is no longer necessary:
|
Thanks.I am aware of it |
Bumps [web](https://github.com/dart-lang/web) from 0.5.1 to 1.0.0. - [Release notes](https://github.com/dart-lang/web/releases) - [Changelog](https://github.com/dart-lang/web/blob/main/CHANGELOG.md) - [Commits](dart-lang/web@v0.5.1...v1.0.0) --- updated-dependencies: - dependency-name: web dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
9e82119
to
5eb2063
Compare
There are two options. class BatteryPlusWebPlugin extends BatteryPlatform {
~~~
/// Return [BatteryManager] if the BatteryManager API is supported by the User Agent.
Future<BatteryManagerPlus?> _getBatteryManager() async {
try {
return await web.window.navigator.getBatteryPlus()?.toDart;
} on NoSuchMethodError catch (_) {
// BatteryManager API is not supported this User Agent.
return null;
} on Object catch (_) {
// Unexpected exception occurred.
return null;
}
}
~~~
}
extension on web.Navigator {
/// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getBattery
@JS('getBattery')
external JSPromise<BatteryManagerPlus>? getBatteryPlus();
}
/// BatteryManager API
/// https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager
extension type BatteryManagerPlus(JSObject _) implements JSObject {
/// https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager/level
external double get level;
/// https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager/charging
external bool get charging;
/// https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager/chargingchange_event
external set onchargingchange(JSFunction fn);
} |
Are you sure the build fails? I'm pretty sure the extension will just have no effect. |
The current implementation can't build because of having two different classes with the name |
The https://github.com/dart-lang/web/blob/v0.5.1/lib/src/dom/html.dart https://github.com/dart-lang/web/blob/v1.0.0/lib/src/dom/html.dart#L11670 Therefore, when you update I believe we need our own |
Indeed, this is how it currently is, similar to what happens in
This is not a requirement to have the range. Good to have, but only if there is no situations like in this package with need to have extension before 1.0.0 and no need afterwards. |
Sorry, I mistakenly thought that the maintainer wanted to specify the same range for battery_plus (if possible), since the other packages were described as |
Tested on chrome, desktop computer, got 100% battery. Seems good? |
@Rexios80 and @koji-1009 if you can, please take a look and let me know if it looks correct. |
@@ -34,7 +34,7 @@ dependencies: | |||
battery_plus_platform_interface: ^2.0.1 | |||
meta: ^1.8.0 | |||
upower: ^0.7.0 | |||
web: ^0.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we doing the range ">=0.5.1 <2.0.0" like the packages repo did for these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, switching to ^1.0.0
is preferable since we want to use the newly available APIs changes in the web package, i.e. getBattery()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We kept the custom extensions in those packages in order to support both 0.5.0 and 1.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I thought we agreed to remove the custom extensions since 1.0.0 already provide those types.
Personally, I am more keen to use 1.0.0 directly and remove the extensions, and only keep the range in cases where no extensions are involved (e.g. with other plugins like device_info_plus
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My vote is for going ^1.0.0 here and in the share_plus.
I have verified that it works as expected with Firefox and Safari on macOS. These browsers do not have the Battery API, so a When I try wasm build + Chrome, I get a TypeError. This is also happening on the main branch, so I'll create a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Bumps web from 0.5.1 to 1.0.0.
Release notes
Sourced from web's releases.
Changelog
Sourced from web's changelog.
Commits
e89fe49
Publish package:web v1 (#271)e4c4d81
Bump the github-actions group with 2 updates (#269)2ae509e
Update doc comments, bump version to 1.0.0-wip (#268)72a806f
Account for static members in MDN docs (#267)82b94c2
Add MAC_FF_META to KeyCode constants (#264)9e20f7f
Update Web IDL to 3.49.0 (#266)50239e9
Rename members when they collide with return/parameter type names (#265)6b8a465
Account for typedef nullability (#257)f6a7d38
Emit double as return value instead of num (#256)6d22294
Add Float16Array alias (#255)You can trigger a rebase of this PR by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)