c-o-l-i-n / joshies

πŸš€ (Work in Progress) Supercharge dynamic, multi-day competitions with realtime brackets, betting, analytics, and more
1 stars 0 forks source link

Add push notifications for bet requests and bet status changes #37

Open c-o-l-i-n opened 2 days ago

c-o-l-i-n commented 2 days ago

This would require a Supabase Edge Function.

  1. Bet request

    • There is a database trigger for when a bet is created
    • On creation, a push notification is sent to the opponent
    • If possible, tapping on the notification routes to the betting dashboard
    • If possible, there are options to accept or reject the bet after "long pressing" the notification
    • The notification looks like this:
    • πŸ‘€ [Requester] bets you [X] points that [description].
    • πŸ‘€ [Requester] bets you [description]. [Requester] wagers [X] points, you wager [Y] points.
  2. Bet canceled by GM

    • There is a database trigger for when a bet changes
    • If the status changes, and the new status is canceled_by_gm, then the requester AND opponent receive a notification
    • The notification looks like this:
    • 😡 The GM canceled your bet against [other player]
  3. Bet rejected

    • Using the same database trigger for when a bet changes
    • If the status changed, and the new status is rejected, then the requester receives a notification
    • The notification looks like this:
    • πŸ˜” [Opponent] rejected your bet
  4. Bet accepted

    • Using the same database trigger for when a bet changes
    • If the status changed, and the new status is active, then the requester receives a notification
    • The notification looks like this:
    • 😎 [Opponent] accepted your bet
  5. Bet settled

    • Using the same database trigger for when a bet changes
    • If the status changed, and the new status is requester_won, opponent_won, or push, then requester AND the opponent receive a notification
    • The notification looks like this:
    • πŸ₯³βœ… You won [X] points from your bet against [other player]
    • πŸ₯²βŒ You lost [X] points from your bet against [other player]