Setting stage for channel types and groups

This commit is contained in:
2026-04-22 21:35:21 -04:00
parent 3b75c2b785
commit 0c9ff3b5d9
5 changed files with 36 additions and 6 deletions

View File

@@ -335,9 +335,11 @@ public partial class MainPage : ContentPage
foreach (var channel in _channels.OrderBy(c => c.CreatedAt))
{
var button = new Button
var button = new ChannelButton
{
Text = $"#{channel.Name}"
Text = $"#{channel.Name}",
Type = channel.Type,
Group = channel.Group
};
button.Clicked += (_, _) =>
@@ -348,6 +350,11 @@ public partial class MainPage : ContentPage
MainThread.BeginInvokeOnMainThread(async () =>
{
await PushRtcContextToJsAsync();
if (channel.Type == ChannelType.Voice)
{
SwapView();
// JoinRtcChannel(); //TODO: Join voice calls when clicking channel rather than a separate button
}
});
ChannelLabel.Text = $"#{_currentChannelName}";
@@ -409,7 +416,7 @@ public partial class MainPage : ContentPage
await MessagesScrollView.ScrollToAsync(MessagesLayout, ScrollToPosition.End, true);
}
private void SwapView_OnClicked(object? sender, EventArgs e)
private void SwapView()
{
if (RtcView.IsVisible)
{
@@ -425,6 +432,10 @@ public partial class MainPage : ContentPage
ViewSwapped.Text = "Swap to Message View";
}
}
private void SwapView_OnClicked(object? sender, EventArgs e)
{
SwapView();
}
#region RTC Functions
public async Task<bool> JoinRtcChannel()
@@ -648,6 +659,12 @@ public partial class MainPage : ContentPage
}
});
}
public class ChannelButton : Button
{
public ChannelType Type { get; set; }
public string Group { get; set; }
}
[JsonSourceGenerationOptions(WriteIndented = false)]
[JsonSerializable(typeof(RtcDescription))]