From 1302a42f450231dcd29ee40481f3d97b8e2749ec Mon Sep 17 00:00:00 2001 From: ElectricS01 <103579308+ElectricS01@users.noreply.github.com> Date: Thu, 19 Oct 2023 13:43:03 +1100 Subject: [PATCH] Show messages in chats --- TPU Mac/TPU_Mac.xcodeproj/project.pbxproj | 10 +-- .../xcshareddata/swiftpm/Package.resolved | 31 +-------- TPU Mac/TPU_Mac/ContentView.swift | 66 +++++++++++++++++-- 3 files changed, 65 insertions(+), 42 deletions(-) diff --git a/TPU Mac/TPU_Mac.xcodeproj/project.pbxproj b/TPU Mac/TPU_Mac.xcodeproj/project.pbxproj index 718f62e..4ed1243 100644 --- a/TPU Mac/TPU_Mac.xcodeproj/project.pbxproj +++ b/TPU Mac/TPU_Mac.xcodeproj/project.pbxproj @@ -14,7 +14,6 @@ C45099272ACFFA8100FA9247 /* TPU_MacTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C45099262ACFFA8100FA9247 /* TPU_MacTests.swift */; }; C45099312ACFFA8100FA9247 /* TPU_MacUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C45099302ACFFA8100FA9247 /* TPU_MacUITests.swift */; }; C45099332ACFFA8100FA9247 /* TPU_MacUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C45099322ACFFA8100FA9247 /* TPU_MacUITestsLaunchTests.swift */; }; - C4569DEA2AD170CF00F17C06 /* ApolloCodegenLib in Frameworks */ = {isa = PBXBuildFile; productRef = C4569DE92AD170CF00F17C06 /* ApolloCodegenLib */; }; C4569DEC2AD1787E00F17C06 /* graphql in Resources */ = {isa = PBXBuildFile; fileRef = C4569DEB2AD1787E00F17C06 /* graphql */; }; C4569DF12AD17A2A00F17C06 /* PrivateUploaderAPI in Frameworks */ = {isa = PBXBuildFile; productRef = C4569DF02AD17A2A00F17C06 /* PrivateUploaderAPI */; }; C4569DF72AD1828300F17C06 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4569DF62AD1828300F17C06 /* Network.swift */; }; @@ -67,7 +66,6 @@ C4569DF12AD17A2A00F17C06 /* PrivateUploaderAPI in Frameworks */, C48C2E9E2AD0417B0000A362 /* Apollo in Frameworks */, C4FE71542AD3F085003E4DC0 /* KeychainSwift in Frameworks */, - C4569DEA2AD170CF00F17C06 /* ApolloCodegenLib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -175,7 +173,6 @@ name = "TPU Mac"; packageProductDependencies = ( C48C2E9D2AD0417B0000A362 /* Apollo */, - C4569DE92AD170CF00F17C06 /* ApolloCodegenLib */, C4569DF02AD17A2A00F17C06 /* PrivateUploaderAPI */, C4FE71532AD3F085003E4DC0 /* KeychainSwift */, ); @@ -674,7 +671,7 @@ repositoryURL = "https://github.com/apollographql/apollo-ios.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 1.5.2; + minimumVersion = 1.6.1; }; }; C4FE71522AD3F084003E4DC0 /* XCRemoteSwiftPackageReference "keychain-swift" */ = { @@ -688,11 +685,6 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - C4569DE92AD170CF00F17C06 /* ApolloCodegenLib */ = { - isa = XCSwiftPackageProductDependency; - package = C48C2E9C2AD0417B0000A362 /* XCRemoteSwiftPackageReference "apollo-ios" */; - productName = ApolloCodegenLib; - }; C4569DF02AD17A2A00F17C06 /* PrivateUploaderAPI */ = { isa = XCSwiftPackageProductDependency; productName = PrivateUploaderAPI; diff --git a/TPU Mac/TPU_Mac.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/TPU Mac/TPU_Mac.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4e3a4eb..1f54643 100644 --- a/TPU Mac/TPU_Mac.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/TPU Mac/TPU_Mac.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,17 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apollographql/apollo-ios.git", "state" : { - "revision" : "42802f5cbcab4705c73d9d83fbc2bcfab022bc17", - "version" : "1.5.2" - } - }, - { - "identity" : "inflectorkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mattt/InflectorKit", - "state" : { - "revision" : "d8cbcc04972690aaa5fc760a2b9ddb3e9f0decd7", - "version" : "1.0.0" + "revision" : "7bbdce4bebb0b3978e69f8a34f26227ab733d96d", + "version" : "1.6.1" } }, { @@ -35,24 +26,6 @@ "revision" : "7a2e3cd27de56f6d396e84f63beefd0267b55ccb", "version" : "0.14.1" } - }, - { - "identity" : "swift-argument-parser", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser", - "state" : { - "revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531", - "version" : "1.2.3" - } - }, - { - "identity" : "swift-collections", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-collections", - "state" : { - "revision" : "a902f1823a7ff3c9ab2fba0f992396b948eda307", - "version" : "1.0.5" - } } ], "version" : 2 diff --git a/TPU Mac/TPU_Mac/ContentView.swift b/TPU Mac/TPU_Mac/ContentView.swift index c15a4c0..5f3d605 100644 --- a/TPU Mac/TPU_Mac/ContentView.swift +++ b/TPU Mac/TPU_Mac/ContentView.swift @@ -235,20 +235,78 @@ struct GalleryView: View { struct CommsView: View { @State private var chatsList: [ChatsQuery.Data.Chat] = [] + @State private var chatMessages: [MessagesQuery.Data.Message] = [] + @State private var chatOpen: Int = 0 + + func openChat (chatId: Int?) { + messages(chat: chatId ?? 0) { result in + switch result { + case .success(let graphQLResult): + if let unwrapped = graphQLResult.data { + chatMessages = unwrapped.messages + chatOpen = chatId ?? 0 + } + case .failure(let error): + print(error) + } + } + } + var body: some View { NavigationSplitView { List { ForEach(0..