1
0
mirror of https://github.com/algora-io/tv.git synced 2024-11-26 01:00:20 +02:00

delete unused event handlers

This commit is contained in:
zafer 2024-03-06 23:41:08 +03:00
parent 6a6e9f139b
commit e68efe6a98

View File

@ -2,7 +2,7 @@ defmodule AlgoraWeb.HomeLive do
use AlgoraWeb, :live_view
require Logger
alias Algora.{Library, Storage}
alias Algora.Library
def render(assigns) do
~H"""
@ -24,51 +24,6 @@ defmodule AlgoraWeb.HomeLive do
{:noreply, socket |> apply_action(socket.assigns.live_action, params)}
end
def handle_info(
{Storage, %Library.Events.ThumbnailsGenerated{video: video}},
socket
) do
{:noreply,
if video.user_id == socket.assigns.channel.user_id do
socket
|> stream_insert(:videos, video, at: 0)
else
socket
end}
end
def handle_info(
{Library, %Library.Events.LivestreamStarted{video: video}},
socket
) do
%{channel: channel} = socket.assigns
{:noreply,
if video.user_id == channel.user_id do
socket
|> assign(channel: %{channel | is_live: true})
|> stream_insert(:videos, video, at: 0)
else
socket
end}
end
def handle_info(
{Library, %Library.Events.LivestreamEnded{video: video}},
socket
) do
%{channel: channel} = socket.assigns
{:noreply,
if video.user_id == channel.user_id do
socket
|> assign(channel: %{channel | is_live: false})
|> stream_insert(:videos, video)
else
socket
end}
end
def handle_info({Library, _}, socket), do: {:noreply, socket}
defp apply_action(socket, :show, _params) do