Page MenuHomeMusing Studio

No OneTemporary

diff --git a/Shared/Models/Post.swift b/Shared/Models/Post.swift
index 0308698..6e56ad9 100644
--- a/Shared/Models/Post.swift
+++ b/Shared/Models/Post.swift
@@ -1,50 +1,50 @@
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
@Published var collection: WFACollection?
@Published var hasNewerRemoteCopy: Bool = false
let id = UUID()
init(
title: String = "Title",
body: String = "Write your post here...",
createdDate: Date = Date(),
- status: PostStatus = .draft,
+ status: PostStatus = .local,
collection: WFACollection? = nil
) {
self.wfPost = WFPost(body: body, title: title, createdDate: createdDate)
self.status = status
self.collection = collection
}
convenience init(wfPost: WFPost, in collection: WFACollection? = nil) {
self.init(
title: wfPost.title ?? "",
body: wfPost.body,
createdDate: wfPost.createdDate ?? Date(),
status: .published,
collection: collection
)
self.wfPost = wfPost
}
}
extension Post {
static func == (lhs: Post, rhs: Post) -> Bool {
return lhs.id == rhs.id
}
func hash(into hasher: inout Hasher) {
hasher.combine(id)
}
}
diff --git a/Shared/PostList/PostStatusBadgeView.swift b/Shared/PostList/PostStatusBadgeView.swift
index 466d914..d7f0ac9 100644
--- a/Shared/PostList/PostStatusBadgeView.swift
+++ b/Shared/PostList/PostStatusBadgeView.swift
@@ -1,103 +1,103 @@
import SwiftUI
struct PostStatusBadgeView: View {
@ObservedObject var post: Post
var body: some View {
let (badgeLabel, badgeColor) = setupBadgeProperties(for: post.status)
Text(badgeLabel)
.font(.caption)
.fontWeight(.semibold)
.foregroundColor(.white)
.textCase(.uppercase)
.lineLimit(1)
.padding(EdgeInsets(top: 2.5, leading: 7.5, bottom: 2.5, trailing: 7.5))
.background(badgeColor)
.clipShape(RoundedRectangle(cornerRadius: 5.0, style: .circular))
}
func setupBadgeProperties(for status: PostStatus) -> (String, Color) {
var badgeLabel: String
var badgeColor: Color
switch status {
case .local:
badgeLabel = "local"
badgeColor = Color(red: 0.75, green: 0.5, blue: 0.85, opacity: 1.0)
case .edited:
badgeLabel = "edited"
badgeColor = Color(red: 0.75, green: 0.7, blue: 0.1, opacity: 1.0)
case .published:
badgeLabel = "published"
badgeColor = .gray
}
return (badgeLabel, badgeColor)
}
}
#if DEBUG
let userCollection1 = WFACollection(context: PersistenceManager.persistentContainer.viewContext)
let userCollection2 = WFACollection(context: PersistenceManager.persistentContainer.viewContext)
let userCollection3 = WFACollection(context: PersistenceManager.persistentContainer.viewContext)
let testPostData = [
Post(
title: "My First Post",
body: "Look at me, creating a first post! That's cool.",
createdDate: Date(timeIntervalSince1970: 1595429452),
status: .published,
collection: userCollection1
),
Post(
title: "Post 2: The Quickening",
body: "See, here's the rule about Highlander jokes: _there can be only one_.",
createdDate: Date(timeIntervalSince1970: 1595514125),
status: .edited,
collection: userCollection1
),
Post(
title: "The Post Revolutions",
body: "I can never keep the Matrix movie order straight. Why not just call them part 2 and part 3?",
createdDate: Date(timeIntervalSince1970: 1595600006)
),
Post(
title: "Episode IV: A New Post",
body: "How many movies does this person watch? How many movie-title jokes will they make?",
createdDate: Date(timeIntervalSince1970: 1596219877),
status: .published,
collection: userCollection2
),
Post(
title: "Fast (Post) Five",
body: "Look, it was either a Fast and the Furious reference, or a Resident Evil reference."
),
Post(
title: "Post: The Final Chapter",
body: "And there you have it, a Resident Evil movie reference.",
createdDate: Date(timeIntervalSince1970: 1596043684),
status: .edited,
collection: userCollection3
)
]
#endif
struct PostStatusBadge_LocalDraftPreviews: PreviewProvider {
static var previews: some View {
userCollection1.title = "Collection 1"
- PostStatusBadgeView(post: testPostData[2])
+ return PostStatusBadgeView(post: testPostData[2])
}
}
struct PostStatusBadge_EditedPreviews: PreviewProvider {
static var previews: some View {
userCollection1.title = "Collection 1"
return PostStatusBadgeView(post: testPostData[1])
}
}
struct PostStatusBadge_PublishedPreviews: PreviewProvider {
static var previews: some View {
PostStatusBadgeView(post: testPostData[0])
}
}
diff --git a/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist b/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist
index 6cd8075..2723ebe 100644
--- a/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -1,19 +1,19 @@
<?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>SchemeUserState</key>
<dict>
<key>WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>1</integer>
+ <integer>0</integer>
</dict>
<key>WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>0</integer>
+ <integer>1</integer>
</dict>
</dict>
</dict>
</plist>

File Metadata

Mime Type
text/x-diff
Expires
Sat, Jan 31, 10:20 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3612238

Event Timeline