Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

chore: Framework-ify SubconsciousCore #841

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions xcode/Subconscious/Shared/Components/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import os
import Combine

/// Top-level view for app
struct AppView: View {
public struct AppView: View {
public init() {}

/// Store for global application state
@StateObject private var store = Store(
state: AppModel(),
Expand All @@ -20,7 +22,7 @@ struct AppView: View {
)
@Environment(\.scenePhase) private var scenePhase: ScenePhase

var body: some View {
public var body: some View {
ZStack {
VStack(spacing: 0) {
if Config.default.appTabs {
Expand Down
2 changes: 1 addition & 1 deletion xcode/Subconscious/Shared/Library/CombineUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ extension Publisher {
/// Recover from a failure.
/// Similar to `catch` but allows you to map an `Error` to an `Output`,
/// without having to wrap in a publisher.
func recover(
public func recover(
_ transform: @escaping (Error) -> Output
) -> Publishers.Catch<Self, Just<Output>> {
self.catch({ error in
Expand Down
2 changes: 1 addition & 1 deletion xcode/Subconscious/Shared/Library/Sentry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import os
import OSLog
import Sentry

struct SentryIntegration {}
public struct SentryIntegration {}

extension SentryIntegration {
public static func start() {
Expand Down
1,513 changes: 743 additions & 770 deletions xcode/Subconscious/Subconscious.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "B8EB29FA26F27797006E97C3"
BuildableName = "Subconscious.app"
BlueprintName = "Subconscious (iOS)"
BlueprintName = "Unconscious (iOS)"
ReferencedContainer = "container:Subconscious.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand Down Expand Up @@ -76,7 +76,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "B8EB29FA26F27797006E97C3"
BuildableName = "Subconscious.app"
BlueprintName = "Subconscious (iOS)"
BlueprintName = "Unconscious (iOS)"
ReferencedContainer = "container:Subconscious.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
Expand All @@ -100,7 +100,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "B8EB29FA26F27797006E97C3"
BuildableName = "Subconscious.app"
BlueprintName = "Subconscious (iOS)"
BlueprintName = "Unconscious (iOS)"
ReferencedContainer = "container:Subconscious.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
Expand Down
18 changes: 18 additions & 0 deletions xcode/Subconscious/SubconsciousCore/SubconsciousCore.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// SubconsciousCore.h
// SubconsciousCore
//
// Created by Jordan Santell on 7/31/23.
//

#import <Foundation/Foundation.h>

//! Project version number for SubconsciousCore.
FOUNDATION_EXPORT double SubconsciousCoreVersionNumber;

//! Project version string for SubconsciousCore.
FOUNDATION_EXPORT const unsigned char SubconsciousCoreVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <SubconsciousCore/PublicHeader.h>


1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/TestUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import XCTest
import Combine
import ObservableStore
@testable import Subconscious
@testable import SubconsciousCore

struct TestUtilities {
/// Create a unique temp dir and return URL
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Test_Markup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

class Test_Markup: XCTestCase {
func testWikilinkLosslessStringConvertable() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_AddressBookService: XCTestCase {
func testFollowUser() async throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_App: XCTestCase {
func testNicknameFormField() throws {
let model = AppModel()
XCTAssertEqual(model.nicknameFormField.value, "", "Nickname form field is empty to start")
XCTAssertEqual(model.nicknameFormField.isValid, false, "Nickname form field is not valid to start")

Check warning on line 16 in xcode/Subconscious/SubconsciousTests/Tests_App.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 100 characters or less; currently it has 107 characters (line_length)

let a = AppModel.update(
state: model,
Expand All @@ -21,7 +22,7 @@
)
XCTAssertEqual(a.state.nicknameFormField.value, "!INVALID", "Nickname form field is set")
XCTAssertEqual(a.state.nicknameFormField.isValid, false, "Nickname form field is not valid")
XCTAssertEqual(a.state.nickname, "", "Nickname is not saved, because form field value is not valid")

Check warning on line 25 in xcode/Subconscious/SubconsciousTests/Tests_App.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 100 characters or less; currently it has 108 characters (line_length)

let b = AppModel.update(
state: model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_AppMigrations: XCTestCase {
func testBasicMigrations() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Audience.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Audience: XCTestCase {
func testAudienceUserDescription() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

class Tests_CollectionUtilities: XCTestCase {
func testCollectionGetValidBounds() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Config: XCTestCase {
func testLoadBuildVars() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import XCTest
import Combine
import ObservableStore
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_DataService: XCTestCase {
/// A place to put cancellables from publishers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

class Tests_DatabaseService: XCTestCase {
func createDatabaseService() throws -> DatabaseService {
Expand All @@ -33,7 +34,7 @@
current,
Slashlink("/oh-all-ye-sweet-powers-of-air-now-hug-me-close")!,
Slashlink("/stubbs-own-unwinking-eye")!,
Slashlink("/pole-pointed-prow")!,

Check warning on line 37 in xcode/Subconscious/SubconsciousTests/Tests_DatabaseService.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Comma Violation: Collection literals should not have trailing commas (trailing_comma)
]
let suggestions = DatabaseService.collateRenameSuggestions(
current: current,
Expand Down Expand Up @@ -68,7 +69,7 @@
Slashlink("/the-whale-the-whale")!,
Slashlink("/oh-all-ye-sweet-powers-of-air-now-hug-me-close")!,
Slashlink("/stubbs-own-unwinking-eye")!,
Slashlink("/pole-pointed-prow")!,

Check warning on line 72 in xcode/Subconscious/SubconsciousTests/Tests_DatabaseService.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Comma Violation: Collection literals should not have trailing commas (trailing_comma)
]
)
guard case let .merge(parent, child) = suggestions[0] else {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Detail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import XCTest
import ObservableStore
@testable import Subconscious
@testable import SubconsciousCore

class Tests_Detail: XCTestCase {
let environment = AppEnvironment()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Did_SubconsciousLocal: XCTestCase {
func testDidIsLocal() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Did.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

class Tests_Did: XCTestCase {
func testValidDid() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_EntryLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

class Tests_EntryLink: XCTestCase {
func testSanitizeTitle() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_FileFingerprint: XCTestCase {
/// Modified time as Unix Timestamp Integer (rounded to the nearest second).
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_FirstRun.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_FirstRun: XCTestCase {
func testPersistFirstRunComplete() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_FormField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import XCTest
import ObservableStore
import SwiftUI
@testable import Subconscious
@testable import SubconsciousCore

class Tests_FormField: XCTestCase {
static func validateStringIsHello(input: String) -> String? {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Func.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Func: XCTestCase {
func testPipe() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Header.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

class Tests_Header: XCTestCase {
func testHeaderTitleNormalization() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_HeaderSubtext: XCTestCase {
func testSize() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Link: XCTestCase {
func testParse() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_LogFmt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_LogFmt: XCTestCase {
func testFormat() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import XCTest
import ObservableStore
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_MarkupText: XCTestCase {
func testRequestFocus() {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Memo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Memo: XCTestCase {
func testMemoMerge() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_MemoRecord: XCTestCase {
func testThrowsWhenInitilizedWithLocalDidWithoutSize() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import XCTest
import ObservableStore
import Combine
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_MemoViewerDetailMetaSheet: XCTestCase {
func testSetAddress() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Migrations: XCTestCase {
func testMigrationMigrate() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Noosphere.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import XCTest
import Noosphere
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Noosphere: XCTestCase {
func testCallWithError() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_NoosphereService: XCTestCase {
/// Create a unique temp dir and return URL
Expand All @@ -23,7 +24,7 @@
}

func testSphereTraversal() async throws {
throw XCTSkip("Sphere Traversal relies on running a gateway, this test will not pass currently.")

Check warning on line 27 in xcode/Subconscious/SubconsciousTests/Tests_NoosphereService.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 100 characters or less; currently it has 105 characters (line_length)

let tmp = try TestUtilities.createTmpDir()
let globalStorageURL = tmp.appending(path: "noosphere")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import XCTest
import ObservableStore
@testable import Subconscious
@testable import SubconsciousCore

/// Tests for Notebook.update
class Tests_NotebookUpdate: XCTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import XCTest
import OrderedCollections
@testable import Subconscious
@testable import SubconsciousCore

class Tests_OrderedCollectionUtilities: XCTestCase {
func testSetDefault() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

class Tests_Parser: XCTestCase {
func testDiscardSpaces() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Peer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Peer: XCTestCase {
func testPeerIsAbsolute() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Petname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

class Tests_Petname: XCTestCase {
func testValid() throws {
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Prose.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Prose: XCTestCase {
func testTitle() throws {
let text = "I stuffed a shirt or two into my old carpet-bag, tucked it under my arm, and started for Cape Horn and the Pacific. Quitting the good city of old Manhatto, I duly arrived in New Bedford."

Check warning on line 14 in xcode/Subconscious/SubconsciousTests/Tests_Prose.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 100 characters or less; currently it has 207 characters (line_length)
XCTAssertEqual(text.title(), "I stuffed a shirt or two into my old carpet-bag, tucked it under my arm, and started for Cape Horn and the Pacific")

Check warning on line 15 in xcode/Subconscious/SubconsciousTests/Tests_Prose.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 100 characters or less; currently it has 154 characters (line_length)
}

func testLongTitle() throws {
let text = "I stuffed a shirt or two into my old carpet-bag, tucked it under my arm, and started for Cape Horn and the Pacific, quitting the good city of old Manhatto, to duly arrive in New Bedford."

Check warning on line 19 in xcode/Subconscious/SubconsciousTests/Tests_Prose.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 100 characters or less; currently it has 207 characters (line_length)
XCTAssertEqual(text.title(), "I stuffed a shirt or two into my old carpet-bag, tucked it under my arm, and started for Cape Horn and the Pacific, quitting the good city…")

Check warning on line 20 in xcode/Subconscious/SubconsciousTests/Tests_Prose.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 100 characters or less; currently it has 179 characters (line_length)
}

func testTitleFallback() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_RecoveryPhrase: XCTestCase {
final class MockPasteboard: PasteboardProtocol {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_SQLite3Database: XCTestCase {
/// Get URL to temp dir for this test instance
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Search.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import XCTest
import ObservableStore
@testable import Subconscious
@testable import SubconsciousCore

class Tests_Search: XCTestCase {
let environment = AppEnvironment()
Expand Down
1 change: 1 addition & 0 deletions xcode/Subconscious/SubconsciousTests/Tests_Slashlink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import XCTest
@testable import Subconscious
@testable import SubconsciousCore

final class Tests_Slashlink: XCTestCase {
func testValid() throws {
Expand Down
Loading
Loading