Page MenuHomeMusing Studio

No OneTemporary

diff --git a/Shared/Navigation/ContentView.swift b/Shared/Navigation/ContentView.swift
index ee33945..426b112 100644
--- a/Shared/Navigation/ContentView.swift
+++ b/Shared/Navigation/ContentView.swift
@@ -1,91 +1,91 @@
import SwiftUI
struct ContentView: View {
@EnvironmentObject var model: WriteFreelyModel
var body: some View {
NavigationView {
SidebarView()
- PostListView(selectedCollection: nil, showAllPosts: true)
+ PostListView(selectedCollection: nil, showAllPosts: model.account.isLoggedIn)
Text("Select a post, or create a new local draft.")
.foregroundColor(.secondary)
}
.onAppear(perform: {
if let lastDraft = self.model.editor.fetchLastDraft() {
model.selectedPost = lastDraft
} else {
let managedPost = WFAPost(context: LocalStorageManager.persistentContainer.viewContext)
managedPost.createdDate = Date()
managedPost.title = ""
managedPost.body = ""
managedPost.status = PostStatus.local.rawValue
switch self.model.preferences.font {
case 1:
managedPost.appearance = "sans"
case 2:
managedPost.appearance = "wrap"
default:
managedPost.appearance = "serif"
}
if let languageCode = Locale.current.languageCode {
managedPost.language = languageCode
managedPost.rtl = Locale.characterDirection(forLanguage: languageCode) == .rightToLeft
}
model.selectedPost = managedPost
}
})
.environmentObject(model)
.alert(isPresented: $model.isPresentingDeleteAlert) {
Alert(
title: Text("Delete Post?"),
message: Text("This action cannot be undone."),
primaryButton: .destructive(Text("Delete"), action: {
if let postToDelete = model.postToDelete {
model.selectedPost = nil
withAnimation {
model.posts.remove(postToDelete)
}
model.postToDelete = nil
}
}),
secondaryButton: .cancel() {
model.postToDelete = nil
}
)
}
.alert(isPresented: $model.isPresentingNetworkErrorAlert, content: {
Alert(
title: Text("Connection Error"),
message: Text("There is no internet connection at the moment. Please reconnect or try again later"),
dismissButton: .default(Text("OK"), action: {
model.isPresentingNetworkErrorAlert = false
})
)
})
#if os(iOS)
EmptyView()
.sheet(
isPresented: $model.isPresentingSettingsView,
onDismiss: { model.isPresentingSettingsView = false },
content: {
SettingsView()
.environmentObject(model)
}
)
#endif
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
let context = LocalStorageManager.persistentContainer.viewContext
let model = WriteFreelyModel()
return ContentView()
.environment(\.managedObjectContext, context)
.environmentObject(model)
}
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Jan 30, 12:38 PM (1 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3610667

Event Timeline