From 1b75950eb53d5cd53a442d6592bd36c507afbc08 Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Thu, 29 Dec 2022 09:26:18 -0500 Subject: [PATCH] Revert "Set the post editor font in the updateUIView method (#237)" (#240) This reverts commit d46eb639addb4aa9fb4bcbe267a633ef988d2862. --- CHANGELOG.md | 1 - .../project.pbxproj | 8 ++++---- iOS/PostEditor/MultilineTextView.swift | 15 +++++++-------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e782eb4..2449acf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,7 +46,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [Mac] Fixed a bug where alerts weren't presented for login errors. - [Mac] Fixed some build warnings in the project. - [Mac] Bumped WriteFreely package to v0.3.6 to handle decoding of fractional seconds in dates. -- [iOS] Fixed a bug where posts were always shown in serif, even if the post was published with another font. ## [1.0.13-ios] - 2022-11-13 diff --git a/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj b/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj index de527cf..f8f628e 100644 --- a/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj +++ b/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj @@ -1050,7 +1050,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 693; + CURRENT_PROJECT_VERSION = 691; DEVELOPMENT_TEAM = TPPAB4YBA6; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "ActionExtension-iOS/Info.plist"; @@ -1081,7 +1081,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CODE_SIGN_ENTITLEMENTS = "ActionExtension-iOS/ActionExtension-iOS.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 693; + CURRENT_PROJECT_VERSION = 691; DEVELOPMENT_TEAM = TPPAB4YBA6; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "ActionExtension-iOS/Info.plist"; @@ -1224,7 +1224,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 693; + CURRENT_PROJECT_VERSION = 691; DEVELOPMENT_TEAM = TPPAB4YBA6; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; @@ -1250,7 +1250,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "WriteFreely-MultiPlatform (iOS).entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 693; + CURRENT_PROJECT_VERSION = 691; DEVELOPMENT_TEAM = TPPAB4YBA6; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; diff --git a/iOS/PostEditor/MultilineTextView.swift b/iOS/PostEditor/MultilineTextView.swift index ffffa18..b3afd97 100644 --- a/iOS/PostEditor/MultilineTextView.swift +++ b/iOS/PostEditor/MultilineTextView.swift @@ -17,12 +17,17 @@ private struct UITextViewWrapper: UIViewRepresentable { textField.delegate = context.coordinator textField.isEditable = true + textField.font = UIFont.preferredFont(forTextStyle: .body) textField.isSelectable = true textField.isUserInteractionEnabled = true textField.isScrollEnabled = false textField.backgroundColor = UIColor.clear textField.smartDashesType = .no + let font = textStyle + let fontMetrics = UIFontMetrics(forTextStyle: .largeTitle) + textField.font = fontMetrics.scaledFont(for: font) + if nil != onDone { textField.returnKeyType = .next } @@ -36,14 +41,8 @@ private struct UITextViewWrapper: UIViewRepresentable { uiView.text = self.text } - let font = textStyle - let fontMetrics = UIFontMetrics(forTextStyle: .largeTitle) - uiView.font = fontMetrics.scaledFont(for: font) - - if uiView.window != nil && isEditing { - DispatchQueue.main.async { - uiView.becomeFirstResponder() - } + if uiView.window != nil, isEditing { + uiView.becomeFirstResponder() } UITextViewWrapper.recalculateHeight(view: uiView, result: $calculatedHeight)