Description

On the Rock Mobile app there is a countdown timer, but the problem is when the countdown hits zero we want the page to show different content, not just a message. The mobile app platform itself has the solution. Using a schedule (in our case the schedule for our live services) I was able to both pull the time to countdown to and find if the schedule is active so it doesn't look for the next instance until the current one ends.

Setup

  1. Choose a schedule, and get both the NextStartDateTime and the IsScheduleActive and assign to variables.
  2. I also chose to have a page parameter since the IsScheduleActive doesn't flip over right away so in testing the countdown went to -2 seconds
  3. Add a countdown to a page (Rock Mobile Countdown)
  4. Choose what behavior you want, for ours I just had the app redirect to the current page (Rock Mobile Redirect)
    
    {% schedule id:'331' %}
{% assign isLive = schedule.IsScheduleActive %}
{% assign start = schedule.NextStartDateTime %}
{% endschedule %}

{% assign hasStarted = PageParameter.Started %}
{% if isLive == true or hasStarted == true %}
<Button Text="Online Service" Command="{Binding OpenBrowser}" StyleClass="btn,btn-primary,h3" CommandParameter="https://live.thecompass.net/" x:Name="online"/>
{% else %}
<Label Text="Next Online Service"/>
<Rock:Countdown StartDateTime="{{start}}" Margin="20,0,0,0">
<Rock:Countdown.CompletedMessage>
<Rock:Redirect PageGuid="32038e97-23de-4f99-bb32-d5b8fa7f3105" QueryString="Started=true"/>
           </Rock:Countdown.CompletedMessage> 
      </Rock:Countdown>                


{% endif %}