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:
Daniel D’Aquino
2023-11-15 18:09:28 -08:00
committed by William Casarin
parent ad75d8546c
commit 87860a7151
13 changed files with 438 additions and 257 deletions

View File

@@ -45,6 +45,12 @@ enum Block: Equatable {
case invoice(Invoice)
case relay(String)
}
struct Blocks: Equatable {
let words: Int
let blocks: [Block]
}
extension Block {
/// Failable initializer for the C-backed type `block_t`. This initializer will inspect
/// the underlying block type and build the appropriate enum value as needed.

View File

@@ -0,0 +1,11 @@
//
// MigratedTypes.swift
// damus
//
// Created by Daniel DAquino on 2023-11-17.
//
typealias NostrEvent = NdbNote
typealias TagElem = NdbTagElem
typealias Tag = TagSequence
typealias Tags = TagsSequence