Pop-up Message in Adalo

Hi everyone :slight_smile:

I’m looking for the cleanest Adalo pattern to show in-app AM / PM messages only once per time window.

Goal

  • Messages are already stored in the database (not push notifications)

  • They should appear only when the user opens the app

  • First open in the AM window → show AM message

  • First open in the PM window → show PM message

  • Subsequent opens in the same window should not show the message again

Constraints

  • No schedulers or background jobs

  • Using On Screen Load

  • Time windows are simple ranges (e.g. AM = 7–11, PM = 6–9)

  • I’ve added boolean fields like morning_shown / evening_shown to persist state

Appreciate any guidance or suggestions :folded_hands:

Hi @bttrszn,

May I ask that, what would be the goal here? To show an offer or a quote, or something else? Would you need to show at the start after opening the app or just only after arriving into the home screen?

I would think you could use @njimmy10’s component (image attached) with boolean fields as an easier approach! : https://youtu.be/_rYWSQyxx88

Instead of the component, I think you could use date properties to build a visibility condition to first check if the current time is between and next to check if the boolean is false. @Victor, since you’re an legendary expert with dates, maybe you could share some information here?

Thank you and have a great day!

1 Like

Ok, so what I could suggest, with some explanations. I don’t have an opportunity to test this so it is theoretical.

  1. The time is stored in Adalo as a number of days since 1/1/1970. The fractional part represents number of hours.
  2. The current time is taken from the user device. The timezone is taken into the account when displaying time (as well as locale of the user device).
  3. When storing time in DateTime property, it will be stored as described in #1, related to GMT+0. But it will be displayed according to the user’s device timezone.
  4. So we could add 2 datetime properties to some collection, e.g. Users collection, name them: currenttime and starttoday. With the action Update Logged-in User, we can store current time and start of today respectively.
  5. We can also add a 3rd number property, call it, say, nbhours. With the second action we can Update Logged-in User → nbhours, set it to Logged-in User → currenttime - Logged-in User → starttoday. Pay attention to “-” - this is minus sign.
  6. What I expect as a result, is having a number between 0 and 1, which represent the %% of hours which already passed in this day. E.g. 0.5 means noon, 0.25 means 6am, etc.
  7. In order to check if this works, you can add a label and display this property.

As we now have time, checking whether it’s AM or PM is trivial (could extend that to morning afternoon evening etc.). For AM/PM I would do these manipulations on some “loading” screen, and then have 2 labels with visibility conditions using comparison with number. If a message needs to displayed only once, the boolean property can be updated at the exit action of the screen (also conditional), and each label should be wrapped into a group which, in turn, also displayed conditionally using morning_shown / evenining_shown.

Again, I can’t test it right now but I hope this gives some inspirational ideas.

Best,
Victor

2 Likes

Hey @bttrszn,

Thanks for the details.

Victor’s approach with the time calculation is accurate and native (using Logged In User updates + nbhours = currenttime - starttoday gives % of day passed as 0-1).

In order to implement this approach practically as a popup that shows once per day AM/PM:

  • On (Loading) or (Home) screen load:

    • Update Logged In User: (currenttime = Now), (starttoday = Start Of Today), nbhours = (currenttime - starttoday).
  • Add the following (True/False) properties on Users collection: morning_shown, afternoon_shown (or one “popup_shown_today”) depending on how you’d like the popup to act.

  • Add the following visibility conditions to the Popup:

    • If nbhours < 0.5 (AM) AND morning_shown = false => show pop-up.

    • If nbhours ≥ 0.5 (PM) AND afternoon_shown = false => show pop-up.

  • On pop-up “Close” action: Update Logged In User => morning_shown = true (or afternoon_shown = true).

This way, the pop-up shows only once per time block per day.

Test it and let me know how it goes.

1 Like

Hi @Victor and @Ali-Bazzi ,

Thank you so much for the recommendations and advice! It totally worked :)))

Hope you guys have a great day!!!

2 Likes

Perfect, you’re very welcome! I’m glad it’s working.

Have a great day as well!