-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve DM design #816
Closed
Closed
Improve DM design #816
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Need to fix the input field to expand to multiple lines. |
looks nice! |
Need to fix issue where it displays image twice. |
jb55
reviewed
Apr 24, 2023
jb55
reviewed
Apr 24, 2023
try this for the separate functions: From ef7ec18e6a88a5b632fd19a568cced244aa5df59 Mon Sep 17 00:00:00 2001
From: William Casarin <[email protected]>
Date: Mon, 24 Apr 2023 16:54:23 -0700
Subject: [PATCH] suggestion
---
damus/Nostr/NostrEvent.swift | 32 ++++++++------------------------
1 file changed, 8 insertions(+), 24 deletions(-)
diff --git a/damus/Nostr/NostrEvent.swift b/damus/Nostr/NostrEvent.swift
index 8e187579..bf569826 100644
--- a/damus/Nostr/NostrEvent.swift
+++ b/damus/Nostr/NostrEvent.swift
@@ -1040,37 +1040,21 @@ func first_eref_mention(ev: NostrEvent, privkey: String?) -> Mention? {
}
func separate_images(ev: NostrEvent, privkey: String?) -> [URL]? {
- let urlBlocks = ev.blocks(privkey).filter { block in
- switch block {
- case .url:
- return true
- default:
- return false
- }
- }.compactMap { block in
- if case .url(let url) = block {
- return url
- } else {
- return nil
+ let urlBlocks: [URL] = ev.blocks(privkey).reduce(into: []) { urls, block in
+ guard case .url(let url) = block else {
+ return
}
+ urls.append(url)
}
return urlBlocks.isEmpty ? nil : urlBlocks
}
func separate_invoices(ev: NostrEvent, privkey: String?) -> [Invoice]? {
- let invoiceBlocks = ev.blocks(privkey).filter { block in
- switch block {
- case .invoice:
- return true
- default:
- return false
- }
- }.compactMap { block in
- if case .invoice(let invoice) = block {
- return invoice
- } else {
- return nil
+ let invoiceBlocks: [Invoice] = ev.blocks(privkey).reduce(into: []) { invoices, block in
+ guard case .invoice(let invoice) = block else {
+ return
}
+ invoices.append(invoice)
}
return invoiceBlocks.isEmpty ? nil : invoiceBlocks
}
--
2.39.2 (Apple Git-143)
|
suhailsaqan
force-pushed
the
improve-dms
branch
3 times, most recently
from
August 8, 2023 21:22
9f93bfe
to
bfb8eac
Compare
suhailsaqan
force-pushed
the
improve-dms
branch
from
August 8, 2023 21:29
bfb8eac
to
3180829
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IMG_9165.MP4