Skip to content

Commit

Permalink
Provide exception logger for gutenberg
Browse files Browse the repository at this point in the history
  • Loading branch information
mchowning committed May 20, 2020
1 parent 50089ce commit d11ff41
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

14.9
-----
* [**] Block editor: Avoid crash when editor gets into invalid state
* [*] Fix issue with Preview post not working after switching to classic editor from inside the post
* [***] Block Editor: New block: Pullquote
* [**] Block Editor: Add support for changing background and text color in Buttons block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.wordpress.android.editor.EditorImageSettingsListener;
import org.wordpress.android.editor.EditorMediaUploadListener;
import org.wordpress.android.editor.EditorMediaUtils;
import org.wordpress.android.editor.ExceptionLogger;
import org.wordpress.android.editor.GutenbergEditorFragment;
import org.wordpress.android.editor.ImageSettingsDialogFragment;
import org.wordpress.android.fluxc.Dispatcher;
Expand Down Expand Up @@ -226,7 +227,8 @@ public class EditPostActivity extends LocaleAwareActivity implements
PostSettingsListDialogFragment.OnPostSettingsDialogFragmentListener,
HistoryListFragment.HistoryItemClickInterface,
EditPostSettingsCallback,
PrivateAtCookieProgressDialogOnDismissListener {
PrivateAtCookieProgressDialogOnDismissListener,
ExceptionLogger {
public static final String ACTION_REBLOG = "reblogAction";
public static final String EXTRA_POST_LOCAL_ID = "postModelLocalId";
public static final String EXTRA_LOAD_AUTO_SAVE_REVISION = "loadAutosaveRevision";
Expand Down Expand Up @@ -3087,6 +3089,11 @@ public void syncPostObjectWithUiAndSaveIt(@Nullable OnPostUpdatedFromUIListener
WPMediaUtils.advertiseImageOptimization(this, listener::invoke);
}

@Override
public Consumer<Exception> getExceptionLogger() {
return (Exception e) -> CrashLoggingUtils.logException(e, T.EDITOR);
}

private void updateAddingMediaToEditorProgressDialogState(ProgressDialogUiState uiState) {
mAddingMediaToEditorProgressDialog = mProgressDialogHelper
.updateProgressDialogState(this, mAddingMediaToEditorProgressDialog, uiState, mUiHelpers);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.wordpress.android.editor;

import androidx.core.util.Consumer;

public interface ExceptionLogger {
Consumer<Exception> getExceptionLogger();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.os.Bundle;
import android.view.ViewGroup;

import androidx.core.util.Consumer;
import androidx.fragment.app.Fragment;

import org.wordpress.mobile.WPAndroidGlue.RequestExecutor;
Expand Down Expand Up @@ -88,6 +89,11 @@ public void onCreate(Bundle savedInstanceState) {
Bundle translations = getArguments().getBundle(ARG_TRANSLATIONS);
boolean isDarkMode = getArguments().getBoolean(ARG_PREFERRED_COLOR_SCHEME);

Consumer<Exception> exceptionLogger = null;
if (getActivity() instanceof ExceptionLogger) {
exceptionLogger = ((ExceptionLogger) getActivity()).getExceptionLogger();
}

mWPAndroidGlueCode = new WPAndroidGlueCode();
mWPAndroidGlueCode.onCreate(getContext());
mWPAndroidGlueCode.onCreateView(
Expand All @@ -101,7 +107,8 @@ public void onCreate(Bundle savedInstanceState) {
localeString,
translations,
getContext().getResources().getColor(R.color.background_color),
isDarkMode);
isDarkMode,
exceptionLogger);

// clear the content initialization flag since a new ReactRootView has been created;
mHasReceivedAnyContent = false;
Expand Down
2 changes: 1 addition & 1 deletion libs/gutenberg-mobile
Submodule gutenberg-mobile updated 28 files
+16 −0 .circleci/config.yml
+4 −0 RELEASE-NOTES.txt
+39 −3 __device-tests__/gutenberg-editor-lists.test.js
+51 −1 __device-tests__/gutenberg-editor-paragraph.test.js
+4 −1 __device-tests__/helpers/utils.js
+2 −2 android/app/src/main/java/com/gutenberg/MainApplication.java
+11 −11 bundle/android/App.js
+1 −1 bundle/android/App.js.map
+1 −1 bundle/android/raw/i18ncache_data_de.json
+1 −1 bundle/android/raw/i18ncache_data_hr.json
+1 −1 bundle/android/raw/i18ncache_data_it.json
+1 −1 bundle/android/raw/i18ncache_data_pl.json
+1 −1 bundle/android/raw/i18ncache_data_ru.json
+11 −11 bundle/ios/App.js
+1 −1 bundle/ios/App.js.map
+1 −1 bundle/ios/assets/i18n-cache/data/de.json
+1 −1 bundle/ios/assets/i18n-cache/data/hr.json
+1 −1 bundle/ios/assets/i18n-cache/data/it.json
+1 −1 bundle/ios/assets/i18n-cache/data/pl.json
+1 −1 bundle/ios/assets/i18n-cache/data/ru.json
+1 −1 gutenberg
+1 −1 package.json
+1 −0 react-native-aztec/android/build.gradle
+47 −0 ...ative-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/IllegalSelectionIndexException.java
+28 −2 react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java
+8 −1 react-native-aztec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecPackage.java
+18 −0 ...e-aztec/android/src/test/java/org/wordpress/mobile/ReactNativeAztec/IllegalSelectionIndexExceptionTest.java
+15 −14 react-native-gutenberg-bridge/android/src/main/java/org/wordpress/mobile/WPAndroidGlue/WPAndroidGlueCode.java

0 comments on commit d11ff41

Please sign in to comment.