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

[apps/widbt_notify] fix screen redraw #1817

Closed
wants to merge 7 commits into from

Conversation

idavydov
Copy link
Contributor

Hi,

I noticed that @KungPhoo opened a PR KungPhoo#3, but I think in a wrong repo.

I cherry-picked his commits on top of the master branch.

This should fix #1810

@idavydov idavydov marked this pull request as draft May 11, 2022 19:55
@idavydov
Copy link
Contributor Author

Hi @KungPhoo , I noticed that the new showAlert behavior doesn't play well with the setTimeout.

I think I managed to solve this problem, but I would like you to first take a look at the code if you approve.

@gfwilliams
Copy link
Member

Looks ok to me - clocks/etc may still draw over it during those 3 seconds though. You could add a plain clearInterval() before the showAlert to stop that happening.

Also I see there's a setTimeout('WIDGETS.bluetooth_notify.warningEnabled = 1;', 30000); but that will never happen because you reload after 3 sec.

One other thing - because you force a reload, it's going to be frustating if you were using another app. Say you're using the calculator and typing a sum in, the alert goes off and 3 seconds later it reloads back to the clock. Probably not ideal. You could check if Bangle.CLOCK!=0 and if so don't show an alert?

@idavydov
Copy link
Contributor Author

Thanks, @gfwilliams ! Makes sense. Not sure I'll update it quickly, since I'm using a different widget now.

But I would like to understand the problem regarding warningEnabled.
The only option here is something like saving the last popup event in storage?

E.g.,

const DATAFILE = "myapp.json";
var appData = Object.assign({
  lastNotify: 0,
}, require('Storage').readJSON(DATAFILE,true)||{});
const time = getTime();
if(time-appData.lastNotify>30) {
  // show notification
  ...
  appData.lastNotify = time;
  require('Storage').writeJSON(DATAFILE,appData); 
}

@gfwilliams
Copy link
Member

The only option here is something like saving the last popup event in storage?

Yes - right now you can't persist anything in RAM when you swap between apps. It's just that the relatively limited RAM available and variable quality of apps means allowing apps to store stuff in RAM all the time could very easily make Bangle.js unstable for everyone

@gfwilliams
Copy link
Member

Closing this for now as no updates (and i'm not sure forcing an app reload is going to be a good improvement for the reasons above).

Espruino 2v15 now includes the ability to draw 'overlays' so I think that would end up being the best solution (although maybe we should have a library to reduce code duplication)

@gfwilliams gfwilliams closed this Sep 7, 2022
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.

[app/widbt_notify] screen not properly cleared after a pop-up
3 participants