Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 13.7 into master #10814

Merged
merged 156 commits into from
Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
6b35195
Extract push IDs
planarvoid Oct 22, 2019
840cddf
Add Delete intent to all the notification builderes
planarvoid Oct 22, 2019
742f7b7
Convert NotificationPushId to enum
planarvoid Oct 22, 2019
5b80bab
Create notifications tracker
planarvoid Oct 22, 2019
c121ee3
Use SystemNotificationTracker
planarvoid Oct 22, 2019
7c3613e
Add tests
planarvoid Oct 22, 2019
f9b4808
Fixes
planarvoid Oct 23, 2019
01e8b37
Revert projects.xml change
planarvoid Oct 23, 2019
996a643
Add tracking for shown and tapped notification
planarvoid Oct 24, 2019
f82a2f3
Fix crash
planarvoid Oct 24, 2019
fcacbe5
Remove test logs
planarvoid Oct 24, 2019
27ffcb7
Add missing newline
planarvoid Oct 24, 2019
de91e04
Merge branch 'feature/add_dismiss_tracking_to_notifications' into fea…
planarvoid Oct 24, 2019
8039bb1
Updating gutenberg-mobile reference for fullscreen preview branch
cameronvoell Oct 30, 2019
63b6c53
Adding OnImageFullscreenPreviewListener to GB Fragment for listening …
cameronvoell Oct 30, 2019
0358274
EditPostActivity implements EditorImagePreviewListener in order to ro…
cameronvoell Oct 30, 2019
e49c088
Rename suffixes to use the US/Canada/Modern British version instead o…
hafizrahman Nov 5, 2019
092a91d
added utility function for encrypting AppLog using libsodium
Nov 4, 2019
28b5eca
* using UTF-8 encoding when converting String to bytes
Nov 4, 2019
02f9e70
now base64 decoding the public key before using
Nov 5, 2019
735f6ff
added a new line to the log line after we split the lines in the AppLog
Nov 5, 2019
34fc367
fixed some style issues
Nov 5, 2019
7fba3e4
fixed an issue with not using the correct byte array length when encr…
Nov 5, 2019
7334b74
cleaned up some comments
Nov 5, 2019
92d6557
fixed style issue
Nov 5, 2019
9b930a8
Merge pull request #10729 from wordpress-mobile/merge/13.6-into-develop
jkmassel Nov 5, 2019
5c463a6
Merge branch 'develop' into feature/add_dismiss_tracking_to_notificat…
planarvoid Nov 6, 2019
23aa14c
Merge pull request #10667 from wordpress-mobile/feature/add_dismiss_t…
develric Nov 6, 2019
0fb273f
Merge branch 'develop' into feature/add_tap_tracking_to_notifications
planarvoid Nov 6, 2019
bc953fb
Merge pull request #10679 from wordpress-mobile/feature/add_tap_track…
develric Nov 6, 2019
4d2737a
Unit test fix.
hafizrahman Nov 6, 2019
b52b813
Merge pull request #10737 from hafizrahman/issue/10709-more-understan…
shiki Nov 6, 2019
d63f5d7
Update gutenberg ref
mchowning Nov 6, 2019
bdec2c2
Merge pull request #10740 from wordpress-mobile/merge/13.6-into-master
jkmassel Nov 6, 2019
834eb16
extracted some tags into class constants for consistency
Nov 7, 2019
af9988f
Gutenberg progressive rollout to 5% of our _wpcom_ userbase
maxme Nov 7, 2019
423c2d8
Sharing Settings: Hide Learn More button everywhere except for FB.
hafizrahman Nov 7, 2019
a837ae6
Fix checkstyle violations
maxme Nov 7, 2019
55412e8
Update gutenberg submodule to target i18n fix PR
Tug Oct 31, 2019
4aef4bb
Remove old gutenberg strings from resource file
Tug Oct 31, 2019
3797fcc
Script to automate merging strings.xml files into main one
Tug Nov 3, 2019
38ec98b
Minor refactoring
Tug Nov 3, 2019
a6648c8
Minor refactoring
Tug Nov 3, 2019
b692795
Minor refactoring
Tug Nov 3, 2019
6da87e8
Add prefix Autogenerated to sections
Tug Nov 3, 2019
d2b713a
Minor refactoring
Tug Nov 3, 2019
1e3d468
Add missing comments to WordPressLoginFlow strings.xml
Tug Nov 3, 2019
6b77342
Fix having opening tag present when editing existing section
Tug Nov 3, 2019
f65f1b6
Fix inserting at the right index
Tug Nov 4, 2019
efcc694
Update generating gutenberg translations to handle plurals
Tug Nov 4, 2019
a39ef5d
Add pre-commit hook to the repository
Tug Nov 4, 2019
09c7721
Add missing class instance declaration for plurals
Tug Nov 4, 2019
ce4e479
Only merge gutenberg strings in for now
Tug Nov 7, 2019
32d3fe3
Update main res xml
Tug Nov 7, 2019
7772480
Update strings.xml
Tug Nov 7, 2019
c8437d0
Fix indents for plurals
Tug Nov 7, 2019
e52d002
Revert changes to libs/login
Tug Nov 7, 2019
48fb918
Make sure strings.xml ends with a newline char
Tug Nov 7, 2019
c4b6654
Update gutenberg ref
mchowning Nov 7, 2019
b67450e
Remove unused LoadPostContent async task
planarvoid Nov 8, 2019
95f1025
Update reference of gb-mobile to official tag for 1.16.1
SergioEstevao Nov 8, 2019
cfeaea6
Revert changes to WordPress/src/main/res/values/strings.xml
Tug Nov 8, 2019
4aaf73c
Merge pull request #10754 from hafizrahman/issue/9828-make-learn-more…
shiki Nov 8, 2019
b00ba72
avatar no longer announces "site icon"
jd-alexander Nov 5, 2019
bc7ca4c
Grouped the empty view elements into one so when the user hovers only…
jd-alexander Nov 6, 2019
879ab12
The empty view for the FilterRecyclerView now announces it's state.
jd-alexander Nov 6, 2019
45e83e4
Fixed save post icon announcement issue
jd-alexander Nov 6, 2019
b348fe2
Fixed the text contrast of several views inside the reader layouts.
jd-alexander Nov 6, 2019
f5672e5
Moved empty state announcement to the empty view itself.
jd-alexander Nov 7, 2019
d202317
Simplified string formatting using Kotlin string templates.
jd-alexander Nov 8, 2019
5e1e299
Changed "bookmark icon" to "Add to Save Posts button" for TalkBack co…
jd-alexander Nov 8, 2019
975d58b
"List" announcement no longer happens when the user hovers over the R…
jd-alexander Nov 8, 2019
b190abb
Announce list state when the data is loaded.
jd-alexander Nov 8, 2019
b24a715
Added TouchDelegate extension method so that the touch area of views …
jd-alexander Nov 9, 2019
f8234a1
Added touch target to follow button to meet accessibility requirements.
jd-alexander Nov 9, 2019
9e3a657
Added touch target to discover and visit layout to meet accessibility…
jd-alexander Nov 9, 2019
98a6ed3
Added touch target sizing to more menu button to meet accessibility r…
jd-alexander Nov 9, 2019
f703dab
Added touch target to filter spinner to meet accessibility requirements.
jd-alexander Nov 9, 2019
812a642
Removed unnecessary blank line.
jd-alexander Nov 9, 2019
94ad7ff
Changed text contrast of tag edit text style.
jd-alexander Nov 9, 2019
9a452d7
removed extra line from ViewUtils
jd-alexander Nov 9, 2019
c297893
added TouchTarget Area to add button for accessibility.
jd-alexander Nov 9, 2019
77d4e2e
refactored EncryptionUtils
Nov 10, 2019
5114caa
Point to Gutenberg mobile v1.17.0
hypest Nov 11, 2019
b9b7928
Fix issues in upload service
malinajirka Nov 11, 2019
6589531
Fix issues in upload service
malinajirka Nov 11, 2019
21b9a88
Update gutenberg-mobile ref
hypest Nov 11, 2019
6e59663
Merge pull request #10750 from wordpress-mobile/gutenberg/release-1.16.1
hypest Nov 11, 2019
790791d
Update gutenberg-mobile ref
hypest Nov 11, 2019
caaeedf
Merge branch 'develop' into gutenberg/release-1.17.0
hypest Nov 11, 2019
96240f7
Merge pull request #10770 from wordpress-mobile/fix-upload-service
mzorz Nov 11, 2019
2d7fd72
cleaned up the code a little bit
Nov 11, 2019
c7f4539
added automated testing for EncryptionUtils class
Nov 11, 2019
1d950a0
added touch targets to the remove button inside the Reader's Followed…
jd-alexander Nov 12, 2019
4c1e064
Update release notes
hypest Nov 12, 2019
cdfaad7
Update Gutenberg mobile ref
hypest Nov 12, 2019
e89767d
Remove pre-commit hook file
Tug Nov 12, 2019
d511ac0
Remove unused imports
planarvoid Nov 12, 2019
65b5392
Merge pull request #10784 from wordpress-mobile/merge/13.6-into-develop
jkmassel Nov 12, 2019
30460a6
Increased Touch Target for the EditText & Button controls that allows…
jd-alexander Nov 12, 2019
fff2492
Removed unnecessary media ID not required for current fullscreen impl…
cameronvoell Nov 13, 2019
5169af3
Updating gb-mobile ref for updated bundles.
cameronvoell Nov 13, 2019
09c15a8
fixed a bug and cleaned up some code in EncryptionUtils
Nov 13, 2019
dd084bd
Fixes time in unpublished revision and conflict dialogs
malinajirka Nov 13, 2019
e8a1f5d
Update release notes
malinajirka Nov 13, 2019
4b3c761
Update GB hash
daniloercoli Nov 13, 2019
8028d0a
Merge pull request #10762 from wordpress-mobile/issue/remove_unused_a…
malinajirka Nov 13, 2019
8088889
Merge pull request #10788 from wordpress-mobile/issue/10786-autosave-…
mzorz Nov 13, 2019
2ff8e8d
Exclude users from the cohort if they have at least one Aztec enabled…
maxme Nov 13, 2019
e64e860
Target the same libs/gutenberg-mobile as gutenberg/release-1.17.0
Tug Nov 13, 2019
b8a2f7a
Add rule to prevent proguard from obfuscating the main resource file …
Tug Nov 13, 2019
739c1da
Move rule from WordPressEditor to WordPress
Tug Nov 13, 2019
ba41a7f
Preserve InnerClasses
Tug Nov 13, 2019
d1fd201
touch targets now utilize dimens instead of hardcoded values.
jd-alexander Nov 13, 2019
028157e
improved layout by removing hardcoded padding, removed other paddings…
jd-alexander Nov 13, 2019
8cf1db4
Gb-mobile caught up with release branches.
cameronvoell Nov 13, 2019
f7bd02b
Updating gb-mobile reference.
cameronvoell Nov 14, 2019
9095d77
Merge branch 'gutenberg/release-1.17.0' into gutenberg/image-fullscre…
cameronvoell Nov 14, 2019
180c789
Updating fullscreen preview parameter to better name, mediaUrl.
cameronvoell Nov 14, 2019
aa875f1
reworked encryption tests, cleaned up some code and fixed a bug
Nov 14, 2019
66e5214
added empty string encryption test and fixed a bug with empty string …
Nov 14, 2019
fada72d
Updated Release notes: Block editor: Images clickable for fullscreen …
cameronvoell Nov 14, 2019
57afb09
updating gb-mobile reference. disabling fullscreen preview during upl…
cameronvoell Nov 14, 2019
01d839f
Updating gutenberg reference after updating gb-mobile release notes.
cameronvoell Nov 14, 2019
8ca3935
Merge pull request #10790 from wordpress-mobile/fix/resource-reflecti…
Tug Nov 14, 2019
f013836
Merge remote-tracking branch 'origin/develop' into gutenberg/release-…
Tug Nov 14, 2019
eec0ca7
Abort gutenberg opt-in if the network is not available
maxme Nov 14, 2019
d0c05b9
Update gutenberg ref
etoledom Nov 14, 2019
5a4e072
Merge branch 'gutenberg/release-1.17.0' into gutenberg/image-fullscre…
hypest Nov 14, 2019
56b0e4a
Update the gutenberg-mobile ref
hypest Nov 14, 2019
563bc1f
Update gutenberg-mobile to the merged hash
hypest Nov 14, 2019
b97ab2e
Merge pull request #10714 from wordpress-mobile/gutenberg/image-fulls…
hypest Nov 14, 2019
6793ea9
Update the gutenberg-mobile ref
hypest Nov 14, 2019
33fadf1
added sample special character test case in EncryptionUtilsTest
Nov 14, 2019
26635f4
rectified hardcoded padding and removed touch delegate since padding …
jd-alexander Nov 14, 2019
3f99349
Merge pull request #10741 from wordpress-mobile/issue/10734-accessibi…
shiki Nov 14, 2019
0ce957c
Catching IllegalStateException.
khaykov Nov 14, 2019
a57da8f
gave descriptive names to some variables in EncryptionUtils and Encry…
Nov 15, 2019
a8b1a63
Merge pull request #10752 from wordpress-mobile/issue/10747-gutenberg…
maxme Nov 15, 2019
e0ded2a
Update gutenberg-mobile hash
hypest Nov 15, 2019
079019d
Bump Gutenberg progressive rollout from 5 to 10%
maxme Nov 15, 2019
2fc6134
Revert "Revert changes to WordPress/src/main/res/values/strings.xml"
Tug Nov 15, 2019
9ecc087
Merge remote-tracking branch 'origin/gutenberg/release-1.17.0' into g…
Tug Nov 15, 2019
c6d80f1
Merge pull request #10719 from wordpress-mobile/gutenberg/fix-i18n
Tug Nov 15, 2019
0ef5a51
Merge pull request #10804 from wordpress-mobile/issue/bump-gb-rollout…
hypest Nov 15, 2019
58a1d52
[Gutenberg] hotfix crash which occurs after deleting image or page br…
marecar3 Nov 15, 2019
116eab6
Added Crash logging for referrer exception.
khaykov Nov 15, 2019
669110e
Revert "Merge pull request #10719 from wordpress-mobile/gutenberg/fix…
Tug Nov 15, 2019
e01d64d
Update gutenberg ref
mchowning Nov 15, 2019
145a94f
Merge pull request #10769 from wordpress-mobile/gutenberg/release-1.17.0
mchowning Nov 15, 2019
bf646d3
Merge pull request #10738 from ravenstewart/issue/10698-implement-enc…
jkmassel Nov 16, 2019
0d5284e
Merge pull request #10803 from wordpress-mobile/issue/9985-catch-Ille…
malinajirka Nov 18, 2019
b8e888e
Merge pull request #10808 from wordpress-mobile/merge/13.6-into-develop
jkmassel Nov 18, 2019
fe1b811
Bump version number
jkmassel Nov 18, 2019
192dc1d
Update release notes.
jkmassel Nov 18, 2019
0f42a3c
Update FluxC
jkmassel Nov 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
13.8
-----

13.7
-----
* Block editor: Include block title in Unsupported block's UI
* Block editor: Show new-block-indicator when no blocks at all and when at the last block
* Block editor: Use existing links in the clipboard to prefill url field when inserting new link
* Block editor: Media & Text block alignment options
* Block editor: Images clickable for fullscreen preview
* Fixed time displayed on Post Conflict Detected and Unpublished Revision dialogs
* Block editor: Fix issue when removing image/page break block crashes the app

13.6
-----
Expand Down
10 changes: 6 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-196"
versionName "alpha-197"
}
versionCode 795
versionCode 798
minSdkVersion 21
targetSdkVersion 28

Expand All @@ -83,9 +83,9 @@ android {
dimension "buildType"
// Only set the release version if one isn't provided
if (!project.hasProperty("versionName")) {
versionName "13.6"
versionName "13.7-rc-1"
}
versionCode 796
versionCode 797
buildConfigField "boolean", "ME_ACTIVITY_AVAILABLE", "false"
}

Expand Down Expand Up @@ -297,6 +297,8 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"

implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha'

implementation 'com.github.joshjdevl.libsodiumjni:libsodium-jni-aar:2.0.1'
}

configurations.all {
Expand Down
9 changes: 9 additions & 0 deletions WordPress/proguard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,12 @@

-dontwarn com.github.godness84.RNRecyclerViewList.**
###### React Native - end

###### Main resource class - begin
-keepattributes InnerClasses

-keep class org.wordpress.android.R
-keep class org.wordpress.android.R$* {
<fields>;
}
###### Main resource class - end
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
package org.wordpress.android.util;

import android.util.Base64;

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

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

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;

// 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";

@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);
}

@Test
public void testEmptyStringEncryptionResultIsValid() {
testEncryption(TEST_EMPTY_STRING);
}

@Test
public void testLogStringEncryptionResultIsValid() {
testEncryption(TEST_LOG_STRING);
}

@Test
public void testCharacterSampleEncryptionResultIsValid() {
testEncryption(TEST_CHAR_SAMPLE);
}

private void testEncryption(final 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(
state,
header,
dataSpecificKey);
assertEquals(initPullReturnCode, 0);

String decryptedDataString = "";
final byte[][] encryptedLines = getEncryptedLines(encryptionDataJson);
assertNotNull(encryptedLines);
for (int i = 0; i < encryptedLines.length; ++i) {
final String decryptedLine = getDecryptedString(state, encryptedLines[i]);
if (decryptedLine == null) {
// expecting null for the final line in the encryption data
assertEquals(encryptedLines.length - 1, i);
break;
}

decryptedDataString = decryptedDataString + decryptedLine;
}

assertEquals(testString, decryptedDataString);
}
private JSONObject getEncryptionDataJson(final byte[] publicKey, final String data) {
try {
final String encryptionDataJsonString = EncryptionUtils.encryptStringData(
Base64.encodeToString(publicKey, Base64.DEFAULT),
data);

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

private byte[] getDataSpecificKey(final JSONObject encryptionDataJson) {
try {
final byte[] decryptedKey = new byte[EncryptionUtils.XCHACHA20POLY1305_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(
decryptedKey,
encryptedKey,
EncryptionUtils.XCHACHA20POLY1305_KEYBYTES + EncryptionUtils.BOX_SEALBYTES,
mPublicKey,
mSecretKey);
assertEquals(returnCode, 0);

return decryptedKey;
} catch (JSONException e) {
fail("failed to get encryptedKey from encrypted data JSON");
}

return null;
}

private byte[] getHeader(final JSONObject encryptionDataJson) {
try {
final String headerBase64 = encryptionDataJson.getString("header");
return Base64.decode(headerBase64, BASE64_DECODE_FLAGS);
} catch (JSONException e) {
fail("failed to get header from encrypted data JSON");
}
return null;
}

private byte[][] getEncryptedLines(final JSONObject encryptionDataJson) {
try {
final JSONArray messages = encryptionDataJson.getJSONArray("messages");

final int messagesLength = messages.length();
final byte[][] encryptedLines = new byte[messagesLength][];
for (int i = 0; i < messagesLength; ++i) {
final String messageBase64 = messages.getString(i);
encryptedLines[i] = Base64.decode(messageBase64, BASE64_DECODE_FLAGS);
}
return encryptedLines;
} catch (JSONException e) {
fail("failed to get messages from encrypted data JSON");
}

return null;
}

private String getDecryptedString(final byte[] state, final byte[] encryptedLine) {
final byte[] tag = new byte[1];
final int decryptedLineLength = encryptedLine.length - EncryptionUtils.XCHACHA20POLY1305_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(
state,
decryptedLine,
decryptedLineLengthOutput,
tag,
encryptedLine,
encryptedLine.length,
additionalData,
additionalDataLength);
assertEquals(returnCode, 0);

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

fail("message decryption failed, unexpected tag.");
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ public void onAppComesFromBackground() {
}

// Let's migrate the old editor preference if available in AppPrefs to the remote backend
SiteUtils.migrateAppWideMobileEditorPreferenceToRemote(mContext, mDispatcher);
SiteUtils.migrateAppWideMobileEditorPreferenceToRemote(mAccountStore, mSiteStore, mDispatcher);

if (mFirstActivityResumed) {
deferredInit();
Expand Down
Loading