From d7644bcc478e46feb8a86d58f4b85079deb15f6a Mon Sep 17 00:00:00 2001 From: Klymentiy haykov Date: Sun, 29 Mar 2020 18:33:16 -0700 Subject: [PATCH 01/30] Updated GB reference --- libs/gutenberg-mobile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/gutenberg-mobile b/libs/gutenberg-mobile index d72586b0fd4a..00503480930b 160000 --- a/libs/gutenberg-mobile +++ b/libs/gutenberg-mobile @@ -1 +1 @@ -Subproject commit d72586b0fd4aa5b2558ea5ea40ee7414dc17febb +Subproject commit 00503480930bb8c0ec6615494662f3fcb3a8e83e From 93bb5dc41eda7e9dd25b3e23b9ad707034b45f99 Mon Sep 17 00:00:00 2001 From: Klymentiy haykov Date: Sun, 29 Mar 2020 18:33:46 -0700 Subject: [PATCH 02/30] Moved Auth header name to constant --- .../wordpress/android/ui/utils/AuthenticationUtils.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/utils/AuthenticationUtils.kt b/WordPress/src/main/java/org/wordpress/android/ui/utils/AuthenticationUtils.kt index d9c2b95135d0..5ecd2d8dd9a8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/utils/AuthenticationUtils.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/utils/AuthenticationUtils.kt @@ -20,7 +20,7 @@ class AuthenticationUtils headers["User-Agent"] = userAgent.userAgent if (WPUrlUtils.safeToAddWordPressComAuthToken(url)) { if (accessToken.exists()) { - headers["Authorization"] = "Bearer " + accessToken.get() + headers[AUTHORIZATION_HEADER_NAME] = "Bearer " + accessToken.get() } } else { // Check if we had HTTP Auth credentials for the root url @@ -28,9 +28,14 @@ class AuthenticationUtils if (httpAuthModel != null) { val creds = String.format("%s:%s", httpAuthModel.username, httpAuthModel.password) val auth = "Basic " + Base64.encodeToString(creds.toByteArray(), Base64.NO_WRAP) - headers["Authorization"] = auth + headers[AUTHORIZATION_HEADER_NAME] = auth } } return headers } + + companion object { + const val AUTHORIZATION_HEADER_NAME = "Authorization" + } + } From 1ebf3e6e7e5649ed3852ba398e50ac41b148d41d Mon Sep 17 00:00:00 2001 From: Klymentiy haykov Date: Sun, 29 Mar 2020 18:34:09 -0700 Subject: [PATCH 03/30] Updated listener signature --- .../org/wordpress/android/editor/EditorFragmentAbstract.java | 2 +- .../org/wordpress/android/editor/GutenbergEditorFragment.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java index 25d47d071e82..cc71037f389b 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/EditorFragmentAbstract.java @@ -192,7 +192,7 @@ public interface EditorFragmentListener { void onMediaDeleted(String mediaId); void onUndoMediaCheck(String undoedContent); void onVideoPressInfoRequested(String videoId); - String onAuthHeaderRequested(String url); + Map onAuthHeaderRequested(String url); void onTrackableEvent(TrackableEvent event); void onHtmlModeToggledInToolbar(); void onAddStockMediaClicked(boolean allowMultipleSelection); diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/GutenbergEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/GutenbergEditorFragment.java index b515e6a18b35..86dc3f6d9a0a 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/GutenbergEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/GutenbergEditorFragment.java @@ -346,7 +346,7 @@ public void run() { } }, new OnAuthHeaderRequestedListener() { - @Override public String onAuthHeaderRequested(String url) { + @Override public Map onAuthHeaderRequested(String url) { return mEditorFragmentListener.onAuthHeaderRequested(url); } }, From 1950a23f30953db8648cc7da63a5f0fdad366571 Mon Sep 17 00:00:00 2001 From: Klymentiy haykov Date: Sun, 29 Mar 2020 18:35:41 -0700 Subject: [PATCH 04/30] Updated headers handling in Aztec --- .../org/wordpress/android/editor/AztecEditorFragment.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java index c499bf259ee8..539ddba8358f 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java @@ -1814,8 +1814,9 @@ public void onClick(DialogInterface dialog, int id) { // Use https:// when requesting the auth header, in case the image is incorrectly using http:// // If an auth header is returned, force https:// for the actual HTTP request final String imageSrc = metaData.getSrc(); - String authHeader = mEditorFragmentListener.onAuthHeaderRequested(UrlUtils.makeHttps(imageSrc)); - if (authHeader.length() > 0) { + Map authHeaders = + mEditorFragmentListener.onAuthHeaderRequested(UrlUtils.makeHttps(imageSrc)); + if (authHeaders != null && authHeaders.containsKey("Authorization")) { metaData.setSrc(UrlUtils.makeHttps(imageSrc)); } From 4797668e6843825d1ea7ffcd14b05d36456f5af1 Mon Sep 17 00:00:00 2001 From: Klymentiy haykov Date: Sun, 29 Mar 2020 18:36:23 -0700 Subject: [PATCH 05/30] Updated headers handling in EditPostActivity --- .../wordpress/android/ui/posts/EditPostActivity.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 5c39667c919e..0491ec0ef5a7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -142,6 +142,7 @@ import org.wordpress.android.ui.uploads.UploadUtils; import org.wordpress.android.ui.uploads.UploadUtilsWrapper; import org.wordpress.android.ui.uploads.VideoOptimizer; +import org.wordpress.android.ui.utils.AuthenticationUtils; import org.wordpress.android.ui.utils.UiHelpers; import org.wordpress.android.util.ActivityUtils; import org.wordpress.android.util.AniUtils; @@ -2663,14 +2664,15 @@ public void onVideoPressInfoRequested(final String videoId) { } @Override - public String onAuthHeaderRequested(String url) { - String authHeader = ""; + public Map onAuthHeaderRequested(String url) { + Map authHeaders = new HashMap<>(); + String token = mAccountStore.getAccessToken(); if (mSite.isPrivate() && WPUrlUtils.safeToAddWordPressComAuthToken(url) && !TextUtils.isEmpty(token)) { - authHeader = "Bearer " + token; + authHeaders.put(AuthenticationUtils.AUTHORIZATION_HEADER_NAME, "Bearer " + token); } - return authHeader; + return authHeaders; } @Override From 3ce8113f1f499296ef9ad126a9e0b7e6740e31d6 Mon Sep 17 00:00:00 2001 From: Klymentiy haykov Date: Sun, 29 Mar 2020 19:51:16 -0700 Subject: [PATCH 06/30] Using constant for header name in Aztec. --- .../org/wordpress/android/editor/AztecEditorFragment.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java index 539ddba8358f..da4d5253d2f5 100644 --- a/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java +++ b/libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/AztecEditorFragment.java @@ -147,6 +147,8 @@ public AztecLoggingException(Throwable originalException) { private static final String TEMP_VIDEO_UPLOADING_CLASS = "data-temp-aztec-video"; private static final String GUTENBERG_BLOCK_START = " Block Editor Enabled - You\’re now using the block editor for new posts \u2014 great! If you\’d like to change to the classic editor, go to \'My Site\' > \'Site Settings\'. - You\’re now using the block editor for new pages \u2014 great! If you\’d like to change to the classic editor, go to \'My Site\' > \'Site Settings\'. + You\’re now using the block editor for new posts, great! If you\’d like to change to the classic editor, go to \'My Site\' > \'Site Settings\'. + You\’re now using the block editor for new pages, great! If you\’d like to change to the classic editor, go to \'My Site\' > \'Site Settings\'. We made big improvements to the block editor and think it\'s worth a try! We enabled it for new posts and pages but if you\'d like to change to the classic editor, go to \'My Site\' > \'Site Settings\'. From dabcdeb6e67295aa38c9fa31ab56bec3f8731b80 Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Fri, 10 Apr 2020 11:24:25 -0500 Subject: [PATCH 27/30] Fixed ktlint issue. --- .../org/wordpress/android/widgets/PostListButtonType.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/widgets/PostListButtonType.kt b/WordPress/src/main/java/org/wordpress/android/widgets/PostListButtonType.kt index 378811e752ce..95723b47ed61 100644 --- a/WordPress/src/main/java/org/wordpress/android/widgets/PostListButtonType.kt +++ b/WordPress/src/main/java/org/wordpress/android/widgets/PostListButtonType.kt @@ -30,7 +30,12 @@ enum class PostListButtonType constructor( R.drawable.ic_trash_white_24dp, R.attr.colorOnSurface ), - BUTTON_CANCEL_PENDING_AUTO_UPLOAD(14, R.string.pages_and_posts_cancel_auto_upload, R.drawable.ic_undo_white_24dp, R.attr.wpColorWarningDark); + BUTTON_CANCEL_PENDING_AUTO_UPLOAD( + 14, + R.string.pages_and_posts_cancel_auto_upload, + R.drawable.ic_undo_white_24dp, + R.attr.wpColorWarningDark + ); companion object { fun fromInt(value: Int): PostListButtonType? = values().firstOrNull { it.value == value } From 88807eed9fd6f9512af442c82ecd16369a3604c6 Mon Sep 17 00:00:00 2001 From: Klymentiy haykov Date: Wed, 8 Apr 2020 10:03:01 -0700 Subject: [PATCH 28/30] Change parent style of NoDisplay activity to WordPress.NoActionBar --- WordPress/src/main/res/values/styles.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/WordPress/src/main/res/values/styles.xml b/WordPress/src/main/res/values/styles.xml index d0075029449f..36378ee48ac9 100644 --- a/WordPress/src/main/res/values/styles.xml +++ b/WordPress/src/main/res/values/styles.xml @@ -129,8 +129,7 @@ @style/DropDownListView.Light.WordPress - - - - -