Page MenuHomeMusing Studio

No OneTemporary

diff --git a/Shared/PostCollection/CollectionListView.swift b/Shared/PostCollection/CollectionListView.swift
index 1f65af6..e8e50e9 100644
--- a/Shared/PostCollection/CollectionListView.swift
+++ b/Shared/PostCollection/CollectionListView.swift
@@ -1,44 +1,48 @@
import SwiftUI
struct CollectionListView: View {
@EnvironmentObject var model: WriteFreelyModel
@Environment(\.managedObjectContext) var moc
@FetchRequest(
entity: WFACollection.entity(),
sortDescriptors: [NSSortDescriptor(keyPath: \WFACollection.title, ascending: true)]
) var collections: FetchedResults<WFACollection>
var body: some View {
List {
NavigationLink(destination: PostListView(selectedCollection: nil, showAllPosts: true)) {
Text("All Posts")
}
- NavigationLink(destination: PostListView(selectedCollection: nil, showAllPosts: false)) {
- Text(model.account.server == "https://write.as" ? "Anonymous" : "Drafts")
- }
- Section(header: Text("Your Blogs")) {
- ForEach(collections, id: \.alias) { collection in
- NavigationLink(
- destination: PostListView(selectedCollection: collection, showAllPosts: false)
- ) {
- Text(collection.title)
+ if model.account.isLoggedIn {
+ NavigationLink(destination: PostListView(selectedCollection: nil, showAllPosts: false)) {
+ Text(model.account.server == "https://write.as" ? "Anonymous" : "Drafts")
+ }
+ Section(header: Text("Your Blogs")) {
+ ForEach(collections, id: \.alias) { collection in
+ NavigationLink(
+ destination: PostListView(selectedCollection: collection, showAllPosts: false)
+ ) {
+ Text(collection.title)
+ }
}
}
}
}
- .navigationTitle("Collections")
+ .navigationTitle(
+ model.account.isLoggedIn ? "\(URL(string: model.account.server)?.host ?? "WriteFreely")" : "WriteFreely"
+ )
.listStyle(SidebarListStyle())
}
}
-struct CollectionListView_Previews: PreviewProvider {
+struct CollectionListView_LoggedOutPreviews: PreviewProvider {
static var previews: some View {
let context = LocalStorageManager.persistentContainer.viewContext
let model = WriteFreelyModel()
return CollectionListView()
.environment(\.managedObjectContext, context)
.environmentObject(model)
}
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Apr 25, 12:28 AM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3214760

Event Timeline