Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from master to bring release v1.0 to develop #660

Merged
merged 27 commits into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d9b9e17
Refactor app initialization for i18n
koke Feb 22, 2019
904c218
Group initialization logic into the index file
Tug Feb 22, 2019
05924b7
Update gutenberg ref
Tug Feb 22, 2019
89aff48
Hide requiring cycle warning in the UI
Tug Feb 22, 2019
ccc511c
Merge branch 'develop' into issue/fix-i18n-initialization-priority
koke Feb 22, 2019
6130a1e
Revert Gutenberg update
koke Feb 22, 2019
48f0049
Fix test initialization
koke Feb 22, 2019
11b5115
Instantiate root component so Gutenberg gets set up
koke Feb 22, 2019
fc5197e
Create setupApp function to be called in the tests
Tug Feb 22, 2019
5d4e166
Make sure the locale is set before we setup gutenberg
Tug Feb 22, 2019
be46760
Rename setupApp to bootstrapEditor
Tug Feb 22, 2019
11c8c72
Merge pull request #651 from wordpress-mobile/issue/fix-i18n-initiali…
hypest Feb 22, 2019
b9b7146
Updated bundles
koke Feb 22, 2019
1142f75
Update Aztec iOS version.
SergioEstevao Feb 22, 2019
da5dccb
Update react-native-aztec version.
SergioEstevao Feb 22, 2019
e6fd73b
Bump version number to 1.0.0
hypest Feb 22, 2019
7f26e47
Updated gutenberg submodule
marecar3 Feb 22, 2019
d0cb028
Fix title padding on Android (#655)
pinarol Feb 22, 2019
728c51c
Merge branch 'release/1.0' into fix/revert_wrong_format_image_color
marecar3 Feb 22, 2019
8deb2b8
Updated gutenberg submodule
marecar3 Feb 22, 2019
576d39a
Merge pull request #657 from wordpress-mobile/fix/revert_wrong_format…
hypest Feb 22, 2019
414293f
Merge branch 'release/1.0' into 1.0-bundles
hypest Feb 22, 2019
45087b1
Updated JS bundle files
hypest Feb 22, 2019
78c8cf6
Merge pull request #654 from wordpress-mobile/1.0-bundles
hypest Feb 22, 2019
364da47
Update to latest GB hash for the v1.0.0 release
hypest Feb 22, 2019
6208cea
Update to merged GB hash
hypest Feb 22, 2019
a08b936
Revert "Update to merged GB hash"
hypest Feb 22, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,685 changes: 842 additions & 843 deletions bundle/android/App.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/android/App.js.map

Large diffs are not rendered by default.

1,703 changes: 851 additions & 852 deletions bundle/ios/App.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/ios/App.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @flow
* @format */

import { setupApp } from './src';
import { registerApp } from './src';

setupApp();
registerApp();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg-mobile",
"version": "0.3.5",
"version": "1.0.0",
"private": true,
"config": {
"jsfiles": "./*.js src/*.js src/**/*.js src/**/**/*.js",
Expand Down
2 changes: 1 addition & 1 deletion react-native-aztec/ios/Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "wordpress-mobile/AztecEditor-iOS" ~> 1.4
github "wordpress-mobile/AztecEditor-iOS" ~> 1.4.3

2 changes: 1 addition & 1 deletion react-native-aztec/ios/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "wordpress-mobile/AztecEditor-iOS" "1.4.2"
github "wordpress-mobile/AztecEditor-iOS" "1.4.3"
2 changes: 1 addition & 1 deletion react-native-aztec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-aztec",
"version": "0.1.5",
"version": "0.1.6",
"license": "GPL-2.0",
"scripts": {
"install-aztec-ios": "cd ./ios && carthage bootstrap --platform iOS --cache-builds",
Expand Down
36 changes: 0 additions & 36 deletions src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,16 @@

import React from 'react';

// Gutenberg imports
import { setLocaleData } from '@wordpress/i18n';

import AppContainer from './AppContainer';
import initialHtml from './initial-html';

import { getTranslation } from '../../i18n-cache';

type PropsType = {
initialData: string,
initialHtmlModeEnabled: boolean,
initialTitle: string,
locale: string,
translations: mixed,
};

export default class AppProvider extends React.Component<PropsType> {
constructor( props: PropsType ) {
super( props );

this.setLocale( props.locale );
}

componentDidUpdate( prevProps: PropsType ) {
if ( prevProps.locale !== this.props.locale ) {
this.setLocale( this.props.locale );
}
}

setLocale( locale: ?string ) {
const translationsFromParentApp = this.props.translations;
let gutenbergTranslations = getTranslation( locale );
if ( locale && ! gutenbergTranslations ) {
// Try stripping out the regional
locale = locale.replace( /[-_][A-Za-z]+$/, '' );
gutenbergTranslations = getTranslation( locale );
}
const translations = Object.assign( {}, gutenbergTranslations, translationsFromParentApp );
// eslint-disable-next-line no-console
console.log( 'locale', locale, translations );
// Only change the locale if it's supported by gutenberg
if ( gutenbergTranslations || translationsFromParentApp ) {
setLocaleData( translations );
}
}

render() {
const { initialHtmlModeEnabled } = this.props;
let initialData = this.props.initialData;
Expand Down
4 changes: 2 additions & 2 deletions src/app/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import renderer from 'react-test-renderer';

import { setupApp } from '..';
import { bootstrapEditor } from '..';
import App from './App';
import BlockHolder from '../block-management/block-holder';
import { dispatch, select } from '@wordpress/data';

describe( 'App', () => {
beforeAll( setupApp );
beforeAll( bootstrapEditor );

it( 'renders without crashing', () => {
const app = renderer.create( <App /> );
Expand Down
55 changes: 48 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// External dependencies
import { AppRegistry, I18nManager } from 'react-native';
import { AppRegistry, I18nManager, YellowBox } from 'react-native';
import React from 'react';

// Setting up environment
import './globals';
import { getTranslation } from '../i18n-cache';
import { setLocaleData } from '@wordpress/i18n';

const gutenbergSetup = () => {
const apiFetch = require( '@wordpress/api-fetch' ).default;
const wpData = require( '@wordpress/data' );

I18nManager.forceRTL( false ); // Change to `true` to debug RTL layout easily.

// wp-api-fetch
apiFetch.use( apiFetch.createRootURLMiddleware( 'https://public-api.wordpress.com/' ) );

Expand Down Expand Up @@ -42,10 +43,50 @@ const editorSetup = () => {
}
};

export function setupApp() {
const setupLocale = ( locale, extraTranslations ) => {
I18nManager.forceRTL( false ); // Change to `true` to debug RTL layout easily.

let gutenbergTranslations = getTranslation( locale );
if ( locale && ! gutenbergTranslations ) {
// Try stripping out the regional
locale = locale.replace( /[-_][A-Za-z]+$/, '' );
gutenbergTranslations = getTranslation( locale );
}
const translations = Object.assign( {}, gutenbergTranslations, extraTranslations );
// eslint-disable-next-line no-console
console.log( 'locale', locale, translations );
// Only change the locale if it's supported by gutenberg
if ( gutenbergTranslations || extraTranslations ) {
setLocaleData( translations );
}
};

export class RootComponent extends React.Component {
constructor( props ) {
super( props );
setupLocale( props.locale, props.translations );
bootstrapEditor();
}

render() {
// eslint-disable-next-line no-unused-vars
const { locale, translations, ...otherProps } = this.props;
// Need to wait for everything to be setup before requiring our App
const App = require( './app/App' ).default;
return (
<App { ...otherProps } />
);
}
}

export function registerApp() {
// Disable require circle warnings showing up in the app (they will still be visible in the console)
YellowBox.ignoreWarnings( [ 'Require cycle:' ] );

AppRegistry.registerComponent( 'gutenberg', () => RootComponent );
}

export function bootstrapEditor() {
gutenbergSetup();
editorSetup();

// Making sure the environment is set up before loading any Component
AppRegistry.registerComponent( 'gutenberg', () => require( './app/App' ).default );
}
2 changes: 2 additions & 0 deletions src/variables.android.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
// Fonts
$default-monospace-font: monospace;
$default-regular-font: serif;
$title-block-padding-top: 0;
$title-block-padding-bottom: 0;
2 changes: 2 additions & 0 deletions src/variables.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
// Fonts
$default-monospace-font: courier;
$default-regular-font: 'Noto Serif';
$title-block-padding-top: 12;
$title-block-padding-bottom: 12;