Skip to content

Commit

Permalink
undo merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ericholguin committed Sep 30, 2023
1 parent ca6a14d commit 055f8d3
Show file tree
Hide file tree
Showing 144 changed files with 1,978 additions and 1,199 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
## [1.6-18] - 2023-09-21

### Added

- Add followed hashtags to your following list (Daniel D’Aquino)
- Add "Do not show #nsfw tagged posts" setting (Daniel D’Aquino)
- Hold tap to preview status URL (Jericho Hasselbush)
- Finnish translations (etrikaj)


### Changed

- Switch to nostrdb for @'s and user search (William Casarin)
- Use nostrdb for profiles (William Casarin)
- Updated relay view (ericholguin)
- Increase size of the hitbox on note ellipsis button (Daniel D’Aquino)
- Make carousel tab dots tappable (Bryan Montz)
- Move the "Follow you" badge into the profile header (Grimless)


### Fixed

- Fix text composer wrapping issue when mentioning npub (Daniel D’Aquino)
- Make blurred videos viewable by allowing blur to disappear once tapped (Daniel D’Aquino)
- Fix parsing issue with NIP-47 compliant NWC urls without double-slashes (Daniel D’Aquino)
- Fix padding of username next to pfp on some views (William Casarin)
- Fixes issue where username with multiple emojis would place cursor in strange position. (Jericho Hasselbush)
- Fixed audio in video playing twice (Bryan Montz)
- Fix crash when long pressing custom reactions (William Casarin)
- Fix random crashom due to old profile database (William Casarin)

[1.6-18]: https://github.com/damus-io/damus/releases/tag/v1.6-18

## [1.6-17] - 2023-08-23

### Added
Expand Down
76 changes: 16 additions & 60 deletions damus.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@
"state" : {
"revision" : "76bb7971da7fbf429de1c84f1244adf657242fee"
}
},
{
"identity" : "tldextractswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/MarcoEidinger/TLDExtractSwift",
"state" : {
"revision" : "d4cbc911ab087e34439879df7f0314075886ae21",
"version" : "2.3.5"
}
}
],
"version" : 2
Expand Down
2 changes: 1 addition & 1 deletion damus/Components/ImageCarousel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public struct ImageFill {
struct ImageCarousel_Previews: PreviewProvider {
static var previews: some View {
let url: MediaUrl = .image(URL(string: "https://jb55.com/red-me.jpg")!)
ImageCarousel(state: test_damus_state(), evid: test_note.id, urls: [url, url])
ImageCarousel(state: test_damus_state, evid: test_note.id, urls: [url, url])
}
}

2 changes: 1 addition & 1 deletion damus/Components/InvoiceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ let test_invoice = Invoice(description: .description("this is a description"), a

struct InvoiceView_Previews: PreviewProvider {
static var previews: some View {
InvoiceView(our_pubkey: .empty, invoice: test_invoice, settings: test_damus_state().settings)
InvoiceView(our_pubkey: .empty, invoice: test_invoice, settings: test_damus_state.settings)
.frame(width: 300, height: 200)
}
}
Expand Down
2 changes: 1 addition & 1 deletion damus/Components/InvoicesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct InvoicesView: View {

struct InvoicesView_Previews: PreviewProvider {
static var previews: some View {
InvoicesView(our_pubkey: test_note.pubkey, invoices: [Invoice.init(description: .description("description"), amount: .specific(10000), string: "invstr", expiry: 100000, payment_hash: Data(), created_at: 1000000)], settings: test_damus_state().settings)
InvoicesView(our_pubkey: test_note.pubkey, invoices: [Invoice.init(description: .description("description"), amount: .specific(10000), string: "invstr", expiry: 100000, payment_hash: Data(), created_at: 1000000)], settings: test_damus_state.settings)
.frame(width: 300)
}
}
5 changes: 2 additions & 3 deletions damus/Components/NIP05Badge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ struct NIP05Badge: View {
}

var username_matches_nip05: Bool {
guard let profile = profiles.lookup(id: pubkey),
let name = profile.name
guard let name = profiles.lookup(id: pubkey).map({ p in p?.name }).value
else {
return false
}
Expand Down Expand Up @@ -97,7 +96,7 @@ func use_nip05_color(pubkey: Pubkey, contacts: Contacts) -> Bool {

struct NIP05Badge_Previews: PreviewProvider {
static var previews: some View {
let test_state = test_damus_state()
let test_state = test_damus_state
VStack {
NIP05Badge(nip05: NIP05(username: "jb55", host: "jb55.com"), pubkey: test_state.pubkey, contacts: test_state.contacts, show_domain: true, profiles: test_state.profiles)

Expand Down
9 changes: 4 additions & 5 deletions damus/Components/Reposted.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import SwiftUI
struct Reposted: View {
let damus: DamusState
let pubkey: Pubkey
let profile: Profile?


var body: some View {
HStack(alignment: .center) {
Image("repost")
.foregroundColor(Color.gray)
ProfileName(pubkey: pubkey, profile: profile, damus: damus, show_nip5_domain: false)
ProfileName(pubkey: pubkey, damus: damus, show_nip5_domain: false)
.foregroundColor(Color.gray)
Text("Reposted", comment: "Text indicating that the note was reposted (i.e. re-shared).")
.foregroundColor(Color.gray)
Expand All @@ -26,7 +25,7 @@ struct Reposted: View {

struct Reposted_Previews: PreviewProvider {
static var previews: some View {
let test_state = test_damus_state()
Reposted(damus: test_state, pubkey: test_state.pubkey, profile: make_test_profile())
let test_state = test_damus_state
Reposted(damus: test_state, pubkey: test_state.pubkey)
}
}
134 changes: 89 additions & 45 deletions damus/Components/Search/SearchHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,11 @@ struct SearchHeaderView: View {

var Icon: some View {
ZStack {
Circle()
.fill(Color(red: 0xF8/255.0, green: 0xE7/255.0, blue: 0xF8/255.0))
.frame(width: 54, height: 54)

switch described {
case .hashtag:
Text(verbatim: "#")
.font(.largeTitle.bold())
.foregroundStyle(PinkGradient)
.mask(Text(verbatim: "#")
.font(.largeTitle.bold()))

case .unknown:
Image(systemName: "magnifyingglass")
.font(.title.bold())
.foregroundStyle(PinkGradient)
case .hashtag:
SingleCharacterAvatar(character: "#")
case .unknown:
SystemIconAvatar(system_name: "magnifyingglass")
}
}
}
Expand All @@ -49,32 +38,6 @@ struct SearchHeaderView: View {
Text(described.description)
}

func unfollow(_ hashtag: String) {
is_following = false
handle_unfollow(state: state, unfollow: FollowRef.hashtag(hashtag))
}

func follow(_ hashtag: String) {
is_following = true
handle_follow(state: state, follow: .hashtag(hashtag))
}

func FollowButton(_ ht: String) -> some View {
return Button(action: { follow(ht) }) {
Text("Follow hashtag", comment: "Button to follow a given hashtag.")
.font(.footnote.bold())
}
.buttonStyle(GradientButtonStyle(padding: 10))
}

func UnfollowButton(_ ht: String) -> some View {
return Button(action: { unfollow(ht) }) {
Text("Unfollow hashtag", comment: "Button to unfollow a given hashtag.")
.font(.footnote.bold())
}
.buttonStyle(GradientButtonStyle(padding: 10))
}

var body: some View {
HStack(alignment: .center, spacing: 30) {
Icon
Expand All @@ -86,9 +49,9 @@ struct SearchHeaderView: View {

if state.is_privkey_user, case .hashtag(let ht) = described {
if is_following {
UnfollowButton(ht)
HashtagUnfollowButton(damus_state: state, hashtag: ht, is_following: $is_following)
} else {
FollowButton(ht)
HashtagFollowButton(damus_state: state, hashtag: ht, is_following: $is_following)
}
}
}
Expand All @@ -104,6 +67,87 @@ struct SearchHeaderView: View {
}
}

struct SystemIconAvatar: View {
let system_name: String

var body: some View {
NonImageAvatar {
Image(systemName: system_name)
.font(.title.bold())
}
}
}

struct SingleCharacterAvatar: View {
let character: String

var body: some View {
NonImageAvatar {
Text(verbatim: character)
.font(.largeTitle.bold())
.mask(Text(verbatim: character)
.font(.largeTitle.bold()))
}
}
}

struct NonImageAvatar<Content: View>: View {
let content: Content

init(@ViewBuilder content: () -> Content) {
self.content = content()
}

var body: some View {
ZStack {
Circle()
.fill(Color(red: 0xF8/255.0, green: 0xE7/255.0, blue: 0xF8/255.0))
.frame(width: 54, height: 54)

content
.foregroundStyle(PinkGradient)
}
}
}

struct HashtagUnfollowButton: View {
let damus_state: DamusState
let hashtag: String
@Binding var is_following: Bool

var body: some View {
return Button(action: { unfollow(hashtag) }) {
Text("Unfollow hashtag", comment: "Button to unfollow a given hashtag.")
.font(.footnote.bold())
}
.buttonStyle(GradientButtonStyle(padding: 10))
}

func unfollow(_ hashtag: String) {
is_following = false
handle_unfollow(state: damus_state, unfollow: FollowRef.hashtag(hashtag))
}
}

struct HashtagFollowButton: View {
let damus_state: DamusState
let hashtag: String
@Binding var is_following: Bool

var body: some View {
return Button(action: { follow(hashtag) }) {
Text("Follow hashtag", comment: "Button to follow a given hashtag.")
.font(.footnote.bold())
}
.buttonStyle(GradientButtonStyle(padding: 10))
}

func follow(_ hashtag: String) {
is_following = true
handle_follow(state: damus_state, follow: .hashtag(hashtag))
}
}

func hashtag_matches_search(desc: DescribedSearch, ref: FollowRef) -> Bool {
guard case .hashtag(let follow_ht) = ref,
case .hashtag(let search_ht) = desc,
Expand All @@ -124,9 +168,9 @@ func is_following_hashtag(contacts: NostrEvent?, hashtag: String) -> Bool {
struct SearchHeaderView_Previews: PreviewProvider {
static var previews: some View {
VStack(alignment: .leading) {
SearchHeaderView(state: test_damus_state(), described: .hashtag("damus"))
SearchHeaderView(state: test_damus_state, described: .hashtag("damus"))

SearchHeaderView(state: test_damus_state(), described: .unknown)
SearchHeaderView(state: test_damus_state, described: .unknown)
}
}
}
2 changes: 1 addition & 1 deletion damus/Components/Status/UserStatusSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ struct UserStatusSheet: View {

struct UserStatusSheet_Previews: PreviewProvider {
static var previews: some View {
UserStatusSheet(postbox: PostBox(pool: RelayPool()), keypair: Keypair(pubkey: .empty, privkey: nil), status: .init())
UserStatusSheet(postbox: test_damus_state.postbox, keypair: test_keypair, status: .init())
}
}
2 changes: 1 addition & 1 deletion damus/Components/TranslateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ extension View {

struct TranslateView_Previews: PreviewProvider {
static var previews: some View {
let ds = test_damus_state()
let ds = test_damus_state
TranslateView(damus_state: ds, event: test_note, size: .normal)
}
}
Expand Down
5 changes: 2 additions & 3 deletions damus/Components/UserView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ struct UserView: View {
ProfilePicView(pubkey: pubkey, size: PFP_SIZE, highlight: .none, profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation)

VStack(alignment: .leading) {
let profile = damus_state.profiles.lookup(id: pubkey)
ProfileName(pubkey: pubkey, profile: profile, damus: damus_state, show_nip5_domain: false)
ProfileName(pubkey: pubkey, damus: damus_state, show_nip5_domain: false)
if let about_text {
about_text
.lineLimit(3)
Expand All @@ -56,6 +55,6 @@ struct UserView: View {

struct UserView_Previews: PreviewProvider {
static var previews: some View {
UserView(damus_state: test_damus_state(), pubkey: test_note.pubkey)
UserView(damus_state: test_damus_state, pubkey: test_note.pubkey)
}
}
2 changes: 1 addition & 1 deletion damus/Components/ZapButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ struct ZapButton_Previews: PreviewProvider {
let pending_zap = PendingZap(amount_msat: 1000, target: ZapTarget.note(id: test_note.id, author: test_note.pubkey), request: .normal(test_zap_request), type: .pub, state: .external(.init(state: .fetching_invoice)))
let zaps = ZapsDataModel([.pending(pending_zap)])

ZapButton(damus_state: test_damus_state(), target: ZapTarget.note(id: test_note.id, author: test_note.pubkey), lnurl: "lnurl", zaps: zaps)
ZapButton(damus_state: test_damus_state, target: ZapTarget.note(id: test_note.id, author: test_note.pubkey), lnurl: "lnurl", zaps: zaps)
}
}

Expand Down
Loading

0 comments on commit 055f8d3

Please sign in to comment.