Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…g-mobile into issue/167-merge-refresh-android

* 'master' of https://github.com/wordpress-mobile/gutenberg-mobile: (35 commits)
  Point to latest from RecyclerViewList
  Point to latest react-native-aztec
  Adding yarn.lock field for `turbo-combine-reducers`.
  Added turbo-combine-reducers dependency to fix failed builds
  Update subrepo ref to point to master again
  Update subrepo ref
  No need for change of default Jest platform
  Update subrepo ref
  Update subrepo ref to point to master again
  Update subrepo ref
  Update subrepo ref
  Update subrepo ref
  Update subrepo ref
  Add symlink in symlinked-packages-in-parent for notices
  Add symlink for notices package to fix the failing CI tests
  Update subrepo by merging from master
  Add support for nextpage block
  Fix lint warnings
  Mocking `react-native-gutenberg-bridge` to make iOS tests pass. From: jestjs/jest#2208 (comment)
  rn-gutenberg-bridge: Adding dumb iOS implementation to avoid errors.
  ...
  • Loading branch information
daniloercoli committed Nov 1, 2018
2 parents 312f253 + 0c26ca9 commit 4553a39
Show file tree
Hide file tree
Showing 34 changed files with 705 additions and 15 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 26
buildToolsVersion "28.0.2"
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.gutenberg"
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function( api ) {
],
plugins: [
'react-require',
'@babel/plugin-transform-async-to-generator',
/*'@babel/plugin-transform-async-to-generator',*/ /* <--- commented out to make the wpandroid release build work */
'@babel/plugin-proposal-async-generator-functions',
'@babel/plugin-transform-runtime',
'react-native-classname-to-style',
Expand Down
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 381 files
30 changes: 30 additions & 0 deletions ios/gutenberg.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
2DCD954D1E0B4F2C00145EB5 /* gutenbergTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* gutenbergTests.m */; };
2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
7E4C21212187419000EC7F49 /* libRNReactNativeGutenbergBridge.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E4C211D2187417100EC7F49 /* libRNReactNativeGutenbergBridge.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
8C666FF0C9224FB88C2C0447 /* libRNSVG-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BFAFEB337654221B2F14D03 /* libRNSVG-tvOS.a */; };
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
Expand Down Expand Up @@ -304,6 +305,13 @@
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTLinking;
};
7E4C211C2187417100EC7F49 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 7E4C20F32187417100EC7F49 /* RNReactNativeGutenbergBridge.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RNReactNativeGutenbergBridge;
};
832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
Expand Down Expand Up @@ -378,6 +386,7 @@
3ADEFEC092CF4D00BEF1019E /* libRNTAztecView.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNTAztecView.a; sourceTree = "<group>"; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
7E4C20F32187417100EC7F49 /* RNReactNativeGutenbergBridge.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNReactNativeGutenbergBridge.xcodeproj; path = "../react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
9B18D59B9364468890D0E546 /* RNSVG.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNSVG.xcodeproj; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = "<group>"; };
9BFAFEB337654221B2F14D03 /* libRNSVG-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNSVG-tvOS.a"; sourceTree = "<group>"; };
Expand All @@ -404,6 +413,7 @@
buildActionMask = 2147483647;
files = (
F1289ECB2100E4320091E81D /* Aztec.framework in Frameworks */,
7E4C21212187419000EC7F49 /* libRNReactNativeGutenbergBridge.a in Frameworks */,
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */,
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */,
146834051AC3E58100842450 /* libReact.a in Frameworks */,
Expand Down Expand Up @@ -593,9 +603,18 @@
name = Products;
sourceTree = "<group>";
};
7E4C20F42187417100EC7F49 /* Products */ = {
isa = PBXGroup;
children = (
7E4C211D2187417100EC7F49 /* libRNReactNativeGutenbergBridge.a */,
);
name = Products;
sourceTree = "<group>";
};
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
7E4C20F32187417100EC7F49 /* RNReactNativeGutenbergBridge.xcodeproj */,
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */,
146833FF1AC3E56700842450 /* React.xcodeproj */,
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
Expand Down Expand Up @@ -849,6 +868,10 @@
ProductGroup = 146834001AC3E56700842450 /* Products */;
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = 7E4C20F42187417100EC7F49 /* Products */;
ProjectRef = 7E4C20F32187417100EC7F49 /* RNReactNativeGutenbergBridge.xcodeproj */;
},
{
ProductGroup = FFEDF6EF21241BDF007FCC6D /* Products */;
ProjectRef = 9B18D59B9364468890D0E546 /* RNSVG.xcodeproj */;
Expand Down Expand Up @@ -1114,6 +1137,13 @@
remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
7E4C211D2187417100EC7F49 /* libRNReactNativeGutenbergBridge.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNReactNativeGutenbergBridge.a;
remoteRef = 7E4C211C2187417100EC7F49 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if ( process.env.TEST_RN_PLATFORM ) {
module.exports = {
verbose: true,
preset: 'react-native',
setupFiles: [ './jest/setup.js' ],
testEnvironment: 'jsdom',
testPathIgnorePatterns: [
'/node_modules/',
Expand Down
7 changes: 7 additions & 0 deletions jest/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
jest.mock( '../react-native-gutenberg-bridge', () => {
return {
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
subscribeParentGetHtml: jest.fn(),
};
} );
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"start:debug": "node --inspect-brk node_modules/.bin/react-native start",
"start:inside-gb:debug": "node --inspect-brk node_modules/.bin/react-native start:inside-gb",
"android": "react-native run-android",
"wpandroid": "yarn android --root wpandroidlink --variant wasabiDebug --appIdSuffix beta --appFolder WordPress --main-activity=ui.WPLaunchActivity",
"preios": "yarn preios:carthage",
"preios:carthage": "cd react-native-aztec && yarn install-aztec-ios",
"ios": "react-native run-ios",
Expand All @@ -71,8 +72,8 @@
"clean:metro": "rm -rf $TMPDIR/metro-cache-*;",
"clean:react": "rm -rf $TMPDIR/react-*",
"clean:node": "rm -rf node_modules",
"clean:watchman": "command -v watchman >/dev/null 2>&1 && watchman watch-del-all; true",
"clean:babel-cache": "rm -rf ./node_modules/.cache/babel-loader/*",
"clean:watchman": "command -v watchman >/dev/null 2>&1 && watchman watch-del-all; true",
"clean:babel-cache": "rm -rf ./node_modules/.cache/babel-loader/*",
"lint": "eslint . --ext .js",
"lint:fix": "yarn lint --fix"
},
Expand All @@ -93,13 +94,15 @@
"react": "16.5.0",
"react-native": "0.57.1",
"react-native-modal": "^6.5.0",
"react-native-recyclerview-list": "git+https://github.com/wordpress-mobile/react-native-recyclerview-list.git#c073c0335ebe0398c85648ffeb11cbed4ee79229",
"react-native-recyclerview-list": "git+https://github.com/wordpress-mobile/react-native-recyclerview-list.git#336f7159eb6e7bad467c041b3f34667d485e7b58",
"react-native-svg": "^6.5.2",
"react-native-hr": "git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"rememo": "^3.0.0",
"shallowequal": "^1.0.2",
"simple-html-tokenizer": "^0.5.1",
"tinycolor2": "^1.4.1"
"tinycolor2": "^1.4.1",
"turbo-combine-reducers": "^1.0.2"
}
}
1 change: 1 addition & 0 deletions react-native-gutenberg-bridge/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
46 changes: 46 additions & 0 deletions react-native-gutenberg-bridge/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

# OSX
#
.DS_Store

# node.js
#
node_modules/
npm-debug.log
yarn-error.log


# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace


# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# BUCK
buck-out/
\.buckd/
*.keystore

44 changes: 44 additions & 0 deletions react-native-gutenberg-bridge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

# react-native-gutenberg-bridge

## Getting started

`$ npm install react-native-gutenberg-bridge --save`

### Mostly automatic installation

`$ react-native link react-native-gutenberg-bridge`

### Manual installation


#### iOS

1. In XCode, in the project navigator, right click `Libraries``Add Files to [your project's name]`
2. Go to `node_modules``react-native-gutenberg-bridge` and add `RNReactNativeGutenbergBridge.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNReactNativeGutenbergBridge.a` to your project's `Build Phases``Link Binary With Libraries`
4. Run your project (`Cmd+R`)<

#### Android

1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import com.reactlibrary.RNReactNativeGutenbergBridgePackage;` to the imports at the top of the file
- Add `new RNReactNativeGutenbergBridgePackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-gutenberg-bridge'
project(':react-native-gutenberg-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gutenberg-bridge/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-gutenberg-bridge')
```

## Usage
```javascript
import RNReactNativeGutenbergBridge from 'react-native-gutenberg-bridge';

// TODO: What to do with the module?
RNReactNativeGutenbergBridge;
```

36 changes: 36 additions & 0 deletions react-native-gutenberg-bridge/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

buildscript {
repositories {
jcenter()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'com.facebook.react:react-native:+'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.wordpress.mobile.ReactNativeGutenbergBridge">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.wordpress.mobile.ReactNativeGutenbergBridge;

public interface GutenbergBridgeJS2Parent {
void responseHtml(String html);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.wordpress.mobile.ReactNativeGutenbergBridge;

import android.support.annotation.Nullable;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;

public class RNReactNativeGutenbergBridgeModule extends ReactContextBaseJavaModule {
private final ReactApplicationContext mReactContext;
private final GutenbergBridgeJS2Parent mGutenbergBridgeJS2Parent;

public RNReactNativeGutenbergBridgeModule(ReactApplicationContext reactContext,
GutenbergBridgeJS2Parent gutenbergBridgeJS2Parent) {
super(reactContext);
mReactContext = reactContext;
mGutenbergBridgeJS2Parent = gutenbergBridgeJS2Parent;
}

@Override
public String getName() {
return "RNReactNativeGutenbergBridge";
}

private void emitToJS(String eventName, @Nullable WritableMap data) {
mReactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, data);
}

public void getHtmlFromJS() {
emitToJS("requestGetHtml", null);
}

@ReactMethod
public void provideToNative_Html(String html) {
mGutenbergBridgeJS2Parent.responseHtml(html);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.wordpress.mobile.ReactNativeGutenbergBridge;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class RNReactNativeGutenbergBridgePackage implements ReactPackage {
private GutenbergBridgeJS2Parent mGutenbergBridgeJS2Parent;
private RNReactNativeGutenbergBridgeModule mRNReactNativeGutenbergBridgeModule;

public RNReactNativeGutenbergBridgeModule getRNReactNativeGutenbergBridgeModule() {
return mRNReactNativeGutenbergBridgeModule;
}

public RNReactNativeGutenbergBridgePackage(GutenbergBridgeJS2Parent gutenbergBridgeJS2Parent) {
mGutenbergBridgeJS2Parent = gutenbergBridgeJS2Parent;
}

@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
mRNReactNativeGutenbergBridgeModule = new RNReactNativeGutenbergBridgeModule(reactContext,
mGutenbergBridgeJS2Parent);
return Arrays.<NativeModule>asList(mRNReactNativeGutenbergBridgeModule);
}

@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}
13 changes: 13 additions & 0 deletions react-native-gutenberg-bridge/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @format */

import { NativeModules, NativeEventEmitter } from 'react-native';

const { RNReactNativeGutenbergBridge } = NativeModules;

const gutenbergBridgeEvents = new NativeEventEmitter( RNReactNativeGutenbergBridge );

export function subscribeParentGetHtml( callback ) {
return gutenbergBridgeEvents.addListener( 'requestGetHtml', callback );
}

export default RNReactNativeGutenbergBridge;
Loading

0 comments on commit 4553a39

Please sign in to comment.