dsernst / GoenkaNative

1 stars 3 forks source link

"Pause" or "Extend time" button ? #16

Open dsernst opened 1 year ago

dsernst commented 1 year ago

On Sun, Feb 5, 2023 at 2:01 AM Suzanne <g...@ g... .c...> wrote:

Dear,

First, my thanks for your great app. After completing my second ten day course I really wanted to continue daily meditation and I love to start and end with the Goenka chants. Since I, sadly, don't always have a complete hour to sit, it is amazing to have this app that gives me everything for a good sitting of any amount of time.

I do have a question. In case you would ever update the app... Would it be possible to build in a "pause" or "extend time" button? Sometimes I set the timer and the final chant begint when Im in the middle of a body scan. It would be great if I could pause or extend the time to the final chant with some minutes so I can complete the scan, or just to stay longer when I'm really into it. If this would be possible it would be great. If not, then I'll still be really enjoy the use of your app as it is. ๐Ÿ˜‰

Best wishes and be happy,

Suzanne

dsernst commented 1 year ago

On Sun, Feb 5, 2023 at 6:18 PM David Ernst <d...@ g... .a...> wrote:

Hi Suzanneโ€”

Nice to hear from you and glad you are liking GoenkaTimer. I was in the same place, frustrated after 8 years of multiple courses, still not able to keep up sitting everyday, and wanted a lower-barrier-to-entry way to stick to a regular schedule.

Re a "pause" or "extend time button": thank you for the suggestion, it is very interesting to consider. The first thing I'd say is I wonder if it's not already sort of possible to achieve this, by pressing the "Stop" button, adjusting the time to the desired 3, 5, 10, 30 or whatever more minutes, and pressing Start again. I know that might be less than ideal, because it's 3 actions instead of just a single "Extend" button. But my partner and I will often start a short sit and then add more time if we're then more in the flow.

The app itself is open-source, and you are more than welcome to modify it yourself or with the help of others. I've created an open thread about this suggestion that you can see here, https://github.com/dsernst/GoenkaNative/issues/16. This is meant to track it so it doesn't get forgotten, and for other people to be able to consider and possibly contribute as well. If the Stop-Set-Start method isn't enough and you do want to pursue another solution, a good next step would be to create a visual mockup of exactly how you imagine this to look. For example, one question I have is: would it be a single button "Extend", that then opens a menu to select an amount of time? Or multiple pre-set buttons, like 1 minute, 5 minutes, 15? How easy are those to fit nicely on the meditation screen, without looking too cluttered?

Hope this is helpful

Lots of mettaโ€” David

suusgroot commented 1 year ago

Dear David,

Thanks for your fast and open response. Very appreciated.

You are right about the possibility of starting a new session to add time. The reasons that this doesn't always work for me is that either I just need a few more minutes to complete the scan or because I am using the option of adding the chanting, which means that with each new session I again have to pass the first chant just so I can end with the final chant. And, like you said, a more simple and easy way would be less distracting. ;)

I've thought about how I would do it. I think most useful (and I expect most easy) way, would be to add two buttons to the timer screen. One +2 (minutes) button and one +5 (minutes) button. Clicking one of those buttons would add the corresponding amount of minutes to the timer. If you can click the button multiple times it will be easy to get to the time desired without going through separate actions (a repetitive action needs less time and focus). So you could use the +2 for adding small amounts of time (2, 4, 6, 8 min, etc) and if you like to add a greater amount of time (like 20 or 30 minutes) you can use the +5. I guess the action of each button should be to add minutes to the timer and to stop the chant in case it has started so it can start again when the timer again reaches 8 minutes. Possibly it could be useful (but not essential) to add a small/delicate sound to clicking the button (like a small click). Since many people will be meditating in dark or dimm rooms or trying to keep their eyes closed as much as possible, it could be good that you can hear how many minutes you added by counting the clicks. But without sound it would also be perfectly functional.

I made two examples of what that could look like (personally I prefer option 2).

Since I am not at all into programming, I have no clue about how easy or complicated it is to make these adjustments, but if it is not too complicated I think it would be a great addition to the already very pleasant app.

Lots of metta too,

Suzanne

dsernst commented 1 year ago

Oo, I do like this design a lot. Much simpler than I had in mind. The 2nd mockup with the Stop button in the middle looks a lot nicer to my eyes.

dsernst commented 1 year ago

Those are great mockups btw, thank you!

dsernst commented 1 year ago

Re programming such a feature, there are a few aspects to it.

I know you said you don't have much experience programming. The following are partially notes for myself, partially for you as reference in case you find it interesting, also for anyone else that might see this, as helpful starter points.

Required Steps

  1. Adding the buttons to the screen, and positioned in the correct spot.

  2. The logic of what specifically happens when either of the buttons are pressed. As a reference point, this file shows all the logic that happens when the Stop button is pressed: https://github.com/dsernst/GoenkaNative/blob/master/src/CountdownScreen/press-stop.ts

    • As you say:

      I guess the action of each button should be to add minutes to the timer and to stop the chant in case it has started so it can start again when the timer again reaches 8 minutes. Possibly it could be useful (but not essential) to add a small/delicate sound to clicking the button (like a small click).

      1. Stopping the current chanting is as simple as copying these few lines: https://github.com/dsernst/GoenkaNative/blob/7d288625363ab0ce7f8d7ad06e5b9b4f8f281e20/src/CountdownScreen/press-stop.ts#L15-L19
      2. Setting up the new timeline for the audio to come back on is maybe the trickiest part. It's a bit complicated under the hood, because each aspect โ€” (a) the opening "every moment aware, every moment equanimous", (b) opening chanting if enabled, (c) closing chanting if enabled, (d) extended metta if enabled, and (e) bhavatu sabba mangalam โ€” are their own mini individual tracks, each scheduled at the start to wait a certain number of seconds and then come on at a specific time, to get the pauses between them right.
        • Here's the current logic for it all, it's a bit of a doozy: https://github.com/dsernst/GoenkaNative/blob/7d288625363ab0ce7f8d7ad06e5b9b4f8f281e20/src/MainScreen/press-play.ts#L89-L147
        • In this case, I think a lot of that could be simplified, if we assume only the closing audios are needed. Also probably wouldn't need the logic that substitutes in "Good, Good, Be Happy" for short sits under 5 minutes.
        • Still, it would need to figure out (a) what is the new total sit length, (b) given our current position, how far are we away from when the final bhavatu sabba mangalam should come on, (c) if extended metta is enabled, subtract back from when the bhavatu sabba mangalam starts so the extended metta starts at the right time, (d) if chanting is enabled, subtract back from the start of extended metta if it's enabled or bhavatu otherwise, so that the closing chanting will finish a few seconds before the next one starts.
      3. Audio click noise when button pressed. One open action item there is to find a good clicking sound.
  3. Making sure the visual of the countdown circle itself updates to the new time properly.

  4. Updating the history entry to reflect the new meditation length.

  5. If we were to ship this in the main app โ€” as opposed to only in a private fork you manually loaded onto your own device โ€” I think I would also want to make this advanced feature opt-in behind a Setting. Here's the current Settings page: https://github.com/dsernst/GoenkaNative/blob/7d288625363ab0ce7f8d7ad06e5b9b4f8f281e20/src/SettingsScreen/SettingsScreen.tsx. So there's a bit of a question there about how that would look. A full section for itself, with its own icon? If so, would need to pick a title, description, and icon. There's also a bunch of ideas for other advanced features,


Whew, that was a lot. ๐Ÿ˜… But I think it covers just about all of it.