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. 47
      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. 21
      damus/Views/ConfigView.swift
  13. 26
      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

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

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

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

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

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

Loading…
Cancel
Save