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);
|
||||
|
||||
@@ -34,8 +34,6 @@ var wssv = new WebSocketServer("ws://localhost:1337");
|
||||
wssv.AddWebSocketService<ChatSocketBehavior>("/");
|
||||
RtcNotificationService.Server = wssv;
|
||||
|
||||
//TODO: Use AnswerCallback as a test on client and use the /rtc/answer endpoint call as a test on server
|
||||
|
||||
wssv.Start();
|
||||
Console.WriteLine("WebSocket server started");
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ public class ChatSocketBehavior : WebSocketBehavior
|
||||
Console.WriteLine("Db is not initialized.");
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO: Update to include ChannelType and Group String on channels
|
||||
var channels = GetChannelsSync()
|
||||
.OrderBy(c => c.CreatedAt)
|
||||
.Select(c => new ChannelItem()
|
||||
|
||||
@@ -26,6 +26,14 @@ public enum SignalType
|
||||
ClientEncryptedChat
|
||||
}
|
||||
|
||||
public enum ChannelType
|
||||
{
|
||||
Text, //Default channel type, handles text, links, files*, all in a linear live chat format
|
||||
Voice, //Used for general voice and video calls, utilizes WebRTC in its intended use
|
||||
File, //File browser for connected text channels, used for browsing files rather than scrolling through text channel
|
||||
Forum, //Specific forum posts, meant to keep conversations grouped and on topic while keeping all in an easy to find place
|
||||
Stage //Used for announcements and presentations, voice/video call utilizing a modified WebRTC protocol through server
|
||||
}
|
||||
public sealed class RtcSignalMessage
|
||||
{
|
||||
[JsonPropertyName("type")]
|
||||
@@ -97,6 +105,10 @@ public sealed class ChannelItem
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public ChannelType Type { get; set; }
|
||||
|
||||
public string Group { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user