diff --git a/TPU_Mac.xcodeproj/project.pbxproj b/TPU_Mac.xcodeproj/project.pbxproj index ab72f52..2c8ab7e 100644 --- a/TPU_Mac.xcodeproj/project.pbxproj +++ b/TPU_Mac.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ C40BC9892B8C8F9800444B56 /* NukeUI in Frameworks */ = {isa = PBXBuildFile; productRef = C40BC9882B8C8F9800444B56 /* NukeUI */; }; C40BC98B2B8C8F9800444B56 /* NukeVideo in Frameworks */ = {isa = PBXBuildFile; productRef = C40BC98A2B8C8F9800444B56 /* NukeVideo */; }; C428DE892B709ADB00A13E4A /* ApolloWebSocket in Frameworks */ = {isa = PBXBuildFile; productRef = C428DE882B709ADB00A13E4A /* ApolloWebSocket */; }; + C44156622CB3F86100EE1F96 /* SDWebImageSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = C44156612CB3F86100EE1F96 /* SDWebImageSwiftUI */; }; C45099152ACFFA7F00FA9247 /* TPU_MacApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C45099142ACFFA7F00FA9247 /* TPU_MacApp.swift */; }; C45099172ACFFA7F00FA9247 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C45099162ACFFA7F00FA9247 /* ContentView.swift */; }; C45099192ACFFA8100FA9247 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C45099182ACFFA8100FA9247 /* Assets.xcassets */; }; @@ -80,6 +81,7 @@ C4DD4D492C4892AE00DF1A22 /* ApolloSQLite in Frameworks */, C40BC98B2B8C8F9800444B56 /* NukeVideo in Frameworks */, C4569DF12AD17A2A00F17C06 /* PrivateUploaderAPI in Frameworks */, + C44156622CB3F86100EE1F96 /* SDWebImageSwiftUI in Frameworks */, C428DE892B709ADB00A13E4A /* ApolloWebSocket in Frameworks */, C48C2E9E2AD0417B0000A362 /* Apollo in Frameworks */, C4FE71542AD3F085003E4DC0 /* KeychainSwift in Frameworks */, @@ -201,6 +203,7 @@ C40BC9882B8C8F9800444B56 /* NukeUI */, C40BC98A2B8C8F9800444B56 /* NukeVideo */, C4DD4D482C4892AE00DF1A22 /* ApolloSQLite */, + C44156612CB3F86100EE1F96 /* SDWebImageSwiftUI */, ); productName = "TPU Mac"; productReference = C45099112ACFFA7F00FA9247 /* TPU Mac.app */; @@ -279,6 +282,7 @@ C4569DEF2AD17A2A00F17C06 /* XCLocalSwiftPackageReference "PrivateUploaderAPI" */, C4FE71522AD3F084003E4DC0 /* XCRemoteSwiftPackageReference "keychain-swift" */, C40BC9872B8C8F9800444B56 /* XCRemoteSwiftPackageReference "Nuke" */, + C44156602CB3F86100EE1F96 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */, ); productRefGroup = C45099122ACFFA7F00FA9247 /* Products */; projectDirPath = ""; @@ -493,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; @@ -518,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.6; + MARKETING_VERSION = 0.3.7; PRODUCT_BUNDLE_IDENTIFIER = "ElectricS01.TPU-Mac"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; @@ -536,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; @@ -561,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.6; + MARKETING_VERSION = 0.3.7; PRODUCT_BUNDLE_IDENTIFIER = "ElectricS01.TPU-Mac"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; @@ -719,6 +723,14 @@ minimumVersion = 12.4.0; }; }; + C44156602CB3F86100EE1F96 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/SDWebImage/SDWebImageSwiftUI"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 3.1.2; + }; + }; C48C2E9C2AD0417B0000A362 /* XCRemoteSwiftPackageReference "apollo-ios" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/apollographql/apollo-ios.git"; @@ -753,6 +765,11 @@ package = C48C2E9C2AD0417B0000A362 /* XCRemoteSwiftPackageReference "apollo-ios" */; productName = ApolloWebSocket; }; + C44156612CB3F86100EE1F96 /* SDWebImageSwiftUI */ = { + isa = XCSwiftPackageProductDependency; + package = C44156602CB3F86100EE1F96 /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */; + productName = SDWebImageSwiftUI; + }; C4569DF02AD17A2A00F17C06 /* PrivateUploaderAPI */ = { isa = XCSwiftPackageProductDependency; productName = PrivateUploaderAPI; diff --git a/TPU_Mac.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/TPU_Mac.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a7535cd..c5191fa 100644 --- a/TPU_Mac.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/TPU_Mac.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "ebcc003c733b5e3546635ee723c81650c5cf3daf96f79b3ea68429af8785148d", + "originHash" : "32de2e6f1ca705660f7b87d82a1831f853f4c9bc74bfe58ee88fe567972e6a9c", "pins" : [ { "identity" : "apollo-ios", @@ -28,6 +28,24 @@ "version" : "12.8.0" } }, + { + "identity" : "sdwebimage", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SDWebImage/SDWebImage.git", + "state" : { + "revision" : "8a1be70a625683bc04d6903e2935bf23f3c6d609", + "version" : "5.19.7" + } + }, + { + "identity" : "sdwebimageswiftui", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SDWebImage/SDWebImageSwiftUI", + "state" : { + "revision" : "5aa947356f4ea49a0c3b9968564267f6ea5abea7", + "version" : "3.1.2" + } + }, { "identity" : "sqlite.swift", "kind" : "remoteSourceControl", diff --git a/TPU_Mac/ChatView.swift b/TPU_Mac/ChatView.swift index a1e8e16..0c2720c 100644 --- a/TPU_Mac/ChatView.swift +++ b/TPU_Mac/ChatView.swift @@ -8,6 +8,7 @@ import Apollo import NukeUI import PrivateUploaderAPI +import SDWebImageSwiftUI import SwiftUI import UserNotifications @@ -296,22 +297,35 @@ struct ChatView: View { .textFieldStyle(RoundedBorderTextFieldStyle()) } ForEach(message.embeds, id: \.self) { embed in - if embed.media != [] { - LazyImage(url: URL(string: embed.media?[0].attachment == nil ? ("https://i.electrics01.com" + (embed.media?[0].proxyUrl ?? "")) : ("https://i.electrics01.com/i/" + (embed.media?[0].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 + 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 { - ProgressView() + 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) } Button(action: { diff --git a/TPU_Mac/CommsView.swift b/TPU_Mac/CommsView.swift index e48f6c2..7f01895 100644 --- a/TPU_Mac/CommsView.swift +++ b/TPU_Mac/CommsView.swift @@ -8,6 +8,7 @@ import Apollo import NukeUI import PrivateUploaderAPI +import SDWebImageSwiftUI import SwiftUI import UserNotifications @@ -331,19 +332,31 @@ struct CommsView: View { .textFieldStyle(RoundedBorderTextFieldStyle()) } ForEach(message.embeds, id: \.self) { embed in - if embed.media != [] { - LazyImage(url: URL(string: embed.media?[0].attachment == nil ? ("https://i.electrics01.com" + (embed.media?[0].proxyUrl ?? "")) : ("https://i.electrics01.com/i/" + (embed.media?[0].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 + 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 { - ProgressView() + 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) } diff --git a/TPU_Mac/ContentView.swift b/TPU_Mac/ContentView.swift index 3251f00..3c1af6a 100644 --- a/TPU_Mac/ContentView.swift +++ b/TPU_Mac/ContentView.swift @@ -248,7 +248,7 @@ struct SettingsView: View { Text("Coming soon") #else Text("TPU iOS").font(.system(size: 32, weight: .semibold)) - Text("Version " + (Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "") + " (5/10/2024)") + Text("Version " + (Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "") + " (7/10/2024)") Text("Made by ElectricS01") Text("[Give it a Star on GitHub](https://github.com/ElectricS01/TPU-Mac)") #endif @@ -267,7 +267,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 ?? "") + " (5/10/2024)") + Text("Version " + (Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "") + " (7/10/2024)") Text("Made by ElectricS01") Text("[Give it a Star on GitHub](https://github.com/ElectricS01/TPU-Mac)") }