From f2d5c68bda5622a4bfd7824679703d67ca053811 Mon Sep 17 00:00:00 2001 From: etoledom Date: Fri, 6 Sep 2019 10:44:33 +0200 Subject: [PATCH 1/3] Replace client side autosave with gutenberg autosave mechanism --- Podfile.lock | 116 ++++++++---------- .../Gutenberg/GutenbergViewController.swift | 33 +---- 2 files changed, 60 insertions(+), 89 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 60c17d0fedb9..d54725f1d637 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -257,14 +257,14 @@ DEPENDENCIES: - Charts (~> 3.2.2) - CocoaLumberjack (= 3.5.2) - Down (~> 0.6.6) - - Folly (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/Folly.podspec.json`) + - Folly (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/Folly.podspec.json`) - FormatterKit/TimeIntervalFormatter (= 1.8.2) - FSInteractiveMap (from `https://github.com/wordpress-mobile/FSInteractiveMap.git`, tag `0.1.1`) - Gifu (= 3.2.0) - GiphyCoreSDK (~> 1.4.0) - - glog (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/glog.podspec.json`) + - glog (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/glog.podspec.json`) - Gridicons (~> 0.16) - - Gutenberg (from `http://github.com/wordpress-mobile/gutenberg-mobile/`, tag `v1.11.0`) + - Gutenberg (from `../gutenberg-mobile`) - HockeySDK (= 5.1.4) - MRProgress (= 0.8.3) - Nimble (~> 7.3.1) @@ -274,29 +274,29 @@ DEPENDENCIES: - OHHTTPStubs (= 6.1.0) - OHHTTPStubs/Swift (= 6.1.0) - Reachability (= 3.2) - - React (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React.podspec.json`) - - React-Core (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-Core.podspec.json`) - - React-cxxreact (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-cxxreact.podspec.json`) - - React-DevSupport (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-DevSupport.podspec.json`) - - React-jsi (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-jsi.podspec.json`) - - React-jsiexecutor (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-jsiexecutor.podspec.json`) - - React-jsinspector (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-jsinspector.podspec.json`) - - react-native-keyboard-aware-scroll-view (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/react-native-keyboard-aware-scroll-view.podspec.json`) - - react-native-safe-area (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/react-native-safe-area.podspec.json`) - - react-native-video (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/react-native-video.podspec.json`) - - React-RCTActionSheet (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTActionSheet.podspec.json`) - - React-RCTAnimation (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTAnimation.podspec.json`) - - React-RCTBlob (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTBlob.podspec.json`) - - React-RCTImage (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTImage.podspec.json`) - - React-RCTLinking (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTLinking.podspec.json`) - - React-RCTNetwork (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTNetwork.podspec.json`) - - React-RCTSettings (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTSettings.podspec.json`) - - React-RCTText (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTText.podspec.json`) - - React-RCTVibration (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTVibration.podspec.json`) - - React-RCTWebSocket (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTWebSocket.podspec.json`) - - ReactNativeDarkMode (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/ReactNativeDarkMode.podspec.json`) - - RNSVG (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/RNSVG.podspec.json`) - - RNTAztecView (from `http://github.com/wordpress-mobile/gutenberg-mobile/`, tag `v1.11.0`) + - React (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React.podspec.json`) + - React-Core (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-Core.podspec.json`) + - React-cxxreact (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-cxxreact.podspec.json`) + - React-DevSupport (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-DevSupport.podspec.json`) + - React-jsi (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsi.podspec.json`) + - React-jsiexecutor (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsiexecutor.podspec.json`) + - React-jsinspector (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsinspector.podspec.json`) + - react-native-keyboard-aware-scroll-view (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-keyboard-aware-scroll-view.podspec.json`) + - react-native-safe-area (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-safe-area.podspec.json`) + - react-native-video (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-video.podspec.json`) + - React-RCTActionSheet (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTActionSheet.podspec.json`) + - React-RCTAnimation (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTAnimation.podspec.json`) + - React-RCTBlob (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTBlob.podspec.json`) + - React-RCTImage (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTImage.podspec.json`) + - React-RCTLinking (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTLinking.podspec.json`) + - React-RCTNetwork (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTNetwork.podspec.json`) + - React-RCTSettings (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTSettings.podspec.json`) + - React-RCTText (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTText.podspec.json`) + - React-RCTVibration (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTVibration.podspec.json`) + - React-RCTWebSocket (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTWebSocket.podspec.json`) + - ReactNativeDarkMode (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/ReactNativeDarkMode.podspec.json`) + - RNSVG (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/RNSVG.podspec.json`) + - RNTAztecView (from `../gutenberg-mobile`) - SimulatorStatusMagic - Starscream (= 3.0.6) - SVProgressHUD (= 2.2.5) @@ -307,7 +307,7 @@ DEPENDENCIES: - WordPressShared (~> 1.8.7) - WordPressUI (~> 1.3.5) - WPMediaPicker (~> 1.4.2) - - yoga (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/yoga.podspec.json`) + - yoga (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/yoga.podspec.json`) - ZendeskSDK (= 3.0.1) - ZIPFoundation (~> 0.9.8) @@ -357,75 +357,67 @@ SPEC REPOS: EXTERNAL SOURCES: Folly: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/Folly.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/Folly.podspec.json" FSInteractiveMap: :git: https://github.com/wordpress-mobile/FSInteractiveMap.git :tag: 0.1.1 glog: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/glog.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/glog.podspec.json" Gutenberg: - :git: http://github.com/wordpress-mobile/gutenberg-mobile/ - :tag: v1.11.0 + :path: "../gutenberg-mobile" React: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React.podspec.json" React-Core: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-Core.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-Core.podspec.json" React-cxxreact: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-cxxreact.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-cxxreact.podspec.json" React-DevSupport: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-DevSupport.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-DevSupport.podspec.json" React-jsi: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-jsi.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsi.podspec.json" React-jsiexecutor: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-jsiexecutor.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsiexecutor.podspec.json" React-jsinspector: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-jsinspector.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsinspector.podspec.json" react-native-keyboard-aware-scroll-view: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/react-native-keyboard-aware-scroll-view.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-keyboard-aware-scroll-view.podspec.json" react-native-safe-area: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/react-native-safe-area.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-safe-area.podspec.json" react-native-video: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/react-native-video.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-video.podspec.json" React-RCTActionSheet: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTActionSheet.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTActionSheet.podspec.json" React-RCTAnimation: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTAnimation.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTAnimation.podspec.json" React-RCTBlob: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTBlob.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTBlob.podspec.json" React-RCTImage: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTImage.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTImage.podspec.json" React-RCTLinking: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTLinking.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTLinking.podspec.json" React-RCTNetwork: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTNetwork.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTNetwork.podspec.json" React-RCTSettings: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTSettings.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTSettings.podspec.json" React-RCTText: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTText.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTText.podspec.json" React-RCTVibration: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTVibration.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTVibration.podspec.json" React-RCTWebSocket: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/React-RCTWebSocket.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTWebSocket.podspec.json" ReactNativeDarkMode: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/ReactNativeDarkMode.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/ReactNativeDarkMode.podspec.json" RNSVG: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/RNSVG.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/RNSVG.podspec.json" RNTAztecView: - :git: http://github.com/wordpress-mobile/gutenberg-mobile/ - :tag: v1.11.0 + :path: "../gutenberg-mobile" yoga: - :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.11.0/react-native-gutenberg-bridge/third-party-podspecs/yoga.podspec.json + :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/yoga.podspec.json" CHECKOUT OPTIONS: FSInteractiveMap: :git: https://github.com/wordpress-mobile/FSInteractiveMap.git :tag: 0.1.1 - Gutenberg: - :git: http://github.com/wordpress-mobile/gutenberg-mobile/ - :tag: v1.11.0 - RNTAztecView: - :git: http://github.com/wordpress-mobile/gutenberg-mobile/ - :tag: v1.11.0 SPEC CHECKSUMS: 1PasswordExtension: 0e95bdea64ec8ff2f4f693be5467a09fac42a83d diff --git a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift index 918083af170d..cb22bc9501e1 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift @@ -117,12 +117,6 @@ class GutenbergViewController: UIViewController, PostEditor { }) } - // MARK: - Auto save post - - static let autoSaveInterval: TimeInterval = 5 - - var autoSaveTimer: Timer? - // MARK: - Set content func setTitle(_ title: String) { @@ -169,11 +163,11 @@ class GutenbergViewController: UIViewController, PostEditor { return GutenbergMediaInserterHelper(post: post, gutenberg: gutenberg) }() - /// For autosaving - The debouncer will execute local saving every defined number of seconds. - /// In this case every 0.5 second + /// For autosaving - We are now using the Gutenberg side autosaving mechanism, so we don't need + /// a local scheduler any longer. We keep the debouncer to reuse the shared PostEditor+Publish save code. /// fileprivate(set) lazy var debouncer: Debouncer = { - return Debouncer(delay: PostEditorDebouncerConstants.autoSavingDelay, callback: debouncerCallback) + return Debouncer(delay: 0, callback: debouncerCallback) }() /// Media Library Data Source @@ -228,7 +222,6 @@ class GutenbergViewController: UIViewController, PostEditor { } deinit { - stopAutoSave() gutenberg.invalidate() attachmentDelegate.cancelAllPendingMediaRequests() } @@ -336,6 +329,9 @@ extension GutenbergViewController { // MARK: - GutenbergBridgeDelegate extension GutenbergViewController: GutenbergBridgeDelegate { + func editorDidAutosave() { + requestHTML(for: .autoSave) + } func gutenbergDidRequestMedia(from source: MediaPickerSource, filter: [MediaFilter]?, with callback: @escaping MediaPickerDidPickMediaCallback) { let flags = mediaFilterFlags(using: filter) @@ -503,7 +499,6 @@ extension GutenbergViewController: GutenbergBridgeDelegate { } func gutenbergDidMount(unsupportedBlockNames: [String]) { - startAutoSave() if !editorSession.started { editorSession.start(unsupportedBlocks: unsupportedBlockNames) } @@ -613,22 +608,6 @@ extension GutenbergViewController: PostEditorNavigationBarManagerDelegate { } } -// MARK: - Auto Save - -extension GutenbergViewController { - - func startAutoSave() { - autoSaveTimer = Timer.scheduledTimer(withTimeInterval: GutenbergViewController.autoSaveInterval, repeats: true, block: { [weak self](timer) in - self?.requestHTML(for: .autoSave) - }) - } - - func stopAutoSave() { - autoSaveTimer?.invalidate() - autoSaveTimer = nil - } -} - // MARK: - Constants private extension GutenbergViewController { From 40d94cd2e9de28be1c7720a080ef1b529b63eb0b Mon Sep 17 00:00:00 2001 From: etoledom Date: Fri, 6 Sep 2019 10:55:35 +0200 Subject: [PATCH 2/3] Update gutenberg ref --- Podfile | 2 +- Podfile.lock | 118 +++++++++++++++++++++++++++------------------------ 2 files changed, 64 insertions(+), 56 deletions(-) diff --git a/Podfile b/Podfile index c71ced544606..9f13c430de70 100644 --- a/Podfile +++ b/Podfile @@ -142,7 +142,7 @@ target 'WordPress' do ## Gutenberg (React Native) ## ===================== ## - gutenberg :tag => 'v1.11.0' + gutenberg :commit => '4b9881f8a0744ea3009c67fbc1e3b4f670f23707' ## Third party libraries ## ===================== diff --git a/Podfile.lock b/Podfile.lock index d54725f1d637..f8e2edc9e02b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -257,14 +257,14 @@ DEPENDENCIES: - Charts (~> 3.2.2) - CocoaLumberjack (= 3.5.2) - Down (~> 0.6.6) - - Folly (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/Folly.podspec.json`) + - Folly (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/Folly.podspec.json`) - FormatterKit/TimeIntervalFormatter (= 1.8.2) - FSInteractiveMap (from `https://github.com/wordpress-mobile/FSInteractiveMap.git`, tag `0.1.1`) - Gifu (= 3.2.0) - GiphyCoreSDK (~> 1.4.0) - - glog (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/glog.podspec.json`) + - glog (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/glog.podspec.json`) - Gridicons (~> 0.16) - - Gutenberg (from `../gutenberg-mobile`) + - Gutenberg (from `http://github.com/wordpress-mobile/gutenberg-mobile/`, commit `4b9881f8a0744ea3009c67fbc1e3b4f670f23707`) - HockeySDK (= 5.1.4) - MRProgress (= 0.8.3) - Nimble (~> 7.3.1) @@ -274,29 +274,29 @@ DEPENDENCIES: - OHHTTPStubs (= 6.1.0) - OHHTTPStubs/Swift (= 6.1.0) - Reachability (= 3.2) - - React (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React.podspec.json`) - - React-Core (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-Core.podspec.json`) - - React-cxxreact (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-cxxreact.podspec.json`) - - React-DevSupport (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-DevSupport.podspec.json`) - - React-jsi (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsi.podspec.json`) - - React-jsiexecutor (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsiexecutor.podspec.json`) - - React-jsinspector (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsinspector.podspec.json`) - - react-native-keyboard-aware-scroll-view (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-keyboard-aware-scroll-view.podspec.json`) - - react-native-safe-area (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-safe-area.podspec.json`) - - react-native-video (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-video.podspec.json`) - - React-RCTActionSheet (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTActionSheet.podspec.json`) - - React-RCTAnimation (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTAnimation.podspec.json`) - - React-RCTBlob (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTBlob.podspec.json`) - - React-RCTImage (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTImage.podspec.json`) - - React-RCTLinking (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTLinking.podspec.json`) - - React-RCTNetwork (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTNetwork.podspec.json`) - - React-RCTSettings (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTSettings.podspec.json`) - - React-RCTText (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTText.podspec.json`) - - React-RCTVibration (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTVibration.podspec.json`) - - React-RCTWebSocket (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTWebSocket.podspec.json`) - - ReactNativeDarkMode (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/ReactNativeDarkMode.podspec.json`) - - RNSVG (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/RNSVG.podspec.json`) - - RNTAztecView (from `../gutenberg-mobile`) + - React (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React.podspec.json`) + - React-Core (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-Core.podspec.json`) + - React-cxxreact (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-cxxreact.podspec.json`) + - React-DevSupport (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-DevSupport.podspec.json`) + - React-jsi (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-jsi.podspec.json`) + - React-jsiexecutor (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-jsiexecutor.podspec.json`) + - React-jsinspector (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-jsinspector.podspec.json`) + - react-native-keyboard-aware-scroll-view (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/react-native-keyboard-aware-scroll-view.podspec.json`) + - react-native-safe-area (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/react-native-safe-area.podspec.json`) + - react-native-video (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/react-native-video.podspec.json`) + - React-RCTActionSheet (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTActionSheet.podspec.json`) + - React-RCTAnimation (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTAnimation.podspec.json`) + - React-RCTBlob (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTBlob.podspec.json`) + - React-RCTImage (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTImage.podspec.json`) + - React-RCTLinking (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTLinking.podspec.json`) + - React-RCTNetwork (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTNetwork.podspec.json`) + - React-RCTSettings (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTSettings.podspec.json`) + - React-RCTText (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTText.podspec.json`) + - React-RCTVibration (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTVibration.podspec.json`) + - React-RCTWebSocket (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTWebSocket.podspec.json`) + - ReactNativeDarkMode (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/ReactNativeDarkMode.podspec.json`) + - RNSVG (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/RNSVG.podspec.json`) + - RNTAztecView (from `http://github.com/wordpress-mobile/gutenberg-mobile/`, commit `4b9881f8a0744ea3009c67fbc1e3b4f670f23707`) - SimulatorStatusMagic - Starscream (= 3.0.6) - SVProgressHUD (= 2.2.5) @@ -307,7 +307,7 @@ DEPENDENCIES: - WordPressShared (~> 1.8.7) - WordPressUI (~> 1.3.5) - WPMediaPicker (~> 1.4.2) - - yoga (from `../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/yoga.podspec.json`) + - yoga (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/yoga.podspec.json`) - ZendeskSDK (= 3.0.1) - ZIPFoundation (~> 0.9.8) @@ -357,67 +357,75 @@ SPEC REPOS: EXTERNAL SOURCES: Folly: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/Folly.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/Folly.podspec.json FSInteractiveMap: :git: https://github.com/wordpress-mobile/FSInteractiveMap.git :tag: 0.1.1 glog: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/glog.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/glog.podspec.json Gutenberg: - :path: "../gutenberg-mobile" + :commit: 4b9881f8a0744ea3009c67fbc1e3b4f670f23707 + :git: http://github.com/wordpress-mobile/gutenberg-mobile/ React: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React.podspec.json React-Core: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-Core.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-Core.podspec.json React-cxxreact: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-cxxreact.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-cxxreact.podspec.json React-DevSupport: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-DevSupport.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-DevSupport.podspec.json React-jsi: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsi.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-jsi.podspec.json React-jsiexecutor: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsiexecutor.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-jsiexecutor.podspec.json React-jsinspector: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-jsinspector.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-jsinspector.podspec.json react-native-keyboard-aware-scroll-view: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-keyboard-aware-scroll-view.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/react-native-keyboard-aware-scroll-view.podspec.json react-native-safe-area: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-safe-area.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/react-native-safe-area.podspec.json react-native-video: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/react-native-video.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/react-native-video.podspec.json React-RCTActionSheet: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTActionSheet.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTActionSheet.podspec.json React-RCTAnimation: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTAnimation.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTAnimation.podspec.json React-RCTBlob: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTBlob.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTBlob.podspec.json React-RCTImage: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTImage.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTImage.podspec.json React-RCTLinking: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTLinking.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTLinking.podspec.json React-RCTNetwork: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTNetwork.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTNetwork.podspec.json React-RCTSettings: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTSettings.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTSettings.podspec.json React-RCTText: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTText.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTText.podspec.json React-RCTVibration: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTVibration.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTVibration.podspec.json React-RCTWebSocket: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/React-RCTWebSocket.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/React-RCTWebSocket.podspec.json ReactNativeDarkMode: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/ReactNativeDarkMode.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/ReactNativeDarkMode.podspec.json RNSVG: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/RNSVG.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/RNSVG.podspec.json RNTAztecView: - :path: "../gutenberg-mobile" + :commit: 4b9881f8a0744ea3009c67fbc1e3b4f670f23707 + :git: http://github.com/wordpress-mobile/gutenberg-mobile/ yoga: - :podspec: "../gutenberg-mobile/react-native-gutenberg-bridge/third-party-podspecs/yoga.podspec.json" + :podspec: https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/4b9881f8a0744ea3009c67fbc1e3b4f670f23707/react-native-gutenberg-bridge/third-party-podspecs/yoga.podspec.json CHECKOUT OPTIONS: FSInteractiveMap: :git: https://github.com/wordpress-mobile/FSInteractiveMap.git :tag: 0.1.1 + Gutenberg: + :commit: 4b9881f8a0744ea3009c67fbc1e3b4f670f23707 + :git: http://github.com/wordpress-mobile/gutenberg-mobile/ + RNTAztecView: + :commit: 4b9881f8a0744ea3009c67fbc1e3b4f670f23707 + :git: http://github.com/wordpress-mobile/gutenberg-mobile/ SPEC CHECKSUMS: 1PasswordExtension: 0e95bdea64ec8ff2f4f693be5467a09fac42a83d @@ -490,6 +498,6 @@ SPEC CHECKSUMS: ZendeskSDK: c2e49fd16a73e43e490f777cea67dd852b819ace ZIPFoundation: 89df685c971926b0323087952320bdfee9f0b6ef -PODFILE CHECKSUM: 57d84dc63964a7474cf34fff8192aca4bebf3635 +PODFILE CHECKSUM: 9a7197abc5b4123e26781d8d72d0361141cc9905 COCOAPODS: 1.6.1 From ada7cd9ca4d172b535bf4ad234fb675d16ab845f Mon Sep 17 00:00:00 2001 From: etoledom Date: Thu, 26 Sep 2019 11:39:39 +0200 Subject: [PATCH 3/3] Editors: Implement new Autosave logic Autosave is now triggered after 50 continuous content changes or after 1 second of inactivity. This in both Aztec and Gutenberg. --- .../AztecPostViewController.swift | 6 ++- .../Gutenberg/GutenbergViewController.swift | 16 ++++---- .../Classes/ViewRelated/Post/Autosaver.swift | 38 +++++++++++++++++++ .../Classes/ViewRelated/Post/PostEditor.swift | 2 + WordPress/WordPress.xcodeproj/project.pbxproj | 4 ++ 5 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 WordPress/Classes/ViewRelated/Post/Autosaver.swift diff --git a/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift b/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift index 5e2b22f7fb1a..8c743e4524e9 100644 --- a/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift +++ b/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift @@ -73,6 +73,10 @@ class AztecPostViewController: UIViewController, PostEditor { return Debouncer(delay: PostEditorDebouncerConstants.autoSavingDelay, callback: debouncerCallback) }() + lazy var autosaver = Autosaver { [weak self] in + self?.mapUIContentToPostAndSave(immediate: true) + } + // MARK: - Styling Options private lazy var optionsTablePresenter = OptionsTablePresenter(presentingViewController: self, presentingTextView: editorView.richTextView) @@ -1306,7 +1310,7 @@ extension AztecPostViewController: UITextViewDelegate { } func textViewDidChange(_ textView: UITextView) { - mapUIContentToPostAndSave() + autosaver.contentDidChange() refreshPlaceholderVisibility() switch textView { diff --git a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift index eb9b0b165401..63967a9e59f6 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift @@ -163,13 +163,17 @@ class GutenbergViewController: UIViewController, PostEditor { return GutenbergMediaInserterHelper(post: post, gutenberg: gutenberg) }() - /// For autosaving - We are now using the Gutenberg side autosaving mechanism, so we don't need - /// a local scheduler any longer. We keep the debouncer to reuse the shared PostEditor+Publish save code. + /// For autosaving - The debouncer will execute local saving every defined number of seconds. + /// In this case every 0.5 second /// fileprivate(set) lazy var debouncer: Debouncer = { - return Debouncer(delay: 0, callback: debouncerCallback) + return Debouncer(delay: PostEditorDebouncerConstants.autoSavingDelay, callback: debouncerCallback) }() + lazy var autosaver = Autosaver { [weak self] in + self?.requestHTML(for: .autoSave) + } + /// Media Library Data Source /// lazy var mediaLibraryDataSource: MediaLibraryPickerDataSource = { @@ -330,7 +334,7 @@ extension GutenbergViewController { extension GutenbergViewController: GutenbergBridgeDelegate { func editorDidAutosave() { - requestHTML(for: .autoSave) + autosaver.contentDidChange() } func gutenbergDidRequestMedia(from source: MediaPickerSource, filter: [MediaFilter]?, with callback: @escaping MediaPickerDidPickMediaCallback) { @@ -504,10 +508,6 @@ extension GutenbergViewController: GutenbergBridgeDelegate { } } - func editorDidAutosave() { - // Currently using native side `autoSaveTimer` for autosave purposes. - } - func gutenbergDidEmitLog(message: String, logLevel: LogLevel) { switch logLevel { case .trace: diff --git a/WordPress/Classes/ViewRelated/Post/Autosaver.swift b/WordPress/Classes/ViewRelated/Post/Autosaver.swift new file mode 100644 index 000000000000..bb72034dae2b --- /dev/null +++ b/WordPress/Classes/ViewRelated/Post/Autosaver.swift @@ -0,0 +1,38 @@ +/// Post autosave helper that triggers an action after X ammount of changes or Y time of inactivity. +/// +class Autosaver { + private let action: (() -> Void) + private let changesThreshold: Int + private var changesCount = 0 + private let delay: Double + private lazy var debouncer = Debouncer(delay: delay, callback: { [weak self] in + self?.triggerAutosave() + }) + + private func triggerAutosave() { + changesCount = 0 + action() + } + + /// Instantiates an instance of Autosaver + /// - Parameter changesThreshold: Ammount of changes allowed before autosaving. Default 50 changes. + /// - Parameter delay: Maximum time of inactivity before autosaving. Default 1 second. + /// - Parameter action: The action to be triggered when autosave is fired. + /// + init(changesThreshold: Int = 50, delay: Double = 1, action: @escaping () -> Void) { + self.changesThreshold = changesThreshold + self.action = action + self.delay = delay + } + + /// Call this method everytime the post content changes to trigger the autosave action at the most appropiate time + /// + func contentDidChange() { + changesCount += 1 + if changesCount > changesThreshold { + triggerAutosave() + } else { + debouncer.call() + } + } +} diff --git a/WordPress/Classes/ViewRelated/Post/PostEditor.swift b/WordPress/Classes/ViewRelated/Post/PostEditor.swift index 69678ff63776..b6a42e66fa4f 100644 --- a/WordPress/Classes/ViewRelated/Post/PostEditor.swift +++ b/WordPress/Classes/ViewRelated/Post/PostEditor.swift @@ -93,6 +93,8 @@ protocol PostEditor: class, UIViewControllerTransitioningDelegate { /// Closure to call when the editor needs to be replaced with a different editor /// First argument is the existing editor, second argument is the replacement editor var replaceEditor: (EditorViewController, EditorViewController) -> () { get } + + var autosaver: Autosaver { get set } } extension PostEditor { diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index fdb782f8535c..907d4e879b29 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -935,6 +935,7 @@ 7E8980CA22E8C7A600C567B0 /* BlogToBlogMigration87to88.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8980C922E8C7A600C567B0 /* BlogToBlogMigration87to88.swift */; }; 7E92828921090E9A00BBD8A3 /* notifications-pingback.json in Resources */ = {isa = PBXBuildFile; fileRef = 7E92828821090E9A00BBD8A3 /* notifications-pingback.json */; }; 7E929CD12110D4F200BCAD88 /* FormattableRangesFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E929CD02110D4F200BCAD88 /* FormattableRangesFactory.swift */; }; + 7E92A1FB233CB1B7006D281B /* Autosaver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E92A1FA233CB1B7006D281B /* Autosaver.swift */; }; 7E987F562108017B00CAFB88 /* NotificationContentRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E987F552108017B00CAFB88 /* NotificationContentRouter.swift */; }; 7E987F58210811CC00CAFB88 /* NotificationContentRouterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E987F57210811CC00CAFB88 /* NotificationContentRouterTests.swift */; }; 7E987F5A2108122A00CAFB88 /* NotificationUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E987F592108122A00CAFB88 /* NotificationUtility.swift */; }; @@ -3047,6 +3048,7 @@ 7E8980C922E8C7A600C567B0 /* BlogToBlogMigration87to88.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = BlogToBlogMigration87to88.swift; path = "87-88/BlogToBlogMigration87to88.swift"; sourceTree = ""; }; 7E92828821090E9A00BBD8A3 /* notifications-pingback.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "notifications-pingback.json"; sourceTree = ""; }; 7E929CD02110D4F200BCAD88 /* FormattableRangesFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormattableRangesFactory.swift; sourceTree = ""; }; + 7E92A1FA233CB1B7006D281B /* Autosaver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Autosaver.swift; sourceTree = ""; }; 7E987F552108017B00CAFB88 /* NotificationContentRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationContentRouter.swift; sourceTree = ""; }; 7E987F57210811CC00CAFB88 /* NotificationContentRouterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationContentRouterTests.swift; sourceTree = ""; }; 7E987F592108122A00CAFB88 /* NotificationUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationUtility.swift; sourceTree = ""; }; @@ -5681,6 +5683,7 @@ 570BFD8A22823D7B007859A8 /* PostActionSheet.swift */, 570265142298921800F2214C /* PostListTableViewHandler.swift */, 57047A4E22A961BC00B461DF /* PostSearchHeader.swift */, + 7E92A1FA233CB1B7006D281B /* Autosaver.swift */, ); name = Utils; sourceTree = ""; @@ -11442,6 +11445,7 @@ 9A38DC6D218899FB006A409B /* DiffAbstractValue.swift in Sources */, 177B4C252123161900CF8084 /* GiphyPicker.swift in Sources */, 17B7C8C120EE2A870042E260 /* Routes+Notifications.swift in Sources */, + 7E92A1FB233CB1B7006D281B /* Autosaver.swift in Sources */, 9A341E5621997A340036662E /* BlogAuthor.swift in Sources */, 9A341E5721997A340036662E /* Blog+BlogAuthors.swift in Sources */, 7E3AB3DB20F52654001F33B6 /* ActivityContentStyles.swift in Sources */,