Setting stage for channel types and groups
This commit is contained in:
@@ -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))]
|
||||
|
||||
@@ -157,6 +157,9 @@ async function refreshDevicesAndPreview() {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Only join call if no active call in progress for client
|
||||
//TODO: Enable proper leave call functions
|
||||
//TODO: Leave call and join new call if client clicks a 2nd voice channel
|
||||
async function joinChannelCall() {
|
||||
LogMessage("Current username: " + currentUsername);
|
||||
LogMessage("Current channel: " + currentChannelId);
|
||||
|
||||
Reference in New Issue
Block a user