Merge branch 'damus-io:master' into beautify-image-zoom
|
Before Width: | Height: | Size: 1.1 MiB |
@@ -14,52 +14,7 @@
|
|||||||
"filename" : "nostr-hello-outline-black@3x.png",
|
"filename" : "nostr-hello-outline-black@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "3x"
|
"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" : {
|
"info" : {
|
||||||
"author" : "xcode",
|
"author" : "xcode",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 308 B |
|
Before Width: | Height: | Size: 486 B |
|
Before Width: | Height: | Size: 700 B |
|
Before Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 536 B |
|
Before Width: | Height: | Size: 830 B |
@@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
import AVFoundation
|
import AVFoundation
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import Kingfisher
|
||||||
|
|
||||||
struct ConfigView: View {
|
struct ConfigView: View {
|
||||||
let state: DamusState
|
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") {
|
Section("Reset") {
|
||||||
Button("Logout") {
|
Button("Logout") {
|
||||||
confirm_logout = true
|
confirm_logout = true
|
||||||
@@ -134,14 +143,18 @@ struct ConfigView: View {
|
|||||||
}
|
}
|
||||||
.sheet(isPresented: $show_add_relay) {
|
.sheet(isPresented: $show_add_relay) {
|
||||||
AddRelayView(show_add_relay: $show_add_relay, relay: $new_relay) { m_relay in
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if relay.starts(with: "wss://") == false {
|
||||||
|
relay = "wss://" + relay
|
||||||
|
}
|
||||||
|
|
||||||
guard let url = URL(string: relay) else {
|
guard let url = URL(string: relay) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let ev = state.contacts.event else {
|
guard let ev = state.contacts.event else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -156,9 +169,9 @@ struct ConfigView: View {
|
|||||||
return
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,20 +14,22 @@ let LINEAR_GRADIENT = LinearGradient(gradient: Gradient(colors: [
|
|||||||
Color("DamusBlue")
|
Color("DamusBlue")
|
||||||
]), startPoint: .topTrailing, endPoint: .bottomTrailing)
|
]), startPoint: .topTrailing, endPoint: .bottomTrailing)
|
||||||
|
|
||||||
|
|
||||||
func PostButton(action: @escaping () -> ()) -> some View {
|
func PostButton(action: @escaping () -> ()) -> some View {
|
||||||
return Button(action: action, label: {
|
return Button(action: action, label: {
|
||||||
Image(systemName: "plus")
|
ZStack(alignment: .center) {
|
||||||
.font(.system(.title2))
|
Circle()
|
||||||
.foregroundColor(Color.white)
|
.fill(LINEAR_GRADIENT)
|
||||||
.frame(width: BUTTON_SIZE, height: BUTTON_SIZE, alignment: .center)
|
.frame(width: BUTTON_SIZE, height: BUTTON_SIZE, alignment: .center)
|
||||||
.background(LINEAR_GRADIENT)
|
.rotationEffect(.degrees(20))
|
||||||
.cornerRadius(38.5)
|
.padding()
|
||||||
.padding()
|
.shadow(color: Color.black.opacity(0.3),
|
||||||
.shadow(color: Color.black.opacity(0.3),
|
radius: 3,
|
||||||
radius: 3,
|
x: 3,
|
||||||
x: 3,
|
y: 3)
|
||||||
y: 3)
|
Image(systemName: "plus")
|
||||||
|
.font(.system(.title2))
|
||||||
|
.foregroundColor(Color.white)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.keyboardShortcut("n", modifiers: [.command, .shift])
|
.keyboardShortcut("n", modifiers: [.command, .shift])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ struct InnerProfilePicView: View {
|
|||||||
.placeholder { _ in
|
.placeholder { _ in
|
||||||
Placeholder
|
Placeholder
|
||||||
}
|
}
|
||||||
.cacheOriginalImage()
|
|
||||||
.scaleFactor(UIScreen.main.scale)
|
.scaleFactor(UIScreen.main.scale)
|
||||||
.loadDiskFileSynchronously()
|
.loadDiskFileSynchronously()
|
||||||
.fade(duration: 0.1)
|
.fade(duration: 0.1)
|
||||||
@@ -112,17 +111,20 @@ struct LargeImageProcessor: ImageProcessor {
|
|||||||
let downsampleSize = CGSize(width: 200, height: 200)
|
let downsampleSize = CGSize(width: 200, height: 200)
|
||||||
|
|
||||||
func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {
|
func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {
|
||||||
let downsamplingImageProcessor = DownsamplingImageProcessor(size: downsampleSize)
|
|
||||||
|
|
||||||
switch item {
|
switch item {
|
||||||
case .image(let image):
|
case .image(let image):
|
||||||
if image.cacheCost > maxSize {
|
guard let data = image.kf.data(format: .unknown) else {
|
||||||
return downsamplingImageProcessor.process(item: item, options: options)
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.count > maxSize {
|
||||||
|
return KingfisherWrapper.downsampledImage(data: data, to: downsampleSize, scale: options.scaleFactor)
|
||||||
}
|
}
|
||||||
return image
|
return image
|
||||||
case .data(let data):
|
case .data(let data):
|
||||||
if data.count > maxSize {
|
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)
|
return KFCrossPlatformImage(data: data)
|
||||||
}
|
}
|
||||||
|
|||||||