2021-12-05 00:36:13 +01:00
|
|
|
defmodule Bump.Messages do
|
2021-12-30 13:06:26 +01:00
|
|
|
alias Bump.Database
|
|
|
|
alias Bump.Firebase
|
2021-12-05 00:36:13 +01:00
|
|
|
|
2021-12-10 15:34:38 +01:00
|
|
|
def pop(sender) do
|
2021-12-30 16:11:53 +01:00
|
|
|
Database.pop(sender)
|
2021-12-10 15:34:38 +01:00
|
|
|
end
|
|
|
|
|
2021-12-17 16:23:48 +01:00
|
|
|
def peek(sender) do
|
2021-12-30 13:06:26 +01:00
|
|
|
Database.peek(sender)
|
2021-12-05 00:36:13 +01:00
|
|
|
end
|
|
|
|
|
2021-12-10 15:34:38 +01:00
|
|
|
def list(sender, minutes) do
|
2021-12-30 13:06:26 +01:00
|
|
|
Database.list(sender, minutes)
|
2021-12-05 00:36:13 +01:00
|
|
|
end
|
|
|
|
|
2021-12-10 15:34:38 +01:00
|
|
|
def clear(sender) do
|
2021-12-30 13:06:26 +01:00
|
|
|
Database.clear(sender)
|
2021-12-05 00:36:13 +01:00
|
|
|
end
|
|
|
|
|
2021-12-10 15:34:38 +01:00
|
|
|
def push(sender, message) do
|
2021-12-30 13:06:26 +01:00
|
|
|
Database.push(sender, message)
|
2021-12-30 16:23:54 +01:00
|
|
|
tokens = Database.tokens(sender)
|
|
|
|
|
|
|
|
for token <- tokens do
|
|
|
|
Firebase.push(token, message)
|
|
|
|
end
|
2021-12-05 00:36:13 +01:00
|
|
|
end
|
|
|
|
|
2021-12-10 12:46:34 +01:00
|
|
|
|
2021-12-05 00:36:13 +01:00
|
|
|
end
|