mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Extract PostStatus enum to own file and add raw Int32 values
This commit is contained in:
parent
5436764e4f
commit
169e3684a6
@ -1,12 +1,6 @@
|
||||
import Foundation
|
||||
import WriteFreely
|
||||
|
||||
enum PostStatus {
|
||||
case local
|
||||
case edited
|
||||
case published
|
||||
}
|
||||
|
||||
class Post: Identifiable, ObservableObject, Hashable {
|
||||
@Published var wfPost: WFPost
|
||||
@Published var status: PostStatus
|
||||
|
7
Shared/Models/PostStatus.swift
Normal file
7
Shared/Models/PostStatus.swift
Normal file
@ -0,0 +1,7 @@
|
||||
import Foundation
|
||||
|
||||
enum PostStatus: Int32 {
|
||||
case local = 0
|
||||
case edited = 1
|
||||
case published = 2
|
||||
}
|
@ -235,7 +235,7 @@ private extension WriteFreelyModel {
|
||||
managedPost.title = fetchedPost.title
|
||||
managedPost.body = fetchedPost.body
|
||||
managedPost.collectionAlias = fetchedPost.collectionAlias
|
||||
managedPost.status = 2 // 0 = local, 1 = edited, 2 = published
|
||||
managedPost.status = PostStatus.published.rawValue // 0 = local, 1 = edited, 2 = published
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.store.updateStore(with: fetchedPostsArray)
|
||||
|
@ -139,7 +139,7 @@ struct PostListView: View {
|
||||
managedPost.createdDate = post.wfPost.createdDate
|
||||
managedPost.title = post.wfPost.title
|
||||
managedPost.body = post.wfPost.body
|
||||
managedPost.status = 0
|
||||
managedPost.status = PostStatus.local.rawValue
|
||||
DispatchQueue.main.async {
|
||||
model.store.add(post)
|
||||
PersistenceManager().saveContext()
|
||||
|
@ -56,6 +56,8 @@
|
||||
17B996D92502D23E0017B536 /* WFAPost+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17B996D62502D23E0017B536 /* WFAPost+CoreDataClass.swift */; };
|
||||
17B996DA2502D23E0017B536 /* WFAPost+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17B996D72502D23E0017B536 /* WFAPost+CoreDataProperties.swift */; };
|
||||
17B996DB2502D23E0017B536 /* WFAPost+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17B996D72502D23E0017B536 /* WFAPost+CoreDataProperties.swift */; };
|
||||
17C42E622507D8E600072984 /* PostStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17C42E612507D8E600072984 /* PostStatus.swift */; };
|
||||
17C42E632507D8E600072984 /* PostStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17C42E612507D8E600072984 /* PostStatus.swift */; };
|
||||
17D435E824E3128F0036B539 /* PreferencesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D435E724E3128F0036B539 /* PreferencesModel.swift */; };
|
||||
17D435E924E3128F0036B539 /* PreferencesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D435E724E3128F0036B539 /* PreferencesModel.swift */; };
|
||||
17DF329D24C87D3500BCE2E3 /* Tests_iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17DF329C24C87D3500BCE2E3 /* Tests_iOS.swift */; };
|
||||
@ -117,6 +119,7 @@
|
||||
17A5389124DDED0000DEFF9A /* PreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesView.swift; sourceTree = "<group>"; };
|
||||
17B996D62502D23E0017B536 /* WFAPost+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WFAPost+CoreDataClass.swift"; sourceTree = SOURCE_ROOT; };
|
||||
17B996D72502D23E0017B536 /* WFAPost+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WFAPost+CoreDataProperties.swift"; sourceTree = SOURCE_ROOT; };
|
||||
17C42E612507D8E600072984 /* PostStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostStatus.swift; sourceTree = "<group>"; };
|
||||
17D435E724E3128F0036B539 /* PreferencesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesModel.swift; sourceTree = "<group>"; };
|
||||
17DF328124C87D3300BCE2E3 /* WriteFreely_MultiPlatformApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteFreely_MultiPlatformApp.swift; sourceTree = "<group>"; };
|
||||
17DF328224C87D3300BCE2E3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
@ -209,6 +212,7 @@
|
||||
17B996D72502D23E0017B536 /* WFAPost+CoreDataProperties.swift */,
|
||||
1756AE6A24CB1E4B00FD7257 /* Post.swift */,
|
||||
171BFDF624D49FD400888236 /* PostCollection.swift */,
|
||||
17C42E612507D8E600072984 /* PostStatus.swift */,
|
||||
1756AE6D24CB255B00FD7257 /* PostStore.swift */,
|
||||
174D313124EC2831006CA9EE /* WriteFreelyModel.swift */,
|
||||
1756DBB524FED3A400207AB8 /* LocalStorageModel.xcdatamodeld */,
|
||||
@ -570,6 +574,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
17DF32AC24C87D3500BCE2E3 /* ContentView.swift in Sources */,
|
||||
17C42E622507D8E600072984 /* PostStatus.swift in Sources */,
|
||||
1756DBBA24FED45500207AB8 /* PersistenceManager.swift in Sources */,
|
||||
1756AE8124CB844500FD7257 /* View+Keyboard.swift in Sources */,
|
||||
17120DAC24E1B99F002B9F6C /* AccountLoginView.swift in Sources */,
|
||||
@ -633,6 +638,7 @@
|
||||
17A5388F24DDEC7400DEFF9A /* AccountView.swift in Sources */,
|
||||
1756AE7524CB26FA00FD7257 /* PostCellView.swift in Sources */,
|
||||
17A5388824DDA31F00DEFF9A /* MacAccountView.swift in Sources */,
|
||||
17C42E632507D8E600072984 /* PostStatus.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user