Skip to content

Commit

Permalink
Merge branch 'develop' into color-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak committed Apr 17, 2020
2 parents 4b9528c + fd39dd9 commit 96905a3
Show file tree
Hide file tree
Showing 141 changed files with 3,084 additions and 2,821 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ symlinked-packages
symlinked-packages-in-parent
react-native-aztec
bundle
jetpack
38 changes: 38 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/release_pull_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Release for Gutenberg Mobile v1.XX.Y

## Related PRs

- Gutenberg: https://github.com/WordPress/gutenberg/pull/
- WPAndroid: https://github.com/wordpress-mobile/WordPress-Android/pull/
- WPiOS: https://github.com/wordpress-mobile/WordPress-iOS/pull/

- Aztec-iOS: https://github.com/wordpress-mobile/AztecEditor-iOS/pull/
- Aztec-Android: https://github.com/wordpress-mobile/AztecEditor-Android/pull

## Extra PRs that Landed After the Release Was Cut

- [ ] PR 1
- [ ] PR 2

## Changes
<!-- To determine the changes you can check the RELEASE-NOTES.txt file and cross check with the list of commits that are part of the PR -->

- Change 1
- Change 2

## Test plan

- Use the main WP apps to test the changes above.
- Check WPAndroid and WPiOS PRs if there are specific tests to run.
- Smoke test the main WP apps for [general writing flow](https://github.com/wordpress-mobile/test-cases/tree/master/test-cases/gutenberg/writing-flow).

## Release Submission Checklist

- [ ] Release number was bumped
- [ ] Aztec dependencies are pointing to a stable release
- iOS: 'grep WordPressAztec-iOS RNTAztecView.podspec'
- Android: 'grep aztecVersion react-native-aztec/android/build.gradle'
- [ ] Gutenberg 'Podfile' and 'Podfile.lock' inside './ios/' are updated to the release number
- [ ] Bundle package of the release is updated
- [ ] Check if `RELEASE-NOTES.txt` is updated with all the changes that made it to the release

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "gutenberg"]
path = gutenberg
url = ../../WordPress/gutenberg.git
[submodule "jetpack"]
path = jetpack
url = ../../Automattic/jetpack.git
14 changes: 12 additions & 2 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
1.26.0
------
* [iOS] Disable ripple effect in all BottomSheet's controls.
* [Android] Disable ripple effect for Slider control
* New block: Columns
* New starter page template: Blog
* Make Starter Page Template picker buttons visible only when the screen height is enough
* Fix a bug which caused to show URL settings modal randomly when changing the device orientation multiple times during the time Starter Page Template Preview is open

1.25.0
------
* New block: Cover
* Improve icon on the "Take a Video" media option
* [Android] Dark Mode
* [Android] Improve icon on the "Take a Video" media option
* Removed the dimming effect on unselected blocks
* Enabled edit button over image block for Android
* [iOS] Add alignment options for heading block
* Implemented dropdown toolbar for alignment toolbar in Heading, Paragraph, Image, MediaText blocks
* Block Editor: When editing link settings, tapping the keyboard return button now closes the settings panel as well as closing the keyboard.
* [Android] Show an "Edit" button overlay on selected image blocks

1.24.0
------
Expand Down
56 changes: 56 additions & 0 deletions __device-tests__/gutenberg-editor-latest-posts.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* @format
* */

/**
* Internal dependencies
*/
import EditorPage from './pages/editor-page';
import {
setupDriver,
isLocalEnvironment,
stopDriver,
} from './helpers/utils';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor Latest Post Block tests', () => {
let driver;
let editorPage;
let allPassed = true;

// Use reporter for setting status for saucelabs Job
if ( ! isLocalEnvironment() ) {
const reporter = {
specDone: async ( result ) => {
allPassed = allPassed && result.status !== 'failed';
},
};

jasmine.getEnv().addReporter( reporter );
}

beforeAll( async () => {
driver = await setupDriver();
editorPage = new EditorPage( driver );
} );

it( 'should be able to see visual editor', async () => {
await expect( editorPage.getBlockList() ).resolves.toBe( true );
} );

it( 'should be able to add a Latests-Posts block', async () => {
await editorPage.addNewLatestPostsBlock();
const latestPostsBlock = await editorPage.getLatestPostsBlockAtPosition( 1 );

expect( latestPostsBlock ).toBeTruthy();
await editorPage.removeLatestPostsBlockAtPosition( 1 );
} );

afterAll( async () => {
if ( ! isLocalEnvironment() ) {
driver.sauceJobStatus( allPassed );
}
await stopDriver( driver );
} );
} );
45 changes: 44 additions & 1 deletion __device-tests__/pages/editor-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class EditorPage {
headingBlockName = 'Heading';
imageBlockName = 'Image';
galleryBlockName = 'Gallery';
latestPostsBlockName = 'Latest Posts';
unorderedListButtonName = 'Convert to unordered list';
orderedListButtonName = 'Convert to ordered list';

Expand Down Expand Up @@ -161,8 +162,34 @@ export default class EditorPage {
await addButton.click();

// Click on block of choice
const blockButton = await this.findBlockButton( blockName );
if ( isAndroid() ) {
await blockButton.click();
} else {
await this.driver.execute( 'mobile: tap', { element: blockButton, x: 10, y: 10 } );
}
}

// Attempts to find the given block button in the block inserter control.
async findBlockButton( blockName: string ) {
if ( isAndroid() ) {
// Checks if the Block Button is available, and if not will scroll to the second half of the available buttons.
while ( ! await this.driver.hasElementByAccessibilityId( blockName ) ) {
await this.driver.pressKeycode( 20 ); // Press the Down arrow to force a scroll.
}

return await this.driver.elementByAccessibilityId( blockName );
}

const blockButton = await this.driver.elementByAccessibilityId( blockName );
await blockButton.click();
const size = await this.driver.getWindowSize();
const height = size.height - 5;

while ( ! await blockButton.isDisplayed() ) {
await this.driver.execute( 'mobile: dragFromToForDuration', { fromX: 50, fromY: height, toX: 50, toY: height - 450, duration: 0.5 } );
}

return blockButton;
}

async clickToolBarButton( buttonName: string ) {
Expand Down Expand Up @@ -432,4 +459,20 @@ export default class EditorPage {
const text = await textViewElement.text();
return text.toString();
}

// ============================
// Latest-Posts Block functions
// ============================

async addNewLatestPostsBlock() {
await this.addNewBlock( this.latestPostsBlockName );
}

async getLatestPostsBlockAtPosition( position: number ) {
return this.getBlockAtPosition( position, this.latestPostsBlockName );
}

async removeLatestPostsBlockAtPosition( position: number ) {
return await this.removeBlockAtPosition( position, this.latestPostsBlockName );
}
}
11 changes: 10 additions & 1 deletion android/app/src/main/java/com/gutenberg/MainApplication.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gutenberg;

import android.app.Application;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;

Expand Down Expand Up @@ -126,7 +127,8 @@ public void editorDidEmitLog(String message, LogLevel logLevel) {

@Override
public void performRequest(String path, Consumer<String> onSuccess, Consumer<Bundle> onError) {}
});

}, isDarkMode());

return new ReactNativeHost(this) {
@Override
Expand All @@ -153,6 +155,13 @@ protected String getJSMainModuleName() {
};
}

private boolean isDarkMode() {
Configuration configuration = getResources().getConfiguration();
int currentNightMode = configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK;

return currentNightMode == Configuration.UI_MODE_NIGHT_YES;
}

@Override
public ReactNativeHost getReactNativeHost() {
if (mReactNativeHost == null) {
Expand Down
19 changes: 17 additions & 2 deletions bin/po2android.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ function escapeResourceXML( unsafeXMLValue ) {
} );
}

/**
* Android specifics replacements.
*
* @param {string} XMLValue input to apply replacements.
* @return {string} valid string passing Android linter rules.
*/
function androidReplacements( XMLValue ) {
return XMLValue.replace( /(-|\.\.\.)/gm, function( character ) {
switch ( character ) {
case '-': return '–'; // Android lint rule: TypographyDashes.
case '...': return '…'; // Android lint rule: TypographyEllipsis
}
} );
}

/**
* Generate a unique string identifier to use as the `name` property in our xml.
* Try using the string first by stripping any non-alphanumeric characters and cropping it
Expand Down Expand Up @@ -74,8 +89,8 @@ function po2Android( poInput ) {
return result;
}
const uniqueName = getUniqueName( translation.msgid );
const escapedValue = escapeResourceXML( translation.msgid );
const escapedValuePlural = escapeResourceXML( translation.msgid_plural || '' );
const escapedValue = androidReplacements( escapeResourceXML( translation.msgid ) );
const escapedValuePlural = androidReplacements( escapeResourceXML( translation.msgid_plural || '' ) );
const comment = translation.comments.extracted || '';
let localizedEntry = '';
if ( comment ) {
Expand Down
Loading

0 comments on commit 96905a3

Please sign in to comment.