Skip to content

Commit

Permalink
Merge branch 'trunk' into feature/enable-account-closure
Browse files Browse the repository at this point in the history
  • Loading branch information
mkevins committed May 19, 2023
2 parents 229c44c + 8bda6cf commit 92f1812
Show file tree
Hide file tree
Showing 20 changed files with 369 additions and 57 deletions.
26 changes: 14 additions & 12 deletions WordPress/jetpack_metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,32 @@ msgstr ""
"X-Generator: VsCode\n"
"Project-Id-Version: Jetpack - Apps - Android - Release Notes\n"

msgctxt "release_note_223"
msgctxt "release_note_224"
msgid ""
"22.3:\n"
"No updates this week, but we’re hard at work on a pressing feature we know you’ll enjoy.\n"
"22.4:\n"
"- Added dashboard cards for Activity Log and Pages\n"
"- Removed ability to convert deleted/undefined reusable blocks to regular blocks\n"
"- Updated nested text blocks for faster editing without tapping through nested levels\n"
"- Corrected “editing not supported” message in reusable blocks\n"
msgstr ""

msgctxt "release_note_222"
msgctxt "release_note_223"
msgid ""
"22.2:\n"
"- Added warning message for when push notifications are turned off\n"
"- Updated media access permissions to align with Android 13 update\n"
"- Added card to dashboard for purchasing custom domains\n"
"- Added other users’ responses to blogging prompts\n"
"22.3:\n"
"No updates this week, but we’re hard at work on a pressing feature we know you’ll enjoy.\n"
msgstr ""

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
#. translators: Title to be displayed in the Play Store. Limit to 30 characters including spaces and commas!
msgctxt "play_store_app_title"
msgid "Jetpack – Website Builder"
msgid "Jetpack – Website Builder
"
msgstr ""

#. translators: Short description of the Jetpack app to be displayed in the Play Store. Limit to 80 characters including spaces and commas!
msgctxt "play_store_promo"
msgid "Build your WordPress website & blog; create posts, add photos & track analytics!"
msgid "Build your WordPress website & blog; create posts, add photos & track analytics!
"
msgstr ""

#. translators: Multi-paragraph text used to display in the Play Store. Limit to 4000 characters including spaces and commas!
Expand Down Expand Up @@ -85,7 +87,7 @@ msgid ""
"\n"
"Learn more at https://jetpack.com/mobile\n"
"\n"
"California users privacy notice: https://automattic.com/privacy/#california-consumer-privacy-act-ccpa\n"
"California users privacy notice: https://automattic.com/privacy/#california-consumer-privacy-act-ccpa"
msgstr ""

#. Description for the first app store image
Expand Down
12 changes: 4 additions & 8 deletions WordPress/jetpack_metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
* [**] [Jetpack-only] Adds a dashboard card for viewing activity log [https://github.com/wordpress-mobile/WordPress-Android/pull/18306]
* [**] [Jetpack-only] Adds a dashboard card for viewing pages [https://github.com/wordpress-mobile/WordPress-Android/pull/18337]
* [**] [internal] Block editor: Add fullscreen embed preview to Android [https://github.com/wordpress-mobile/gutenberg-mobile/pull/5743]
* [*] [Jetpack-only] Block editor: Fix crash when trying to convert to regular blocks an undefined/deleted reusable block [https://github.com/WordPress/gutenberg/pull/50475]
* [**] Block editor: Tapping on a nested block now gets focus directly instead of having to tap multiple times depending on the nesting levels. [https://github.com/WordPress/gutenberg/pull/50108]
* [*] [Jetpack-only] Block editor: Use host app namespace in reusable block message [https://github.com/WordPress/gutenberg/pull/50478]
* [*] [internal] [Jetpack-only] Enables domain purchases in site creation A/B experiment. [https://github.com/wordpress-mobile/WordPress-Android/pull/18414]

- Added dashboard cards for Activity Log and Pages
- Removed ability to convert deleted/undefined reusable blocks to regular blocks
- Updated nested text blocks for faster editing without tapping through nested levels
- Corrected “editing not supported” message in reusable blocks
15 changes: 7 additions & 8 deletions WordPress/metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ msgstr ""
"X-Generator: VsCode\n"
"Project-Id-Version: Release Notes & Play Store Descriptions\n"

msgctxt "release_note_223"
msgctxt "release_note_224"
msgid ""
"22.3:\n"
"No updates this week, but we’re hard at work on a pressing feature we know you’ll enjoy.\n"
"22.4:\n"
"When you tap on a nested text block, you can immediately edit content in that block—no more tapping through every nesting level to get where you want to go. (Our fingers were getting tired, too.)\n"
msgstr ""

msgctxt "release_note_222"
msgctxt "release_note_223"
msgid ""
"22.2:\n"
"- We added a yellow warning box telling you when notifications and blogging reminders are no longer being sent to your device as push notifications.\n"
"- We updated media access permissions for photos, videos, and audio to align with the Android 13 update.\n"
"22.3:\n"
"No updates this week, but we’re hard at work on a pressing feature we know you’ll enjoy.\n"
msgstr ""

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
Expand Down Expand Up @@ -92,7 +91,7 @@ msgid ""
"\n"
"Whether you need a website builder to create your website, or a simple blog maker, WordPress can help. It gives you beautiful designs, powerful features, and the freedom to build anything you want.\n"
"\n"
"California users privacy notice: https://wp.me/Pe4R-d/#california-consumer-privacy-act-ccpa.\n"
"California users privacy notice: https://wp.me/Pe4R-d/#california-consumer-privacy-act-ccpa."
msgstr ""

#. translators: Title to be displayed in the Play Store. Limit to 30 characters including spaces and commas!
Expand Down
4 changes: 1 addition & 3 deletions WordPress/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
* [**] [internal] Block editor: Add fullscreen embed preview to Android [https://github.com/wordpress-mobile/gutenberg-mobile/pull/5743]
* [**] Block editor: Tapping on a nested block now gets focus directly instead of having to tap multiple times depending on the nesting levels. [https://github.com/WordPress/gutenberg/pull/50108]

When you tap on a nested text block, you can immediately edit content in that block—no more tapping through every nesting level to get where you want to go. (Our fingers were getting tired, too.)
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class BlockEditorTests : BaseTest() {
"""

@Test
@Ignore("Skipped due to increased flakiness. See build-and-ship channel for 17.05.2023")
fun e2ePublishSimplePost() {
val title = "publishSimplePost"
MySitesPage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.wordpress.android.e2e

import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.wordpress.android.e2e.pages.ReaderPage
import org.wordpress.android.support.BaseTest
Expand All @@ -16,6 +17,7 @@ class ReaderTests : BaseTest() {
}

@Test
@Ignore("Skipped due to increased flakiness. See build-and-ship channel for 17.05.2023")
fun e2eNavigateThroughPosts() {
ReaderPage()
.tapFollowingTab()
Expand All @@ -29,6 +31,7 @@ class ReaderTests : BaseTest() {
}

@Test
@Ignore("Skipped due to increased flakiness. See build-and-ship channel for 17.05.2023")
fun e2eLikePost() {
ReaderPage()
.tapFollowingTab()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.After
import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.wordpress.android.BuildConfig
import org.wordpress.android.R
Expand Down Expand Up @@ -38,6 +39,7 @@ class StatsTests : BaseTest() {
}

@Test
@Ignore("Skipped due to increased flakiness. See build-and-ship channel for 17.05.2023")
fun e2eAllDayStatsLoad() {
val todayVisits = StatsVisitsData("97", "28", "14", "11")
val postsList: List<StatsKeyValueData> = StatsMocksReader().readDayTopPostsToList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.widget.TextView;

import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
Expand Down Expand Up @@ -62,6 +63,7 @@
import org.wordpress.android.util.WPUrlUtils;
import org.wordpress.android.util.WPWebViewClient;
import org.wordpress.android.util.extensions.CompatExtensionsKt;
import org.wordpress.android.viewmodel.wpwebview.WPWebViewSource;
import org.wordpress.android.viewmodel.wpwebview.WPWebViewViewModel;
import org.wordpress.android.viewmodel.wpwebview.WPWebViewViewModel.NavBarUiState;
import org.wordpress.android.viewmodel.wpwebview.WPWebViewViewModel.PreviewModeSelectorStatus;
Expand Down Expand Up @@ -132,8 +134,14 @@ public class WPWebViewActivity extends WebViewActivity implements ErrorManagedWe
public static final String ACTION_BAR_TITLE = "action_bar_title";
public static final String SHOW_PREVIEW_MODE_TOGGLE = "SHOW_PREVIEW_MODE_TOGGLE";
public static final String PRIVATE_AT_SITE_ID = "PRIVATE_AT_SITE_ID";
public static final String CSS_TO_INJECT = "CSS_TO_INJECT";
public static final String WEBVIEW_SOURCE = "WEBVIEW_SOURCE";
private static final int PREVIEW_INITIAL_SCALE = 90;
private static final long PREVIEW_JS_EVALUATION_DELAY = 250L;
private static final long CSS_JS_EVALUATION_DELAY = 250L;
private static final String CSS_INJECTION_SCRIPT_TEMPLATE = "var style = document.createElement('style'); "
+ "style.innerHTML = '%s'; "
+ "document.head.appendChild(style);";

@Inject AccountStore mAccountStore;
@Inject SiteStore mSiteStore;
Expand Down Expand Up @@ -172,7 +180,7 @@ public void handleOnBackPressed() {
refreshBackForwardNavButtons();
} else {
CompatExtensionsKt.onBackPressedCompat(getOnBackPressedDispatcher(), this);
mViewModel.track(Stat.WEBVIEW_DISMISSED);
mViewModel.track(Stat.WEBVIEW_DISMISSED, getSource());
setResultIfNeeded();
}
}
Expand Down Expand Up @@ -263,7 +271,7 @@ public final void configureView() {

setupToolbar();

mViewModel.track(Stat.WEBVIEW_DISPLAYED);
mViewModel.track(Stat.WEBVIEW_DISPLAYED, getSource());
}

private void setupToolbar() {
Expand Down Expand Up @@ -422,19 +430,26 @@ public void onChanged(@Nullable PreviewMode previewMode) {
}

public static void openUrlByUsingGlobalWPCOMCredentials(Context context, String url) {
openWPCOMURL(context, url, null, null, false, false);
openWPCOMURL(context, url, null, null, false, false, null, null);
}

public static void openUrlByUsingGlobalWPCOMCredentials(Context context, String url,
String cssToInject, WPWebViewSource source) {
openWPCOMURL(context, url, null, null, false, false, cssToInject, source);
}

public static void openUrlByUsingGlobalWPCOMCredentials(Context context,
String url,
boolean allowPreviewModeSelection) {
openWPCOMURL(context, url, null, null, allowPreviewModeSelection, false);
openWPCOMURL(context, url, null, null, allowPreviewModeSelection, false, null, null);
}

public static void openPostUrlByUsingGlobalWPCOMCredentials(Context context, String url, String shareableUrl,
String shareSubject, boolean allowPreviewModeSelection,
boolean startPreviewForResult) {
openWPCOMURL(context, url, shareableUrl, shareSubject, allowPreviewModeSelection, startPreviewForResult);
openWPCOMURL(context, url, shareableUrl, shareSubject,
allowPreviewModeSelection, startPreviewForResult,
null, null);
}

// frameNonce is used to show drafts, without it "no page found" error would be thrown
Expand Down Expand Up @@ -545,13 +560,23 @@ public static void openURL(Context context, String url, String referrer) {
openURL(context, url, referrer, false, 0);
}

public static void openURL(Context context, String url, String cssToInject, WPWebViewSource source) {
openURL(context, url, null, false, 0, cssToInject, source);
}

public static void openURL(Context context, String url, boolean allowPreviewModeSelection,
long privateSiteId) {
openURL(context, url, null, allowPreviewModeSelection, privateSiteId);
}

public static void openURL(Context context, String url, String referrer,
boolean allowPreviewModeSelection, long privateSiteId) {
openURL(context, url, referrer, allowPreviewModeSelection, privateSiteId, null, null);
}

public static void openURL(Context context, String url, String referrer,
boolean allowPreviewModeSelection, long privateSiteId,
String cssToInject, WPWebViewSource source) {
if (context == null) {
AppLog.e(AppLog.T.UTILS, "Context is null");
return;
Expand All @@ -572,6 +597,12 @@ public static void openURL(Context context, String url, String referrer,
if (!TextUtils.isEmpty(referrer)) {
intent.putExtra(REFERRER_URL, referrer);
}
if (!TextUtils.isEmpty(cssToInject)) {
intent.putExtra(CSS_TO_INJECT, cssToInject);
}
if (source != null) {
intent.putExtra(WPWebViewActivity.WEBVIEW_SOURCE, source);
}
context.startActivity(intent);
}

Expand All @@ -590,7 +621,7 @@ protected static boolean checkContextAndUrl(Context context, String url) {
}

private static void openWPCOMURL(Context context, String url, String shareableUrl, String shareSubject) {
openWPCOMURL(context, url, shareableUrl, shareSubject, false, false);
openWPCOMURL(context, url, shareableUrl, shareSubject, false, false, null, null);
}

private static void openWPCOMURL(
Expand All @@ -599,7 +630,9 @@ private static void openWPCOMURL(
String shareableUrl,
String shareSubject,
boolean allowPreviewModeSelection,
boolean startPreviewForResult
boolean startPreviewForResult,
String cssToInject,
WPWebViewSource source
) {
if (!checkContextAndUrl(context, url)) {
return;
Expand All @@ -616,6 +649,12 @@ private static void openWPCOMURL(
if (!TextUtils.isEmpty(shareSubject)) {
intent.putExtra(WPWebViewActivity.SHARE_SUBJECT, shareSubject);
}
if (!TextUtils.isEmpty(cssToInject)) {
intent.putExtra(WPWebViewActivity.CSS_TO_INJECT, cssToInject);
}
if (source != null) {
intent.putExtra(WPWebViewActivity.WEBVIEW_SOURCE, source);
}

if (startPreviewForResult) {
intent.putExtra(WPWebViewActivity.WEBVIEW_USAGE_TYPE,
Expand Down Expand Up @@ -696,6 +735,11 @@ protected WebViewClient createWebViewClient(List<String> allowedURL) {

@Override
public void onWebViewPageLoaded() {
if (getIntent().hasExtra(CSS_TO_INJECT)) {
String css = getIntent().getStringExtra(CSS_TO_INJECT);
injectCss(css);
}

if (mPreviewModeChangeAllowed) {
enforcePreviewMode();
} else {
Expand All @@ -704,6 +748,15 @@ public void onWebViewPageLoaded() {
refreshBackForwardNavButtons();
}

private void injectCss(@NonNull final String css) {
String script = String.format(CSS_INJECTION_SCRIPT_TEMPLATE, css);

new Handler().postDelayed(
() -> mWebView.evaluateJavascript(script, null),
CSS_JS_EVALUATION_DELAY
);
}

private void refreshBackForwardNavButtons() {
mViewModel.toggleBackNavigation(mWebView.canGoBack());
mViewModel.toggleForwardNavigation(mWebView.canGoForward());
Expand Down Expand Up @@ -908,7 +961,7 @@ public boolean onOptionsItemSelected(final MenuItem item) {
int itemID = item.getItemId();

if (itemID == android.R.id.home) {
mViewModel.track(Stat.WEBVIEW_DISMISSED);
mViewModel.track(Stat.WEBVIEW_DISMISSED, getSource());
setResultIfNeeded();
} else if (itemID == R.id.menu_refresh) {
mViewModel.track(Stat.WEBVIEW_RELOAD_TAPPED);
Expand Down Expand Up @@ -984,4 +1037,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
public void startActivityForFileChooserResult(Intent intent, int requestCode) {
startActivityForResult(intent, requestCode);
}

@Nullable
private WPWebViewSource getSource() {
return (WPWebViewSource) getIntent().getSerializableExtra(WPWebViewActivity.WEBVIEW_SOURCE);
}
}
24 changes: 21 additions & 3 deletions WordPress/src/main/java/org/wordpress/android/ui/pages/PageItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.annotation.ColorRes
import androidx.annotation.IdRes
import androidx.annotation.StringRes
import org.wordpress.android.R
import org.wordpress.android.fluxc.model.SiteModel
import org.wordpress.android.ui.pages.PageItem.Type.DIVIDER
import org.wordpress.android.ui.pages.PageItem.Type.EMPTY
import org.wordpress.android.ui.pages.PageItem.Type.PAGE
Expand Down Expand Up @@ -190,9 +191,26 @@ sealed class PageItem(open val type: Type) {
) : PageItem(EMPTY)

object VirtualHomepage : PageItem(VIRTUAL_HOMEPAGE) {
enum class Action {
OPEN_SITE_EDITOR,
OPEN_LEARN_MORE_URL,
sealed class Action {
class OpenSiteEditor : Action() {
val customCss: String get() = SITE_EDITOR_CSS

fun getUrl(site: SiteModel): String = site.adminUrl + "site-editor.php?canvas=edit"

companion object {
const val SITE_EDITOR_CSS = ".edit-site-header-edit-mode { padding-left: 0px } " +
".edit-site-site-hub { display: none } " +
".edit-site-template-details " +
".edit-site-template-details__show-all-button.components-button " +
"{ display: none }"
}
}

sealed class OpenExternalLink(
val url: String
) : Action() {
object TemplateSupport : OpenExternalLink("https://wordpress.com/support/templates/")
}
}
}

Expand Down
Loading

0 comments on commit 92f1812

Please sign in to comment.