Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
762866a
Replace lock with logging to fix deadlock when opening the editor
planarvoid Dec 4, 2019
af2f5c0
Merge pull request #10900 from wordpress-mobile/fix/remove_lock_to_fi…
malinajirka Dec 4, 2019
c1dbc0c
Bump version number
jkmassel Dec 4, 2019
eeba6fb
Update release notes
jkmassel Dec 5, 2019
dcd5452
Update metadata strings
jkmassel Dec 5, 2019
c1d9023
Bump Gutenberg progressive rollout from 10 to 30%
maxme Dec 10, 2019
910be76
Remove escaped double quotes in translated files
Tug Dec 10, 2019
e0725f1
Manual fix for remnaining errors for the fr locale
Tug Dec 10, 2019
968aa26
Manual fix for remnaining errors for ko sq and zh errors
Tug Dec 10, 2019
f3eabd3
Manual fix for remnaining errors for sq
Tug Dec 10, 2019
cc54e9d
Merge pull request #10928 from wordpress-mobile/issue/bump-gb-rollout…
hypest Dec 11, 2019
fba6ace
Update the original/main/en-US strings.xml
Tug Dec 12, 2019
51b6b88
Changing lifecycle owner to be the fragment instead of the activity.
develric Dec 12, 2019
0935311
Merge pull request #10932 from wordpress-mobile/fix/translations-manu…
Tug Dec 12, 2019
c1addd9
Merge pull request #10954 from wordpress-mobile/issue/10948-npe-on-ta…
planarvoid Dec 12, 2019
85e15bc
Updates translations
jkmassel Dec 13, 2019
34aa544
Bump version number
jkmassel Dec 13, 2019
6636dd3
Update metadata translations for 13.8
jkmassel Dec 13, 2019
f651cfe
Fix 13.8 translations
jkmassel Dec 16, 2019
27ee8e8
Revert non-gutenberg related changes and fix quotes being removed uni…
Tug Dec 16, 2019
09ca137
Merge pull request #10961 from wordpress-mobile/fix/13.8-translations
maxme Dec 16, 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
8 changes: 4 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-199"
versionName "alpha-200"
}
versionCode 803
versionCode 805
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 "13.8-rc-1"
versionName "13.8"
}
versionCode 802
versionCode 806
buildConfigField "boolean", "ME_ACTIVITY_AVAILABLE", "false"
}

Expand Down
18 changes: 9 additions & 9 deletions WordPress/metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ 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_137"
msgctxt "release_note_138"
msgid ""
"13.7:\n"
"* Block editor updates: unsupported blocks now display a title, new-block indicators display both in empty editors and after the last block, adding links pulls from existing URLs in your clipboard, Media and Text blocks have more alignment options, image blocks are tappable for full-screen preview.\n"
"13.8:\n"
"* Block editor improvements: Added Spacer block for creating white space between content.\n"
"* Modified Blog Post Search to include posts under all categories.\n"
"* Lots of under-the-hood improvements across the entire app –26 unique crash and bug fixes in all.\n"
"\n"
"* General improvements: fixed some bugs and crashes, and added better TalkBack screen reader support in the Reader.\n"
msgstr ""

msgctxt "release_note_136"
msgctxt "release_note_137"
msgid ""
"13.6:\n"
"- We updated the navigation bar color to white on Android 8.1 and higher.\n"
"- Bugs in page list ordering are fixed, so pages always appear in alphabetical order.\n"
"- Block editor updates: Added support for Pexels images and image alignment options.\n"
"13.7:\n"
"* Block editor updates: unsupported blocks now display a title, new-block indicators display both in empty editors and after the last block, adding links pulls from existing URLs in your clipboard, Media and Text blocks have more alignment options, image blocks are tappable for full-screen preview.\n"
"\n"
"* General improvements: fixed some bugs and crashes, and added better TalkBack screen reader support in the Reader.\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
5 changes: 3 additions & 2 deletions WordPress/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Block editor updates: unsupported blocks now display a title, new-block indicators display both in empty editors and after the last block, adding links pulls from existing URLs in your clipboard, Media and Text blocks have more alignment options, image blocks are tappable for full-screen preview.
* Block editor improvements: Added Spacer block for creating white space between content.
* Modified Blog Post Search to include posts under all categories.
* Lots of under-the-hood improvements across the entire app –26 unique crash and bug fixes in all.

* General improvements: fixed some bugs and crashes, and added better TalkBack screen reader support in the Reader.
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ private void newPostSetup() {
}

// Create a new post
mEditPostRepository.setInTransaction(() -> {
mEditPostRepository.set(() -> {
PostModel post = mPostStore.instantiatePostModel(mSite, mIsPage, null, null);
post.setStatus(PostStatus.DRAFT.toString());
return post;
Expand Down Expand Up @@ -442,7 +442,7 @@ protected void onCreate(Bundle savedInstanceState) {

if (mEditPostRepository.hasPost()) {
if (extras.getBoolean(EXTRA_LOAD_AUTO_SAVE_REVISION)) {
mEditPostRepository.updateInTransaction(postModel -> {
mEditPostRepository.update(postModel -> {
postModel.setTitle(
TextUtils.isEmpty(postModel.getAutoSaveTitle()) ? postModel
.getTitle()
Expand Down Expand Up @@ -608,7 +608,7 @@ private void startObserving() {
private void initializePostObject() {
if (mEditPostRepository.hasPost()) {
mEditPostRepository.saveSnapshot();
mEditPostRepository.replaceInTransaction(UploadService::updatePostWithCurrentlyCompletedUploads);
mEditPostRepository.replace(UploadService::updatePostWithCurrentlyCompletedUploads);
if (mShowAztecEditor) {
try {
mMediaMarkedUploadingOnStartIds = AztecEditorFragment
Expand Down Expand Up @@ -683,7 +683,7 @@ private void resetUploadingMediaToFailedIfPostHasNotMediaInProgressOrQueued() {
if (!useAztec || UploadService.hasPendingOrInProgressMediaUploadsForPost(mEditPostRepository.getPost())) {
return;
}
mEditPostRepository.updateInTransaction(postModel -> {
mEditPostRepository.update(postModel -> {
String oldContent = postModel.getContent();
if (!AztecEditorFragment.hasMediaItemsMarkedUploading(EditPostActivity.this, oldContent)
// we need to make sure items marked failed are still failed or not as well
Expand Down Expand Up @@ -1611,7 +1611,7 @@ private boolean updatePostObject(boolean isAutosave) {
AppLog.e(AppLog.T.POSTS, "Attempted to save an invalid Post.");
return false;
}
return mEditPostRepository.updateInTransaction(postModel -> {
return mEditPostRepository.update(postModel -> {
try {
boolean postTitleOrContentChanged =
updatePostContentNewEditor(postModel, isAutosave, (String) mEditorFragment.getTitle(),
Expand Down Expand Up @@ -1821,7 +1821,7 @@ public void onHistoryItemClicked(@NonNull Revision revision, @NonNull List<Revis
private void loadRevision() {
updatePostLoadingAndDialogState(PostLoadingState.LOADING_REVISION);
mEditPostRepository.saveForUndo();
mEditPostRepository.updateInTransaction(postModel -> {
mEditPostRepository.update(postModel -> {
postModel.setTitle(Objects.requireNonNull(mRevision.getPostTitle()));
postModel.setContent(Objects.requireNonNull(mRevision.getPostContent()));
postModel.setIsLocallyChanged(true);
Expand Down Expand Up @@ -1907,7 +1907,7 @@ private class SavePostLocallyAndFinishTask extends AsyncTask<Void, Void, Boolean
@Override
protected Boolean doInBackground(Void... params) {
if (mEditPostRepository.postHasEdits()) {
mEditPostRepository.updateInTransaction(postModel -> {
mEditPostRepository.update(postModel -> {
// Changes have been made - save the post and ask for the post list to refresh
// We consider this being "manual save", it will replace some Android "spans" by an html
// or a shortcode replacement (for instance for images and galleries)
Expand Down Expand Up @@ -2010,7 +2010,7 @@ private void uploadPost(final boolean publishPost) {
// text 2. better not to call `updatePostObject()` from the UI thread due to weird thread blocking behavior
// on API 16 (and 21) with the visual editor.
new Thread(() -> {
mEditPostRepository.updateInTransaction(postModel -> {
mEditPostRepository.update(postModel -> {
boolean isFirstTimePublish = isFirstTimePublish(publishPost);
if (publishPost) {
// now set status to PUBLISHED - only do this AFTER we have run the isFirstTimePublish() check,
Expand Down Expand Up @@ -2382,7 +2382,7 @@ protected void setPostContentFromShareAction() {
final String text = intent.getStringExtra(Intent.EXTRA_TEXT);
final String title = intent.getStringExtra(Intent.EXTRA_SUBJECT);
if (text != null) {
mEditPostRepository.updateInTransaction(postModel -> {
mEditPostRepository.update(postModel -> {
if (title != null) {
mEditorFragment.setTitle(title);
postModel.setTitle(title);
Expand Down Expand Up @@ -2480,7 +2480,7 @@ private boolean isCurrentMediaMarkedUploadingDifferentToOriginal(String newConte
}

private void setFeaturedImageId(final long mediaId) {
mEditPostRepository.updateInTransaction(postModel -> {
mEditPostRepository.update(postModel -> {
postModel.setFeaturedImageId(mediaId);
postModel.setIsLocallyChanged(true);
return true;
Expand Down Expand Up @@ -3158,7 +3158,7 @@ public void onPostChanged(OnPostChanged event) {
AppLog.e(T.POSTS, "REMOTE_AUTO_SAVE_POST failed: " + event.error.type + " - " + event.error.message);
}
mEditPostRepository.loadPostByLocalPostId(mEditPostRepository.getId());
mEditPostRepository.replaceInTransaction(postModel -> handleRemoteAutoSave(event.isError(), postModel));
mEditPostRepository.replace(postModel -> handleRemoteAutoSave(event.isError(), postModel));
}
}

Expand Down Expand Up @@ -3219,13 +3219,13 @@ public void onPostUploaded(OnPostUploaded event) {
mUploadUtilsWrapper.onPostUploadedSnackbarHandler(this, snackbarAttachView, event.isError(), post,
event.isError() ? event.error.message : null, getSite());
if (!event.isError()) {
mEditPostRepository.setInTransaction(() -> {
mEditPostRepository.set(() -> {
updateOnSuccessfulUpload();
return post;
});
}
} else {
mEditPostRepository.setInTransaction(() -> handleRemoteAutoSave(event.isError(), post));
mEditPostRepository.set(() -> handleRemoteAutoSave(event.isError(), post));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class EditPostPublishSettingsViewModel
}

fun updatePost(updatedDate: Calendar, postRepository: EditPostRepository?) {
postRepository?.updateInTransaction { postModel ->
postRepository?.update { postModel ->
val dateCreated = DateTimeUtils.iso8601FromDate(updatedDate.time)
postModel.setDateCreated(dateCreated)
val initialPostStatus = postRepository.status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import org.wordpress.android.fluxc.model.post.PostStatus.DRAFT
import org.wordpress.android.fluxc.model.post.PostStatus.fromPost
import org.wordpress.android.fluxc.store.PostStore
import org.wordpress.android.ui.uploads.UploadService
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.AppLog.T
import org.wordpress.android.util.CrashLoggingUtils
import org.wordpress.android.util.DateTimeUtils
import org.wordpress.android.util.LocaleManagerWrapper
import java.util.concurrent.locks.ReentrantReadWriteLock
import java.util.Arrays
import javax.inject.Inject
import kotlin.concurrent.write

class EditPostRepository
@Inject constructor(
Expand Down Expand Up @@ -72,18 +74,37 @@ class EditPostRepository
val dateLocallyChanged: String
get() = post!!.dateLocallyChanged

private val lock = ReentrantReadWriteLock()
private var locked = false

fun updateInTransaction(action: (PostModel) -> Boolean) = lock.write {
action(post!!)
fun update(action: (PostModel) -> Boolean): Boolean {
reportTransactionState(true)
val result = action(post!!)
reportTransactionState(false)
return result
}

fun replaceInTransaction(action: (PostModel) -> PostModel) = lock.write {
fun replace(action: (PostModel) -> PostModel) {
reportTransactionState(true)
this.post = action(post!!)
reportTransactionState(false)
}

fun setInTransaction(action: () -> PostModel) = lock.write {
fun set(action: () -> PostModel) {
reportTransactionState(true)
this.post = action()
reportTransactionState(false)
}

@Synchronized
private fun reportTransactionState(lock: Boolean) {
if (lock && locked) {
val message = "EditPostRepository: Transaction is writing on a locked thread ${Arrays.toString(
Thread.currentThread().stackTrace
)}"
AppLog.e(T.EDITOR, message)
CrashLoggingUtils.log(message)
}
locked = lock
}

fun hasLocation() = post!!.hasLocation()
Expand Down Expand Up @@ -132,7 +153,9 @@ class EditPostRepository
fun updateStatusFromSnapshot(post: PostModel) {
// the user has just tapped on "PUBLISH" on an empty post, make sure to set the status back to the
// original post's status as we could not proceed with the action
reportTransactionState(true)
post.setStatus(postSnapshotWhenEditorOpened?.status ?: DRAFT.toString())
reportTransactionState(false)
}

fun hasStatusChanged(postStatus: String?): Boolean {
Expand All @@ -142,21 +165,21 @@ class EditPostRepository
fun postHasEdits() = postUtils.postHasEdits(postSnapshotWhenEditorOpened, post!!)

fun updateStatus(status: PostStatus) {
updateInTransaction {
update {
it.setStatus(status.toString())
true
}
}

fun loadPostByLocalPostId(postId: Int) {
lock.write {
post = postStore.getPostByLocalPostId(postId)
}
reportTransactionState(true)
post = postStore.getPostByLocalPostId(postId)
reportTransactionState(false)
}

fun loadPostByRemotePostId(remotePostId: Long, site: SiteModel) {
lock.write {
post = postStore.getPostByRemotePostId(remotePostId, site)
}
reportTransactionState(true)
post = postStore.getPostByRemotePostId(remotePostId, site)
reportTransactionState(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ private void updateSaveButton() {
private void updateExcerpt(String excerpt) {
EditPostRepository editPostRepository = getEditPostRepository();
if (editPostRepository != null) {
editPostRepository.updateInTransaction(postModel -> {
editPostRepository.update(postModel -> {
postModel.setExcerpt(excerpt);
mExcerptTextView.setText(excerpt);
return true;
Expand All @@ -673,7 +673,7 @@ private void updateExcerpt(String excerpt) {
private void updateSlug(String slug) {
EditPostRepository editPostRepository = getEditPostRepository();
if (editPostRepository != null) {
editPostRepository.updateInTransaction(postModel -> {
editPostRepository.update(postModel -> {
postModel.setSlug(slug);
mSlugTextView.setText(slug);
return true;
Expand All @@ -684,7 +684,7 @@ private void updateSlug(String slug) {
private void updatePassword(String password) {
EditPostRepository editPostRepository = getEditPostRepository();
if (editPostRepository != null) {
editPostRepository.updateInTransaction(postModel -> {
editPostRepository.update(postModel -> {
postModel.setPassword(password);
mPasswordTextView.setText(password);
return true;
Expand All @@ -698,7 +698,7 @@ private void updateCategories(List<Long> categoryList) {
}
EditPostRepository editPostRepository = getEditPostRepository();
if (editPostRepository != null) {
editPostRepository.updateInTransaction(postModel -> {
editPostRepository.update(postModel -> {
postModel.setCategoryIdList(categoryList);
updateCategoriesTextView();
return true;
Expand All @@ -709,7 +709,7 @@ private void updateCategories(List<Long> categoryList) {
public void updatePostStatus(PostStatus postStatus) {
EditPostRepository editPostRepository = getEditPostRepository();
if (editPostRepository != null) {
editPostRepository.updateInTransaction(postModel -> {
editPostRepository.update(postModel -> {
postModel.setStatus(postStatus.toString());
updatePostStatusRelatedViews();
updateSaveButton();
Expand All @@ -721,7 +721,7 @@ public void updatePostStatus(PostStatus postStatus) {
private void updatePostFormat(String postFormat) {
EditPostRepository editPostRepository = getEditPostRepository();
if (editPostRepository != null) {
editPostRepository.updateInTransaction(postModel -> {
editPostRepository.update(postModel -> {
postModel.setPostFormat(postFormat);
updatePostFormatTextView();
return true;
Expand Down Expand Up @@ -751,7 +751,7 @@ private void updateTags(String selectedTags) {
if (postRepository == null) {
return;
}
postRepository.updateInTransaction(postModel -> {
postRepository.update(postModel -> {
if (!TextUtils.isEmpty(selectedTags)) {
String tags = selectedTags.replace("\n", " ");
postModel.setTagNameList(Arrays.asList(TextUtils.split(tags, ",")));
Expand Down Expand Up @@ -902,7 +902,7 @@ public void updateFeaturedImage(long featuredImageId) {
if (postRepository == null) {
return;
}
postRepository.updateInTransaction(postModel -> {
postRepository.update(postModel -> {
postModel.setFeaturedImageId(featuredImageId);
updateFeaturedImageView();
return true;
Expand Down Expand Up @@ -1069,7 +1069,7 @@ private void setLocation(@Nullable Place place) {
if (postRepository == null) {
return;
}
postRepository.updateInTransaction(postModel -> {
postRepository.update(postModel -> {
if (place == null) {
postModel.clearLocation();
mLocationTextView.setText("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public void onCreate(Bundle savedInstanceState) {
.get(ReaderPostListViewModel.class);

if (BuildConfig.INFORMATION_ARCHITECTURE_AVAILABLE && mIsTopLevel) {
mViewModel.getCurrentSubFilter().observe(getActivity(), subfilterListItem -> {
mViewModel.getCurrentSubFilter().observe(this, subfilterListItem -> {
if (ReaderUtils.isFollowing(
mCurrentTag,
BuildConfig.INFORMATION_ARCHITECTURE_AVAILABLE && mIsTopLevel,
Expand All @@ -402,11 +402,11 @@ public void onCreate(Bundle savedInstanceState) {
}
});

mViewModel.getShouldShowSubFilters().observe(getActivity(), show -> {
mViewModel.getShouldShowSubFilters().observe(this, show -> {
mSubFilterComponent.setVisibility(show ? View.VISIBLE : View.GONE);
});

mViewModel.getReaderModeInfo().observe(getActivity(), readerModeInfo -> {
mViewModel.getReaderModeInfo().observe(this, readerModeInfo -> {
if (readerModeInfo != null) {
changeReaderMode(readerModeInfo, true);

Expand All @@ -421,7 +421,7 @@ public void onCreate(Bundle savedInstanceState) {
}
});

mViewModel.isBottomSheetShowing().observe(getActivity(), event -> {
mViewModel.isBottomSheetShowing().observe(this, event -> {
event.applyIfNotHandled(isShowing -> {
FragmentManager fm = getFragmentManager();
if (fm != null) {
Expand Down
Loading