Skip to content

Commit 75ac9dc

Browse files
author
Momo Ozawa
committed
Merge branch 'trunk' into task/enable-qs-for-existing-users-feature-flag
2 parents 982f632 + 31af38b commit 75ac9dc

File tree

127 files changed

+485
-641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+485
-641
lines changed

Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ PODS:
487487
- WordPressKit (~> 4.18-beta)
488488
- WordPressShared (~> 1.12-beta)
489489
- WordPressUI (~> 1.7-beta)
490-
- WordPressKit (4.52.0-beta.2):
490+
- WordPressKit (4.52.0-beta.3):
491491
- Alamofire (~> 4.8.0)
492492
- CocoaLumberjack (~> 3.4)
493493
- NSObject-SafeExpectations (= 0.0.4)
@@ -603,7 +603,6 @@ DEPENDENCIES:
603603
SPEC REPOS:
604604
https://github.com/wordpress-mobile/cocoapods-specs.git:
605605
- WordPressAuthenticator
606-
- WordPressKit
607606
trunk:
608607
- Alamofire
609608
- AlamofireImage
@@ -641,6 +640,7 @@ SPEC REPOS:
641640
- UIDeviceIdentifier
642641
- WordPress-Aztec-iOS
643642
- WordPress-Editor-iOS
643+
- WordPressKit
644644
- WordPressMocks
645645
- WordPressShared
646646
- WordPressUI
@@ -853,7 +853,7 @@ SPEC CHECKSUMS:
853853
WordPress-Aztec-iOS: 7d11d598f14c82c727c08b56bd35fbeb7dafb504
854854
WordPress-Editor-iOS: 9eb9f12f21a5209cb837908d81ffe1e31cb27345
855855
WordPressAuthenticator: 5163f732e4e529781f931f158f54b1a1545bc536
856-
WordPressKit: cc1e5b12e92232d977664682ac69110852fc4ce7
856+
WordPressKit: 0defd60331a0b66f09e8892179582814cecb9fdc
857857
WordPressMocks: 6b52b0764d9939408151367dd9c6e8a910877f4d
858858
WordPressShared: 0c4bc5e25765732fcf5d07f28c81970ab28493fb
859859
WordPressUI: c5be816f6c7b3392224ac21de9e521e89fa108ac

RELEASE-NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* [*] Site Settings: we fixed an issue that prevented the site title to be updated when it changed in Site Settings [#18543]
44
* [*] Media Picker: Fixed an issue where the empty state view was being displayed incorrectly. [#18471]
55
* [*] Quick Start: We are now showing a different set of Quick Start tasks for existing sites and new sites. The existing sites checklist includes new tours such as: "Check your notifications" and "Upload photos or videos". [#18395, #18412, #18443, #18471]
6+
* [*] Site Creation: we fixed an issue where the navigation buttons were not scaling when large fonts were selected on the device [#18559]
7+
* [*] Widgets: we fixed an issue where text appeared flipped in rtl languages [#18567]
68

79
19.8
810
-----

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ private extension DashboardPromptsCardCell {
359359
self?.prompt = prompt
360360
self?.didFailLoadingPrompt = false
361361
}, failure: { [weak self] (error) in
362+
self?.prompt = nil
362363
self?.didFailLoadingPrompt = true
363364
DDLogError("Failed fetching blogging prompt: \(String(describing: error))")
364365
})

WordPress/Classes/ViewRelated/Site Creation/Wizard/WizardNavigation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22

33
// MARK: - WizardNavigation
4-
final class WizardNavigation: GutenbergLightNavigationController {
4+
final class WizardNavigation: UINavigationController {
55
private let steps: [WizardStep]
66
private let pointer: WizardNavigationPointer
77

WordPress/Classes/ViewRelated/System/Action Sheet/BloggingPromptsHeaderView.swift

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,21 @@ class BloggingPromptsHeaderView: UIView, NibLoadable {
1818
configureView()
1919
}
2020

21-
@IBAction private func answerPromptTapped(_ sender: Any) {
22-
answerPromptHandler?()
21+
static func view(for prompt: BloggingPrompt?) -> BloggingPromptsHeaderView {
22+
let promptsHeaderView = BloggingPromptsHeaderView.loadFromNib()
23+
promptsHeaderView.configure(prompt)
24+
return promptsHeaderView
2325
}
2426

25-
@IBAction private func shareTapped(_ sender: Any) {
26-
// TODO
27-
}
2827
}
2928

3029
// MARK: - Private methods
3130

3231
private extension BloggingPromptsHeaderView {
3332

33+
// MARK: - Configure View
34+
3435
func configureView() {
35-
// TODO: Hide correct UI based on if prompt is answered
36-
answeredStackView.isHidden = true
3736
configureSpacing()
3837
configureStrings()
3938
configureStyles()
@@ -49,8 +48,6 @@ private extension BloggingPromptsHeaderView {
4948

5049
func configureStrings() {
5150
titleLabel.text = Strings.title
52-
// TODO: Use prompt from backend
53-
promptLabel.text = Strings.examplePrompt
5451
answerPromptButton.titleLabel?.text = Strings.answerButtonTitle
5552
answeredLabel.text = Strings.answeredLabelTitle
5653
shareButton.titleLabel?.text = Strings.shareButtonTitle
@@ -91,6 +88,24 @@ private extension BloggingPromptsHeaderView {
9188
}
9289
}
9390

91+
func configure(_ prompt: BloggingPrompt?) {
92+
promptLabel.text = prompt?.text
93+
94+
let answered = prompt?.answered ?? false
95+
answerPromptButton.isHidden = answered
96+
answeredStackView.isHidden = !answered
97+
}
98+
99+
// MARK: - Button Actions
100+
101+
@IBAction func answerPromptTapped(_ sender: Any) {
102+
answerPromptHandler?()
103+
}
104+
105+
@IBAction func shareTapped(_ sender: Any) {
106+
// TODO
107+
}
108+
94109
// MARK: - Constants
95110

96111
struct Constants {
@@ -102,7 +117,6 @@ private extension BloggingPromptsHeaderView {
102117
}
103118

104119
struct Strings {
105-
static let examplePrompt = NSLocalizedString("Cast the movie of your life.", comment: "Example prompt for blogging prompts in the create new bottom action sheet.")
106120
static let title = NSLocalizedString("Prompts", comment: "Title label for blogging prompts in the create new bottom action sheet.")
107121
static let answerButtonTitle = NSLocalizedString("Answer Prompt", comment: "Title for a call-to-action button in the create new bottom action sheet.")
108122
static let answeredLabelTitle = NSLocalizedString("✓ Answered", comment: "Title label that indicates the prompt has been answered.")

WordPress/Classes/ViewRelated/System/Floating Create Button/CreateButtonCoordinator.swift

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,11 @@ import WordPressFlux
5656
}
5757
}
5858

59-
private lazy var promptsHeaderView: BloggingPromptsHeaderView? = {
60-
let headerView = FeatureFlag.bloggingPrompts.enabled ? BloggingPromptsHeaderView.loadFromNib() : nil
61-
headerView?.answerPromptHandler = { [weak self] in
62-
self?.viewController?.dismiss(animated: true) {
63-
guard let blog = self?.blog else {
64-
return
65-
}
66-
let editor = EditPostViewController(blog: blog, prompt: .examplePrompt)
67-
editor.modalPresentationStyle = .fullScreen
68-
editor.entryPoint = .bloggingPromptsActionSheetHeader
69-
self?.viewController?.present(editor, animated: true)
70-
}
71-
}
72-
return headerView
59+
// TODO: when prompt is used, get prompt from cache so it's using the latest.
60+
private var prompt: BloggingPrompt?
61+
62+
private lazy var bloggingPromptsService: BloggingPromptsService? = {
63+
return BloggingPromptsService(blog: blog)
7364
}()
7465

7566
private weak var noticeContainerView: NoticeContainerView?
@@ -92,6 +83,11 @@ import WordPressFlux
9283
super.init()
9384

9485
listenForQuickStart()
86+
87+
// Only fetch the prompt if it is actually needed, i.e. on the FAB that has multiple actions.
88+
if actions.count > 1 {
89+
fetchBloggingPrompt()
90+
}
9591
}
9692

9793
deinit {
@@ -161,7 +157,7 @@ import WordPressFlux
161157
}
162158

163159
private func actionSheetController(with traitCollection: UITraitCollection) -> UIViewController {
164-
let actionSheetVC = CreateButtonActionSheet(headerView: promptsHeaderView, actions: actions)
160+
let actionSheetVC = CreateButtonActionSheet(headerView: createPromptHeaderView(), actions: actions)
165161
setupPresentation(on: actionSheetVC, for: traitCollection)
166162
return actionSheetVC
167163
}
@@ -302,3 +298,50 @@ extension UserDefaults {
302298
}
303299
}
304300
}
301+
302+
303+
// MARK: - Blogging Prompts Methods
304+
305+
private extension CreateButtonCoordinator {
306+
307+
private func fetchBloggingPrompt() {
308+
309+
// TODO: check for cached prompt first.
310+
311+
guard let bloggingPromptsService = bloggingPromptsService else {
312+
DDLogError("FAB > failed creating BloggingPromptsService instance.")
313+
prompt = nil
314+
return
315+
}
316+
317+
bloggingPromptsService.fetchTodaysPrompt(success: { [weak self] (prompt) in
318+
self?.prompt = prompt
319+
}, failure: { [weak self] (error) in
320+
self?.prompt = nil
321+
DDLogError("FAB > failed fetching blogging prompt: \(String(describing: error))")
322+
})
323+
}
324+
325+
private func createPromptHeaderView() -> BloggingPromptsHeaderView? {
326+
guard FeatureFlag.bloggingPrompts.enabled,
327+
let blog = blog,
328+
let prompt = prompt else {
329+
return nil
330+
}
331+
332+
let promptsHeaderView = BloggingPromptsHeaderView.view(for: prompt)
333+
334+
promptsHeaderView.answerPromptHandler = { [weak self] in
335+
self?.viewController?.dismiss(animated: true) {
336+
// TODO: pass prompt to post editor
337+
let editor = EditPostViewController(blog: blog, prompt: .examplePrompt)
338+
editor.modalPresentationStyle = .fullScreen
339+
editor.entryPoint = .bloggingPromptsActionSheetHeader
340+
self?.viewController?.present(editor, animated: true)
341+
}
342+
}
343+
344+
return promptsHeaderView
345+
}
346+
347+
}

WordPress/WordPress.xcodeproj/project.pbxproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,6 @@
15421542
8BD36E062395CC4400EFFF1C /* MediaEditorOperation+DescriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD36E052395CC4400EFFF1C /* MediaEditorOperation+DescriptionTests.swift */; };
15431543
8BD66ED42787530C00CCD95A /* PostsCardViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD66ED32787530C00CCD95A /* PostsCardViewModel.swift */; };
15441544
8BD66ED52787530C00CCD95A /* PostsCardViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD66ED32787530C00CCD95A /* PostsCardViewModel.swift */; };
1545-
8BD6E34A2477514E009AE97C /* TestContextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD6E3492477514E009AE97C /* TestContextManager.m */; };
15461545
8BD8201924BCCE8600FF25FD /* ReaderWelcomeBanner.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8BD8201824BCCE8600FF25FD /* ReaderWelcomeBanner.xib */; };
15471546
8BD8201B24BCDBFF00FF25FD /* ReaderWelcomeBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD8201A24BCDBFF00FF25FD /* ReaderWelcomeBanner.swift */; };
15481547
8BD8201D24BF9E5200FF25FD /* ReaderWelcomeBannerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD8201C24BF9E5200FF25FD /* ReaderWelcomeBannerTests.swift */; };
@@ -6311,8 +6310,6 @@
63116310
8BD36E012395CAEA00EFFF1C /* MediaEditorOperation+Description.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MediaEditorOperation+Description.swift"; sourceTree = "<group>"; };
63126311
8BD36E052395CC4400EFFF1C /* MediaEditorOperation+DescriptionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MediaEditorOperation+DescriptionTests.swift"; sourceTree = "<group>"; };
63136312
8BD66ED32787530C00CCD95A /* PostsCardViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostsCardViewModel.swift; sourceTree = "<group>"; };
6314-
8BD6E3492477514E009AE97C /* TestContextManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestContextManager.m; sourceTree = "<group>"; };
6315-
8BD6E34B24775164009AE97C /* TestContextManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestContextManager.h; sourceTree = "<group>"; };
63166313
8BD8201724BC93B500FF25FD /* WordPress 98.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "WordPress 98.xcdatamodel"; sourceTree = "<group>"; };
63176314
8BD8201824BCCE8600FF25FD /* ReaderWelcomeBanner.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ReaderWelcomeBanner.xib; sourceTree = "<group>"; };
63186315
8BD8201A24BCDBFF00FF25FD /* ReaderWelcomeBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderWelcomeBanner.swift; sourceTree = "<group>"; };
@@ -14208,8 +14205,6 @@
1420814205
4A17C1A3281A823E0001FFE5 /* NSManagedObject+Fixture.swift */,
1420914206
93E9050519E6F3D8005513C9 /* ContextManagerMock.h */,
1421014207
93E9050619E6F3D8005513C9 /* ContextManagerMock.m */,
14211-
8BD6E34B24775164009AE97C /* TestContextManager.h */,
14212-
8BD6E3492477514E009AE97C /* TestContextManager.m */,
1421314208
933D1F451EA64108009FB462 /* TestingAppDelegate.h */,
1421414209
933D1F461EA64108009FB462 /* TestingAppDelegate.m */,
1421514210
933D1F6B1EA7A3AB009FB462 /* TestingMode.storyboard */,
@@ -19730,7 +19725,6 @@
1973019725
E135965D1E7152D1006C6606 /* RecentSitesServiceTests.swift in Sources */,
1973119726
D88A64AC208D9B09008AE9BC /* StockPhotosPageableTests.swift in Sources */,
1973219727
40C403F82215D88100E8C894 /* TopViewedStatsTests.swift in Sources */,
19733-
8BD6E34A2477514E009AE97C /* TestContextManager.m in Sources */,
1973419728
59ECF87B1CB7061D00E68F25 /* PostSharingControllerTests.swift in Sources */,
1973519729
E157D5E01C690A6C00F04FB9 /* ImmuTableTestUtils.swift in Sources */,
1973619730
40C403EE2215CE9500E8C894 /* SearchResultsStatsRecordValueTests.swift in Sources */,

WordPress/WordPressStatsWidgets/Views/Cards/FlexibleCard.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ struct FlexibleCard: View {
6262
Spacer()
6363
titleView
6464
}
65-
.flipsForRightToLeftLayoutDirection(true)
6665
}
6766
}
6867
}

WordPress/WordPressStatsWidgets/Views/Cards/ListRow.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ struct ListRow: View {
8080
.frame(height: rowHeight)
8181
.offset(x: 0, y: Constants.verticalCenteringOffset) // each row isn't _quite_ centered vertically
8282
// and we're not entirely sure why yet, but this fixes it
83-
.flipsForRightToLeftLayoutDirection(true)
8483
}
8584
}
8685

WordPress/WordPressStatsWidgets/Views/Cards/VerticalCard.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ struct VerticalCard: View {
3030
.accessibility(label: accessibilityLabel)
3131

3232
}
33-
.flipsForRightToLeftLayoutDirection(true)
3433
}
3534
}
3635

0 commit comments

Comments
 (0)