Make NostrDB (and related) code build under the new extension target as well.
This change includes several source files related to NostrDB into the extension target as well, so that we can use it from that context (and thus enable more advanced push notification formatting and suppression) To make this change possible, I had to split some source files as well as to move some functions to different files, to ensure we don't have to pull too much unnecessary code into the extension. Testing ------- PASS Device: iPhone 15 Pro simulator iOS: 17.0.1 Damus: This commit Test steps: 1. Build DamusNotificationService. Should succeed. PASS 2. Build Damus (the app). PASS 3. Run app, scroll around some notes, go to a few different views, post a note. Should work as normal. PASS
This commit is contained in:
committed by
William Casarin
parent
ad75d8546c
commit
87860a7151
@@ -186,11 +186,6 @@ struct DMChatView_Previews: PreviewProvider {
|
||||
}
|
||||
}
|
||||
|
||||
enum EncEncoding {
|
||||
case base64
|
||||
case bech32
|
||||
}
|
||||
|
||||
func encrypt_message(message: String, privkey: Privkey, to_pk: Pubkey, encoding: EncEncoding = .base64) -> String? {
|
||||
let iv = random_bytes(count: 16).bytes
|
||||
guard let shared_sec = get_shared_secret(privkey: privkey, pubkey: to_pk) else {
|
||||
|
||||
@@ -669,3 +669,16 @@ func count_markdown_words(blocks: [BlockNode]) -> Int {
|
||||
}
|
||||
}
|
||||
|
||||
func separate_images(ev: NostrEvent, keypair: Keypair) -> [MediaUrl]? {
|
||||
let urlBlocks: [URL] = ev.blocks(keypair).blocks.reduce(into: []) { urls, block in
|
||||
guard case .url(let url) = block else {
|
||||
return
|
||||
}
|
||||
if classify_url(url).is_img != nil {
|
||||
urls.append(url)
|
||||
}
|
||||
}
|
||||
let mediaUrls = urlBlocks.map { MediaUrl.image($0) }
|
||||
return mediaUrls.isEmpty ? nil : mediaUrls
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,3 @@ struct PubkeyView: View {
|
||||
#Preview {
|
||||
PubkeyView(pubkey: test_pubkey)
|
||||
}
|
||||
|
||||
func abbrev_pubkey(_ pubkey: String, amount: Int = 8) -> String {
|
||||
return pubkey.prefix(amount) + ":" + pubkey.suffix(amount)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user