Browse Source

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

remove-participants
Ben Weeks 2 years ago
committed by GitHub
parent
commit
b7c7b0b3bf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. BIN
      damus/Assets.xcassets/Profile/profile-banner.imageset/profile-banner.png
  2. 45
      damus/Assets.xcassets/shaka.imageset/Contents.json
  3. BIN
      damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white.png
  4. BIN
      damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@2x.png
  5. BIN
      damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@3x.png
  6. BIN
      damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black.png
  7. BIN
      damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@2x.png
  8. BIN
      damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@3x.png
  9. BIN
      damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white.png
  10. BIN
      damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@2x.png
  11. BIN
      damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@3x.png
  12. 19
      damus/Views/ConfigView.swift
  13. 14
      damus/Views/PostButton.swift
  14. 12
      damus/Views/ProfilePicView.swift

BIN
damus/Assets.xcassets/Profile/profile-banner.imageset/profile-banner.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

45
damus/Assets.xcassets/shaka.imageset/Contents.json

@ -14,51 +14,6 @@
"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" : {

BIN
damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

BIN
damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 741 B

BIN
damus/Assets.xcassets/shaka.imageset/nostr-hello-outline-white@3x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 B

BIN
damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

BIN
damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-black@3x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 700 B

BIN
damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

BIN
damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 536 B

BIN
damus/Assets.xcassets/shaka.imageset/nostr-hello-solid-white@3x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

19
damus/Views/ConfigView.swift

@ -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,10 +143,14 @@ 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
} }
@ -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
damus/Views/PostButton.swift

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

12
damus/Views/ProfilePicView.swift

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

Loading…
Cancel
Save