diff --git a/damus/Assets.xcassets/Profile/profile-banner.imageset/profile-banner.png b/damus/Assets.xcassets/Profile/profile-banner.imageset/profile-banner.png deleted file mode 100644 index 78bc0616..00000000 Binary files a/damus/Assets.xcassets/Profile/profile-banner.imageset/profile-banner.png and /dev/null differ diff --git a/damus/Assets.xcassets/shaka.imageset/Contents.json b/damus/Assets.xcassets/shaka.imageset/Contents.json index 1d117063..43f9de63 100644 --- a/damus/Assets.xcassets/shaka.imageset/Contents.json +++ b/damus/Assets.xcassets/shaka.imageset/Contents.json @@ -14,52 +14,7 @@ "filename" : "nostr-hello-outline-black@3x.png", "idiom" : "universal", "scale" : "3x" - }, - { - "filename" : "nostr-hello-outline-white.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "nostr-hello-outline-white@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "nostr-hello-outline-white@3x.png", - "idiom" : "universal", - "scale" : "3x" - }, - { - "filename" : "nostr-hello-solid-black.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "nostr-hello-solid-black@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "nostr-hello-solid-black@3x.png", - "idiom" : "universal", - "scale" : "3x" - }, - { - "filename" : "nostr-hello-solid-white.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "nostr-hello-solid-white@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "nostr-hello-solid-white@3x.png", - "idiom" : "universal", - "scale" : "3x" - } + } ], "info" : { "author" : "xcode", diff --git a/damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white.png b/damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white.png deleted file mode 100644 index 6572f831..00000000 Binary files a/damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white.png and /dev/null differ diff --git a/damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@2x.png b/damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@2x.png deleted file mode 100644 index 4ddb963c..00000000 Binary files a/damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@2x.png and /dev/null differ diff --git a/damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@3x.png b/damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@3x.png deleted file mode 100644 index f139b845..00000000 Binary files a/damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@3x.png and /dev/null differ diff --git a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black.png b/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black.png deleted file mode 100644 index 2f8c4924..00000000 Binary files a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black.png and /dev/null differ diff --git a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@2x.png b/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@2x.png deleted file mode 100644 index b7a53b4b..00000000 Binary files a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@2x.png and /dev/null differ diff --git a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@3x.png b/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@3x.png deleted file mode 100644 index 8e822d4f..00000000 Binary files a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@3x.png and /dev/null differ diff --git a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white.png b/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white.png deleted file mode 100644 index c84f5f6f..00000000 Binary files a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white.png and /dev/null differ diff --git a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@2x.png b/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@2x.png deleted file mode 100644 index 1c1b41e1..00000000 Binary files a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@2x.png and /dev/null differ diff --git a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@3x.png b/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@3x.png deleted file mode 100644 index 2f10f6fc..00000000 Binary files a/damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@3x.png and /dev/null differ diff --git a/damus/Views/ConfigView.swift b/damus/Views/ConfigView.swift index 719c2d11..e17bc2ff 100644 --- a/damus/Views/ConfigView.swift +++ b/damus/Views/ConfigView.swift @@ -6,6 +6,7 @@ // import AVFoundation import SwiftUI +import Kingfisher struct ConfigView: View { let state: DamusState @@ -113,6 +114,14 @@ struct ConfigView: View { } } + Section("Clear Cache") { + Button("Clear") { + KingfisherManager.shared.cache.clearMemoryCache() + KingfisherManager.shared.cache.clearDiskCache() + KingfisherManager.shared.cache.cleanExpiredDiskCache() + } + } + Section("Reset") { Button("Logout") { confirm_logout = true @@ -134,14 +143,18 @@ struct ConfigView: View { } .sheet(isPresented: $show_add_relay) { AddRelayView(show_add_relay: $show_add_relay, relay: $new_relay) { m_relay in - guard let relay = m_relay else { + guard var relay = m_relay else { return } + if relay.starts(with: "wss://") == false { + relay = "wss://" + relay + } + guard let url = URL(string: relay) else { return } - + guard let ev = state.contacts.event else { return } @@ -156,9 +169,9 @@ struct ConfigView: View { return } - state.pool.connect(to: [new_relay]) + state.pool.connect(to: [relay]) - guard let new_ev = add_relay(ev: ev, privkey: privkey, current_relays: state.pool.descriptors, relay: new_relay, info: info) else { + guard let new_ev = add_relay(ev: ev, privkey: privkey, current_relays: state.pool.descriptors, relay: relay, info: info) else { return } diff --git a/damus/Views/PostButton.swift b/damus/Views/PostButton.swift index 37cd99a9..14d1fd91 100644 --- a/damus/Views/PostButton.swift +++ b/damus/Views/PostButton.swift @@ -14,20 +14,22 @@ let LINEAR_GRADIENT = LinearGradient(gradient: Gradient(colors: [ Color("DamusBlue") ]), startPoint: .topTrailing, endPoint: .bottomTrailing) - func PostButton(action: @escaping () -> ()) -> some View { return Button(action: action, label: { - Image(systemName: "plus") - .font(.system(.title2)) - .foregroundColor(Color.white) - .frame(width: BUTTON_SIZE, height: BUTTON_SIZE, alignment: .center) - .background(LINEAR_GRADIENT) - .cornerRadius(38.5) - .padding() - .shadow(color: Color.black.opacity(0.3), - radius: 3, - x: 3, - y: 3) + ZStack(alignment: .center) { + Circle() + .fill(LINEAR_GRADIENT) + .frame(width: BUTTON_SIZE, height: BUTTON_SIZE, alignment: .center) + .rotationEffect(.degrees(20)) + .padding() + .shadow(color: Color.black.opacity(0.3), + radius: 3, + x: 3, + y: 3) + Image(systemName: "plus") + .font(.system(.title2)) + .foregroundColor(Color.white) + } }) .keyboardShortcut("n", modifiers: [.command, .shift]) } diff --git a/damus/Views/ProfilePicView.swift b/damus/Views/ProfilePicView.swift index 69be4b8f..d32e8bfd 100644 --- a/damus/Views/ProfilePicView.swift +++ b/damus/Views/ProfilePicView.swift @@ -62,7 +62,6 @@ struct InnerProfilePicView: View { .placeholder { _ in Placeholder } - .cacheOriginalImage() .scaleFactor(UIScreen.main.scale) .loadDiskFileSynchronously() .fade(duration: 0.1) @@ -112,17 +111,20 @@ struct LargeImageProcessor: ImageProcessor { let downsampleSize = CGSize(width: 200, height: 200) func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? { - let downsamplingImageProcessor = DownsamplingImageProcessor(size: downsampleSize) switch item { case .image(let image): - if image.cacheCost > maxSize { - return downsamplingImageProcessor.process(item: item, options: options) + guard let data = image.kf.data(format: .unknown) else { + return nil + } + + if data.count > maxSize { + return KingfisherWrapper.downsampledImage(data: data, to: downsampleSize, scale: options.scaleFactor) } return image case .data(let data): if data.count > maxSize { - return downsamplingImageProcessor.process(item: item, options: options) + return KingfisherWrapper.downsampledImage(data: data, to: downsampleSize, scale: options.scaleFactor) } return KFCrossPlatformImage(data: data) }