From 4ad076ccabcc301483a6c7a028a060261964e7e5 Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Mon, 25 Jan 2021 13:22:15 -0500 Subject: [PATCH] Move new-post generation for iOS app to PostEditorModel --- Shared/PostList/PostListView.swift | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/Shared/PostList/PostListView.swift b/Shared/PostList/PostListView.swift index 271e4e8..972ad38 100644 --- a/Shared/PostList/PostListView.swift +++ b/Shared/PostList/PostListView.swift @@ -36,25 +36,7 @@ struct PostListView: View { ZStack { Spacer() Button(action: { - let managedPost = WFAPost(context: self.managedObjectContext) - 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 - } + let managedPost = model.editor.generateNewLocalPost(withFont: model.preferences.font) withAnimation { self.model.showAllPosts = false self.model.selectedCollection = nil