Skip to content
Merged
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
10 changes: 10 additions & 0 deletions Code.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
47DDE1F353D72DB6C899D6E0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC0A077F6E7EE1EB0853134B /* Foundation.framework */; };
4C7D70012FC8892D0091C7A4 /* NotificationService.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 4C7D6FFA2FC8892D0091C7A4 /* NotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
4C7D80012FC8892D0091C7A4 /* FlipcashCore in Frameworks */ = {isa = PBXBuildFile; productRef = 9ABDD1942D9D7B61006B6CDA /* FlipcashCore */; };
4CA1B0022FD00002000AA002 /* FlipcashStore in Frameworks */ = {isa = PBXBuildFile; productRef = 4CA1B0012FD00001000AA001 /* FlipcashStore */; };
4CA1B0032FD00003000AA003 /* FlipcashStore in Frameworks */ = {isa = PBXBuildFile; productRef = 4CA1B0012FD00001000AA001 /* FlipcashStore */; };
08B8484332ED78035E9D399B /* Bugsnag in Frameworks */ = {isa = PBXBuildFile; productRef = 9ADEF1D62DD627C0001B260A /* Bugsnag */; };
4CB225762F77260D0075874E /* FirebaseInstallations in Frameworks */ = {isa = PBXBuildFile; productRef = 4CB225752F77260D0075874E /* FirebaseInstallations */; };
4CB225782F7726500075874E /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = 4CB225772F7726500075874E /* FirebaseMessaging */; };
Expand Down Expand Up @@ -157,6 +159,7 @@
buildActionMask = 2147483647;
files = (
4C7D80012FC8892D0091C7A4 /* FlipcashCore in Frameworks */,
4CA1B0022FD00002000AA002 /* FlipcashStore in Frameworks */,
08B8484332ED78035E9D399B /* Bugsnag in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -176,6 +179,7 @@
508AF9C6D67C4CD29DE10A16 /* TweetNacl in Frameworks */,
9AC0156C2DA576FA0030298E /* opencv2.framework in Frameworks */,
9ABDD1952D9D7B61006B6CDA /* FlipcashCore in Frameworks */,
4CA1B0032FD00003000AA003 /* FlipcashStore in Frameworks */,
9ADEF1D92DD627C6001B260A /* Mixpanel in Frameworks */,
9AE5C0122FA10003004C0DE0 /* SharedCoreKit in Frameworks */,
);
Expand Down Expand Up @@ -322,6 +326,7 @@
name = NotificationService;
packageProductDependencies = (
9ABDD1942D9D7B61006B6CDA /* FlipcashCore */,
4CA1B0012FD00001000AA001 /* FlipcashStore */,
9ADEF1D62DD627C0001B260A /* Bugsnag */,
);
productName = NotificationService;
Expand Down Expand Up @@ -371,6 +376,7 @@
name = Flipcash;
packageProductDependencies = (
9ABDD1942D9D7B61006B6CDA /* FlipcashCore */,
4CA1B0012FD00001000AA001 /* FlipcashStore */,
9AC011172DA4320F0030298E /* FlipcashUI */,
9AD1265D2DA98ADC0048141F /* SQLite */,
9ADEF1D62DD627C0001B260A /* Bugsnag */,
Expand Down Expand Up @@ -1820,6 +1826,10 @@
isa = XCSwiftPackageProductDependency;
productName = FlipcashCore;
};
4CA1B0012FD00001000AA001 /* FlipcashStore */ = {
isa = XCSwiftPackageProductDependency;
productName = FlipcashStore;
};
9AC011172DA4320F0030298E /* FlipcashUI */ = {
isa = XCSwiftPackageProductDependency;
productName = FlipcashUI;
Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Controllers/BlocklistController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import FlipcashCore
import FlipcashStore

nonisolated private let logger = Logger(label: "flipcash.blocklist-controller")

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Controllers/ContactDirectory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import Contacts
import Foundation
import FlipcashCore
import FlipcashStore

nonisolated private let logger = Logger(label: "flipcash.contact-directory")

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Controllers/ContactSyncController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import Contacts
import Foundation
import FlipcashCore
import FlipcashStore

nonisolated private let logger = Logger(label: "flipcash.contact-sync-controller")

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Controllers/ConversationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import SwiftUI
import FlipcashCore
import FlipcashStore

nonisolated private let logger = Logger(label: "flipcash.conversation-controller")

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Controllers/HistoryController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import FlipcashCore
import FlipcashStore

private let logger = Logger(label: "flipcash.history-controller")

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Controllers/RatesController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Foundation
// or these are migrated to AsyncSequence.
@preconcurrency import Combine
import FlipcashCore
import FlipcashStore

nonisolated private let logger = Logger(label: "flipcash.rates-controller")

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Screens/Main/AddMoney/AddMoneyGate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import Foundation
import FlipcashCore
import FlipcashStore

/// Read access to every balance the launch gate weighs.
@MainActor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore

private let logger = Logger(label: "flipcash.add-money-processing")

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Screens/Main/Bill/BillValuation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import FlipcashCore
import FlipcashStore

struct BillValuation: Identifiable {

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Screens/Main/Buy/BuyAmountViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore
import FlipcashUI

private let logger = Logger(label: "flipcash.buy-amount")
Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Screens/Main/Buy/BuyConfirmationScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore
import FlipcashUI

struct BuyConfirmationScreen: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore
import FlipcashUI

private let logger = Logger(label: "flipcash.buy-confirmation")
Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Screens/Main/Buy/BuyFlowPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import FlipcashCore
import FlipcashStore

/// Sub-flow path for the buy stack. The `.buy(mint)` sheet's root is
/// `BuyAmountScreen`; secondary screens (buy summary, post-buy processing) are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore
import FlipcashUI

/// Amount entry for converting a currency into a chosen destination. Pushed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore
import FlipcashUI

private let logger = Logger(label: "flipcash.convert-amount")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import SwiftUI
import UniformTypeIdentifiers
import FlipcashCore
import FlipcashStore
import FlipcashUI

private let logger = Logger(label: "flipcash.currency-creation")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore
import FlipcashUI

@Observable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore
import FlipcashUI

/// Marks the hero card as the morph destination for the wallet's tapped card.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import SwiftUI
import FlipcashUI
import FlipcashCore
import FlipcashStore

/// Thin environment-reading wrapper that hands the DI containers to
/// ``CurrencyInfoScreenContent``, whose two-init delegation builds the `@State`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore

@Observable
class CurrencyInfoViewModel {
Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Screens/Main/ExchangedBalance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import FlipcashCore
import FlipcashStore

/// A stored balance paired with its fiat value at a given rate.
struct ExchangedBalance: Identifiable, Hashable {
Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Screens/Main/Home/ActivityAvatar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import SwiftUI
import FlipcashUI
import FlipcashCore
import FlipcashStore

/// The avatar an activity draws — the counterparty's profile photo for peer
/// activity (tips/sends), the token image for token activity (deposits, buys),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import SwiftUI
import UIKit
import FlipcashUI
import FlipcashCore
import FlipcashStore

/// One activity entry in full (Figma node 9708:105260) — what opens when a row is
/// tapped in the Wallet's Recent section, the cross-token history, or a token's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import FlipcashCore
import FlipcashStore

private let logger = Logger(label: "flipcash.scan-cash")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import FlipcashCore
import FlipcashStore

private let logger = Logger(label: "flipcash.send-cash")

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Session/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import UIKit
import FlipcashUI
import FlipcashCore
import FlipcashStore

private let logger = Logger(label: "flipcash.session")

Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Session/SessionAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import SwiftUI
import FlipcashCore
import FlipcashStore
import FlipcashUI

private let logger = Logger(label: "flipcash.session-auth")
Expand Down
1 change: 1 addition & 0 deletions Flipcash/Core/Session/SessionProtocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import Foundation
import FlipcashCore
import FlipcashStore

// MARK: - Account

Expand Down
18 changes: 18 additions & 0 deletions FlipcashCore/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ let package = Package(
name: "FlipcashCore",
targets: ["FlipcashCore"]
),
.library(
name: "FlipcashStore",
targets: ["FlipcashStore"]
),
],
dependencies: [
.package(url: "https://github.com/marmelroy/PhoneNumberKit", from: "4.1.4"),
Expand All @@ -24,6 +28,9 @@ let package = Package(
.package(url: "https://github.com/apple/swift-nio.git", from: "2.81.0"),
.package(path: "../FlipcashAPI"),
.package(url: "https://github.com/code-payments/flipcash-shared-core-spm", .upToNextMinor(from: "0.5.0")),
// Branch-pinned to match the app project's own reference to the same fork. SPM resolves one
// version of it for the whole graph, so the two have to agree.
.package(url: "https://github.com/dbart01/SQLite.swift", branch: "master"),
],
targets: [
.target(
Expand All @@ -43,6 +50,17 @@ let package = Package(
.copy("Resources/discrete_cumulative_table.bin"),
]
),
// The SQLite store, shared by the app and the notification service extension. It is a
// separate target rather than part of `FlipcashCore` so that everything depending on the
// models does not also pull in SQLite.
.target(
name: "FlipcashStore",
dependencies: [
"FlipcashCore",
.product(name: "Logging", package: "swift-log"),
.product(name: "SQLite", package: "SQLite.swift"),
]
),
.testTarget(
name: "FlipcashCoreTests",
dependencies: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ nonisolated extension Database {

// MARK: - Get -

func getLatestActivityID() throws -> PublicKey? {
public func getLatestActivityID() throws -> PublicKey? {
let statement = try reader.prepareRowIterator("""
SELECT
a.id
Expand All @@ -32,7 +32,7 @@ nonisolated extension Database {
return ids.first
}

func getPendingActivityIDs() throws -> [PublicKey] {
public func getPendingActivityIDs() throws -> [PublicKey] {
let statement = try reader.prepareRowIterator("""
SELECT
a.id
Expand All @@ -55,7 +55,7 @@ nonisolated extension Database {
/// serialises access through its own dispatch queue; this wrapper only
/// hops off main so the caller's actor isn't blocked on up-to-1024
/// `NSDateFormatter.dateFromString(_:)` calls.
func getActivities(mint: PublicKey) async throws -> [Activity] {
public func getActivities(mint: PublicKey) async throws -> [Activity] {
try await withCheckedThrowingContinuation { continuation in
DispatchQueue.global(qos: .userInitiated).async {
do {
Expand All @@ -68,7 +68,7 @@ nonisolated extension Database {
}
}

func getActivities(mint: PublicKey) throws -> [Activity] {
public func getActivities(mint: PublicKey) throws -> [Activity] {
let statement = try reader.prepareRowIterator("""
SELECT
a.id,
Expand Down Expand Up @@ -115,7 +115,7 @@ nonisolated extension Database {
/// The unified, cross-mint recent activity for the wallet preview: the newest
/// `limit` activities regardless of token. `getActivities(mint:)` is the
/// per-token slice; this is the "everything" feed.
func getRecentActivities(limit: Int) throws -> [Activity] {
public func getRecentActivities(limit: Int) throws -> [Activity] {
let statement = try reader.prepareRowIterator("""
SELECT
a.id,
Expand Down Expand Up @@ -250,7 +250,7 @@ nonisolated extension Database {

// MARK: - Insert -

func insertActivities(activities: [Activity]) throws {
public func insertActivities(activities: [Activity]) throws {
try activities.forEach {
try insertActivity(activity: $0)
}
Expand Down
Loading