Skip to content

Commit

Permalink
Merge branch 'trunk' into Parent-PR-for-updating-targetSdkVersion-to-…
Browse files Browse the repository at this point in the history
…33-(Android-13)

# Conflicts:
#	build.gradle
  • Loading branch information
irfano committed Apr 6, 2023
2 parents a76ef47 + f6daf13 commit b81f101
Show file tree
Hide file tree
Showing 46 changed files with 2,728 additions and 1,966 deletions.
2 changes: 2 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

22.2
[***] [internal] Adds media permissions support for Android 13 [https://github.com/wordpress-mobile/WordPress-Android/pull/18183]
-----


22.1
-----
Expand Down
1 change: 1 addition & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ android {
buildConfigField "boolean", "WP_INDIVIDUAL_PLUGIN_OVERLAY", "false"
buildConfigField "boolean", "DASHBOARD_CARD_PAGES", "false"
buildConfigField "boolean", "DASHBOARD_CARD_ACTIVITY_LOG", "false"
buildConfigField "boolean", "DASHBOARD_CARD_DOMAIN", "false"

// Override these constants in jetpack product flavor to enable/ disable features
buildConfigField "boolean", "ENABLE_SITE_CREATION", "true"
Expand Down
13 changes: 6 additions & 7 deletions WordPress/jetpack_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: Jetpack - Apps - Android - Release Notes\n"

msgctxt "release_note_220"
msgctxt "release_note_221"
msgid ""
"22.0:\n"
"You can now transform most types of blocks into other block types, like quotes, columns, and groups.\n"
"22.1:\n"
"No updates this week. In the meantime, we're just over here cooling our jets.\n"
msgstr ""

msgctxt "release_note_219"
msgctxt "release_note_220"
msgid ""
"21.9:\n"
"Hot news—Jetpack now supports Blaze, so you can reach new readers by promoting a post or page from within the app.\n"
"We also added a post-migration FAQ card to the Help screen, which you’ll see after switching from the WordPress app over to Jetpack.\n"
"22.0:\n"
"You can now transform most types of blocks into other block types, like quotes, columns, and groups.\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
2 changes: 1 addition & 1 deletion WordPress/jetpack_metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
You can now transform most types of blocks into other block types, like quotes, columns, and groups.
No updates this week. In the meantime, we're just over here cooling our jets.
15 changes: 6 additions & 9 deletions WordPress/metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,16 @@ msgstr ""
"X-Generator: VsCode\n"
"Project-Id-Version: Release Notes & Play Store Descriptions\n"

msgctxt "release_note_220"
msgctxt "release_note_221"
msgid ""
"22.0:\n"
"You can now transform most types of blocks into other block types, like quotes, columns, and groups.\n"
"22.1:\n"
"When you log in to a self-hosted site that connects to Jetpack through individual plugins, you’ll see a pop-up stating that this type of connection doesn’t support the app’s core features yet. You can get around that problem by switching over to the Jetpack app. Up, up, and away.\n"
msgstr ""

msgctxt "release_note_219"
msgctxt "release_note_220"
msgid ""
"21.9:\n"
"Good words are read\n"
"The WordPress logo is blue\n"
"There are no new updates\n"
"Sorry to disappoint you\n"
"22.0:\n"
"You can now transform most types of blocks into other block types, like quotes, columns, and groups.\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
2 changes: 1 addition & 1 deletion WordPress/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
You can now transform most types of blocks into other block types, like quotes, columns, and groups.
When you log in to a self-hosted site that connects to Jetpack through individual plugins, you’ll see a pop-up stating that this type of connection doesn’t support the app’s core features yet. You can get around that problem by switching over to the Jetpack app. Up, up, and away.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.wordpress.android.ui.domains

import org.wordpress.android.fluxc.model.SiteModel
import org.wordpress.android.ui.prefs.AppPrefsWrapper
import org.wordpress.android.util.BuildConfigWrapper
import org.wordpress.android.util.config.DashboardCardDomainFeatureConfig
import javax.inject.Inject

class DashboardCardDomainUtils @Inject constructor(
private val appPrefsWrapper: AppPrefsWrapper,
private val dashboardCardDomainFeatureConfig: DashboardCardDomainFeatureConfig,
private val buildConfigWrapper: BuildConfigWrapper,
) {
fun shouldShowCard(siteModel: SiteModel, isDomainCreditAvailable: Boolean): Boolean {
return isDashboardCardDomainEnabled() &&
!isDashboardCardDomainHiddenByUser(siteModel.siteId) &&
(siteModel.isWPCom || siteModel.isWPComAtomic) &&
siteModel.isAdmin &&
// !hasSiteDomains(siteModel) && // this may need a separate api call!
!isDomainCreditAvailable
}

fun hideCard(siteId: Long) {
appPrefsWrapper.setShouldHideDashboardDomainCard(siteId, true)
}

private fun isDashboardCardDomainHiddenByUser(siteId: Long): Boolean {
return appPrefsWrapper.getShouldHideDashboardDomainCard(siteId)
}

private fun isDashboardCardDomainEnabled(): Boolean {
return buildConfigWrapper.isJetpackApp &&
dashboardCardDomainFeatureConfig.isEnabled()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package org.wordpress.android.ui.jetpackoverlay.individualplugin
import org.wordpress.android.fluxc.persistence.JetpackCPConnectedSiteModel
import org.wordpress.android.fluxc.store.SiteStore
import org.wordpress.android.ui.prefs.AppPrefsWrapper
import org.wordpress.android.util.StringUtils
import org.wordpress.android.util.UrlUtils
import org.wordpress.android.util.config.WPIndividualPluginOverlayFeatureConfig
import org.wordpress.android.util.config.WPIndividualPluginOverlayMaxShownConfig
import org.wordpress.android.util.extensions.activeIndividualJetpackPluginNames
Expand All @@ -27,7 +29,7 @@ class WPJetpackIndividualPluginHelper @Inject constructor(
return individualPluginConnectedSites.map { site ->
SiteWithIndividualJetpackPlugins(
name = site.name,
url = site.url,
url = StringUtils.removeTrailingSlash(UrlUtils.removeScheme(site.url)),
individualPluginNames = site.activeIndividualJetpackPluginNames(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ sealed class MySiteCardAndItemBuilderParams {
val todaysStatsCardBuilderParams: TodaysStatsCardBuilderParams,
val postCardBuilderParams: PostCardBuilderParams,
val bloggingPromptCardBuilderParams: BloggingPromptCardBuilderParams,
val promoteWithBlazeCardBuilderParams: PromoteWithBlazeCardBuilderParams
val promoteWithBlazeCardBuilderParams: PromoteWithBlazeCardBuilderParams,
val dashboardCardDomainBuilderParams: DashboardCardDomainBuilderParams
) : MySiteCardAndItemBuilderParams()

data class TodaysStatsCardBuilderParams(
Expand Down Expand Up @@ -115,6 +116,13 @@ sealed class MySiteCardAndItemBuilderParams {
val onMoreMenuClick: () -> Unit
) : MySiteCardAndItemBuilderParams()

data class DashboardCardDomainBuilderParams(
val isEligible: Boolean = false,
val onClick: () -> Unit,
val onHideMenuItemClick: () -> Unit,
val onMoreMenuClick: () -> Unit
) : MySiteCardAndItemBuilderParams()

data class SingleActionCardParams(
@StringRes val textResource: Int,
@DrawableRes val imageResource: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import org.wordpress.android.ui.blaze.BlazeFeatureUtils
import org.wordpress.android.ui.blaze.BlazeFlowSource
import org.wordpress.android.ui.bloggingprompts.BloggingPromptsPostTagProvider
import org.wordpress.android.ui.bloggingprompts.BloggingPromptsSettingsHelper
import org.wordpress.android.ui.domains.DashboardCardDomainUtils
import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalOverlayUtil
import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalOverlayUtil.JetpackFeatureCollectionOverlaySource.FEATURE_CARD
import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalPhaseHelper
Expand All @@ -61,6 +62,7 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItem.SiteInfoHeaderCard
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Type
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.BloggingPromptCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DashboardCardsBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DashboardCardDomainBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.DomainRegistrationCardBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.InfoItemBuilderParams
import org.wordpress.android.ui.mysite.MySiteCardAndItemBuilderParams.JetpackInstallFullPluginCardBuilderParams
Expand Down Expand Up @@ -205,6 +207,7 @@ class MySiteViewModel @Inject constructor(
private val getShowJetpackFullPluginInstallOnboardingUseCase: GetShowJetpackFullPluginInstallOnboardingUseCase,
private val jetpackInstallFullPluginShownTracker: JetpackInstallFullPluginShownTracker,
private val blazeFeatureUtils: BlazeFeatureUtils,
private val dashboardCardDomainUtils: DashboardCardDomainUtils,
private val jetpackFeatureRemovalPhaseHelper: JetpackFeatureRemovalPhaseHelper,
private val wpJetpackIndividualPluginHelper: WPJetpackIndividualPluginHelper,
) : ScopedViewModel(mainDispatcher) {
Expand Down Expand Up @@ -588,6 +591,14 @@ class MySiteViewModel @Inject constructor(
onClick = this::onPromoteWithBlazeCardClick,
onHideMenuItemClick = this::onPromoteWithBlazeCardHideMenuItemClick,
onMoreMenuClick = this::onPromoteWithBlazeCardMoreMenuClick
),
dashboardCardDomainBuilderParams = DashboardCardDomainBuilderParams(
isEligible = dashboardCardDomainUtils.shouldShowCard(
site, isDomainCreditAvailable
),
onClick = this::onDashboardCardDomainClick,
onHideMenuItemClick = this::onDashboardCardDomainHideMenuItemClick,
onMoreMenuClick = this::onDashboardCardDomainMoreMenuClick
)
),
QuickLinkRibbonBuilderParams(
Expand Down Expand Up @@ -1563,6 +1574,24 @@ class MySiteViewModel @Inject constructor(
refresh()
}

private fun onDashboardCardDomainMoreMenuClick() {
// track
}

private fun onDashboardCardDomainClick() {
val selectedSite = requireNotNull(selectedSiteRepository.getSelectedSite())
// track
_onNavigation.value = Event(SiteNavigationAction.OpenDomainRegistration(selectedSite))
}

private fun onDashboardCardDomainHideMenuItemClick() {
// track
selectedSiteRepository.getSelectedSite()?.let {
dashboardCardDomainUtils.hideCard(it.siteId)
}
refresh()
}

fun isRefreshing() = mySiteSourceManager.isRefreshing()

fun onActionableEmptyViewGone() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3135,6 +3135,17 @@ public void onAddFileClicked(boolean allowMultipleSelection) {
}
}

@Override public void onPerformPost(
String path,
Map<String, Object> body,
Consumer<String> onResult,
Consumer<Bundle> onError
) {
if (mSite != null) {
mReactNativeRequestHandler.performPostRequest(path, body, mSite, onResult, onError);
}
}

@Override
public void onCaptureVideoClicked() {
onPhotoPickerIconClicked(PhotoPickerIcon.ANDROID_CAPTURE_VIDEO, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public abstract class BlockProcessor {
String mLocalId;
String mRemoteId;
String mRemoteUrl;
String mRemoteGuid;

private String mBlockName;
private JsonObject mJsonAttributes;
Expand All @@ -46,6 +47,7 @@ public abstract class BlockProcessor {
mRemoteId = mediaFile.getMediaId();
mRemoteUrl = org.wordpress.android.util.StringUtils.notNullStr(Utils.escapeQuotes(mediaFile
.getOptimalFileURL()));
mRemoteGuid = mediaFile.getVideoPressGuid();
}

private JsonObject parseJson(String blockJson) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.wordpress.android.ui.posts.mediauploadcompletionprocessors;

import org.wordpress.android.util.UriEncoder;
import org.wordpress.android.util.helpers.MediaFile;

import java.util.HashMap;
Expand All @@ -12,10 +13,12 @@
import static org.wordpress.android.ui.posts.mediauploadcompletionprocessors.MediaBlockType.IMAGE;
import static org.wordpress.android.ui.posts.mediauploadcompletionprocessors.MediaBlockType.MEDIA_TEXT;
import static org.wordpress.android.ui.posts.mediauploadcompletionprocessors.MediaBlockType.VIDEO;
import static org.wordpress.android.ui.posts.mediauploadcompletionprocessors.MediaBlockType.VIDEOPRESS;

class BlockProcessorFactory {
private final MediaUploadCompletionProcessor mMediaUploadCompletionProcessor;
private final Map<MediaBlockType, BlockProcessor> mMediaBlockTypeBlockProcessorMap;
private final UriEncoder mUriEncoder;

/**
* This factory initializes block processors for all media block types and provides a method to retrieve a block
Expand All @@ -24,6 +27,7 @@ class BlockProcessorFactory {
BlockProcessorFactory(MediaUploadCompletionProcessor mediaUploadCompletionProcessor) {
mMediaUploadCompletionProcessor = mediaUploadCompletionProcessor;
mMediaBlockTypeBlockProcessorMap = new HashMap<>();
mUriEncoder = new UriEncoder();
}

/**
Expand All @@ -34,6 +38,7 @@ class BlockProcessorFactory {
*/
BlockProcessorFactory init(String localId, MediaFile mediaFile, String siteUrl) {
mMediaBlockTypeBlockProcessorMap.put(IMAGE, new ImageBlockProcessor(localId, mediaFile));
mMediaBlockTypeBlockProcessorMap.put(VIDEOPRESS, new VideoPressBlockProcessor(localId, mediaFile, mUriEncoder));
mMediaBlockTypeBlockProcessorMap.put(VIDEO, new VideoBlockProcessor(localId, mediaFile));
mMediaBlockTypeBlockProcessorMap.put(MEDIA_TEXT, new MediaTextBlockProcessor(localId, mediaFile));
mMediaBlockTypeBlockProcessorMap.put(GALLERY, new GalleryBlockProcessor(localId, mediaFile, siteUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

enum MediaBlockType {
IMAGE("image"),
VIDEOPRESS("videopress/video"),
VIDEO("video"),
MEDIA_TEXT("media-text"),
GALLERY("gallery"),
Expand Down
Loading

0 comments on commit b81f101

Please sign in to comment.