Skip to content

Commit

Permalink
Merge pull request #11322 from wordpress-mobile/merge/release-14.2-to…
Browse files Browse the repository at this point in the history
…-master

Merge 14.2 release into master (includes release notes changes)
  • Loading branch information
jkmassel authored Feb 14, 2020
2 parents 4b6254a + d349ba4 commit 8921c1d
Show file tree
Hide file tree
Showing 90 changed files with 1,929 additions and 620 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ DEPENDENCIES
rmagick (~> 3.2.0)

BUNDLED WITH
2.0.2
2.1.1
13 changes: 12 additions & 1 deletion RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
14.2
14.3
-----

14.2
-----
* Block editor: Long-press Inserter icon to show options to add before/after
* Block editor: Retry displaying image when connectivity restores
* Block editor: Fix blank post when sharing media from another app
* Block editor: Add support for image size options in the gallery block
* Block editor: Fix issue that sometimes prevented merging paragraph blocks
* Block editor: Fix retry media upload action

14.1
-----
* Fixes an issue where searching for posts sometimes doesn't show some results.

* Disable the option to remove a Jetpack site from site picker
* Block editor: small performance improvements

* Block Editor: Reduced padding around text on Rich Text based blocks.
* Block Editor: Improved stability on very long posts.
* Block Editor: New block "Shortcode". You can now create and edit Shortcode blocks in the editor.
Expand Down
13 changes: 9 additions & 4 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ android {
if (project.hasProperty("versionName")) {
versionName project.property("versionName")
} else {
versionName "alpha-207"
versionName "alpha-208"
}
versionCode 825
versionCode 828
minSdkVersion 21
targetSdkVersion 28

Expand All @@ -84,9 +84,9 @@ android {
dimension "buildType"
// Only set the release version if one isn't provided
if (!project.hasProperty("versionName")) {
versionName "14.1"
versionName "14.2-rc-1"
}
versionCode 826
versionCode 827
buildConfigField "boolean", "ME_ACTIVITY_AVAILABLE", "false"
}

Expand Down Expand Up @@ -133,6 +133,11 @@ android {
packagingOptions {
// MPAndroidChart uses androidX - remove this line when we migrate everything to androidX
exclude 'META-INF/proguard/androidx-annotations.pro'

// Exclude React Native's JSC and Hermes debug binaries
exclude '**/libjscexecutor.so'
exclude '**/libhermes-inspector.so'
exclude '**/libhermes-executor-debug.so'
}

bundle {
Expand Down
21 changes: 13 additions & 8 deletions WordPress/metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ msgstr ""
"Project-Id-Version: Release Notes & Play Store Descriptions\n"

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
msgctxt "release_note_142"
msgid ""
"14.2:\n"
"Lots of updates to the block editor:\n"
"\n"
"* Added a long-press icon for adding blocks before/after.\n"
"* App will try to display images when coming back online after a disconnection.\n"
"* Resolved issue with blank editor when trying to create a post with images or links from another app.\n"
"* Added image size options to the Gallery block.\n"
"* Fixed a bug that prevented paragraph blocks from merging.\n"
"\n"
msgstr ""

msgctxt "release_note_141"
msgid ""
"14.1:\n"
Expand All @@ -22,14 +35,6 @@ msgid ""
"\n"
msgstr ""

msgctxt "release_note_140"
msgid ""
"14.0:\n"
"- Block editor: Sometimes the Block editor would crash when you tried to undo, which is a little too much undoing. That’s fixed, along with a bug affecting image placeholders.\n"
"- Moved the “me” section of the app to within “My Site”.\n"
"- Added a floating action button to My Site for quick creation of new posts and pages.\n"
msgstr ""

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
msgctxt "sample_post_content"
msgid "The best moment of any trip, for me, is when I first step foot off the plane. The whole of the trip is in front me, ripe with possibility."
Expand Down
10 changes: 7 additions & 3 deletions WordPress/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
- Block Editor: a new Shortcode block lets you create and edit shortcodes, we’ve reduced the padding around text-based blocks, and editing very long posts is now a more stable experience.
- Updates: The option to remove a Jetpack site from the site picker has been disabled.
- Bug fixes: searches for posts omitted some results. Now searching works as intended!
Lots of updates to the block editor:

* Added a long-press icon for adding blocks before/after.
* App will try to display images when coming back online after a disconnection.
* Resolved issue with blank editor when trying to create a post with images or links from another app.
* Added image size options to the Gallery block.
* Fixed a bug that prevented paragraph blocks from merging.
2 changes: 2 additions & 0 deletions WordPress/proguard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
-dontwarn org.wordpress.aztec.glideloader.**

-dontwarn com.github.godness84.RNRecyclerViewList.**

-keep class com.facebook.hermes.unicode.** { *; }
###### React Native - end

###### Main resource class - begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,62 @@

import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.json.JSONException;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.libsodium.jni.NaCl;
import org.libsodium.jni.Sodium;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static junit.framework.Assert.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

@RunWith(AndroidJUnit4.class)
public class EncryptionUtilsTest {
byte[] mPublicKey;
byte[] mSecretKey;

static final int BOX_PUBLIC_KEY_BYTES = NaCl.sodium().crypto_box_publickeybytes();
static final int BOX_SECRET_KEY_BYTES = NaCl.sodium().crypto_box_secretkeybytes();

static final int BASE64_DECODE_FLAGS = Base64.DEFAULT;

private static final int BOX_PUBLIC_KEY_BYTES = NaCl.sodium().crypto_box_publickeybytes();
private static final int BOX_SECRET_KEY_BYTES = NaCl.sodium().crypto_box_secretkeybytes();
private static final int BASE64_DECODE_FLAGS = Base64.DEFAULT;
// test data
static final String TEST_EMPTY_STRING = "";
static final String TEST_LOG_STRING = "WordPress - 13.5 - Version code: 789\n"
+ "Android device name: Google Android SDK built for x86\n\n"
+ "01 - [Nov-11 03:04 UTILS] WordPress.onCreate\n"
+ "02 - [Nov-11 03:04 API] Dispatching action: ListAction-REMOVE_EXPIRED_LISTS\n"
+ "03 - [Nov-11 03:04 API] QuickStartStore onRegister\n"
+ "04 - [Nov-11 03:04 STATS] 🔵 Tracked: deep_link_not_default_handler, "
+ "Properties: {\"interceptor_classname\":\"com.google.android.setupwizard.util.WebDialogActivity\"}\n"
+ "05 - [Nov-11 03:04 UTILS] App comes from background\n"
+ "06 - [Nov-11 03:04 STATS] 🔵 Tracked: application_opened\n"
+ "07 - [Nov-11 03:04 READER] notifications update job service > job scheduled\n"
+ "08 - [Nov-11 03:04 API] Dispatching action: SiteAction-FETCH_SITES\n"
+ "09 - [Nov-11 03:04 API] StackTrace: com.android.volley.AuthFailureError\n"
+ " at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:195)\n"
+ " at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)\n"
+ " at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)\n"
+ " at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)\n";
static final String TEST_CHAR_SAMPLE = "!\"#$%&' ()*+,- ./{|}~[\\]^_`: ;<=>?Ⓟ @︼︽︾⑳₡\n"
+ "¢£¤¥¦§¨©ª«¬®¯ °±²ɇɈɉɊɋɌɎɏɐɑɒɓɔ ɕɖɗɘəɚ⤚▓⤜⤝⤞⤟ⰙⰚⰛⰜ⭑⬤⭒‰ ꕢ ꕣꕤ ꕥ¥₩ \n"
+ "❌ ⛱⛲⛳⛰⛴⛵ ⚡⏰⏱⏲⭐ ✋☕⛩⛺⛪✨ ⚽ ⛄⏳\n"
+ " ḛḜḝḞṶṷṸẂ ẃ ẄẅẆ ᾃᾄᾅ ᾆ Ṥṥ ȊȋȌ ȍ Ȏȏ ȐṦṧåæçèéêë ì í ΔƟΘ\n"
+ "㥯㥰㥱㥲㥳㥴㥵 㥶㥷㥸㥹㥺 俋 俌 俍 俎 俏 俐 俑 俒 俓㞢㞣㞤㞥㞦㞧㞨쨜 쨝쨠쨦걵걷 걸걹걺モヤユ ヨラリル\n"
+ " ﵑﵓﵔ ﵕﵗ ﵘ ﯿ ﰀﰁﰂ ﰃ ﮁﮂﮃﮄﮅᎹᏪ Ⴥჭᡴᠦᡀ\n";
private static final List<String> TEST_EMPTY_STRING = new ArrayList<>();
private static final List<String> TEST_LOG_STRING = Arrays.asList("WordPress - 13.5 - Version code: 789\n",
"Android device name: Google Android SDK built for x86\n\n",
"01 - [Nov-11 03:04 UTILS] WordPress.onCreate\n",
"02 - [Nov-11 03:04 API] Dispatching action: ListAction-REMOVE_EXPIRED_LISTS\n",
"03 - [Nov-11 03:04 API] QuickStartStore onRegister\n",
"04 - [Nov-11 03:04 STATS] 🔵 Tracked: deep_link_not_default_handler ",
"Properties: {\"interceptor_classname\":\"com.google.android.setupwizard.util.WebDialogActivity\"}\n",
"05 - [Nov-11 03:04 UTILS] App comes from background\n",
"06 - [Nov-11 03:04 STATS] 🔵 Tracked: application_opened\n",
"07 - [Nov-11 03:04 READER] notifications update job service > job scheduled\n",
"08 - [Nov-11 03:04 API] Dispatching action: SiteAction-FETCH_SITES\n",
"09 - [Nov-11 03:04 API] StackTrace: com.android.volley.AuthFailureError\n",
" at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:195)\n",
" at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)\n",
" at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)\n",
" at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)\n");

private static final List<String> TEST_CHAR_SAMPLE =
Arrays.asList("!\"#$%&' ()*+,- ./{|}~[\\]^_`: ;<=>?Ⓟ @︼︽︾⑳₡\n",
"¢£¤¥¦§¨©ª«¬®¯ °±²ɇɈɉɊɋɌɎɏɐɑɒɓɔ ɕɖɗɘəɚ⤚▓⤜⤝⤞⤟ⰙⰚⰛⰜ⭑⬤⭒‰ ꕢ ꕣꕤ ꕥ¥₩ \n",
"❌ ⛱⛲⛳⛰⛴⛵ ⚡⏰⏱⏲⭐ ✋☕⛩⛺⛪✨ ⚽ ⛄⏳\n",
" ḛḜḝḞṶṷṸẂ ẃ ẄẅẆ ᾃᾄᾅ ᾆ Ṥṥ ȊȋȌ ȍ Ȏȏ ȐṦṧåæçèéêë ì í ΔƟΘ\n",
"㥯㥰㥱㥲㥳㥴㥵 㥶㥷㥸㥹㥺 俋 俌 俍 俎 俏 俐 俑 俒 俓㞢㞣㞤㞥㞦㞧㞨쨜 쨝쨠쨦걵걷 걸걹걺モヤユ ヨラリル\n",
" ﵑﵓﵔ ﵕﵗ ﵘ ﯿ ﰀﰁﰂ ﰃ ﮁﮂﮃﮄﮅᎹᏪ Ⴥჭᡴᠦᡀ\n");
private byte[] mPublicKey;
private byte[] mSecretKey;

@Before
public void setup() {
mPublicKey = new byte[BOX_PUBLIC_KEY_BYTES];
mSecretKey = new byte[BOX_SECRET_KEY_BYTES];
NaCl.sodium().crypto_box_keypair(mPublicKey, mSecretKey);
Sodium.crypto_box_keypair(mPublicKey, mSecretKey);
}

@Test
Expand All @@ -73,34 +77,28 @@ public void testCharacterSampleEncryptionResultIsValid() {
testEncryption(TEST_CHAR_SAMPLE);
}

private void testEncryption(final String testString) {
/**
* This method exercises the encryption logic and verify the result is
* following the format returned from [EncryptionUtils.generateJSONEncryptedLogs()]
*/
private void testEncryption(final List<String> testString) {
final JSONObject encryptionDataJson = getEncryptionDataJson(mPublicKey, testString);
assertNotNull(encryptionDataJson);

/*
Expected Contents for JSON:
{
"keyedWith": "v1",
"encryptedKey": "$key_as_base_64", // The encrypted AES key
"header": "base_64_encoded_header", // The xchacha20poly1305 stream header
"messages": [] // the stream elements, base-64 encoded
}
*/

final byte[] dataSpecificKey = getDataSpecificKey(encryptionDataJson);
assertNotNull(dataSpecificKey);

final byte[] header = getHeader(encryptionDataJson);
assertNotNull(header);

final byte[] state = new byte[EncryptionUtils.XCHACHA20POLY1305_STATEBYTES];
final int initPullReturnCode = NaCl.sodium().crypto_secretstream_xchacha20poly1305_init_pull(
final byte[] state = new byte[EncryptionUtils.STATEBYTES];
final int initPullReturnCode = Sodium.crypto_secretstream_xchacha20poly1305_init_pull(
state,
header,
dataSpecificKey);
assertEquals(initPullReturnCode, 0);

String decryptedDataString = "";
final List<String> decryptedData = new ArrayList<>();
final byte[][] encryptedLines = getEncryptedLines(encryptionDataJson);
assertNotNull(encryptedLines);
for (int i = 0; i < encryptedLines.length; ++i) {
Expand All @@ -111,33 +109,32 @@ private void testEncryption(final String testString) {
break;
}

decryptedDataString = decryptedDataString + decryptedLine;
decryptedData.add(decryptedLine);
}

assertEquals(testString, decryptedDataString);
assertEquals(testString, decryptedData);
}
private JSONObject getEncryptionDataJson(final byte[] publicKey, final String data) {

private JSONObject getEncryptionDataJson(final byte[] publicKey, final List<String> data) {
try {
final String encryptionDataJsonString = EncryptionUtils.encryptStringData(
Base64.encodeToString(publicKey, Base64.DEFAULT),
data);
final String encryptionDataJsonString = EncryptionUtils.generateJSONEncryptedLogs(publicKey, data);

return new JSONObject(encryptionDataJsonString);
} catch (JSONException e) {
fail("encryptStringData failed with JSONException: " + e.toString());
fail("generateJSONEncryptedLogs failed with JSONException: " + e.toString());
}
return null;
}

private byte[] getDataSpecificKey(final JSONObject encryptionDataJson) {
try {
final byte[] decryptedKey = new byte[EncryptionUtils.XCHACHA20POLY1305_KEYBYTES];
final byte[] decryptedKey = new byte[EncryptionUtils.KEYBYTES];
final String encryptedKeyBase64 = encryptionDataJson.getString("encryptedKey");
final byte[] encryptedKey = Base64.decode(encryptedKeyBase64, BASE64_DECODE_FLAGS);
final int returnCode = NaCl.sodium().crypto_box_seal_open(
final int returnCode = Sodium.crypto_box_seal_open(
decryptedKey,
encryptedKey,
EncryptionUtils.XCHACHA20POLY1305_KEYBYTES + EncryptionUtils.BOX_SEALBYTES,
EncryptionUtils.KEYBYTES + EncryptionUtils.BOX_SEALBYTES,
mPublicKey,
mSecretKey);
assertEquals(returnCode, 0);
Expand Down Expand Up @@ -180,12 +177,12 @@ private byte[][] getEncryptedLines(final JSONObject encryptionDataJson) {

private String getDecryptedString(final byte[] state, final byte[] encryptedLine) {
final byte[] tag = new byte[1];
final int decryptedLineLength = encryptedLine.length - EncryptionUtils.XCHACHA20POLY1305_ABYTES;
final int decryptedLineLength = encryptedLine.length - EncryptionUtils.ABYTES;
final byte[] decryptedLine = new byte[decryptedLineLength];
final byte[] additionalData = new byte[0]; // opting not to use this value
final int additionalDataLength = 0;
final int[] decryptedLineLengthOutput = new int[0]; // opting not to get this value
final int returnCode = NaCl.sodium().crypto_secretstream_xchacha20poly1305_pull(
final int returnCode = Sodium.crypto_secretstream_xchacha20poly1305_pull(
state,
decryptedLine,
decryptedLineLengthOutput,
Expand All @@ -197,9 +194,9 @@ private String getDecryptedString(final byte[] state, final byte[] encryptedLine
assertEquals(returnCode, 0);

final int encryptionTag = tag[0];
if (encryptionTag == EncryptionUtils.XCHACHA20POLY1305_TAG_MESSAGE) {
if (encryptionTag == EncryptionUtils.TAG_MESSAGE) {
return new String(decryptedLine);
} else if (encryptionTag == EncryptionUtils.XCHACHA20POLY1305_TAG_FINAL) {
} else if (encryptionTag == EncryptionUtils.TAG_FINAL) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions WordPress/src/main/java/org/wordpress/android/WordPress.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ public void onCreate() {
mContext = this;
long startDate = SystemClock.elapsedRealtime();

CrashLoggingUtils.startCrashLogging(getContext());

// This call needs be made before accessing any methods in android.webkit package
setWebViewDataDirectorySuffixOnAndroidP();

CrashLoggingUtils.startCrashLogging(getContext());

initWellSql();

// Init Dagger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,16 @@ public String getMshotsUrl(int width) {
}

public boolean isSameAs(ReaderBlog blogInfo) {
return isSameAs(blogInfo, true);
}

public boolean isSameAs(ReaderBlog blogInfo, boolean compareSubscribers) {
return blogInfo != null
&& this.blogId == blogInfo.blogId
&& this.feedId == blogInfo.feedId
&& this.isFollowing == blogInfo.isFollowing
&& this.isPrivate == blogInfo.isPrivate
&& this.numSubscribers == blogInfo.numSubscribers
&& ((this.numSubscribers == blogInfo.numSubscribers) || !compareSubscribers)
&& this.getName().equals(blogInfo.getName())
&& this.getDescription().equals(blogInfo.getDescription())
&& this.getUrl().equals(blogInfo.getUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.wordpress.android.ui.news.LocalNewsService;
import org.wordpress.android.ui.news.NewsService;
import org.wordpress.android.ui.reader.ReaderPostWebViewCachingFragment;
import org.wordpress.android.ui.reader.subfilter.SubfilterPageFragment;
import org.wordpress.android.ui.sitecreation.SiteCreationStep;
import org.wordpress.android.ui.sitecreation.SiteCreationStepsProvider;
import org.wordpress.android.ui.stats.refresh.StatsFragment;
Expand Down Expand Up @@ -94,6 +95,9 @@ public static NewsService provideLocalNewsService(ContextProvider contextProvide
@ContributesAndroidInjector
abstract ReaderPostWebViewCachingFragment contributeReaderPostWebViewCachingFragment();

@ContributesAndroidInjector
abstract SubfilterPageFragment contributeSubfilterPageFragment();

@Provides
public static WizardManager<SiteCreationStep> provideWizardManager(
SiteCreationStepsProvider stepsProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.wordpress.android.ui.posts.editor.StorePostViewModel;
import org.wordpress.android.ui.reader.ReaderCommentListViewModel;
import org.wordpress.android.ui.reader.viewmodels.ReaderPostListViewModel;
import org.wordpress.android.ui.reader.viewmodels.SubfilterPageViewModel;
import org.wordpress.android.ui.sitecreation.SiteCreationMainVM;
import org.wordpress.android.ui.sitecreation.domains.SiteCreationDomainsViewModel;
import org.wordpress.android.ui.sitecreation.previews.SitePreviewViewModel;
Expand Down Expand Up @@ -96,6 +97,11 @@ abstract class ViewModelModule {
@ViewModelKey(ReaderPostListViewModel.class)
abstract ViewModel readerPostListViewModel(ReaderPostListViewModel viewModel);

@Binds
@IntoMap
@ViewModelKey(SubfilterPageViewModel.class)
abstract ViewModel subfilterPageViewModel(SubfilterPageViewModel viewModel);

@Binds
@IntoMap
@ViewModelKey(JetpackRemoteInstallViewModel.class)
Expand Down
Loading

0 comments on commit 8921c1d

Please sign in to comment.