committed by
William Casarin
parent
0da10eb716
commit
9847f12c95
@@ -14,26 +14,5 @@ enum Highlight {
|
||||
case main
|
||||
case reply
|
||||
case custom(Color, Float)
|
||||
|
||||
var is_main: Bool {
|
||||
if case .main = self {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var is_none: Bool {
|
||||
if case .none = self {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var is_replied_to: Bool {
|
||||
switch self {
|
||||
case .reply: return true
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,17 +52,6 @@ enum ImageShape {
|
||||
}
|
||||
}
|
||||
|
||||
// Try either calculated imagefill from the real image or from metadata hints in tags
|
||||
func lookup_imgmeta_size_hint(events: EventCache, url: URL?) -> CGSize? {
|
||||
guard let url,
|
||||
let meta = events.lookup_img_metadata(url: url),
|
||||
let img_size = meta.meta.dim?.size else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return img_size
|
||||
}
|
||||
|
||||
struct ImageCarousel: View {
|
||||
var urls: [URL]
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import SwiftUI
|
||||
|
||||
struct InvoiceView: View {
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
@Environment(\.openURL) private var openURL
|
||||
let our_pubkey: String
|
||||
let invoice: Invoice
|
||||
@State var showing_select_wallet: Bool = false
|
||||
|
||||
@@ -12,9 +12,6 @@ struct InvoicesView: View {
|
||||
var invoices: [Invoice]
|
||||
let settings: UserSettingsStore
|
||||
|
||||
@State var open_sheet: Bool = false
|
||||
@State var current_invoice: Invoice? = nil
|
||||
|
||||
var body: some View {
|
||||
TabView {
|
||||
ForEach(invoices, id: \.string) { invoice in
|
||||
|
||||
@@ -16,7 +16,7 @@ struct Reposted: View {
|
||||
HStack(alignment: .center) {
|
||||
Image(systemName: "arrow.2.squarepath")
|
||||
.foregroundColor(Color.gray)
|
||||
ProfileName(pubkey: pubkey, profile: profile, damus: damus, show_friend_confirmed: true, show_nip5_domain: false)
|
||||
ProfileName(pubkey: pubkey, profile: profile, damus: damus, show_nip5_domain: false)
|
||||
.foregroundColor(Color.gray)
|
||||
Text("Reposted", comment: "Text indicating that the post was reposted (i.e. re-shared).")
|
||||
.foregroundColor(Color.gray)
|
||||
|
||||
@@ -9,8 +9,6 @@ import SwiftUI
|
||||
|
||||
public struct ShimmerConfiguration {
|
||||
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
|
||||
public let gradient: Gradient
|
||||
public let initialLocation: (start: UnitPoint, end: UnitPoint)
|
||||
public let finalLocation: (start: UnitPoint, end: UnitPoint)
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
//
|
||||
// TextFieldAlert.swift
|
||||
// damus
|
||||
//
|
||||
// Created by William Casarin on 2022-06-09.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct TextFieldAlert<Presenting>: View where Presenting: View {
|
||||
@Binding var isShowing: Bool
|
||||
@Binding var text: String
|
||||
let presenting: Presenting
|
||||
let title: String
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { (deviceSize: GeometryProxy) in
|
||||
ZStack {
|
||||
self.presenting
|
||||
.disabled(isShowing)
|
||||
VStack {
|
||||
Text(self.title)
|
||||
TextField(NSLocalizedString("Relay", comment: "Text field for relay server. Used for testing purposes."), text: self.$text)
|
||||
Divider()
|
||||
HStack {
|
||||
Button(action: {
|
||||
withAnimation {
|
||||
self.isShowing.toggle()
|
||||
}
|
||||
}) {
|
||||
Text("Dismiss", comment: "Button to dismiss a text field alert.")
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background(Color.white)
|
||||
.frame(
|
||||
width: deviceSize.size.width*0.7,
|
||||
height: deviceSize.size.height*0.7
|
||||
)
|
||||
.shadow(radius: 1)
|
||||
.opacity(self.isShowing ? 1 : 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
extension View {
|
||||
|
||||
func textFieldAlert(isShowing: Binding<Bool>,
|
||||
text: Binding<String>,
|
||||
title: String) -> some View {
|
||||
TextFieldAlert(isShowing: isShowing,
|
||||
text: text,
|
||||
presenting: self,
|
||||
title: title)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -143,7 +143,7 @@ func translate_note(profiles: Profiles, privkey: String?, event: NostrEvent, set
|
||||
|
||||
// Render translated note
|
||||
let translated_blocks = event.get_blocks(content: translated_note)
|
||||
let artifacts = render_blocks(blocks: translated_blocks, profiles: profiles, privkey: privkey)
|
||||
let artifacts = render_blocks(blocks: translated_blocks, profiles: profiles)
|
||||
|
||||
// and cache it
|
||||
return .translated(Translated(artifacts: artifacts, language: note_lang))
|
||||
|
||||
@@ -41,7 +41,7 @@ struct UserView: View {
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
let profile = damus_state.profiles.lookup(id: pubkey)
|
||||
ProfileName(pubkey: pubkey, profile: profile, damus: damus_state, show_friend_confirmed: false, show_nip5_domain: false)
|
||||
ProfileName(pubkey: pubkey, profile: profile, damus: damus_state, show_nip5_domain: false)
|
||||
if let about = profile?.about {
|
||||
Text(about)
|
||||
.lineLimit(3)
|
||||
|
||||
@@ -32,8 +32,6 @@ struct ZapButton: View {
|
||||
|
||||
@State var zapping: Bool = false
|
||||
@State var invoice: String = ""
|
||||
@State var slider_value: Double = 0.0
|
||||
@State var slider_visible: Bool = false
|
||||
@State var showing_select_wallet: Bool = false
|
||||
@State var showing_zap_customizer: Bool = false
|
||||
@State var is_charging: Bool = false
|
||||
|
||||
Reference in New Issue
Block a user