From 66f390136a7a11027f733a3673a11db68d930bcb Mon Sep 17 00:00:00 2001
From: kruplm <73655443+kruplm@users.noreply.github.com>
Date: Mon, 3 Jul 2023 12:59:57 +0200
Subject: [PATCH] Add FDC3 IIFE Bundle Directly from dist
---
src/shell/dotnet/Shell/App.xaml.cs | 18 ++-----------
src/shell/dotnet/Shell/Shell.csproj | 12 +++------
.../dotnet/Shell/Utilities/ResourceReader.cs | 25 +++++++++++++++++++
src/shell/dotnet/copy-fdc3-iife-bundle.ps1 | 10 --------
4 files changed, 30 insertions(+), 35 deletions(-)
create mode 100644 src/shell/dotnet/Shell/Utilities/ResourceReader.cs
delete mode 100644 src/shell/dotnet/copy-fdc3-iife-bundle.ps1
diff --git a/src/shell/dotnet/Shell/App.xaml.cs b/src/shell/dotnet/Shell/App.xaml.cs
index 956df6702..e7e55038f 100644
--- a/src/shell/dotnet/Shell/App.xaml.cs
+++ b/src/shell/dotnet/Shell/App.xaml.cs
@@ -13,8 +13,6 @@
// */
using System;
-using System.IO;
-using System.Reflection;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
@@ -181,21 +179,9 @@ private void InjectMessageRouterConfig()
private void InjectFdc3()
{
- string bundle = @"fdc3-iife-bundle.js";
- string iife = ReadPreloadResource(bundle);
+ string bundle = @"Shell.fdc3-iife-bundle.js";
+ string iife = ResourceReader.ReadResource(bundle);
WebWindow.AddPreloadScript(iife);
}
-
- public string ReadPreloadResource(string name)
- {
- var assembly = Assembly.GetExecutingAssembly();
- string resourcePath = $$"""Shell.Preload.{{name}}""";
-
- using (var stream = assembly.GetManifestResourceStream(resourcePath))
- using (var reader = new StreamReader(stream))
- {
- return reader.ReadToEnd();
- }
- }
}
diff --git a/src/shell/dotnet/Shell/Shell.csproj b/src/shell/dotnet/Shell/Shell.csproj
index 80970b8a3..91655cb5e 100644
--- a/src/shell/dotnet/Shell/Shell.csproj
+++ b/src/shell/dotnet/Shell/Shell.csproj
@@ -14,11 +14,10 @@
-
+
-
- PreserveNewest
-
+
+
@@ -44,7 +43,6 @@
-
@@ -53,8 +51,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/shell/dotnet/Shell/Utilities/ResourceReader.cs b/src/shell/dotnet/Shell/Utilities/ResourceReader.cs
new file mode 100644
index 000000000..51712a705
--- /dev/null
+++ b/src/shell/dotnet/Shell/Utilities/ResourceReader.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shell.Utilities
+{
+ public static class ResourceReader
+ {
+ public static string ReadResource(string name)
+ {
+ var assembly = Assembly.GetExecutingAssembly();
+ string resourcePath = name;
+
+ using (var stream = assembly.GetManifestResourceStream(resourcePath))
+ using (var reader = new StreamReader(stream))
+ {
+ return reader.ReadToEnd();
+ }
+ }
+ }
+}
diff --git a/src/shell/dotnet/copy-fdc3-iife-bundle.ps1 b/src/shell/dotnet/copy-fdc3-iife-bundle.ps1
deleted file mode 100644
index 138dc0ec8..000000000
--- a/src/shell/dotnet/copy-fdc3-iife-bundle.ps1
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copying the IIFE bundle of FDC3 to the shell' Preload folder
-# so that it can be preloaded for the Embedded Browser
-
-
-$bundle = "./src/shell/js/composeui-fdc3/dist/fdc3-iife-bundle.js"
-$destPath = Resolve-Path -Path "./src/shell/dotnet/Shell"
-
-$preloadFolder = New-Item -Path $destPath -Name "Preload" -ItemType "directory" -Force
-
-Copy-Item $bundle -Destination $preloadFolder