fix: project dependency issue

This commit is contained in:
CMK 2022-01-28 12:09:28 +08:00
parent 9c7da4389e
commit 12b73f5a10
65 changed files with 113 additions and 742 deletions

View File

@ -10,6 +10,7 @@ import Foundation
import CryptoKit import CryptoKit
import KeychainAccess import KeychainAccess
import Keys import Keys
import MastodonCommon
public final class AppSecret { public final class AppSecret {

View File

@ -6,6 +6,7 @@
// //
import UIKit import UIKit
import MastodonCommon
extension UserDefaults { extension UserDefaults {
public static let shared = UserDefaults(suiteName: AppName.groupID)! public static let shared = UserDefaults(suiteName: AppName.groupID)!

View File

@ -1,18 +0,0 @@
//
// CoreDataStack.h
// CoreDataStack
//
// Created by MainasuK Cirno on 2021/1/27.
//
#import <Foundation/Foundation.h>
//! Project version number for CoreDataStack.
FOUNDATION_EXPORT double CoreDataStackVersionNumber;
//! Project version string for CoreDataStack.
FOUNDATION_EXPORT const unsigned char CoreDataStackVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <CoreDataStack/PublicHeader.h>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.3.0</string>
<key>CFBundleVersion</key>
<string>91</string>
</dict>
</plist>

View File

@ -1,33 +0,0 @@
//
// CoreDataStackTests.swift
// CoreDataStackTests
//
// Created by MainasuK Cirno on 2021/1/27.
//
import XCTest
@testable import CoreDataStack
class CoreDataStackTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.3.0</string>
<key>CFBundleVersion</key>
<string>91</string>
</dict>
</plist>

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
<key>AppShared.xcscheme_^#shared#^_</key> <key>AppShared.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>28</integer> <integer>19</integer>
</dict> </dict>
<key>CoreDataStack.xcscheme_^#shared#^_</key> <key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict> <dict>
@ -97,7 +97,7 @@
<key>MastodonIntent.xcscheme_^#shared#^_</key> <key>MastodonIntent.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>26</integer> <integer>18</integer>
</dict> </dict>
<key>MastodonIntents.xcscheme_^#shared#^_</key> <key>MastodonIntents.xcscheme_^#shared#^_</key>
<dict> <dict>
@ -117,7 +117,7 @@
<key>ShareActionExtension.xcscheme_^#shared#^_</key> <key>ShareActionExtension.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>25</integer> <integer>20</integer>
</dict> </dict>
</dict> </dict>
<key>SuppressBuildableAutocreation</key> <key>SuppressBuildableAutocreation</key>

View File

@ -11,6 +11,7 @@ import Combine
import CoreData import CoreData
import CoreDataStack import CoreDataStack
import MastodonSDK import MastodonSDK
import MastodonUI
final class StatusFetchedResultsController: NSObject { final class StatusFetchedResultsController: NSObject {

View File

@ -11,6 +11,7 @@ import Combine
import CoreData import CoreData
import CoreDataStack import CoreDataStack
import MastodonSDK import MastodonSDK
import MastodonUI
final class UserFetchedResultsController: NSObject { final class UserFetchedResultsController: NSObject {

View File

@ -7,6 +7,7 @@
import Foundation import Foundation
import CoreDataStack import CoreDataStack
import MastodonUI
enum StatusItem: Hashable { enum StatusItem: Hashable {
case feed(record: ManagedObjectRecord<Feed>) case feed(record: ManagedObjectRecord<Feed>)

View File

@ -8,6 +8,7 @@
import Foundation import Foundation
import CoreData import CoreData
import CoreDataStack import CoreDataStack
import MastodonUI
extension DataSourceFacade { extension DataSourceFacade {
static func status( static func status(

View File

@ -7,6 +7,7 @@
import UIKit import UIKit
import Combine import Combine
import AppShared
// ref: https://zamzam.io/protocol-oriented-themes-for-ios-apps/ // ref: https://zamzam.io/protocol-oriented-themes-for-ios-apps/
final class ThemeService { final class ThemeService {

View File

@ -13,12 +13,19 @@ let package = Package(
.library( .library(
name: "MastodonSDK", name: "MastodonSDK",
targets: [ targets: [
"MastodonSDK", "CoreDataStack",
"MastodonExtension",
"MastodonAsset", "MastodonAsset",
"MastodonCommon",
"MastodonExtension",
"MastodonLocalization", "MastodonLocalization",
"MastodonSDK",
"MastodonUI", "MastodonUI",
]), ]),
.library(
name: "MastodonCommon",
targets: [
"MastodonCommon",
]),
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", from: "5.0.0"), .package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", from: "5.0.0"),
@ -36,27 +43,38 @@ let package = Package(
// Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on. // Targets can depend on other targets in this package, and on products in packages this package depends on.
.target( .target(
name: "MastodonSDK", name: "CoreDataStack",
dependencies: [ dependencies: [
.product(name: "SwiftyJSON", package: "SwiftyJSON"), "MastodonCommon",
.product(name: "NIOHTTP1", package: "swift-nio"),
] ]
), ),
.target( .target(
name: "MastodonExtension", name: "MastodonAsset",
dependencies: [] dependencies: []
), ),
.target( .target(
name: "MastodonAsset", name: "MastodonCommon",
dependencies: []
),
.target(
name: "MastodonExtension",
dependencies: [] dependencies: []
), ),
.target( .target(
name: "MastodonLocalization", name: "MastodonLocalization",
dependencies: [] dependencies: []
), ),
.target(
name: "MastodonSDK",
dependencies: [
.product(name: "SwiftyJSON", package: "SwiftyJSON"),
.product(name: "NIOHTTP1", package: "swift-nio"),
]
),
.target( .target(
name: "MastodonUI", name: "MastodonUI",
dependencies: [ dependencies: [
"CoreDataStack",
"MastodonSDK", "MastodonSDK",
"MastodonExtension", "MastodonExtension",
"MastodonAsset", "MastodonAsset",

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="19574" systemVersion="21D49" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> <model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="19574" systemVersion="21D49" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Application" representedClassName=".Application" syncable="YES"> <entity name="Application" representedClassName="CoreDataStack.Application" syncable="YES">
<attribute name="identifier" optional="YES" attributeType="UUID" usesScalarValueType="NO"/> <attribute name="identifier" optional="YES" attributeType="UUID" usesScalarValueType="NO"/>
<attribute name="name" attributeType="String"/> <attribute name="name" attributeType="String"/>
<attribute name="vapidKey" optional="YES" attributeType="String"/> <attribute name="vapidKey" optional="YES" attributeType="String"/>
<attribute name="website" optional="YES" attributeType="String"/> <attribute name="website" optional="YES" attributeType="String"/>
<relationship name="status" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="application" inverseEntity="Status"/> <relationship name="status" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="application" inverseEntity="Status"/>
</entity> </entity>
<entity name="DomainBlock" representedClassName=".DomainBlock" syncable="YES"> <entity name="DomainBlock" representedClassName="CoreDataStack.DomainBlock" syncable="YES">
<attribute name="blockedDomain" attributeType="String"/> <attribute name="blockedDomain" attributeType="String"/>
<attribute name="createAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="domain" attributeType="String"/> <attribute name="domain" attributeType="String"/>
@ -20,7 +20,7 @@
</uniquenessConstraint> </uniquenessConstraint>
</uniquenessConstraints> </uniquenessConstraints>
</entity> </entity>
<entity name="Emoji" representedClassName=".Emoji" syncable="YES"> <entity name="Emoji" representedClassName="CoreDataStack.Emoji" syncable="YES">
<attribute name="category" optional="YES" attributeType="String"/> <attribute name="category" optional="YES" attributeType="String"/>
<attribute name="createAt" attributeType="Date" defaultDateTimeInterval="631123200" usesScalarValueType="NO"/> <attribute name="createAt" attributeType="Date" defaultDateTimeInterval="631123200" usesScalarValueType="NO"/>
<attribute name="identifier" attributeType="UUID" usesScalarValueType="NO"/> <attribute name="identifier" attributeType="UUID" usesScalarValueType="NO"/>
@ -29,7 +29,7 @@
<attribute name="url" attributeType="String"/> <attribute name="url" attributeType="String"/>
<attribute name="visibleInPicker" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="visibleInPicker" attributeType="Boolean" usesScalarValueType="YES"/>
</entity> </entity>
<entity name="Feed" representedClassName=".Feed" syncable="YES"> <entity name="Feed" representedClassName="CoreDataStack.Feed" syncable="YES">
<attribute name="acctRaw" optional="YES" attributeType="String"/> <attribute name="acctRaw" optional="YES" attributeType="String"/>
<attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="hasMore" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="hasMore" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
@ -39,7 +39,7 @@
<relationship name="notification" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Notification" inverseName="feeds" inverseEntity="Notification"/> <relationship name="notification" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Notification" inverseName="feeds" inverseEntity="Notification"/>
<relationship name="status" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="feeds" inverseEntity="Status"/> <relationship name="status" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="feeds" inverseEntity="Status"/>
</entity> </entity>
<entity name="HomeTimelineIndex" representedClassName=".HomeTimelineIndex" syncable="YES"> <entity name="HomeTimelineIndex" representedClassName="CoreDataStack.HomeTimelineIndex" syncable="YES">
<attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="deletedAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/> <attribute name="deletedAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="domain" attributeType="String"/> <attribute name="domain" attributeType="String"/>
@ -48,14 +48,14 @@
<attribute name="userID" attributeType="String"/> <attribute name="userID" attributeType="String"/>
<relationship name="status" maxCount="1" deletionRule="Nullify" destinationEntity="Status"/> <relationship name="status" maxCount="1" deletionRule="Nullify" destinationEntity="Status"/>
</entity> </entity>
<entity name="Instance" representedClassName=".Instance" syncable="YES"> <entity name="Instance" representedClassName="CoreDataStack.Instance" syncable="YES">
<attribute name="configurationRaw" optional="YES" attributeType="Binary"/> <attribute name="configurationRaw" optional="YES" attributeType="Binary"/>
<attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="domain" attributeType="String"/> <attribute name="domain" attributeType="String"/>
<attribute name="updatedAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="updatedAt" attributeType="Date" usesScalarValueType="NO"/>
<relationship name="authentications" toMany="YES" deletionRule="Nullify" destinationEntity="MastodonAuthentication" inverseName="instance" inverseEntity="MastodonAuthentication"/> <relationship name="authentications" toMany="YES" deletionRule="Nullify" destinationEntity="MastodonAuthentication" inverseName="instance" inverseEntity="MastodonAuthentication"/>
</entity> </entity>
<entity name="MastodonAuthentication" representedClassName=".MastodonAuthentication" syncable="YES"> <entity name="MastodonAuthentication" representedClassName="CoreDataStack.MastodonAuthentication" syncable="YES">
<attribute name="activedAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="activedAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="appAccessToken" attributeType="String"/> <attribute name="appAccessToken" attributeType="String"/>
<attribute name="clientID" attributeType="String"/> <attribute name="clientID" attributeType="String"/>
@ -70,7 +70,7 @@
<relationship name="instance" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Instance" inverseName="authentications" inverseEntity="Instance"/> <relationship name="instance" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Instance" inverseName="authentications" inverseEntity="Instance"/>
<relationship name="user" maxCount="1" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="mastodonAuthentication" inverseEntity="MastodonUser"/> <relationship name="user" maxCount="1" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="mastodonAuthentication" inverseEntity="MastodonUser"/>
</entity> </entity>
<entity name="MastodonUser" representedClassName=".MastodonUser" syncable="YES"> <entity name="MastodonUser" representedClassName="CoreDataStack.MastodonUser" syncable="YES">
<attribute name="acct" attributeType="String"/> <attribute name="acct" attributeType="String"/>
<attribute name="avatar" attributeType="String"/> <attribute name="avatar" attributeType="String"/>
<attribute name="avatarStatic" optional="YES" attributeType="String"/> <attribute name="avatarStatic" optional="YES" attributeType="String"/>
@ -119,7 +119,7 @@
<relationship name="votePollOptions" toMany="YES" deletionRule="Nullify" destinationEntity="PollOption" inverseName="votedBy" inverseEntity="PollOption"/> <relationship name="votePollOptions" toMany="YES" deletionRule="Nullify" destinationEntity="PollOption" inverseName="votedBy" inverseEntity="PollOption"/>
<relationship name="votePolls" toMany="YES" deletionRule="Nullify" destinationEntity="Poll" inverseName="votedBy" inverseEntity="Poll"/> <relationship name="votePolls" toMany="YES" deletionRule="Nullify" destinationEntity="Poll" inverseName="votedBy" inverseEntity="Poll"/>
</entity> </entity>
<entity name="Notification" representedClassName=".Notification" syncable="YES"> <entity name="Notification" representedClassName="CoreDataStack.Notification" syncable="YES">
<attribute name="createAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="domain" attributeType="String"/> <attribute name="domain" attributeType="String"/>
<attribute name="id" attributeType="String"/> <attribute name="id" attributeType="String"/>
@ -135,7 +135,7 @@
</uniquenessConstraint> </uniquenessConstraint>
</uniquenessConstraints> </uniquenessConstraints>
</entity> </entity>
<entity name="Poll" representedClassName=".Poll" syncable="YES"> <entity name="Poll" representedClassName="CoreDataStack.Poll" syncable="YES">
<attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="domain" attributeType="String" defaultValueString=""/> <attribute name="domain" attributeType="String" defaultValueString=""/>
<attribute name="expired" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="expired" attributeType="Boolean" usesScalarValueType="YES"/>
@ -150,7 +150,7 @@
<relationship name="status" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="poll" inverseEntity="Status"/> <relationship name="status" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="poll" inverseEntity="Status"/>
<relationship name="votedBy" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="votePolls" inverseEntity="MastodonUser"/> <relationship name="votedBy" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="votePolls" inverseEntity="MastodonUser"/>
</entity> </entity>
<entity name="PollOption" representedClassName=".PollOption" syncable="YES"> <entity name="PollOption" representedClassName="CoreDataStack.PollOption" syncable="YES">
<attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="index" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="index" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="isSelected" transient="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/> <attribute name="isSelected" transient="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
@ -160,13 +160,13 @@
<relationship name="poll" maxCount="1" deletionRule="Nullify" destinationEntity="Poll" inverseName="options" inverseEntity="Poll"/> <relationship name="poll" maxCount="1" deletionRule="Nullify" destinationEntity="Poll" inverseName="options" inverseEntity="Poll"/>
<relationship name="votedBy" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="votePollOptions" inverseEntity="MastodonUser"/> <relationship name="votedBy" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="votePollOptions" inverseEntity="MastodonUser"/>
</entity> </entity>
<entity name="PrivateNote" representedClassName=".PrivateNote" syncable="YES"> <entity name="PrivateNote" representedClassName="CoreDataStack.PrivateNote" syncable="YES">
<attribute name="note" optional="YES" attributeType="String"/> <attribute name="note" optional="YES" attributeType="String"/>
<attribute name="updatedAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="updatedAt" attributeType="Date" usesScalarValueType="NO"/>
<relationship name="from" maxCount="1" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="privateNotesTo" inverseEntity="MastodonUser"/> <relationship name="from" maxCount="1" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="privateNotesTo" inverseEntity="MastodonUser"/>
<relationship name="to" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="privateNotes" inverseEntity="MastodonUser"/> <relationship name="to" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="privateNotes" inverseEntity="MastodonUser"/>
</entity> </entity>
<entity name="SearchHistory" representedClassName=".SearchHistory" syncable="YES"> <entity name="SearchHistory" representedClassName="CoreDataStack.SearchHistory" syncable="YES">
<attribute name="createAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="domain" attributeType="String" defaultValueString=""/> <attribute name="domain" attributeType="String" defaultValueString=""/>
<attribute name="identifier" attributeType="UUID" usesScalarValueType="NO"/> <attribute name="identifier" attributeType="UUID" usesScalarValueType="NO"/>
@ -176,7 +176,7 @@
<relationship name="hashtag" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Tag" inverseName="searchHistories" inverseEntity="Tag"/> <relationship name="hashtag" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Tag" inverseName="searchHistories" inverseEntity="Tag"/>
<relationship name="status" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="searchHistories" inverseEntity="Status"/> <relationship name="status" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="searchHistories" inverseEntity="Status"/>
</entity> </entity>
<entity name="Setting" representedClassName=".Setting" syncable="YES"> <entity name="Setting" representedClassName="CoreDataStack.Setting" syncable="YES">
<attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="domain" attributeType="String"/> <attribute name="domain" attributeType="String"/>
<attribute name="preferredStaticAvatar" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/> <attribute name="preferredStaticAvatar" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
@ -187,7 +187,7 @@
<attribute name="userID" attributeType="String"/> <attribute name="userID" attributeType="String"/>
<relationship name="subscriptions" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Subscription" inverseName="setting" inverseEntity="Subscription"/> <relationship name="subscriptions" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Subscription" inverseName="setting" inverseEntity="Subscription"/>
</entity> </entity>
<entity name="Status" representedClassName=".Status" syncable="YES"> <entity name="Status" representedClassName="CoreDataStack.Status" syncable="YES">
<attribute name="attachments" optional="YES" attributeType="Binary"/> <attribute name="attachments" optional="YES" attributeType="Binary"/>
<attribute name="content" attributeType="String"/> <attribute name="content" attributeType="String"/>
<attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/>
@ -227,7 +227,7 @@
<relationship name="replyTo" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="replyFrom" inverseEntity="Status"/> <relationship name="replyTo" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Status" inverseName="replyFrom" inverseEntity="Status"/>
<relationship name="searchHistories" toMany="YES" deletionRule="Cascade" destinationEntity="SearchHistory" inverseName="status" inverseEntity="SearchHistory"/> <relationship name="searchHistories" toMany="YES" deletionRule="Cascade" destinationEntity="SearchHistory" inverseName="status" inverseEntity="SearchHistory"/>
</entity> </entity>
<entity name="Subscription" representedClassName=".Subscription" syncable="YES"> <entity name="Subscription" representedClassName="CoreDataStack.Subscription" syncable="YES">
<attribute name="activedAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="activedAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createdAt" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="endpoint" optional="YES" attributeType="String"/> <attribute name="endpoint" optional="YES" attributeType="String"/>
@ -239,7 +239,7 @@
<relationship name="alert" maxCount="1" deletionRule="Cascade" destinationEntity="SubscriptionAlerts" inverseName="subscription" inverseEntity="SubscriptionAlerts"/> <relationship name="alert" maxCount="1" deletionRule="Cascade" destinationEntity="SubscriptionAlerts" inverseName="subscription" inverseEntity="SubscriptionAlerts"/>
<relationship name="setting" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Setting" inverseName="subscriptions" inverseEntity="Setting"/> <relationship name="setting" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Setting" inverseName="subscriptions" inverseEntity="Setting"/>
</entity> </entity>
<entity name="SubscriptionAlerts" representedClassName=".SubscriptionAlerts" syncable="YES"> <entity name="SubscriptionAlerts" representedClassName="CoreDataStack.SubscriptionAlerts" syncable="YES">
<attribute name="createdAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/> <attribute name="createdAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="favouriteRaw" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="favouriteRaw" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="followRaw" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="followRaw" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
@ -250,7 +250,7 @@
<attribute name="updatedAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/> <attribute name="updatedAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<relationship name="subscription" maxCount="1" deletionRule="Nullify" destinationEntity="Subscription" inverseName="alert" inverseEntity="Subscription"/> <relationship name="subscription" maxCount="1" deletionRule="Nullify" destinationEntity="Subscription" inverseName="alert" inverseEntity="Subscription"/>
</entity> </entity>
<entity name="Tag" representedClassName=".Tag" syncable="YES"> <entity name="Tag" representedClassName="CoreDataStack.Tag" syncable="YES">
<attribute name="createAt" attributeType="Date" defaultDateTimeInterval="631123200" usesScalarValueType="NO"/> <attribute name="createAt" attributeType="Date" defaultDateTimeInterval="631123200" usesScalarValueType="NO"/>
<attribute name="domain" attributeType="String" defaultValueString=""/> <attribute name="domain" attributeType="String" defaultValueString=""/>
<attribute name="histories" optional="YES" attributeType="Binary"/> <attribute name="histories" optional="YES" attributeType="Binary"/>
@ -277,7 +277,7 @@
<element name="Setting" positionX="72" positionY="162" width="128" height="164"/> <element name="Setting" positionX="72" positionY="162" width="128" height="164"/>
<element name="Status" positionX="0" positionY="0" width="128" height="599"/> <element name="Status" positionX="0" positionY="0" width="128" height="599"/>
<element name="Subscription" positionX="81" positionY="171" width="128" height="179"/> <element name="Subscription" positionX="81" positionY="171" width="128" height="179"/>
<element name="SubscriptionAlerts" positionX="72" positionY="162" width="128" height="14"/> <element name="SubscriptionAlerts" positionX="72" positionY="162" width="128" height="164"/>
<element name="Tag" positionX="0" positionY="0" width="128" height="149"/> <element name="Tag" positionX="0" positionY="0" width="128" height="149"/>
</elements> </elements>
</model> </model>

View File

@ -9,7 +9,7 @@ import os
import Foundation import Foundation
import Combine import Combine
import CoreData import CoreData
import AppShared import MastodonCommon
public final class CoreDataStack { public final class CoreDataStack {
@ -46,7 +46,7 @@ public final class CoreDataStack {
}() }()
static func persistentContainer() -> NSPersistentContainer { static func persistentContainer() -> NSPersistentContainer {
let bundles = [Bundle(for: Status.self)] let bundles = [Bundle.module] // .module required for package in the SwiftPM
guard let managedObjectModel = NSManagedObjectModel.mergedModel(from: bundles) else { guard let managedObjectModel = NSManagedObjectModel.mergedModel(from: bundles) else {
fatalError("cannot locate bundles") fatalError("cannot locate bundles")
} }

View File

@ -50,7 +50,7 @@ extension NSManagedObjectContext {
extension NSManagedObjectContext { extension NSManagedObjectContext {
public func perform<T>(block: @escaping () throws -> T) async throws -> T { public func perform<T>(block: @escaping () throws -> T) async throws -> T {
if #available(iOSApplicationExtension 15.0, *) { if #available(iOS 15.0, *) {
return try await perform(schedule: .enqueued) { return try await perform(schedule: .enqueued) {
try block() try block()
} }

View File

@ -9,7 +9,7 @@
import Foundation import Foundation
import CoreData import CoreData
public class ManagedObjectRecord<T: Managed>: Hashable { public class ManagedObjectRecord<T: NSFetchRequestResult>: Hashable {
public let objectID: NSManagedObjectID public let objectID: NSManagedObjectID

View File

@ -1,6 +1,6 @@
// //
// AppName.swift // AppName.swift
// AppShared // MastodonCommon
// //
// Created by MainasuK Cirno on 2021-4-27. // Created by MainasuK Cirno on 2021-4-27.
// //

View File

@ -7,6 +7,7 @@
import Foundation import Foundation
import CoreData import CoreData
import CoreDataStack
public enum PollItem: Hashable { public enum PollItem: Hashable {
case option(record: ManagedObjectRecord<PollOption>) case option(record: ManagedObjectRecord<PollOption>)