mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Move new-post generation for iOS app to PostEditorModel
This commit is contained in:
parent
e1c5823cd6
commit
4ad076ccab
@ -36,25 +36,7 @@ struct PostListView: View {
|
|||||||
ZStack {
|
ZStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
Button(action: {
|
Button(action: {
|
||||||
let managedPost = WFAPost(context: self.managedObjectContext)
|
let managedPost = model.editor.generateNewLocalPost(withFont: model.preferences.font)
|
||||||
managedPost.createdDate = Date()
|
|
||||||
managedPost.title = ""
|
|
||||||
managedPost.body = ""
|
|
||||||
managedPost.status = PostStatus.local.rawValue
|
|
||||||
managedPost.collectionAlias = nil
|
|
||||||
switch 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
|
|
||||||
//swiftlint:disable:next line_length
|
|
||||||
managedPost.rtl = Locale.characterDirection(forLanguage: languageCode) == .rightToLeft
|
|
||||||
}
|
|
||||||
withAnimation {
|
withAnimation {
|
||||||
self.model.showAllPosts = false
|
self.model.showAllPosts = false
|
||||||
self.model.selectedCollection = nil
|
self.model.selectedCollection = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user