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

Grandfather Clock Widget #3724

Merged
merged 21 commits into from
Feb 12, 2025
Merged

Grandfather Clock Widget #3724

merged 21 commits into from
Feb 12, 2025

Conversation

yogsoy
Copy link
Contributor

@yogsoy yogsoy commented Jan 30, 2025

( Available at: https://yogsoy.github.io/BangleApps/?id=grandfather-clock )

A widget that uses vibrations to count fractions of the hour and the hour of the day, much like an old grandfather clock.

I did try to work on this as a set of options for Chimer, but found that it was easier and more efficient to make a separate widget. Keeps both apps lighter for people that need them - there's quite a bit of logic that went into the counting function.

Goals:

  • Recreate(?) the Taptic Time accessibility feature from devices such as the Apple Watch, reminiscent of the chimes of old clocks.

Current considerations:

  • Is the name descriptive enough? Happy to hear any other options.
  • App setting configuration isn't there yet. It's in the todo for v0.02 (arbitrary). I've fiddled a lot and I think the default configuration will be familiar for most people that would be interested.
  • I'd like a proper icon for both the app loader and on-screen widget. The one included in this PR is just an icon from material.io. (I am not very good at images)
  • On-screen icon is to be made optional, I just found it useful to double-check the widget was running and to remind me why my wrist was vibrating. I'd like to make a tap on the widget buzz out the whole time.

@thyttan
Copy link
Collaborator

thyttan commented Feb 8, 2025

  • Is the name descriptive enough? Happy to hear any other options

Works for me! I'd prefer though if the app id was just "grandfatherclock" since most app ids only use letters.

  • I'd like a proper icon for both the app loader and on-screen widget. The one included in this PR is just an icon from material.io. (I am not very good at images)

Gordon pays icons8.com for a license to use the icons they provide - maybe you can find one you like there? https://www.espruino.com/Bangle.js+First+App#icon-timer-img

  • On-screen icon is to be made optional, I just found it useful to double-check the widget was running and to remind me why my wrist was vibrating. I'd like to make a tap on the widget buzz out the whole time.

👍

@yogsoy
Copy link
Contributor Author

yogsoy commented Feb 9, 2025

I'm happy with how this works now.

  • App settings menu is done
  • Found a new icon that I'm happy with
  • Renamed the app

I'd like someone to take a look at the WIDGETS entry in the widget.js file, I'm not sure if my implementation of the show/hide is safe (no errors, but I haven't looked into how those values are handled).

@thyttan
Copy link
Collaborator

thyttan commented Feb 10, 2025

So what you do is set the widget draw method to undefined if it shouldn't draw.

I guess if you tested it and it works we're good - what do you think @bobrippling ?

What many other widgets seem to do is change the width to zero and then redraw. But that is maybe only needed if it's not statically either shown or not.

@bobrippling
Copy link
Collaborator

Yeah looks good to me - I think perhaps we change to a zero width + check in the widget draw method to match the others, so if some future code assumes draw is there, the future code won't bail at that point, wdyt?

@yogsoy
Copy link
Contributor Author

yogsoy commented Feb 12, 2025

That makes sense to me. I'll drop that change in now.

@thyttan
Copy link
Collaborator

thyttan commented Feb 12, 2025

Or just change : undefined to : ()=>{}. That way draw will always be a function as well.

sets width to 0 and checks inside the draw function rather than
leaving them undefined
@thyttan
Copy link
Collaborator

thyttan commented Feb 12, 2025

Just say when you tested it again and I will merge 🙏☺️

@yogsoy
Copy link
Contributor Author

yogsoy commented Feb 12, 2025

Updated the app and it all works now. Turns out I was wrong and there were errors when leaving the draw function undefined. I assume the code that handles it always tries to run a draw() if there's an entry in WIDGETS - makes sense.

@thyttan thyttan merged commit b18e1e6 into espruino:master Feb 12, 2025
1 check passed
@thyttan
Copy link
Collaborator

thyttan commented Feb 12, 2025

Thank you 🎆

@yogsoy yogsoy deleted the grandfather-clock branch February 12, 2025 09:06
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