Auto stash before merge of "main" and "origin/main"

This commit is contained in:
2026-04-06 20:48:57 -04:00
parent 68a905a292
commit 7af9cd0df8
3 changed files with 25 additions and 23 deletions

View File

@@ -479,15 +479,17 @@ public partial class MainPage : ContentPage
public async Task AnswerCallback(RtcDescription answer) public async Task AnswerCallback(RtcDescription answer)
{ {
string json = JsonSerializer.Serialize(answer); var test = new RtcDescription{type="answer", sdp = "Long\r\n string of data"};
SafeSendRawToWebView("WriteRtcAnswer answered with: " + json); test.sdp = test.sdp.Replace("\r\n", "(rn)");
// SafeSendRawToWebView("TEST: " + test);
answer.sdp = answer.sdp.Replace("\r\n", "(rn)");
string json = JsonSerializer.Serialize(test, HybridJSType.Default.RtcDescription);
SafeSendRawToWebView("JSON: " + json);
try try
{ {
SafeSendRawToWebView("Pre"); await hybridWebView.InvokeJavaScriptAsync("AnswerCallbackJS", [answer], [HybridJSType.Default.RtcDescription]);
// await hybridWebView.InvokeJavaScriptAsync("CSharpCallTest", ["value from C#"], [HybridJSTypeString.Default.String]); SafeSendRawToWebView("After JS");
// SafeSendRawToWebView("Mid");
await hybridWebView.InvokeJavaScriptAsync("AnswerCallback", [json], [HybridJSTypeString.Default.String]);
SafeSendRawToWebView("End");
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -582,16 +584,11 @@ public partial class MainPage : ContentPage
}); });
} }
[JsonSourceGenerationOptions(WriteIndented = true)] [JsonSourceGenerationOptions(WriteIndented = false)]
[JsonSerializable(typeof(string))]
internal partial class HybridJSTypeString : JsonSerializerContext
{
// This type's attributes specify JSON serialization info to preserve type structure
// for trimmed builds.
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(RtcDescription))] [JsonSerializable(typeof(RtcDescription))]
internal partial class HybridJSTypeRtcDescription : JsonSerializerContext [JsonSerializable(typeof(List<RtcSignalMessage>))]
[JsonSerializable(typeof(string))]
internal partial class HybridJSType : JsonSerializerContext
{ {
// This type's attributes specify JSON serialization info to preserve type structure // This type's attributes specify JSON serialization info to preserve type structure
// for trimmed builds. // for trimmed builds.

View File

@@ -85,5 +85,5 @@ textarea::-webkit-scrollbar-thumb {
background: #1F1A24; background: #1F1A24;
border: 1px solid #332940; border: 1px solid #332940;
border-radius: 10px; border-radius: 10px;
padding: 11px; padding: 12px;
} }

View File

@@ -262,17 +262,22 @@ async function channelCallJoin(activeCall)
async function CSharpCallTest(value) async function CSharpCallTest(value)
{ {
LogMessage("Called from C#: " + value); LogMessage("Called from C#: " + value);
// let test = JSON.parse(value);
// LogMessage("JSON : " + JSON.stringify(test));
} }
async function AnswerCallback(answer) async function AnswerCallbackJS(answer)
{ {
LogMessage("Answer: " + answer); answer.sdp = answer.sdp.replaceAll("(rn)", "\r\n");
// answer.sdp += "\n";
LogMessage("Answer: " + JSON.stringify(answer));
let callBack = JSON.parse(answer); // let callBack = JSON.parse(answer);
LogMessage("Call Back: " + callBack); // LogMessage("Call Back: " + callBack);
LogMessage("RemoteDescription: " + peerConnection.currentRemoteDescription);
if (!peerConnection.currentRemoteDescription && callBack) if (!peerConnection.currentRemoteDescription && answer)
{ {
LogMessage("Current answer: " + callBack); LogMessage("Current answer: " + JSON.stringify(answer));
const desc = new RTCSessionDescription(answer); const desc = new RTCSessionDescription(answer);
await peerConnection.setRemoteDescription(desc); await peerConnection.setRemoteDescription(desc);
} }