Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into issue/darkmode-too…
Browse files Browse the repository at this point in the history
…lbar-buttons
  • Loading branch information
etoledom committed Oct 3, 2019
2 parents baf32b3 + b8e8fe1 commit 717c69d
Show file tree
Hide file tree
Showing 31 changed files with 2,066 additions and 1,786 deletions.
10 changes: 10 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
1.15.0
------
* Fix issue when multiple media selection adds only one image or video block on Android
* Fix issue when force Touch app shortcut doesn't work properly selecting "New Photo Post" on iOS

1.14.0
------
* Fix a bug on iOS 13.0 were tapping on a link opens Safari
* Fix a link editing issue, where trying to add a empty link at the start of another link would remove the existing link.

1.12.0
------
* Add rich text styling to video captions
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-block-insertion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor tests for Block insertion', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-heading.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor tests', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-image.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor Image Block tests', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-lists-end.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor tests for List block (end)', () => {
let driver;
Expand Down
4 changes: 2 additions & 2 deletions __device-tests__/gutenberg-editor-lists.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

xdescribe( 'Gutenberg Editor tests for List block', () => {
describe( 'Gutenberg Editor tests for List block', () => {
let driver;
let editorPage;
let allPassed = true;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-paragraph.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor tests for Paragraph Block', () => {
let driver;
Expand Down
2 changes: 1 addition & 1 deletion __device-tests__/gutenberg-editor-paste.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

describe( 'Gutenberg Editor paste tests', () => {
// skip iOS for now
Expand Down
4 changes: 2 additions & 2 deletions __device-tests__/gutenberg-editor-rotatation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import {
} from './helpers/utils';
import testData from './helpers/test-data';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000;

xdescribe( 'Gutenberg Editor tests', () => {
describe( 'Gutenberg Editor tests', () => {
let driver;
let editorPage;
let allPassed = true;
Expand Down
8 changes: 6 additions & 2 deletions android/app/src/main/java/com/gutenberg/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public void requestMediaPickerFromDeviceCamera(MediaUploadCallback mediaUploadCa
}

@Override
public void requestMediaPickFromDeviceLibrary(MediaUploadCallback mediaUploadCallback, MediaType mediaType) {
public void requestMediaPickFromDeviceLibrary(MediaUploadCallback mediaUploadCallback, Boolean allowMultipleSelection, MediaType mediaType) {
}

@Override
public void requestMediaPickFromMediaLibrary(MediaSelectedCallback mediaSelectedCallback, MediaType mediaType) {
public void requestMediaPickFromMediaLibrary(MediaSelectedCallback mediaSelectedCallback, Boolean allowMultipleSelection, MediaType mediaType) {
}


Expand All @@ -73,6 +73,10 @@ public void requestImageUploadCancel(int mediaId) {
public void editorDidMount(ReadableArray unsupportedBlockNames) {
}

@Override
public void editorDidAutosave() {
}

@Override
public void editorDidEmitLog(String message, LogLevel logLevel) {
switch (logLevel) {
Expand Down
1,709 changes: 873 additions & 836 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,725 changes: 881 additions & 844 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.

23 changes: 17 additions & 6 deletions ios/gutenberg/GutenbergViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class GutenbergViewController: UIViewController {
}

extension GutenbergViewController: GutenbergBridgeDelegate {
func editorDidAutosave() {
print("➡️ Editor Did Autosave")
}

func gutenbergDidLoad() {
gutenberg.setFocusOnTitle()
Expand All @@ -61,7 +64,7 @@ extension GutenbergViewController: GutenbergBridgeDelegate {
print("↳ HTML: \(html)")
}

func gutenbergDidRequestMedia(from source: MediaPickerSource, filter: [MediaFilter]?, with callback: @escaping MediaPickerDidPickMediaCallback) {
func gutenbergDidRequestMedia(from source: MediaPickerSource, filter: [MediaFilter]?, allowMultipleSelection: Bool, with callback: @escaping MediaPickerDidPickMediaCallback) {
guard let currentFilter = filter?.first else {
return
}
Expand All @@ -70,9 +73,17 @@ extension GutenbergViewController: GutenbergBridgeDelegate {
print("Gutenberg did request media picker, passing a sample url in callback")
switch currentFilter {
case .image:
callback(1, "https://cldup.com/cXyG__fTLN.jpg")
if(allowMultipleSelection) {
callback([(1, "https://cldup.com/cXyG__fTLN.jpg"), (3, "https://cldup.com/cXyG__fTLN.jpg")])
} else {
callback([(1, "https://cldup.com/cXyG__fTLN.jpg")])
}
case .video:
callback(2, "https://i.cloudup.com/YtZFJbuQCE.mov")
if(allowMultipleSelection) {
callback([(2, "https://i.cloudup.com/YtZFJbuQCE.mov"), (4, "https://i.cloudup.com/YtZFJbuQCE.mov")])
} else {
callback([(2, "https://i.cloudup.com/YtZFJbuQCE.mov")])
}
default:
break
}
Expand All @@ -87,16 +98,16 @@ extension GutenbergViewController: GutenbergBridgeDelegate {

func gutenbergDidRequestImport(from url: URL, with callback: @escaping MediaPickerDidPickMediaCallback) {
let id = mediaUploadCoordinator.upload(url: url)
callback(id, url.absoluteString)
callback([(id, url.absoluteString)])
}

func pickAndUpload(from source: UIImagePickerController.SourceType, filter: MediaFilter, callback: @escaping MediaPickerDidPickMediaCallback) {
mediaPickCoordinator = MediaPickCoordinator(presenter: self, filter: filter, callback: { (url) in
guard let url = url, let mediaID = self.mediaUploadCoordinator.upload(url: url) else {
callback(nil, nil)
callback([(nil, nil)])
return
}
callback(mediaID, url.absoluteString)
callback([(mediaID, url.absoluteString)])
self.mediaPickCoordinator = nil
} )
mediaPickCoordinator?.pick(from: source)
Expand Down
1 change: 1 addition & 0 deletions jest_ui.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const main = require( './jest.config.js' );

module.exports = {
...main,
timers: 'real',
setupFiles: [],
testMatch: [ '**/__device-tests__/**/*.test.[jt]s?(x)' ],
testPathIgnorePatterns: [
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg-mobile",
"version": "1.11.0",
"version": "1.13.1",
"private": true,
"config": {
"jsfiles": "./*.js src/*.js src/**/*.js src/**/**/*.js",
Expand Down Expand Up @@ -147,8 +147,8 @@
"node-libs-react-native": "^1.0.2",
"node-sass": "^4.12.0",
"react": "16.8.6",
"react-native": "jtreanor/react-native#v0.60.0-patched",
"react-native-dark-mode": "git+https://github.com/wordpress-mobile/react-native-dark-mode.git#f09bf1480e7b34536413ab3300f29e4375edb2c6",
"react-native": "jtreanor/react-native#v0.60.0-patched",
"react-native-dark-mode": "git+https://github.com/wordpress-mobile/react-native-dark-mode.git#f09bf1480e7b34536413ab3300f29e4375edb2c6",
"react-native-hr": "git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3",
"react-native-keyboard-aware-scroll-view": "git+https://github.com/wordpress-mobile/react-native-keyboard-aware-scroll-view.git#gb-v0.8.7",
"react-native-modal": "^6.5.0",
Expand Down
2 changes: 1 addition & 1 deletion react-native-aztec/ios/Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "wordpress-mobile/AztecEditor-iOS" "1.8.1"
github "wordpress-mobile/AztecEditor-iOS" "1.9.0"
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.8.1"
github "wordpress-mobile/AztecEditor-iOS" "1.9.0"
35 changes: 30 additions & 5 deletions react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,23 @@ class RCTAztecView: Aztec.TextView {
}

override func paste(_ sender: Any?) {
let start = selectedRange.location
let end = selectedRange.location + selectedRange.length

let pasteboard = UIPasteboard.general
let text = readText(from: pasteboard) ?? ""
let html = readHTML(from: pasteboard) ?? ""
let imagesURLs = readImages(from: pasteboard)
sendPasteCallback(text: text, html: html, imagesURLs: imagesURLs);
}

override func pasteWithoutFormatting(_ sender: Any?) {
let pasteboard = UIPasteboard.general
let text = readText(from: pasteboard) ?? ""
let imagesURLs = readImages(from: pasteboard)
sendPasteCallback(text: text, html: "", imagesURLs: imagesURLs);
}

private func sendPasteCallback(text: String, html: String, imagesURLs: [String]) {
let start = selectedRange.location
let end = selectedRange.location + selectedRange.length
onPaste?([
"currentContent": cleanHTML(),
"selectionStart": start,
Expand Down Expand Up @@ -570,8 +579,8 @@ class RCTAztecView: Aztec.TextView {
// MARK: UITextView Delegate Methods
extension RCTAztecView: UITextViewDelegate {

func textViewDidChangeSelection(_ textView: UITextView) {
guard isInsertingDictationResult == false else {
func textViewDidChangeSelection(_ textView: UITextView) {
guard isFirstResponder, isInsertingDictationResult == false else {
return
}

Expand Down Expand Up @@ -600,4 +609,20 @@ extension RCTAztecView: UITextViewDelegate {
func textViewDidEndEditing(_ textView: UITextView) {
onBlur?([:])
}

func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
if #available(iOS 13.1, *) {
return false
} else if #available(iOS 13.0.0, *) {
// Sergio Estevao: This shouldn't happen in an editable textView, but it looks we have a system bug in iOS13 so we need this workaround
let position = characterRange.location
textView.selectedRange = NSRange(location: position, length: 0)
textView.typingAttributes = textView.attributedText.attributes(at: position, effectiveRange: nil)
textView.delegate?.textViewDidChangeSelection?(textView)
} else {
return false
}

return false
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
package org.wordpress.mobile.ReactNativeGutenbergBridge;

import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.WritableMap;

import java.util.List;

public interface GutenbergBridgeJS2Parent {
interface RNMedia {
String getUrl();
int getId();
WritableMap toMap();
}

void responseHtml(String title, String html, boolean changed);

void editorDidMount(ReadableArray unsupportedBlockNames);

interface MediaSelectedCallback {
void onMediaSelected(int mediaId, String mediaUrl);
void onMediaSelected(List<RNMedia> mediaList);
}

interface MediaUploadCallback {
void onUploadMediaFileSelected(int mediaId, String mediaUri);
void onUploadMediaFileSelected(List<RNMedia> mediaList);
void onUploadMediaFileClear(int mediaId);
void onMediaFileUploadProgress(int mediaId, float progress);
void onMediaFileUploadSucceeded(int mediaId, String mediaUrl, int serverId);
Expand Down Expand Up @@ -65,9 +74,9 @@ public static MediaType getEnum(String value) {
}
}

void requestMediaPickFromMediaLibrary(MediaSelectedCallback mediaSelectedCallback, MediaType mediaType);
void requestMediaPickFromMediaLibrary(MediaSelectedCallback mediaSelectedCallback, Boolean allowMultipleSelection, MediaType mediaType);

void requestMediaPickFromDeviceLibrary(MediaUploadCallback mediaUploadCallback, MediaType mediaType);
void requestMediaPickFromDeviceLibrary(MediaUploadCallback mediaUploadCallback, Boolean allowMultipleSelection, MediaType mediaType);

void requestMediaPickerFromDeviceCamera(MediaUploadCallback mediaUploadCallback, MediaType mediaType);

Expand All @@ -82,4 +91,6 @@ public static MediaType getEnum(String value) {
void requestImageUploadCancel(int mediaId);

void editorDidEmitLog(String message, LogLevel logLevel);

void editorDidAutosave();
}
Loading

0 comments on commit 717c69d

Please sign in to comment.