Can we make daily login rewards system here?

I want to make a daily login rewards system but I don't know how to make it . It's looks like that a countdown started and when user click on button he gets some rewards and then from there new 24 hrs countdown starts and button disable.

1 Like

You will need:

  • a button component
  • a clock component
  • a tinydb
  • some blocks logic
1 Like

You can save the last time the user collected their reward to check if 24 hours have passed since then. Each time the user starts the app (or you can check it whenever inside the app), it checks if 24 hours have passed from that moment to the current one. If 24 hours have already passed, you give him the opportunity to collect the reward, and you record the time.

1 Like

You will need a couple of TinyDB tags for this.

The last Clock1.SystemTime of login

Accumulated points

Note that TinyDB can't store Instants, and milliseconds from 1970 has easier math.


Even easier than milliseconds:

Save the Clock1.FormatDATE OF Clock1.Now, and give a point if it changes.

1 Like

I make one .
Used components -

  • Tiny dp
  • Label to show time
  • Clock
  • Firebase - to store coins
  • Sound - when user collects reward
  • Button

But the error I'm facing is that the coins don't store in tiny dp and the timer is not showing 24 hrs countdown & doesn't starts with 0 . The coins in another page is blank but it shown in main page :disappointed_relieved:

If something more can improve then tell me I will because I don't want to change it .

Here are screenshots of the page

1 Like

you're storing that in the local variable instead of the global one.

What is that supposed to do?

1 Like

Guys , I solve the coins problem but again new problem occurs :clown_face:, my time countdown doesn't starts from 0 and even it already started the time before the user enters the app and when we click on button it disable for 24 hrs but when I reopen the app it showing the button. I want that the timelable should be 0 and when we click on the button it disable for 24 hrs and time should show 24hrs and after that button enables .
Here are some pics

@Ramon that's lable is for showing the time
@ABG Can you do something regarding to this

1 Like

You are assigning to that label its own text ...

Remember that tinyDb is a localDb so I recommend you to save on firebase the date too. If you save coin and user on firebase and date on mobile (tinyDb) if users delete app (or memory) can restore coins and add new rewards for the same day.
If you have already fixed this problem , I apologize and I wish you a nice day

@Raffaele_Gold I already fixed that , thanks for concerning
@Ramon yes , because the label text is 00:00:00 which represents the starting time
Don't you guys get? I said that I'm facing issue that when I close the app and reopen the button was showing and timer was not stop

You need the formatting code for a countdown timer.

The clock block that formats milliseconds is meant for milliseconds from 1970.

Search the Gallery for countdown timer.

Also, did you remember to add a day to the deadline when it comes due?

Also, payout should not affect the next deadline, only the points.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.