Merge branch 'damus-io:master' into beautify-image-zoom

This commit is contained in:
Ben Weeks
2023-01-06 00:25:15 +00:00
committed by GitHub
14 changed files with 39 additions and 67 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -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",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

View File

@@ -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
}

View File

@@ -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])
}

View File

@@ -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)
}