From bb017dbc807f962b1052a8f54fb461c764ee66d0 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Mon, 11 Mar 2019 14:50:57 -0300 Subject: [PATCH 01/14] added hook 'blocks.onRemoveBlockCheckUpload' for trashed image block to listen to in-progress image upload blocks being deleted --- gutenberg | 2 +- src/block-management/block-holder.js | 29 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 8f82fd3031..4a88e01ab9 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 8f82fd30315a7bec4054fbd2de7e6fdd29b459c8 +Subproject commit 4a88e01ab9cc3fe6399294ba278e1a8cc662f58c diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index 42fdedf4af..49b28bf028 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -13,8 +13,12 @@ import { } from 'react-native'; import InlineToolbar, { InlineToolbarActions } from './inline-toolbar'; +/** + * WordPress dependencies + */ import { withDispatch, withSelect } from '@wordpress/data'; import { compose } from '@wordpress/compose'; +import { addFilter, removeFilter, hasFilter } from '@wordpress/hooks'; import type { BlockType } from '../store/types'; @@ -61,6 +65,10 @@ export class BlockHolder extends React.Component { }; } + componentWillUnmount() { + this.removeOnRemoveBlockCheckUploadFilter(); + } + onFocus = ( event: NativeSyntheticEvent ) => { if ( event ) { // == Hack for the Alpha == @@ -75,6 +83,24 @@ export class BlockHolder extends React.Component { this.props.onSelect( this.props.clientId ); }; + onRemoveBlockCheckUpload( mediaId, isUploading ) { + if ( isUploading ) { + console.log( " about to send cancel signal for mediaId: " + mediaId ); + // TODO here we will be being passed the mediaId of the Image component being unmounted so, safe to issue the cancel signal + // through the bridge. + } + + // now remove the filter as it won't be needed anymore + this.removeOnRemoveBlockCheckUploadFilter(); + } + + removeOnRemoveBlockCheckUploadFilter() { + // remove filter if still registered + if ( hasFilter( 'blocks.onRemoveBlockCheckUpload' ) ) { + removeFilter( 'blocks.onRemoveBlockCheckUpload', 'gutenberg-mobile/blocks' ); + } + } + onInlineToolbarButtonPressed = ( button: number ) => { switch ( button ) { case InlineToolbarActions.UP: @@ -84,6 +110,9 @@ export class BlockHolder extends React.Component { this.props.moveBlockDown(); break; case InlineToolbarActions.DELETE: + // adding a filter that will exist for as long as it takes for the block to be removed and the component unmounted + // using a namespace that is only valid for the current block id + addFilter( 'blocks.onRemoveBlockCheckUpload', 'gutenberg-mobile/blocks', this.onRemoveBlockCheckUpload ); this.props.removeBlock(); break; } From b7c72c58fac478c066f67e61e5332ecce065def7 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Mon, 11 Mar 2019 15:24:19 -0300 Subject: [PATCH 02/14] fixed filter removal to work from callback function only --- src/block-management/block-holder.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index 49b28bf028..979f76c871 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -12,6 +12,9 @@ import { NativeTouchEvent, } from 'react-native'; import InlineToolbar, { InlineToolbarActions } from './inline-toolbar'; +import { + requestImageUploadCancel, +} from 'react-native-gutenberg-bridge'; /** * WordPress dependencies @@ -65,10 +68,6 @@ export class BlockHolder extends React.Component { }; } - componentWillUnmount() { - this.removeOnRemoveBlockCheckUploadFilter(); - } - onFocus = ( event: NativeSyntheticEvent ) => { if ( event ) { // == Hack for the Alpha == @@ -85,22 +84,17 @@ export class BlockHolder extends React.Component { onRemoveBlockCheckUpload( mediaId, isUploading ) { if ( isUploading ) { - console.log( " about to send cancel signal for mediaId: " + mediaId ); // TODO here we will be being passed the mediaId of the Image component being unmounted so, safe to issue the cancel signal // through the bridge. + // requestImageUploadCancel( mediaId ); } // now remove the filter as it won't be needed anymore - this.removeOnRemoveBlockCheckUploadFilter(); - } - - removeOnRemoveBlockCheckUploadFilter() { - // remove filter if still registered if ( hasFilter( 'blocks.onRemoveBlockCheckUpload' ) ) { removeFilter( 'blocks.onRemoveBlockCheckUpload', 'gutenberg-mobile/blocks' ); } } - + onInlineToolbarButtonPressed = ( button: number ) => { switch ( button ) { case InlineToolbarActions.UP: From 1f3f4cf8005ab581af6c429386956841e913d9d7 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Mon, 11 Mar 2019 15:24:43 -0300 Subject: [PATCH 03/14] fixed hash for gutenberg, unused import --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 4a88e01ab9..7e830fd0ff 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 4a88e01ab9cc3fe6399294ba278e1a8cc662f58c +Subproject commit 7e830fd0ffe956b02c283e0fdc750fa2842530c9 From e4925d90865e022ebfd625898e241fdf6da22598 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Mon, 11 Mar 2019 17:05:16 -0300 Subject: [PATCH 04/14] added bridge functionality to allow JS to request an in-progress media upload to be cancelled --- .../app/src/main/java/com/gutenberg/MainApplication.java | 3 +++ .../GutenbergBridgeJS2Parent.java | 2 ++ .../RNReactNativeGutenbergBridgeModule.java | 5 +++++ .../wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java | 7 +++++++ react-native-gutenberg-bridge/index.js | 4 ++++ src/block-management/block-holder.js | 6 +++--- 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/java/com/gutenberg/MainApplication.java b/android/app/src/main/java/com/gutenberg/MainApplication.java index c918055167..9c69193f88 100644 --- a/android/app/src/main/java/com/gutenberg/MainApplication.java +++ b/android/app/src/main/java/com/gutenberg/MainApplication.java @@ -55,6 +55,9 @@ public void requestImageFailedRetryDialog(int mediaId) {} @Override public void requestImageUploadCancelDialog(int mediaId) {} + @Override + public void requestImageUploadCancel(int mediaId) {} + @Override public void editorDidMount(boolean hasUnsupportedBlocks) {} }) diff --git a/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/GutenbergBridgeJS2Parent.java b/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/GutenbergBridgeJS2Parent.java index 9d193648d9..bb31aeb413 100644 --- a/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/GutenbergBridgeJS2Parent.java +++ b/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/GutenbergBridgeJS2Parent.java @@ -28,4 +28,6 @@ interface MediaUploadCallback { void requestImageFailedRetryDialog(int mediaId); void requestImageUploadCancelDialog(int mediaId); + + void requestImageUploadCancel(int mediaId); } diff --git a/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java b/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java index 8513f3719d..0049b20b91 100644 --- a/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java +++ b/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java @@ -116,6 +116,11 @@ public void requestImageUploadCancelDialog(final int mediaId) { mGutenbergBridgeJS2Parent.requestImageUploadCancelDialog(mediaId); } + @ReactMethod + public void requestImageUploadCancel(final int mediaId) { + mGutenbergBridgeJS2Parent.requestImageUploadCancel(mediaId); + } + private MediaSelectedCallback getNewMediaSelectedCallback(final Callback jsCallback) { return new MediaSelectedCallback() { @Override public void onMediaSelected(int mediaId, String mediaUrl) { diff --git a/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java b/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java index dc3a56fd6d..d614a5ae82 100644 --- a/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java +++ b/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java @@ -86,6 +86,7 @@ public interface OnMediaLibraryButtonListener { void onCapturePhotoButtonClicked(); void onRetryUploadForMediaClicked(int mediaId); void onCancelUploadForMediaClicked(int mediaId); + void onCancelUploadForMediaDueToDeletedBlock(int mediaId); } public interface OnReattachQueryListener { @@ -142,6 +143,12 @@ public void requestImageUploadCancelDialog(int mediaId) { mOnMediaLibraryButtonListener.onCancelUploadForMediaClicked(mediaId); } + @Override + public void requestImageUploadCancel(int mediaId) { + // TODO here request host app to cancel any progressing uploads if any. + mOnMediaLibraryButtonListener.onCancelUploadForMediaDueToDeletedBlock(mediaId); + } + @Override public void editorDidMount(boolean hasUnsupportedBlocks) { mOnEditorMountListener.onEditorDidMount(hasUnsupportedBlocks); diff --git a/react-native-gutenberg-bridge/index.js b/react-native-gutenberg-bridge/index.js index 4bd5806c5c..afd93eee6a 100644 --- a/react-native-gutenberg-bridge/index.js +++ b/react-native-gutenberg-bridge/index.js @@ -68,4 +68,8 @@ export function requestImageUploadCancelDialog( mediaId ) { return RNReactNativeGutenbergBridge.requestImageUploadCancelDialog( mediaId ); } +export function requestImageUploadCancel( mediaId ) { + return RNReactNativeGutenbergBridge.requestImageUploadCancel( mediaId ); +} + export default RNReactNativeGutenbergBridge; diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index 979f76c871..6aa90ff478 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -83,10 +83,10 @@ export class BlockHolder extends React.Component { }; onRemoveBlockCheckUpload( mediaId, isUploading ) { - if ( isUploading ) { - // TODO here we will be being passed the mediaId of the Image component being unmounted so, safe to issue the cancel signal + if ( isUploading && mediaId) { + // here we will be being passed the mediaId of the Image component being unmounted so, safe to issue the cancel signal // through the bridge. - // requestImageUploadCancel( mediaId ); + requestImageUploadCancel( mediaId ); } // now remove the filter as it won't be needed anymore From 7887b64201e9c2c0c99cc9717089a576e07308ef Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 12 Mar 2019 08:58:27 -0300 Subject: [PATCH 05/14] removed TODO comment --- .../org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java | 1 - 1 file changed, 1 deletion(-) diff --git a/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java b/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java index d614a5ae82..7ec53cc7a1 100644 --- a/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java +++ b/react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java @@ -145,7 +145,6 @@ public void requestImageUploadCancelDialog(int mediaId) { @Override public void requestImageUploadCancel(int mediaId) { - // TODO here request host app to cancel any progressing uploads if any. mOnMediaLibraryButtonListener.onCancelUploadForMediaDueToDeletedBlock(mediaId); } From 05a734c62b438f3171d8356f34d0e5eef93b8957 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 12 Mar 2019 14:35:26 -0300 Subject: [PATCH 06/14] added type annotation --- src/block-management/block-holder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index 6aa90ff478..9b3e588367 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -82,7 +82,7 @@ export class BlockHolder extends React.Component { this.props.onSelect( this.props.clientId ); }; - onRemoveBlockCheckUpload( mediaId, isUploading ) { + onRemoveBlockCheckUpload = ( mediaId: number, isUploading: boolean ) => { if ( isUploading && mediaId) { // here we will be being passed the mediaId of the Image component being unmounted so, safe to issue the cancel signal // through the bridge. From adcc19f282f4fe496847f490d3e8f22ba52f843e Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 12 Mar 2019 14:48:13 -0300 Subject: [PATCH 07/14] added missing space --- src/block-management/block-holder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index 9b3e588367..45b95b3616 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -83,7 +83,7 @@ export class BlockHolder extends React.Component { }; onRemoveBlockCheckUpload = ( mediaId: number, isUploading: boolean ) => { - if ( isUploading && mediaId) { + if ( isUploading && mediaId ) { // here we will be being passed the mediaId of the Image component being unmounted so, safe to issue the cancel signal // through the bridge. requestImageUploadCancel( mediaId ); From 14c2520c54ff5ee7037a84c5bc79b6386672b70e Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Wed, 13 Mar 2019 09:01:34 -0300 Subject: [PATCH 08/14] updated gutenberg hash --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 1d8297722b..af44013859 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 1d8297722be316a2119d4c1d9229d0cdd252349b +Subproject commit af44013859c4b8072ee97ec1f506c535367e3970 From 160c51bccde264047fd71150a7651f46d4424a7b Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Wed, 13 Mar 2019 09:18:08 -0300 Subject: [PATCH 09/14] moving bridge-specific code to Image component - if the filter exists and returns true, the upload cancellation will be requested --- gutenberg | 2 +- src/block-management/block-holder.js | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/gutenberg b/gutenberg index af44013859..cb063b8259 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit af44013859c4b8072ee97ec1f506c535367e3970 +Subproject commit cb063b82595502c9106c78789051a17ade6b6295 diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index 45b95b3616..54b328908d 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -12,9 +12,6 @@ import { NativeTouchEvent, } from 'react-native'; import InlineToolbar, { InlineToolbarActions } from './inline-toolbar'; -import { - requestImageUploadCancel, -} from 'react-native-gutenberg-bridge'; /** * WordPress dependencies @@ -82,17 +79,13 @@ export class BlockHolder extends React.Component { this.props.onSelect( this.props.clientId ); }; - onRemoveBlockCheckUpload = ( mediaId: number, isUploading: boolean ) => { - if ( isUploading && mediaId ) { - // here we will be being passed the mediaId of the Image component being unmounted so, safe to issue the cancel signal - // through the bridge. - requestImageUploadCancel( mediaId ); - } - - // now remove the filter as it won't be needed anymore + onRemoveBlockCheckUpload() { if ( hasFilter( 'blocks.onRemoveBlockCheckUpload' ) ) { + // now remove the filter as it's a one-shot use and won't be needed anymore removeFilter( 'blocks.onRemoveBlockCheckUpload', 'gutenberg-mobile/blocks' ); + return true; } + return false; } onInlineToolbarButtonPressed = ( button: number ) => { @@ -105,7 +98,7 @@ export class BlockHolder extends React.Component { break; case InlineToolbarActions.DELETE: // adding a filter that will exist for as long as it takes for the block to be removed and the component unmounted - // using a namespace that is only valid for the current block id + // this acts as a flag for the code using the filter to know of its existence addFilter( 'blocks.onRemoveBlockCheckUpload', 'gutenberg-mobile/blocks', this.onRemoveBlockCheckUpload ); this.props.removeBlock(); break; From 1abd72589569d698d393cbe067b7dbfce2c7150f Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Wed, 13 Mar 2019 11:13:14 -0300 Subject: [PATCH 10/14] using hook actions instead of filters --- gutenberg | 2 +- src/block-management/block-holder.js | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/gutenberg b/gutenberg index cb063b8259..65fd883e0f 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit cb063b82595502c9106c78789051a17ade6b6295 +Subproject commit 65fd883e0fbe8639d5169ca96d06047e28bf7de2 diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index 54b328908d..acdd022f8e 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -12,13 +12,17 @@ import { NativeTouchEvent, } from 'react-native'; import InlineToolbar, { InlineToolbarActions } from './inline-toolbar'; +import { + requestImageUploadCancel, +} from 'react-native-gutenberg-bridge'; + /** * WordPress dependencies */ import { withDispatch, withSelect } from '@wordpress/data'; import { compose } from '@wordpress/compose'; -import { addFilter, removeFilter, hasFilter } from '@wordpress/hooks'; +import { addAction, removeAction, hasAction } from '@wordpress/hooks'; import type { BlockType } from '../store/types'; @@ -79,13 +83,12 @@ export class BlockHolder extends React.Component { this.props.onSelect( this.props.clientId ); }; - onRemoveBlockCheckUpload() { - if ( hasFilter( 'blocks.onRemoveBlockCheckUpload' ) ) { - // now remove the filter as it's a one-shot use and won't be needed anymore - removeFilter( 'blocks.onRemoveBlockCheckUpload', 'gutenberg-mobile/blocks' ); - return true; + onRemoveBlockCheckUpload = ( mediaId: number ) => { + if ( hasAction( 'blocks.onRemoveBlockCheckUpload' ) ) { + // now remove the action as it's a one-shot use and won't be needed anymore + removeAction( 'blocks.onRemoveBlockCheckUpload', 'gutenberg-mobile/blocks' ); + requestImageUploadCancel( mediaId ); } - return false; } onInlineToolbarButtonPressed = ( button: number ) => { @@ -97,9 +100,9 @@ export class BlockHolder extends React.Component { this.props.moveBlockDown(); break; case InlineToolbarActions.DELETE: - // adding a filter that will exist for as long as it takes for the block to be removed and the component unmounted - // this acts as a flag for the code using the filter to know of its existence - addFilter( 'blocks.onRemoveBlockCheckUpload', 'gutenberg-mobile/blocks', this.onRemoveBlockCheckUpload ); + // adding a action that will exist for as long as it takes for the block to be removed and the component unmounted + // this acts as a flag for the code using the action to know of its existence + addAction( 'blocks.onRemoveBlockCheckUpload', 'gutenberg-mobile/blocks', this.onRemoveBlockCheckUpload ); this.props.removeBlock(); break; } From d182b08aeb839d39c606d2a02f695b50ceb71f2e Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Wed, 13 Mar 2019 11:18:35 -0300 Subject: [PATCH 11/14] removed extra line --- src/block-management/block-holder.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index acdd022f8e..cb04a11f22 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -16,7 +16,6 @@ import { requestImageUploadCancel, } from 'react-native-gutenberg-bridge'; - /** * WordPress dependencies */ From 79d789af58f19d05407cfca7dc080a9f3b844964 Mon Sep 17 00:00:00 2001 From: Sergio Estevao Date: Thu, 14 Mar 2019 16:38:13 +0000 Subject: [PATCH 12/14] Implement image upload cancelation in iOS. --- ios/gutenberg/GutenbergViewController.swift | 9 +++++++++ .../ios/GutenbergBridgeDelegate.swift | 4 ++++ .../ios/RNReactNativeGutenbergBridge.m | 1 + .../ios/RNReactNativeGutenbergBridge.swift | 7 +++++++ 4 files changed, 21 insertions(+) diff --git a/ios/gutenberg/GutenbergViewController.swift b/ios/gutenberg/GutenbergViewController.swift index e1baad0ab1..1293b3fdf2 100644 --- a/ios/gutenberg/GutenbergViewController.swift +++ b/ios/gutenberg/GutenbergViewController.swift @@ -113,6 +113,15 @@ extension GutenbergViewController: GutenbergBridgeDelegate { alertController.popoverPresentationController?.permittedArrowDirections = .any present(alertController, animated: true, completion: nil) } + + /// Tells the delegate that an image block requested for the upload cancelation. + /// + func gutenbergDidRequestMediaUploadCancelation(for mediaID: Int32) { + guard let progress = mediaUploadCoordinator.progressForUpload(mediaID: mediaID) else { + return + } + progress.cancel() + } } extension GutenbergViewController: GutenbergBridgeDataSource { diff --git a/react-native-gutenberg-bridge/ios/GutenbergBridgeDelegate.swift b/react-native-gutenberg-bridge/ios/GutenbergBridgeDelegate.swift index 89e5ad4ebe..ea081f0d6b 100644 --- a/react-native-gutenberg-bridge/ios/GutenbergBridgeDelegate.swift +++ b/react-native-gutenberg-bridge/ios/GutenbergBridgeDelegate.swift @@ -33,6 +33,10 @@ public protocol GutenbergBridgeDelegate: class { /// func gutenbergDidRequestMediaUploadActionDialog(for mediaID: Int32) + /// Tells the delegate that an image block requested for the upload cancelation. + /// + func gutenbergDidRequestMediaUploadCancelation(for mediaID: Int32) + /// Tells the delegate that the Gutenberg module has finished loading. /// func gutenbergDidLoad() diff --git a/react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.m b/react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.m index ffe52f64a0..9ac81989bf 100644 --- a/react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.m +++ b/react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.m @@ -7,6 +7,7 @@ @interface RCT_EXTERN_MODULE(RNReactNativeGutenbergBridge, NSObject) RCT_EXTERN_METHOD(mediaUploadSync) RCT_EXTERN_METHOD(requestImageFailedRetryDialog:(int)mediaID) RCT_EXTERN_METHOD(requestImageUploadCancelDialog:(int)mediaID) +RCT_EXTERN_METHOD(requestImageUploadCancel:(int)mediaID) RCT_EXTERN_METHOD(editorDidLayout) RCT_EXTERN_METHOD(editorDidMount:(BOOL)hasUnsupportedBlocks) diff --git a/react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.swift b/react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.swift index 5f4f03e7f3..a229883f18 100644 --- a/react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.swift +++ b/react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.swift @@ -48,6 +48,13 @@ public class RNReactNativeGutenbergBridge: RCTEventEmitter { } } + @objc + func requestImageUploadCancel(_ mediaID: Int32) { + DispatchQueue.main.async { + self.delegate?.gutenbergDidRequestMediaUploadCancelation(for: mediaID) + } + } + @objc func editorDidLayout() { DispatchQueue.main.async { From 6bc5f460350714b67b65c3e4854ed48e6c5b7a47 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Fri, 15 Mar 2019 10:14:26 -0300 Subject: [PATCH 13/14] updated gb hash --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 65fd883e0f..688e21fad4 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 65fd883e0fbe8639d5169ca96d06047e28bf7de2 +Subproject commit 688e21fad4ef05dc18402fb77b904223fce3cdd9 From a4155939c561410402fe17d94be196a60f195917 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 19 Mar 2019 12:40:57 -0300 Subject: [PATCH 14/14] updated GB hash --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 688e21fad4..ac02ed9ce8 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 688e21fad4ef05dc18402fb77b904223fce3cdd9 +Subproject commit ac02ed9ce8752412ed3f59bed1bb3ea2fd90d459