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

Adds function to create screenshots #50

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

halemmerich
Copy link
Contributor

This allows the apploader to get a screenshot via g.dump().

js/index.js Outdated
Progress.show({title:"Screenshot done",percent:85,sticky:true});

}, err=>{
showToast("Error creating screenshot: "+err,"error");
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! Does this need a Progress.hide(...) call here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean line 1267? Without that it does not change from animated progress bar to fixed percentages. There might be a better way to do this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh no, I was thinking if we hit an error we could've done Progress.show({title:"Creating screenshot",interval:10,percent:"animate",sticky:true});, and then no other change to Progress in this error handler section, if you see what I mean?

@gfwilliams
Copy link
Member

That's a great idea - thanks! Please could you add a:

if (device.id=="BANGLEJS") show_a_prompt("Screenshots aren't supported on Bangle.js 1")?

It might be a bit confusing for older Bangle.js owners otherwise

@halemmerich
Copy link
Contributor Author

Do we want to check for the Bangle v1 in this code or would it maybe be cleaner to do that in BangleApps and just hide the screenshot button for v1? Are there other Espruino devices capable of screenshots using g.dump()?

@gfwilliams
Copy link
Member

I thought showing/hiding the button might just be extra work. Most users now will be Bangle.js 2, the dialog is just to stop the inevitable complaints :)

We only support the 2 bangles, but if there is a bangle 3 it'll probably support screenshots :) I think if EspruinoApps is used with a Pixl.js then you might be able to screenshot that

@gfwilliams
Copy link
Member

Thanks!

@gfwilliams gfwilliams merged commit 2328a68 into espruino:master Jul 25, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants