Skip to content

Commit

Permalink
Merge branch 'develop' into feature/use_google_login_refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ScoutHarris committed May 22, 2020
2 parents 2a304de + 31716f4 commit e765e14
Show file tree
Hide file tree
Showing 19 changed files with 153 additions and 26 deletions.
4 changes: 3 additions & 1 deletion Podfile
Expand Up @@ -209,7 +209,9 @@ target 'WordPress' do
post_install do
puts 'Patching RCTShadowView to fix nested group block - it could be removed after upgrade to 0.62'
%x(patch Pods/React-Core/React/Views/RCTShadowView.m < patches/react-native+0.61.5.patch)

puts 'Patching RCTActionSheet to add possibility to disable action sheet buttons -
it could be removed once PR with that functionality will be merged into RN'
%x(patch Pods/React-RCTActionSheet/RCTActionSheetManager.m < patches/react-native+0.61.5.patch)

## Convert the 3rd-party license acknowledgements markdown into html for use in the app
require 'commonmarker'
Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Expand Up @@ -730,6 +730,6 @@ SPEC CHECKSUMS:
ZendeskSupportSDK: a87ab1e4badace92c75eb11dc77ede1e995b2adc
ZIPFoundation: 249fa8890597086cd536bb2df5c9804d84e122b0

PODFILE CHECKSUM: 990ce2f4cd5a734d92961bc491c5c61259307730
PODFILE CHECKSUM: 33d363bcf485dfc7dafef75205fe4d5a3639ec69

COCOAPODS: 1.8.4
3 changes: 2 additions & 1 deletion RELEASE-NOTES.txt
Expand Up @@ -17,10 +17,11 @@
* [**] Block editor: Fix the icons and buttons in Gallery, Paragraph, List and MediaText block on RTL mode.
* [**] Block editor: Update page templates to use new blocks.
* [**] Block editor: Fix a crash when uploading new videos on a video block.

* [**] Block Editor: Add support for changing background and text color in Buttons block
* [internal] the "enter your password" screen has navigation changes that can cause regressions. See https://git.io/Jfl1C for full testing details.
* Support the superscript and subscript HTML formatting on the Block Editor and Classic Editor.
* [***] You can now draw on images to annotate them using the Edit image feature in the post editor.
* [*] Fixed a bug on the editors where changing a featured image didn't trigger that the post/page changed.

14.8.1
-----
Expand Down
5 changes: 5 additions & 0 deletions WordPress/Classes/Models/AbstractPost.m
Expand Up @@ -572,6 +572,11 @@ - (BOOL)hasLocalChanges
return YES;
}

if ( ((self.featuredImage != nil) && ![self.featuredImage.objectID isEqual: original.featuredImage.objectID]) ||
(self.featuredImage == nil && self.original.featuredImage != nil) ) {
return YES;
}

return NO;
}

Expand Down
Expand Up @@ -257,7 +257,7 @@ - (void)dealloc

- (id)initWithMeScenePresenter:(id<ScenePresenter>)meScenePresenter
{
self = [super init];
self = [self init];
self.meScenePresenter = meScenePresenter;
return self;
}
Expand Down Expand Up @@ -377,7 +377,7 @@ - (void)viewWillAppear:(BOOL)animated
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if ([self.tabBarController isKindOfClass:[WPTabBarController class]]) {
if ([self.tabBarController isKindOfClass:[WPTabBarController class]] && [Feature enabled:FeatureFlagFloatingCreateButton]) {
[self.createButtonCoordinator showCreateButton];
}
[self createUserActivity];
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Classes/ViewRelated/Cells/PostFeaturedImageCell.m
Expand Up @@ -25,6 +25,8 @@ - (void)setup
{
[self layoutImageView];
_imageLoader = [[ImageLoader alloc] initWithImageView:self.featuredImageView gifStrategy:GIFStrategyLargeGIFs];
self.accessibilityLabel = NSLocalizedString(@"A featured image is set. Tap to change it.", @"Label for image that is set as a feature image for post/page");
self.accessibilityIdentifier = @"CurrentFeaturedImage";
}

- (void)setImageWithURL:(NSURL *)url inPost:(AbstractPost *)post withSize:(CGSize)size
Expand Down
Expand Up @@ -280,6 +280,12 @@ class GutenbergViewController: UIViewController, PostEditor {
verificationPromptHelper?.updateVerificationStatus()
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Handles refreshing controls with state context after options screen is dismissed
editorContentWasUpdated()
}

// MARK: - Functions

private var keyboardShowObserver: Any?
Expand Down
Expand Up @@ -1445,8 +1445,7 @@ - (void)postFeatureImageCell:(PostFeaturedImageCell *)cell didFinishLoadingImage

- (void)updateFeaturedImageCell:(PostFeaturedImageCell *)cell
{
self.featuredImage = cell.image;
cell.accessibilityIdentifier = @"Current Featured Image";
self.featuredImage = cell.image;
NSInteger featuredImageSection = [self.sections indexOfObject:@(PostSettingsSectionFeaturedImage)];
NSIndexSet *featuredImageSectionSet = [NSIndexSet indexSetWithIndex:featuredImageSection];
[self.tableView reloadSections:featuredImageSectionSet withRowAnimation:UITableViewRowAnimationNone];
Expand All @@ -1461,7 +1460,7 @@ - (void)FeaturedImageViewControllerOnRemoveImageButtonPressed:(FeaturedImageView
self.animatedFeaturedImageData = nil;
[self.apost setFeaturedImage:nil];
[self dismissViewControllerAnimated:YES completion:nil];
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:PostSettingsSectionFeaturedImage] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView reloadData];
}

@end
Expand Up @@ -201,17 +201,15 @@ extension ReaderTabView {

private func toggleButtonsView() {
guard let tabItems = tabBar.items as? [ReaderTabItem] else {
return
return
}
// hide/show buttons depending on the selected tab. Do not execute the animation if not necessary.
guard buttonsStackView.isHidden != tabItems[tabBar.selectedIndex].shouldHideButtonsView else {
return
}
UIView.animate(withDuration: Appearance.tabBarAnimationsDuration) {
let shouldHideButtons = tabItems[self.tabBar.selectedIndex].shouldHideButtonsView
self.buttonsStackView.isHidden = shouldHideButtons
self.horizontalDivider.isHidden = shouldHideButtons
}
let shouldHideButtons = tabItems[self.tabBar.selectedIndex].shouldHideButtonsView
self.buttonsStackView.isHidden = shouldHideButtons
self.horizontalDivider.isHidden = shouldHideButtons
}

/// Filter button
Expand Down
Expand Up @@ -83,8 +83,10 @@ import WordPressFlux
}
}

/// Button must be manually shown _after_ adding using `showCreateButton`
@objc func add(to view: UIView, trailingAnchor: NSLayoutXAxisAnchor, bottomAnchor: NSLayoutYAxisAnchor) {
button.translatesAutoresizingMaskIntoConstraints = false
button.isHidden = true

view.addSubview(button)

Expand Down
19 changes: 13 additions & 6 deletions WordPress/Resources/AppStoreStrings.po
Expand Up @@ -38,15 +38,22 @@ msgctxt "app_store_keywords"
msgid "social,network,notes,jetpack,photos,writing,geotagging,media,blog,wordpress,website,blogging,design\n"
msgstr ""

msgctxt "v14.8-whats-new"
msgctxt "v14.9-whats-new"
msgid ""
"There’s never been a better time to use the WordPress app to manage your website — use it while hovering in the doorway of your house waiting for a curb-side delivery, in your living room while sitting six feet away from your roommate, or in the bathroom where you go to get a five minute break from your kids. The possibilities are endless, especially since v14.8 packs more features into the Block editor:\n"
"Here’s what’s new:\n"
"\n"
"With the new Buttons block, you can add multiple buttons in the same row.\n"
"The Cover block includes more uploading options for getting pictures from your device to your site.\n"
"If your image files have captions, the Image block will automatically pre-fill them for you.\n"
"Organization overhaul: We’ve made some changes that’ll let you find what you need faster:\n"
"\n"
"While we were poking around, we fixed a few bugs — whitespace around Text blocks getting removed, Quote blocks that didn’t align properly, and buttons in page templates not displaying correctly on the web. And we gave the screens you see post-login and signup some polish so they look cleaner and feel more consistent within the app.\n"
"Want to start a new post or page? Tap the big pink button, always visible in the My Sites tab.\n"
"Want to edit your profile? Look in the upper right corner.\n"
"Want to find something to read? The Reader tab has a revamped layout for more intuitive searching and filtering.\n"
"Block editor updates: There’s a new Pullquote block, to highlight quotes with more visual emphasis than the regular Quote block. Page templates got an update to make use of the newest blocks, and we fixed up icons in a few blocks that weren’t displaying quite right in RTL mode.\n"
"\n"
"The Button block got more color options for background and text. And there’s support for superscript and subscript HTML formatting (in the Classic editor, too).\n"
"\n"
"Image annotation: With the new “edit image” feature in the editor, you can draw directly on images.\n"
"\n"
"One really great bug fix: Sometimes you’d add a Video block and start uploading a video, and the app would crash. Counterproductive! That doesn’t happen anymore.\n"
msgstr ""

#. translators: This is a standard chunk of text used to tell a user what's new with a release when nothing major has changed.
Expand Down
17 changes: 12 additions & 5 deletions WordPress/Resources/release_notes.txt
@@ -1,7 +1,14 @@
There’s never been a better time to use the WordPress app to manage your website — use it while hovering in the doorway of your house waiting for a curb-side delivery, in your living room while sitting six feet away from your roommate, or in the bathroom where you go to get a five minute break from your kids. The possibilities are endless, especially since v14.8 packs more features into the Block editor:
Here’s what’s new:

With the new Buttons block, you can add multiple buttons in the same row.
The Cover block includes more uploading options for getting pictures from your device to your site.
If your image files have captions, the Image block will automatically pre-fill them for you.
Organization overhaul: We’ve made some changes that’ll let you find what you need faster:

While we were poking around, we fixed a few bugs — whitespace around Text blocks getting removed, Quote blocks that didn’t align properly, and buttons in page templates not displaying correctly on the web. And we gave the screens you see post-login and signup some polish so they look cleaner and feel more consistent within the app.
Want to start a new post or page? Tap the big pink button, always visible in the My Sites tab.
Want to edit your profile? Look in the upper right corner.
Want to find something to read? The Reader tab has a revamped layout for more intuitive searching and filtering.
Block editor updates: There’s a new Pullquote block, to highlight quotes with more visual emphasis than the regular Quote block. Page templates got an update to make use of the newest blocks, and we fixed up icons in a few blocks that weren’t displaying quite right in RTL mode.

The Button block got more color options for background and text. And there’s support for superscript and subscript HTML formatting (in the Classic editor, too).

Image annotation: With the new “edit image” feature in the editor, you can draw directly on images.

One really great bug fix: Sometimes you’d add a Video block and start uploading a video, and the app would crash. Counterproductive! That doesn’t happen anymore.
4 changes: 4 additions & 0 deletions WordPress/WordPress.xcodeproj/project.pbxproj
Expand Up @@ -2242,6 +2242,7 @@
FFC6ADDA1B56F366002F3C84 /* LocalCoreDataService.m in Sources */ = {isa = PBXBuildFile; fileRef = FFC6ADD91B56F366002F3C84 /* LocalCoreDataService.m */; };
FFCB9F4B22A125BD0080A45F /* WPException.m in Sources */ = {isa = PBXBuildFile; fileRef = FFCB9F4A22A125BD0080A45F /* WPException.m */; };
FFD12D5E1FE1998D00F20A00 /* Progress+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD12D5D1FE1998D00F20A00 /* Progress+Helpers.swift */; };
FFD47BDF2474228C00F00660 /* FeaturedImageScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFD47BDE2474228C00F00660 /* FeaturedImageScreen.swift */; };
FFDA7E501B8DF6E500B83C56 /* BlogSiteVisibilityHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = FFDA7E4F1B8DF6E500B83C56 /* BlogSiteVisibilityHelper.m */; };
FFE3B2C71B2E651400E9F1E0 /* WPAndDeviceMediaLibraryDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = FFE3B2C61B2E651400E9F1E0 /* WPAndDeviceMediaLibraryDataSource.m */; };
FFEECFFC2084DE2B009B8CDB /* PostSettingsViewController+FeaturedImageUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFEECFFB2084DE2B009B8CDB /* PostSettingsViewController+FeaturedImageUpload.swift */; };
Expand Down Expand Up @@ -4873,6 +4874,7 @@
FFCB9F4922A125BD0080A45F /* WPException.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WPException.h; sourceTree = "<group>"; };
FFCB9F4A22A125BD0080A45F /* WPException.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WPException.m; sourceTree = "<group>"; };
FFD12D5D1FE1998D00F20A00 /* Progress+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Progress+Helpers.swift"; sourceTree = "<group>"; };
FFD47BDE2474228C00F00660 /* FeaturedImageScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeaturedImageScreen.swift; sourceTree = "<group>"; };
FFDA7E4E1B8DF6E500B83C56 /* BlogSiteVisibilityHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlogSiteVisibilityHelper.h; sourceTree = "<group>"; };
FFDA7E4F1B8DF6E500B83C56 /* BlogSiteVisibilityHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlogSiteVisibilityHelper.m; sourceTree = "<group>"; };
FFE3B2C51B2E651400E9F1E0 /* WPAndDeviceMediaLibraryDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPAndDeviceMediaLibraryDataSource.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -9326,6 +9328,7 @@
CC2BB0C92289CC3B0034F9AB /* BlockEditorScreen.swift */,
CC94FC67221452A4002E5825 /* EditorNoticeComponent.swift */,
CC19BE05223FECAC00CAB3E1 /* EditorPostSettings.swift */,
FFD47BDE2474228C00F00660 /* FeaturedImageScreen.swift */,
);
path = Editor;
sourceTree = "<group>";
Expand Down Expand Up @@ -13719,6 +13722,7 @@
FF2716921CAAC87B0006E2D4 /* LoginTests.swift in Sources */,
F97DA42023D67B820050E791 /* MediaScreen.swift in Sources */,
CC8498D32241477F00DB490A /* TagsComponent.swift in Sources */,
FFD47BDF2474228C00F00660 /* FeaturedImageScreen.swift in Sources */,
BE2B4E9F1FD664F5007AE3E4 /* BaseScreen.swift in Sources */,
CC7CB97A22B15C1000642EE9 /* SignupEpilogueScreen.swift in Sources */,
F5E032EC240D49FF003AF350 /* ActionSheetComponent.swift in Sources */,
Expand Down
30 changes: 30 additions & 0 deletions WordPress/WordPressTest/PostTests.swift
Expand Up @@ -489,4 +489,34 @@ class PostTests: XCTestCase {
XCTAssertNil(post.statusAfterSync)
XCTAssertNil(post.statusAfterSyncString)
}

/// When removing the featured image hasLocalChanges returns true
func testLocalChangesWhenfeaturedImageIsRemoved() {
let post = newTestPost()
post.featuredImage = Media.makeMedia(in: context)
let revision = post.createRevision()
revision.featuredImage = nil

XCTAssertTrue(revision.hasLocalChanges())
}

/// When adding a featured image hasLocalChanges returns true
func testLocalChangesWhenfeaturedImageIsAdded() {
let post = newTestPost()
let revision = post.createRevision()
revision.featuredImage = Media.makeMedia(in: context)

XCTAssertTrue(revision.hasLocalChanges())
}

/// When keeping the featured image hasLocalChanges returns false
func testLocalChangesWhenFeaturedImageIsTheSame() {
let post = newTestPost()
let media = Media.makeMedia(in: context)
post.featuredImage = media
let revision = post.createRevision()
revision.featuredImage = media

XCTAssertFalse(revision.hasLocalChanges())
}
}
Expand Up @@ -6,6 +6,9 @@ class EditorPostSettings: BaseScreen {
let categoriesSection: XCUIElement
let tagsSection: XCUIElement
let featuredImageButton: XCUIElement
var changeFeaturedImageButton: XCUIElement {
return settingsTable.cells["CurrentFeaturedImage"]
}

init() {
let app = XCUIApplication()
Expand Down Expand Up @@ -41,6 +44,14 @@ class EditorPostSettings: BaseScreen {
return TagsComponent()
}

func removeFeatureImage() -> EditorPostSettings {
changeFeaturedImageButton.tap()
FeaturedImageScreen()
.tapRemoveFeaturedImageButton()

return EditorPostSettings()
}

func setFeaturedImage() -> EditorPostSettings {
featuredImageButton.tap()
MediaPickerAlbumListScreen()
Expand All @@ -57,9 +68,11 @@ class EditorPostSettings: BaseScreen {
if let postTag = tag {
XCTAssertTrue(tagsSection.staticTexts[postTag].exists, "Tag \(postTag) not set")
}
let imageCount = settingsTable.images.count
if hasImage {
let imageCount = settingsTable.images.count
XCTAssertTrue(imageCount == 1, "Featured image not set")
} else {
XCTAssertTrue(imageCount == 0, "Featured image is set but should not be")
}

return EditorPostSettings()
Expand Down
@@ -0,0 +1,20 @@
import Foundation
import XCTest

class FeaturedImageScreen: BaseScreen {


let removeButton: XCUIElement

init() {
let app = XCUIApplication()
removeButton = app.navigationBars.buttons["Remove Featured Image"]
super.init(element: removeButton )
}

func tapRemoveFeaturedImageButton() {
removeButton.tap()
app.sheets.buttons.element(boundBy: 0).tap()
}

}
4 changes: 4 additions & 0 deletions WordPress/WordPressUITests/Tests/EditorAztecTests.swift
Expand Up @@ -49,6 +49,10 @@ class EditorAztecTests: XCTestCase {
.addTag(name: tag)
.setFeaturedImage()
.verifyPostSettings(withCategory: category, withTag: tag, hasImage: true)
.removeFeatureImage()
.verifyPostSettings(withCategory: category, withTag: tag, hasImage: false)
.setFeaturedImage()
.verifyPostSettings(withCategory: category, withTag: tag, hasImage: true)
.closePostSettings()
AztecEditorScreen(mode: .rich).publish()
.viewPublishedPost(withTitle: title)
Expand Down
4 changes: 4 additions & 0 deletions WordPress/WordPressUITests/Tests/EditorGutenbergTests.swift
Expand Up @@ -51,6 +51,10 @@ class EditorGutenbergTests: XCTestCase {
.addTag(name: tag)
.setFeaturedImage()
.verifyPostSettings(withCategory: category, withTag: tag, hasImage: true)
.removeFeatureImage()
.verifyPostSettings(withCategory: category, withTag: tag, hasImage: false)
.setFeaturedImage()
.verifyPostSettings(withCategory: category, withTag: tag, hasImage: true)
.closePostSettings()
BlockEditorScreen().publish()
.viewPublishedPost(withTitle: title)
Expand Down
23 changes: 23 additions & 0 deletions patches/react-native+0.61.5.patch
@@ -1,3 +1,26 @@
diff --git a/node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheetManager.m b/node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheetManager.m
index 65fa2bb..c5f265b 100644
--- a/node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheetManager.m
+++ b/node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheetManager.m
@@ -66,6 +66,7 @@ - (void)presentViewController:(UIViewController *)alertController
NSArray<NSString *> *buttons = [RCTConvert NSStringArray:options[@"options"]];
NSInteger cancelButtonIndex = options[@"cancelButtonIndex"] ? [RCTConvert NSInteger:options[@"cancelButtonIndex"]] : -1;
NSArray<NSNumber *> *destructiveButtonIndices;
+ NSArray<NSNumber *> *disabledButtonIndices = [RCTConvert NSArray:options[@"disabledButtonIndices"]];
if ([options[@"destructiveButtonIndex"] isKindOfClass:[NSArray class]]) {
destructiveButtonIndices = [RCTConvert NSArray:options[@"destructiveButtonIndex"]];
} else {
@@ -108,6 +109,10 @@ - (void)presentViewController:(UIViewController *)alertController
callback(@[@(localIndex)]);
}]];

+ if ([disabledButtonIndices containsObject:@(localIndex)]) {
+ [alertController.actions[localIndex] setEnabled:false];
+ }
+
index++;
}

diff --git a/node_modules/react-native/React/Views/RCTShadowView.m b/node_modules/react-native/React/Views/RCTShadowView.m
index 40c0cda..646f137 100644
--- a/node_modules/react-native/React/Views/RCTShadowView.m
Expand Down

0 comments on commit e765e14

Please sign in to comment.