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/release 16.3 into develop #13590

Merged
merged 51 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
570ba66
Only show story block in picker if supported by site
aforcier Dec 2, 2020
7fc2f74
only allow updating a Post to the server when a Story is finished bei…
mzorz Dec 1, 2020
4101525
Merge pull request #13517 from wordpress-mobile/fix/hide-story-block-…
mzorz Dec 2, 2020
41dd635
Skip prechecks on release builds on CI
loremattei Dec 2, 2020
1f43fd9
Calculate end index of Story block relative to start
aforcier Dec 3, 2020
76bec26
Update Story intro screen assets and links
aforcier Dec 3, 2020
430d39f
Merge pull request #13525 from wordpress-mobile/fix/stories-stringind…
mzorz Dec 3, 2020
88e2f3a
Merge pull request #13526 from wordpress-mobile/update/story-intro-as…
mzorz Dec 3, 2020
99a3eac
Merge pull request #13518 from wordpress-mobile/fix/stories-wait-for-…
aforcier Dec 4, 2020
15d4f82
Update stories lib hash
aforcier Dec 4, 2020
b56f049
Release script: Update gutenberg-mobile ref
ceyhun Dec 4, 2020
b08311d
updated stories lib hash and bring the upload string up for translation
mzorz Dec 4, 2020
34cde4e
Revert "updated stories lib hash and bring the upload string up for t…
mzorz Dec 4, 2020
4732cec
updated stories lib hash and bring the upload string up for translation
mzorz Dec 4, 2020
140f273
updated stories lib commit hash
mzorz Dec 4, 2020
18d8ccf
Update gutenberg-mobile ref
ceyhun Dec 4, 2020
7cfd0ee
Update fastlane/Fastfile
loremattei Dec 4, 2020
52adb7f
Update fastlane/Fastfile
loremattei Dec 4, 2020
39599f8
Merge pull request #13523 from wordpress-mobile/fix/release-build
loremattei Dec 4, 2020
2d21cb1
Updated gutenberg-mobile reference to release tag
cameronvoell Dec 4, 2020
1f6134d
updated stories hash lib
mzorz Dec 4, 2020
d5f9e63
Merge pull request #13543 from wordpress-mobile/fix/bring-thumbnail-back
mzorz Dec 4, 2020
bb64093
Merge pull request #13540 from wordpress-mobile/gutenberg/integrate_r…
cameronvoell Dec 4, 2020
46dfca5
changed flow for remote media from WP site to be copied locally befor…
mzorz Dec 4, 2020
13807d1
removed unused import
mzorz Dec 4, 2020
8b2c56c
updated test
mzorz Dec 4, 2020
41d7e74
Merge pull request #13548 from wordpress-mobile/fix/remote-video-copy
aforcier Dec 4, 2020
732e452
udpated stories libs commit hash
mzorz Dec 4, 2020
431766c
Update gutenberg-mobile reference to release tag
aforcier Dec 5, 2020
4d9f50e
Merge pull request #13550 from wordpress-mobile/gutenberg/integrate_r…
cameronvoell Dec 5, 2020
289994b
Merge branch 'release/16.3' into fix/stories-for-16.3
aforcier Dec 5, 2020
cfcbc24
Merge pull request #13539 from wordpress-mobile/fix/stories-for-16.3
mzorz Dec 5, 2020
681df63
Send strings to translation.
jkmassel Dec 5, 2020
034ccd9
Updates translations
jkmassel Dec 5, 2020
add9d8b
Bump version number
jkmassel Dec 5, 2020
8fb2529
Updates translations
loremattei Dec 11, 2020
81c0b16
Bump version number
loremattei Dec 11, 2020
d74bf49
Update metadata translations for 16.3
loremattei Dec 11, 2020
95498de
Fix merge conflicts
loremattei Dec 11, 2020
8889a55
Hotfix: Fix crash when deleting a block
Tug Dec 11, 2020
2bd254f
Update gutenberg ref
Tug Dec 11, 2020
105ccc3
Update gutenberg ref
Tug Dec 11, 2020
bf648a5
Update gutenberg ref
Tug Dec 11, 2020
23daebf
Updated release notes.
jd-alexander Dec 11, 2020
c0204ba
Updated gutenberg ref.
jd-alexander Dec 11, 2020
e6c3ed7
Updated gutenberg ref.
jd-alexander Dec 12, 2020
5c784a5
Revert "Updated release notes. "
jd-alexander Dec 11, 2020
4b12e41
Merge pull request #13594 from wordpress-mobile/fix/deleting-block-16.3
Tug Dec 14, 2020
e7bdd7e
Fix merge conflicts
loremattei Dec 14, 2020
e876de4
Suppress a false positive on WPUtils
loremattei Dec 11, 2020
e3b3138
Remove unused resource
loremattei Dec 14, 2020
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 @@ -54,9 +54,9 @@ android {
if (project.hasProperty("versionName")) {
versionName project.property("versionName")
} else {
versionName "alpha-261"
versionName "alpha-262"
}
versionCode 965
versionCode 967
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion

Expand Down Expand Up @@ -98,9 +98,9 @@ android {
dimension "buildType"
// Only set the release version if one isn't provided
if (!project.hasProperty("versionName")) {
versionName "16.3-rc-2"
versionName "16.3"
}
versionCode 964
versionCode 968
buildConfigField "boolean", "ME_ACTIVITY_AVAILABLE", "false"
buildConfigField "boolean", "TENOR_AVAILABLE", "false"
buildConfigField "long", "REMOTE_CONFIG_FETCH_INTERVAL", "3600"
Expand Down
16 changes: 16 additions & 0 deletions WordPress/lint-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4060,4 +4060,20 @@
column="28"/>
</issue>

<issue
id="ResourceType"
severity="Error"
message="Expected a color resource id (`R.color.`) but received an RGB integer"
category="Correctness"
priority="7"
summary="Wrong Resource Type"
explanation="Ensures that resource id&apos;s passed to APIs are of the right type; for example, calling `Resources.getColor(R.string.name)` is wrong."
errorLine1=" return new SwipeToRefreshHelper(swipeRefreshLayout, listener, backgroundColor, primaryProgressColor,"
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="../WordPress/src/main/java/org/wordpress/android/util/WPSwipeToRefreshHelper.java"
line="33"
column="71"/>
</issue>

</issues>
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,7 @@ private void doMediaIdsSelected(ArrayList<Long> mediaIds, @NonNull PhotoPickerMe
if (mediaIds != null && mediaIds.size() > 0) {
if (mBrowserType == MediaBrowserType.WP_STORIES_MEDIA_PICKER) {
// TODO WPSTORIES add TRACKS (see how it's tracked below? maybe do along the same lines)
Intent data = new Intent()
.putExtra(MediaBrowserActivity.RESULT_IDS, ListUtils.toLongArray(mediaIds))
.putExtra(ARG_BROWSER_TYPE, mBrowserType)
.putExtra(MediaPickerConstants.EXTRA_MEDIA_SOURCE, source.name());
setResult(RESULT_OK, data);
finish();
getPickerFragment().mediaIdsSelectedFromWPMediaPicker(mediaIds);
} else {
// if user chose a featured image, track image picked event
if (mBrowserType == MediaBrowserType.FEATURED_IMAGE_PICKER) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ class PhotoPickerFragment : Fragment() {
viewModel.urisSelectedFromSystemPicker(uris.map { UriWrapper(it) })
}

fun mediaIdsSelectedFromWPMediaPicker(mediaIds: List<Long>) {
viewModel.mediaIdsSelectedFromWPMediaPicker(mediaIds)
}

companion object {
private const val KEY_LAST_TAPPED_ICON = "last_tapped_icon"
private const val KEY_SELECTED_POSITIONS = "selected_positions"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.wordpress.android.ui.photopicker

import android.Manifest.permission
import android.net.Uri
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import kotlinx.coroutines.CoroutineDispatcher
Expand Down Expand Up @@ -41,6 +42,7 @@ import org.wordpress.android.ui.photopicker.PhotoPickerViewModel.BottomBarUiMode
import org.wordpress.android.ui.photopicker.PhotoPickerViewModel.BottomBarUiModel.BottomBar.NONE
import org.wordpress.android.ui.photopicker.PhotoPickerViewModel.PopupMenuUiModel.PopupMenuItem
import org.wordpress.android.ui.posts.editor.media.CopyMediaToAppStorageUseCase
import org.wordpress.android.ui.posts.editor.media.GetMediaModelUseCase
import org.wordpress.android.ui.utils.UiString
import org.wordpress.android.ui.utils.UiString.UiStringRes
import org.wordpress.android.ui.utils.UiString.UiStringText
Expand Down Expand Up @@ -75,7 +77,8 @@ class PhotoPickerViewModel @Inject constructor(
private val permissionsHandler: PermissionsHandler,
private val tenorFeatureConfig: TenorFeatureConfig,
private val resourceProvider: ResourceProvider,
private val copyMediaToAppStorageUseCase: CopyMediaToAppStorageUseCase
private val copyMediaToAppStorageUseCase: CopyMediaToAppStorageUseCase,
private val getMediaModelUseCase: GetMediaModelUseCase
) : ScopedViewModel(mainDispatcher) {
private val _navigateToPreview = MutableLiveData<Event<UriWrapper>>()
private val _onInsert = MutableLiveData<Event<List<UriWrapper>>>()
Expand Down Expand Up @@ -478,6 +481,18 @@ class PhotoPickerViewModel @Inject constructor(
}

fun urisSelectedFromSystemPicker(uris: List<UriWrapper>) {
copySelectedUrisLocally(uris)
}

fun mediaIdsSelectedFromWPMediaPicker(mediaIds: List<Long>) {
launch {
val mediaModels = getMediaModelUseCase
.loadMediaByRemoteId(requireNotNull(site), mediaIds)
copySelectedUrisLocally(mediaModels.map { UriWrapper(Uri.parse(it.url)) })
}
}

fun copySelectedUrisLocally(uris: List<UriWrapper>) {
launch {
_showProgressDialog.value = ProgressDialogUiModel.Visible(R.string.uploading_title) {
_showProgressDialog.postValue(ProgressDialogUiModel.Hidden)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1322,12 +1322,34 @@ private boolean handleBackPressed() {
} else if (mEditorPhotoPicker.isPhotoPickerShowing()) {
mEditorPhotoPicker.hidePhotoPicker();
} else {
savePostAndOptionallyFinish(true, false);
performWhenNoStoriesBeingSaved(new DoWhenNoStoriesBeingSavedCallback() {
@Override public void doWhenNoStoriesBeingSaved() {
savePostAndOptionallyFinish(true, false);
}
});
}

return true;
}

interface DoWhenNoStoriesBeingSavedCallback {
void doWhenNoStoriesBeingSaved();
}

private void performWhenNoStoriesBeingSaved(DoWhenNoStoriesBeingSavedCallback callback) {
if (mWPStoriesFeatureConfig.isEnabled()) {
if (mStoriesEventListener.getStoriesSavingInProgress().isEmpty()) {
callback.doWhenNoStoriesBeingSaved();
} else {
// Oops! A story is still being saved, let's wait
ToastUtils.showToast(EditPostActivity.this,
getString(R.string.toast_edit_story_update_in_progress_title));
}
} else {
callback.doWhenNoStoriesBeingSaved();
}
}

private RemotePreviewLogicHelper.RemotePreviewHelperFunctions getEditPostActivityStrategyFunctions() {
return new RemotePreviewLogicHelper.RemotePreviewHelperFunctions() {
@Override
Expand Down Expand Up @@ -1499,7 +1521,7 @@ private boolean performSecondaryAction() {
case PUBLISH_NOW:
mAnalyticsTrackerWrapper.track(Stat.EDITOR_POST_PUBLISH_TAPPED);
mPublishPostImmediatelyUseCase.updatePostToPublishImmediately(mEditPostRepository, mIsNewPost);
showPrepublishingNudgeBottomSheet();
checkNoStorySaveOperationInProgressAndShowPrepublishingNudgeBottomSheet();
return true;
case NONE:
throw new IllegalStateException("Switch in `secondaryAction` shouldn't go through the NONE case");
Expand Down Expand Up @@ -1611,12 +1633,12 @@ private void performPrimaryAction() {
switch (getPrimaryAction()) {
case PUBLISH_NOW:
mAnalyticsTrackerWrapper.track(Stat.EDITOR_POST_PUBLISH_TAPPED);
showPrepublishingNudgeBottomSheet();
checkNoStorySaveOperationInProgressAndShowPrepublishingNudgeBottomSheet();
return;
case UPDATE:
case SCHEDULE:
case SUBMIT_FOR_REVIEW:
showPrepublishingNudgeBottomSheet();
checkNoStorySaveOperationInProgressAndShowPrepublishingNudgeBottomSheet();
return;
case SAVE:
uploadPost(false);
Expand Down Expand Up @@ -2014,6 +2036,14 @@ private void setupPrepublishingBottomSheetRunnable() {
};
}

private void checkNoStorySaveOperationInProgressAndShowPrepublishingNudgeBottomSheet() {
performWhenNoStoriesBeingSaved(new DoWhenNoStoriesBeingSavedCallback() {
@Override public void doWhenNoStoriesBeingSaved() {
showPrepublishingNudgeBottomSheet();
}
});
}

private void showPrepublishingNudgeBottomSheet() {
mViewPager.setCurrentItem(PAGE_CONTENT);
ActivityUtils.hideKeyboard(this);
Expand Down Expand Up @@ -2306,7 +2336,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() {
boolean unsupportedBlockEditorSwitch = !mIsJetpackSsoEnabled && "gutenberg".equals(mSite.getWebEditor());

return new GutenbergPropsBuilder(
mWPStoriesFeatureConfig.isEnabled(),
mWPStoriesFeatureConfig.isEnabled() && SiteUtils.supportsStoriesFeature(mSite),
enableMentions,
isUnsupportedBlockEditorEnabled,
unsupportedBlockEditorSwitch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import com.wordpress.stories.compose.frame.StorySaveEvents.FrameSaveCompleted
import com.wordpress.stories.compose.frame.StorySaveEvents.FrameSaveFailed
import com.wordpress.stories.compose.frame.StorySaveEvents.FrameSaveProgress
import com.wordpress.stories.compose.frame.StorySaveEvents.FrameSaveStart
import com.wordpress.stories.compose.frame.StorySaveEvents.StorySaveProcessStart
import com.wordpress.stories.compose.frame.StorySaveEvents.StorySaveResult
import com.wordpress.stories.compose.story.StoryIndex
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.wordpress.android.R
Expand Down Expand Up @@ -58,6 +60,8 @@ class StoriesEventListener @Inject constructor(
private lateinit var site: SiteModel
private lateinit var editPostRepository: EditPostRepository
private var storySaveMediaListener: StorySaveMediaListener? = null
var storiesSavingInProgress = HashSet<StoryIndex>()
private set

@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
private fun onCreate() {
Expand Down Expand Up @@ -168,6 +172,7 @@ class StoriesEventListener @Inject constructor(

@Subscribe(threadMode = ThreadMode.MAIN)
fun onStorySaveProcessFinished(event: StorySaveResult) {
storiesSavingInProgress.remove(event.storyIndex)
if (!lifecycle.currentState.isAtLeast(CREATED)) {
return
}
Expand All @@ -179,6 +184,11 @@ class StoriesEventListener @Inject constructor(
}
}

@Subscribe(threadMode = ThreadMode.MAIN)
fun onStorySaveStart(event: StorySaveProcessStart) {
storiesSavingInProgress.add(event.storyIndex)
}

// Editor load / cancel events
fun onRequestMediaFilesEditorLoad(
activity: Activity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ class SaveStoryGutenbergBlockUseCase @Inject constructor(
while (storyBlockStartIndex > -1 && storyBlockStartIndex < content.length) {
storyBlockStartIndex = content.indexOf(HEADING_START, storyBlockStartIndex)
if (storyBlockStartIndex > -1) {
val storyBlockEndIndex = content.indexOf(HEADING_END, storyBlockStartIndex)
val jsonString: String = content.substring(
storyBlockStartIndex + HEADING_START.length,
content.indexOf(HEADING_END))
storyBlockEndIndex)
content = listener.doWithMediaFilesJson(content, jsonString)
storyBlockStartIndex += HEADING_START.length
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class StoriesIntroViewModel @Inject constructor(
}

companion object {
private const val STORY_URL_1 = "https://wpstories.wordpress.com/2020/10/12/patagonia-2/"
private const val STORY_URL_2 = "https://wpstories.wordpress.com/2020/10/12/hiking-in-the-southwest/"
private const val STORY_URL_1 = "https://wpstories.wordpress.com/2020/12/02/story-demo-01/"
private const val STORY_URL_2 = "https://wpstories.wordpress.com/2020/12/02/story-demo-02/"
private const val STORY_FULLSCREEN_URL_PARAMS = "?wp-story-load-in-fullscreen=true&wp-story-play-on-load=true"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified WordPress/src/main/res/drawable-hdpi/stories_intro_cover_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified WordPress/src/main/res/drawable-xhdpi/stories_intro_cover_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified WordPress/src/main/res/drawable-xhdpi/stories_intro_cover_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading