diff --git a/PrivateUploaderAPI/Sources/Fragments/StandardEmbed.graphql.swift b/PrivateUploaderAPI/Sources/Fragments/StandardEmbed.graphql.swift index 9ae1606..79553c7 100644 --- a/PrivateUploaderAPI/Sources/Fragments/StandardEmbed.graphql.swift +++ b/PrivateUploaderAPI/Sources/Fragments/StandardEmbed.graphql.swift @@ -5,7 +5,7 @@ public struct StandardEmbed: PrivateUploaderAPI.SelectionSet, Fragment { public static var fragmentDefinition: StaticString { - #"fragment StandardEmbed on EmbedDataV2 { __typename media { __typename url proxyUrl attachment width height isInternal videoEmbedUrl upload { __typename id createdAt attachment userId name type fileSize } mimeType type } text { __typename imageProxyUrl text heading imageUrl } }"# + #"fragment StandardEmbed on EmbedDataV2 { __typename media { __typename url proxyUrl attachment isInternal videoEmbedUrl mimeType type } text { __typename imageProxyUrl text heading imageUrl } }"# } public let __data: DataDict @@ -34,11 +34,8 @@ public struct StandardEmbed: PrivateUploaderAPI.SelectionSet, Fragment { .field("url", String?.self), .field("proxyUrl", String?.self), .field("attachment", String?.self), - .field("width", Int?.self), - .field("height", Int?.self), .field("isInternal", Bool.self), .field("videoEmbedUrl", String?.self), - .field("upload", Upload?.self), .field("mimeType", String?.self), .field("type", GraphQLEnum.self), ] } @@ -46,42 +43,11 @@ public struct StandardEmbed: PrivateUploaderAPI.SelectionSet, Fragment { public var url: String? { __data["url"] } public var proxyUrl: String? { __data["proxyUrl"] } public var attachment: String? { __data["attachment"] } - public var width: Int? { __data["width"] } - public var height: Int? { __data["height"] } public var isInternal: Bool { __data["isInternal"] } /// Used for trusted video embed sources, such as YouTube. public var videoEmbedUrl: String? { __data["videoEmbedUrl"] } - public var upload: Upload? { __data["upload"] } public var mimeType: String? { __data["mimeType"] } public var type: GraphQLEnum { __data["type"] } - - /// Medium.Upload - /// - /// Parent Type: `Upload` - public struct Upload: PrivateUploaderAPI.SelectionSet { - public let __data: DataDict - public init(_dataDict: DataDict) { __data = _dataDict } - - public static var __parentType: ApolloAPI.ParentType { PrivateUploaderAPI.Objects.Upload } - public static var __selections: [ApolloAPI.Selection] { [ - .field("__typename", String.self), - .field("id", Int.self), - .field("createdAt", PrivateUploaderAPI.Date.self), - .field("attachment", String.self), - .field("userId", Int.self), - .field("name", String?.self), - .field("type", String.self), - .field("fileSize", Double.self), - ] } - - public var id: Int { __data["id"] } - public var createdAt: PrivateUploaderAPI.Date { __data["createdAt"] } - public var attachment: String { __data["attachment"] } - public var userId: Int { __data["userId"] } - public var name: String? { __data["name"] } - public var type: String { __data["type"] } - public var fileSize: Double { __data["fileSize"] } - } } /// Text diff --git a/TPU_Mac.xcodeproj/project.pbxproj b/TPU_Mac.xcodeproj/project.pbxproj index e3d5769..f8b1672 100644 --- a/TPU_Mac.xcodeproj/project.pbxproj +++ b/TPU_Mac.xcodeproj/project.pbxproj @@ -497,7 +497,7 @@ CODE_SIGN_ENTITLEMENTS = TPU_Mac/TPU_Mac.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"TPU_Mac/Preview Content\""; DEVELOPMENT_TEAM = PK36GR28A7; @@ -522,7 +522,7 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 14.0; - MARKETING_VERSION = 0.3.9; + MARKETING_VERSION = 0.3.10; PRODUCT_BUNDLE_IDENTIFIER = "ElectricS01.TPU-Mac"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; @@ -540,7 +540,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = TPU_Mac/TPU_Mac.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"TPU_Mac/Preview Content\""; DEVELOPMENT_TEAM = PK36GR28A7; @@ -565,7 +565,7 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 14.0; - MARKETING_VERSION = 0.3.9; + MARKETING_VERSION = 0.3.10; PRODUCT_BUNDLE_IDENTIFIER = "ElectricS01.TPU-Mac"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; diff --git a/TPU_Mac/CommsView.swift b/TPU_Mac/CommsView.swift index 0752e29..ee35595 100644 --- a/TPU_Mac/CommsView.swift +++ b/TPU_Mac/CommsView.swift @@ -358,35 +358,47 @@ struct CommsView: View { .textFieldStyle(RoundedBorderTextFieldStyle()) } ForEach(message.embeds, id: \.self) { embed in - if let media = embed.media, embed.media != [] { - ForEach(media, id: \.self) { img in - if img.mimeType != "image/gif" { - LazyImage(url: URL(string: img.attachment == nil ? ("https://i.electrics01.com" + (img.proxyUrl ?? "")) : ("https://i.electrics01.com/i/" + (img.attachment ?? "")))) { state in - if let image = state.image { - image.resizable().aspectRatio(contentMode: .fit) - // .onAppear { - //// if chatMessages.count != 0 { - //// proxy.scrollTo(0, anchor: .bottom) - //// } - // } - } else if state.error != nil { - Color.red - } else { - ProgressView() - } + VStack { + if let text = embed.text, embed.text != [] { + ForEach(Array(text.enumerated()), id: \.element) { index, line in + if index == 0 { + Text(line.text ?? "").font( .title2).lineLimit(1 : nil) + } else { + Text(line.text ?? "") } - } else { - HStack { - WebImage(url: URL(string: img.attachment == nil ? ("https://i.electrics01.com" + (img.proxyUrl ?? "")) : ("https://i.electrics01.com/i/" + (img.attachment ?? "")))) { image in - image.resizable().aspectRatio(contentMode: .fit) - } placeholder: { - ProgressView() + } + } + if let media = embed.media, embed.media != [] { + ForEach(media, id: \.self) { img in + if img.mimeType != "image/gif" { + LazyImage(url: URL(string: img.attachment == nil ? ("https://i.electrics01.com" + (img.proxyUrl ?? "")) : ("https://i.electrics01.com/i/" + (img.attachment ?? "")))) { state in + if let image = state.image { + image.resizable().aspectRatio(contentMode: .fit) + // .onAppear { + //// if chatMessages.count != 0 { + //// proxy.scrollTo(0, anchor: .bottom) + //// } + // } + } else if state.error != nil { + Color.red + } else { + ProgressView() + } + } + } else { + HStack { + WebImage(url: URL(string: img.attachment == nil ? ("https://i.electrics01.com" + (img.proxyUrl ?? "")) : ("https://i.electrics01.com/i/" + (img.attachment ?? "")))) { image in + image.resizable().aspectRatio(contentMode: .fit) + } placeholder: { + ProgressView() + } } } - } - }.frame(minWidth: 0, maxWidth: 600, minHeight: 0, maxHeight: 400) - } - }.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity, alignment: .topLeading) + }.frame(minWidth: 0, maxWidth: 600, minHeight: 0, maxHeight: 400).clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous)) + } + }.padding(8) + }.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity, alignment: .topLeading).background() + .clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous)) } Button(action: { if replyingId != message.id { diff --git a/TPU_Mac/ContentView.swift b/TPU_Mac/ContentView.swift index 623ee18..cd54c49 100644 --- a/TPU_Mac/ContentView.swift +++ b/TPU_Mac/ContentView.swift @@ -252,7 +252,7 @@ struct SettingsView: View { Text("Coming soon") #else Text("TPU iOS").font(.system(size: 32, weight: .semibold)) - Text("Version " + (Bundle.main.infoDictionary?[kCFBundleVersionKey as String] as? String ?? "") + " (15/10/2024)") + Text("Version " + (Bundle.main.infoDictionary?[kCFBundleVersionKey as String] as? String ?? "") + " (16/10/2024)") Text("Made by ElectricS01") Text("[Give it a Star on GitHub](https://github.com/ElectricS01/TPU-Mac)") #endif @@ -272,7 +272,7 @@ struct AboutView: View { Text("About") .navigationTitle("About") Text("TPU Mac").font(.system(size: 32, weight: .semibold)) - Text("Version " + (Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "") + " (15/10/2024)") + Text("Version " + (Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "") + " (16/10/2024)") Text("Made by ElectricS01") Text("[Give it a Star on GitHub](https://github.com/ElectricS01/TPU-Mac)") } diff --git a/graphql/Comms/MessagesQuery.graphql b/graphql/Comms/MessagesQuery.graphql index 1af40f8..1ba8605 100644 --- a/graphql/Comms/MessagesQuery.graphql +++ b/graphql/Comms/MessagesQuery.graphql @@ -3,19 +3,8 @@ fragment StandardEmbed on EmbedDataV2 { url proxyUrl attachment - width - height isInternal videoEmbedUrl - upload { - id - createdAt - attachment - userId - name - type - fileSize - } mimeType type }