-
Notifications
You must be signed in to change notification settings - Fork 46
Adds WhatsNew to Settings, displaying content from a Markdown file in project #172
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,4 +81,3 @@ extension AWSTweet { | |
userVerified: false) | ||
] | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,28 @@ class SettingsViewModel: ObservableObject { | |
} | ||
.resume() | ||
} | ||
|
||
func getStringFromBundle() -> String { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rename this to be more specific that this is only for getting the |
||
if let filepath = Bundle.main.path(forResource: "whatsnew", ofType: "md") { | ||
do { | ||
let string = try String(contentsOfFile: filepath) | ||
return string | ||
} catch { | ||
print("string could not be loaded") | ||
} | ||
} else { | ||
print("whatsnew.md not found in app bundle") | ||
} | ||
return "" | ||
} | ||
|
||
func createAttributedString(plainString: String) -> AttributedString { | ||
do { | ||
let newString = try AttributedString(markdown: plainString, options: AttributedString.MarkdownParsingOptions(interpretedSyntax: .inlineOnlyPreservingWhitespace)) | ||
return newString | ||
} catch { | ||
print("Error creating AttributedString: \(error)") | ||
} | ||
return "" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,15 @@ struct SettingsView<ViewModel: InfoViewModel>: View { | |
} | ||
} | ||
} | ||
|
||
Section(header: Text("Updates")) { | ||
NavigationLink { | ||
WhatsNewView(viewModel: viewModel) | ||
} label: { | ||
HStack { | ||
Text("What's New") | ||
} | ||
} | ||
} | ||
Comment on lines
+40
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you fix the indentation here? Also the |
||
Section(header: Text("Appearance")) { | ||
NavigationLink { | ||
AppIconListView(appIconSettings: appIconSettings) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// WhatsNewView.swift | ||
// brain-marks | ||
// | ||
// Created by Susannah Skyer Gupta on 10/26/22. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct WhatsNewView: View { | ||
@StateObject var viewModel: SettingsViewModel | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be an |
||
|
||
var body: some View { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also add a navigation title to this screen, just "What's New" is fine! |
||
let plainString = viewModel.getStringFromBundle() | ||
let attributedString = viewModel.createAttributedString(plainString: plainString) | ||
Text(attributedString) | ||
.padding() | ||
Spacer() | ||
} | ||
Comment on lines
+13
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you put this into a A better way to this would be to have a function called This also makes it so you can make Lastly instead of returning a blank string, you could return an error message saying like "Problem with file" idk haha something useful, otherwise an empty string is weird |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
**v1.2** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine, if you don't want to change it, but I'd prefer for the version numbers to be like this |
||
* Delightful updates arriving soon! | ||
|
||
**v1.1** | ||
* Fix add folder and add tweet button not working in iOS 15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the deployment target changed to
iOS 15.0
?