diff --git a/Prisma.xcodeproj/project.pbxproj b/Prisma.xcodeproj/project.pbxproj index ecd12cc..5e04549 100644 --- a/Prisma.xcodeproj/project.pbxproj +++ b/Prisma.xcodeproj/project.pbxproj @@ -70,6 +70,7 @@ A9D83F962B083794000D0C78 /* SpeziFirebaseAccountStorage in Frameworks */ = {isa = PBXBuildFile; productRef = A9D83F952B083794000D0C78 /* SpeziFirebaseAccountStorage */; }; A9DFE8A92ABE551400428242 /* AccountButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9DFE8A82ABE551400428242 /* AccountButton.swift */; }; A9FE7AD02AA39BAB0077B045 /* AccountSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9FE7ACF2AA39BAB0077B045 /* AccountSheet.swift */; }; + E4C766262B72D50500C1DEDA /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4C766252B72D50500C1DEDA /* WebView.swift */; }; AC69903E2B6C5A2F00D92970 /* PrivacyControls.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC69903D2B6C5A2F00D92970 /* PrivacyControls.swift */; }; AC6990402B6C627100D92970 /* ToggleTestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC69903F2B6C627100D92970 /* ToggleTestView.swift */; }; F8AF6F9A2B5F2B1A0011C32D /* AppIcon-NoBG.png in Resources */ = {isa = PBXBuildFile; fileRef = F8AF6F992B5F2B1A0011C32D /* AppIcon-NoBG.png */; }; @@ -148,6 +149,7 @@ A9720E422ABB68CC00872D23 /* AccountSetupHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSetupHeader.swift; sourceTree = ""; }; A9DFE8A82ABE551400428242 /* AccountButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountButton.swift; sourceTree = ""; }; A9FE7ACF2AA39BAB0077B045 /* AccountSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSheet.swift; sourceTree = ""; }; + E4C766252B72D50500C1DEDA /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = ""; }; AC69903D2B6C5A2F00D92970 /* PrivacyControls.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyControls.swift; sourceTree = ""; }; AC69903F2B6C627100D92970 /* ToggleTestView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleTestView.swift; sourceTree = ""; }; F8AF6F992B5F2B1A0011C32D /* AppIcon-NoBG.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AppIcon-NoBG.png"; sourceTree = ""; }; @@ -404,6 +406,7 @@ isa = PBXGroup; children = ( F8AF6F9E2B5F35400011C32D /* ChatView.swift */, + E4C766252B72D50500C1DEDA /* WebView.swift */, ); path = Chat; sourceTree = ""; @@ -642,6 +645,7 @@ 2F4FC8D729EE69D300BFFE26 /* MockUpload.swift in Sources */, 2FE5DC3A29EDD7CA004B9AB4 /* Welcome.swift in Sources */, 2FE5DC3829EDD7CA004B9AB4 /* Features.swift in Sources */, + E4C766262B72D50500C1DEDA /* WebView.swift in Sources */, 2FE5DC4529EDD7F2004B9AB4 /* Binding+Negate.swift in Sources */, 2FC975A82978F11A00BA99FE /* Home.swift in Sources */, 2FE5DC4E29EDD7FA004B9AB4 /* ScheduleView.swift in Sources */, diff --git a/Prisma/Chat/ChatView.swift b/Prisma/Chat/ChatView.swift index 2ddb39f..34e0165 100644 --- a/Prisma/Chat/ChatView.swift +++ b/Prisma/Chat/ChatView.swift @@ -8,25 +8,29 @@ import Foundation import SwiftUI +import WebKit struct ChatView: View { @Binding var presentingAccount: Bool - var body: some View { NavigationStack { - Text("Coming soon!") - .navigationTitle("Chat") - .toolbar { - if AccountButton.shouldDisplay { - AccountButton(isPresented: $presentingAccount) - } + GeometryReader { geometry in + if let url = URL(string: "http://localhost:3000") { + WebView(url: url) + .navigationTitle("Chat") + .frame( + width: geometry.size.width, + height: geometry.size.height + ) + } else { + Text("Invalid URL") } + } } } - - + init(presentingAccount: Binding) { self._presentingAccount = presentingAccount } diff --git a/Prisma/Chat/WebView.swift b/Prisma/Chat/WebView.swift new file mode 100644 index 0000000..c185599 --- /dev/null +++ b/Prisma/Chat/WebView.swift @@ -0,0 +1,25 @@ +// +// This source file is part of the Stanford Prisma Application based on the Stanford Spezi Template Application project +// +// SPDX-FileCopyrightText: 2023 Stanford University +// +// SPDX-License-Identifier: MIT +// + +import SwiftUI +import WebKit + +struct WebView: UIViewRepresentable { + var url: URL + + func makeUIView(context: Context) -> WKWebView { + let webView = WKWebView() + webView.scrollView.isScrollEnabled = true + return webView + } + + func updateUIView(_ uiView: WKWebView, context: Context) { + let request = URLRequest(url: url) + uiView.load(request) + } +} diff --git a/Prisma/Resources/Localizable.xcstrings b/Prisma/Resources/Localizable.xcstrings index 45709c0..1225f36 100644 --- a/Prisma/Resources/Localizable.xcstrings +++ b/Prisma/Resources/Localizable.xcstrings @@ -75,6 +75,9 @@ } } } + }, + "chat" : { + }, "Chat" : { @@ -89,9 +92,6 @@ } } } - }, - "Coming soon!" : { - }, "Completed at %@" : { @@ -314,6 +314,7 @@ } } }, + "Invalid URL" : {}, "Include Active Energy Burned" : { },