Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10455567
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
View Options
diff --git a/iOS/Settings/SettingsView.swift b/iOS/Settings/SettingsView.swift
index f4721d7..cfd0211 100644
--- a/iOS/Settings/SettingsView.swift
+++ b/iOS/Settings/SettingsView.swift
@@ -1,95 +1,105 @@
import SwiftUI
struct SettingsView: View {
+
@EnvironmentObject var model: WriteFreelyModel
+ @State private var isShowingAlert = false
private let logger = Logging(for: String(describing: SettingsView.self))
var body: some View {
VStack {
SettingsHeaderView()
Form {
Section(header: Text("Login Details")) {
AccountView()
.withErrorHandling()
}
Section(header: Text("Appearance")) {
PreferencesView(preferences: model.preferences)
}
Section(header: Text("Help and Support")) {
Link("View the Guide", destination: model.howToURL)
Link("Visit the Help Forum", destination: model.helpURL)
Link("Write a Review on the App Store", destination: model.reviewURL)
if #available(iOS 15.0, *) {
VStack(alignment: .leading, spacing: 8) {
Button(
action: didTapGenerateLogPostButton,
label: {
Text("Create Log Post")
}
)
Text("Generates a local post using recent logs. You can share this for troubleshooting.")
.font(.footnote)
.foregroundColor(.secondary)
}
}
}
Section(header: Text("Acknowledgements")) {
VStack {
VStack(alignment: .leading) {
Text("This application makes use of the following open-source projects:")
.padding(.bottom)
Text("• Lora typeface")
.padding(.leading)
Text("• Open Sans typeface")
.padding(.leading)
Text("• Hack typeface")
.padding(.leading)
}
.padding(.bottom)
.foregroundColor(.secondary)
HStack {
Spacer()
Link("View the licenses", destination: model.licensesURL)
Spacer()
}
}
.padding()
}
}
}
+ .alert(isPresented: $isShowingAlert) {
+ Alert(
+ title: Text("Log Post Created"),
+ message: Text("Check your local drafts for app logs from the past 24 hours.")
+ )
+ }
// .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.
}
@available(iOS 15, *)
private func didTapGenerateLogPostButton() {
logger.log("Generating local log post...")
DispatchQueue.main.asyncAfter(deadline: .now()) {
// Unset selected post and collection and navigate to local drafts.
self.model.selectedPost = nil
self.model.selectedCollection = nil
self.model.showAllPosts = false
// Create the new log post.
let newLogPost = model.editor.generateNewLocalPost(withFont: 2)
newLogPost.title = "Logs For Support"
var postBody: [String] = [
"WriteFreely-Multiplatform v\(Bundle.main.appMarketingVersion) (\(Bundle.main.appBuildVersion))",
"Generated \(Date())",
""
]
postBody.append(contentsOf: logger.fetchLogs())
newLogPost.body = postBody.joined(separator: "\n")
+
+ self.isShowingAlert = true
}
logger.log("Generated local log post.")
}
}
struct SettingsView_Previews: PreviewProvider {
static var previews: some View {
SettingsView()
.environmentObject(WriteFreelyModel())
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Jan 31, 2:53 PM (9 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3145800
Attached To
rWFSUI WriteFreely SwiftUI
Event Timeline
Log In to Comment