Skip to content
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

fix(entry): added battery level check #851

Merged
merged 23 commits into from
Apr 21, 2024

Conversation

ThornWalli
Copy link
Contributor

@ThornWalli ThornWalli commented Sep 11, 2023

  • occurs when battery is not charging and <= 20%.
  • added message in speedkitLayer.

#786

- occurs when battery is not charging and <= 20%.
- added message in speedkitLayer.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we implement a generalistic solution. so it also works on ios and in desktop browsers (laptop)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the silent catch to switch to video detection.

src/module.mjs Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it it helpful to create an ignore object? so we have an easy possibility to extend it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThornWalli ThornWalli deleted the branch main September 12, 2023 08:00
@ThornWalli ThornWalli closed this Sep 12, 2023
@ThornWalli ThornWalli reopened this Sep 12, 2023
throw new Error('Battery is low.');
}
} catch (error) {
// Ignore Check
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

silent catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unnecessary catch has been removed.

In the entry now console.warn are built in, these show the respective case as a warning.

image

const VIDEO_TIMEOUT = 250;

const video = document.createElement('video');
video.muted = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need that. it seems to be a duplicate -> next line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All setAttribute have been removed and replaced with set properties.

}, VIDEO_TIMEOUT);

try {
await video.play();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain me, what should happen here in combination with the timeout.
i think we should wait for the playing event? and perhaps there is another event we can use to detect it is not playing cause of weak battery

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Video timeout was removed.

Now only the reject from the video play() is caught.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play

- removed video timeout, only catch by play reject
- added warn logs for catches
- removed setAttributes, only set property
} catch (error) {
clearTimeout(timeout);
throw new Error("Video playback not possible. Reason: can't play video");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please consign a meaningful error message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then there is alternatively only the possibility to forward the video error.

No separate text for an error that we can not guess when a video does not play.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we use an additional file? Or can we also use a super small base64 string?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the silent catch to switch to video detection.

@ThornWalli ThornWalli changed the base branch from next to feature/renaming January 12, 2024 20:09
@Object905
Copy link

Any news on this? Really like to see this in v3-next.

@ThornWalli
Copy link
Contributor Author

Hello @Object905 ,

will be in shortly 😉

Just planning the renaming of the package there it must be included 🙂
#921

But will probably be available before that.

Base automatically changed from feature/renaming to main April 20, 2024 13:19
@ThornWalli ThornWalli mentioned this pull request Apr 20, 2024
2 tasks
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@StephanGerbeth StephanGerbeth merged commit 8e48dab into main Apr 21, 2024
4 of 5 checks passed
@StephanGerbeth StephanGerbeth deleted the feature/entry-battery-level-check branch April 21, 2024 07:49
Copy link

🎉 This PR is included in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants