Skip to content

Commit

Permalink
Merge pull request #16640 from wordpress-mobile/merge/19.9-rc-4
Browse files Browse the repository at this point in the history
Merge release/19.9 after `19.9-rc-4` beta (+ conflict resolution)
  • Loading branch information
AliSoftware authored May 25, 2022
2 parents e824bb2 + 10fee74 commit 572edb0
Show file tree
Hide file tree
Showing 50 changed files with 1,048 additions and 995 deletions.
1 change: 1 addition & 0 deletions WordPress/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@
<activity
android:name=".ui.domains.DomainRegistrationActivity"
android:label="@string/register_domain"
android:windowSoftInputMode="adjustResize"
android:theme="@style/WordPress.NoActionBar"/>

<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.wordpress.android.ui.domains
import android.os.Bundle
import android.view.View
import androidx.core.text.parseAsHtml
import androidx.core.view.isGone
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.core.widget.doAfterTextChanged
Expand Down Expand Up @@ -86,8 +85,8 @@ class DomainSuggestionsFragment : Fragment(R.layout.domain_suggestions_fragment)
val isLoading = listState is ListState.Loading<*>

domainSuggestionsContainer.isInvisible = isLoading
suggestionSearchIcon.isVisible = !isLoading
suggestionProgressBar.isVisible = isLoading
suggestionSearchIcon.isGone = isLoading

if (!isLoading) {
(domainSuggestionsList.adapter as DomainSuggestionsAdapter).submitList(listState.data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ sealed class MySiteCardAndItem(open val type: Type, open val activeQuickStartIte
val title: UiString,
val excerpt: UiString,
@DrawableRes val imageRes: Int,
override val footerLink: FooterLink
override val footerLink: FooterLink,
val onClick: ListItemInteraction
) : PostCard(
dashboardCardType = DashboardCardType.POST_CARD_WITHOUT_POST_ITEMS,
footerLink = footerLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1135,11 +1135,12 @@ class MySiteViewModel @Inject constructor(
selectedSiteRepository.getSelectedSite()?.let { site ->
cardsTracker.trackPostItemClicked(params.postCardType)
when (params.postCardType) {
PostCardType.CREATE_FIRST, PostCardType.CREATE_NEXT -> _onNavigation.value =
Event(SiteNavigationAction.OpenEditorToCreateNewPost(site))
PostCardType.DRAFT -> _onNavigation.value =
Event(SiteNavigationAction.EditDraftPost(site, params.postId))
PostCardType.SCHEDULED -> _onNavigation.value =
Event(SiteNavigationAction.EditScheduledPost(site, params.postId))
else -> Unit // Do nothing
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class PostCardBuilder @Inject constructor(
posts?.hasPublished?.takeIf { !posts.hasDraftsOrScheduledPosts() }
?.let { hasPublished ->
if (hasPublished) {
add(createNextPostCard(params.onFooterLinkClick))
add(createNextPostCard(params.onPostItemClick, params.onFooterLinkClick))
} else {
add(createFirstPostCard(params.onFooterLinkClick))
add(createFirstPostCard(params.onPostItemClick, params.onFooterLinkClick))
}
}
posts?.draft?.takeIf { it.isNotEmpty() }?.let { add(it.createDraftPostsCard(params)) }
Expand All @@ -60,29 +60,41 @@ class PostCardBuilder @Inject constructor(
title = UiStringRes(R.string.posts)
)

private fun createFirstPostCard(onFooterLinkClick: (postCardType: PostCardType) -> Unit) =
PostCardWithoutPostItems(
postCardType = PostCardType.CREATE_FIRST,
title = UiStringRes(R.string.my_site_create_first_post_title),
excerpt = UiStringRes(R.string.my_site_create_first_post_excerpt),
imageRes = R.drawable.img_write_212dp,
footerLink = FooterLink(
label = UiStringRes(R.string.my_site_post_card_link_create_post),
onClick = onFooterLinkClick
)
private fun createFirstPostCard(
onPostItemClick: (params: PostItemClickParams) -> Unit,
onFooterLinkClick: (postCardType: PostCardType) -> Unit
) = PostCardWithoutPostItems(
postCardType = PostCardType.CREATE_FIRST,
title = UiStringRes(R.string.my_site_create_first_post_title),
excerpt = UiStringRes(R.string.my_site_create_first_post_excerpt),
imageRes = R.drawable.img_write_212dp,
footerLink = FooterLink(
label = UiStringRes(R.string.my_site_post_card_link_create_post),
onClick = onFooterLinkClick
),
onClick = ListItemInteraction.create(
PostItemClickParams(postCardType = PostCardType.CREATE_FIRST, postId = NOT_SET),
onPostItemClick
)
)

private fun createNextPostCard(onFooterLinkClick: (postCardType: PostCardType) -> Unit) =
PostCardWithoutPostItems(
postCardType = PostCardType.CREATE_NEXT,
title = UiStringRes(R.string.my_site_create_next_post_title),
excerpt = UiStringRes(R.string.my_site_create_next_post_excerpt),
imageRes = R.drawable.img_write_212dp,
footerLink = FooterLink(
label = UiStringRes(R.string.my_site_post_card_link_create_post),
onClick = onFooterLinkClick
)
private fun createNextPostCard(
onPostItemClick: (params: PostItemClickParams) -> Unit,
onFooterLinkClick: (postCardType: PostCardType) -> Unit
) = PostCardWithoutPostItems(
postCardType = PostCardType.CREATE_NEXT,
title = UiStringRes(R.string.my_site_create_next_post_title),
excerpt = UiStringRes(R.string.my_site_create_next_post_excerpt),
imageRes = R.drawable.img_write_212dp,
footerLink = FooterLink(
label = UiStringRes(R.string.my_site_post_card_link_create_post),
onClick = onFooterLinkClick
),
onClick = ListItemInteraction.create(
PostItemClickParams(postCardType = PostCardType.CREATE_NEXT, postId = NOT_SET),
onPostItemClick
)
)

private fun List<PostCardModel>.createDraftPostsCard(params: PostCardBuilderParams) =
PostCardWithPostItems(
Expand Down Expand Up @@ -150,5 +162,6 @@ class PostCardBuilder @Inject constructor(

companion object {
private const val MONTH_DAY_FORMAT = "MMM d"
const val NOT_SET = -1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.DashboardCards.Das
import org.wordpress.android.ui.mysite.cards.dashboard.CardViewHolder
import org.wordpress.android.ui.utils.UiHelpers
import org.wordpress.android.ui.utils.UiString
import org.wordpress.android.util.image.ImageManager
import org.wordpress.android.util.extensions.viewBinding
import org.wordpress.android.util.image.ImageManager

sealed class PostCardViewHolder<T : ViewBinding>(
override val binding: T
Expand All @@ -35,6 +35,7 @@ sealed class PostCardViewHolder<T : ViewBinding>(
mySiteCardFooterLink.linkLabel.setOnClickListener {
postCard.footerLink.onClick.invoke(card.postCardType)
}
itemView.setOnClickListener { postCard.onClick.click() }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,48 @@ class QuickLinkRibbonBuilder @Inject constructor(
val quickStartRepository: QuickStartRepository
) {
fun build(params: QuickLinkRibbonBuilderParams) = QuickLinkRibbon(
quickLinkRibbonItems = getQuickLinkRibbonItems(params),
showPagesFocusPoint = shouldShowPagesFocusPoint(params),
showStatsFocusPoint = shouldShowStatsFocusPoint(params),
showMediaFocusPoint = shouldShowMediaFocusPoint(params)
quickLinkRibbonItems = getQuickLinkRibbonItems(params),
showPagesFocusPoint = shouldShowPagesFocusPoint(params),
showStatsFocusPoint = shouldShowStatsFocusPoint(params),
showMediaFocusPoint = shouldShowMediaFocusPoint(params)
)

private fun getQuickLinkRibbonItems(params: QuickLinkRibbonBuilderParams): MutableList<QuickLinkRibbonItem> {
val items = mutableListOf<QuickLinkRibbonItem>()
if (params.siteModel.isSelfHostedAdmin || params.siteModel.hasCapabilityEditPages) {
val pages = QuickLinkRibbonItem(
label = R.string.pages,
icon = R.drawable.ic_pages_white_24dp,
onClick = ListItemInteraction.create(params.onPagesClick),
showFocusPoint = shouldShowPagesFocusPoint(params)
)
items.add(pages)
}
items.apply {
add(
QuickLinkRibbonItem(
label = R.string.posts,
icon = R.drawable.ic_posts_white_24dp,
onClick = ListItemInteraction.create(params.onPostsClick)
)
QuickLinkRibbonItem(
label = R.string.stats,
icon = R.drawable.ic_stats_alt_white_24dp,
onClick = ListItemInteraction.create(params.onStatsClick),
showFocusPoint = shouldShowStatsFocusPoint(params)
)
)
add(
QuickLinkRibbonItem(
label = R.string.media,
icon = R.drawable.ic_media_white_24dp,
onClick = ListItemInteraction.create(params.onMediaClick),
showFocusPoint = shouldShowMediaFocusPoint(params)
)
QuickLinkRibbonItem(
label = R.string.posts,
icon = R.drawable.ic_posts_white_24dp,
onClick = ListItemInteraction.create(params.onPostsClick)
)
)

add(
QuickLinkRibbonItem(
label = R.string.stats,
icon = R.drawable.ic_stats_alt_white_24dp,
onClick = ListItemInteraction.create(params.onStatsClick),
showFocusPoint = shouldShowStatsFocusPoint(params)
)
QuickLinkRibbonItem(
label = R.string.media,
icon = R.drawable.ic_media_white_24dp,
onClick = ListItemInteraction.create(params.onMediaClick),
showFocusPoint = shouldShowMediaFocusPoint(params)
)
)
}
if (params.siteModel.isSelfHostedAdmin || params.siteModel.hasCapabilityEditPages) {
val pages = QuickLinkRibbonItem(
label = R.string.pages,
icon = R.drawable.ic_pages_white_24dp,
onClick = ListItemInteraction.create(params.onPagesClick),
showFocusPoint = shouldShowPagesFocusPoint(params)
)
items.add(QUICK_LINK_PAGE_INDEX, pages)
}
return items
}

Expand All @@ -76,4 +75,8 @@ class QuickLinkRibbonBuilder @Inject constructor(
QuickStartStore.QUICK_START_UPLOAD_MEDIA_LABEL
)
}

companion object {
private const val QUICK_LINK_PAGE_INDEX = 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.OnItemTouchListener
import org.wordpress.android.R
import org.wordpress.android.databinding.QuickLinkRibbonListBinding
import org.wordpress.android.ui.mysite.MySiteCardAndItem.Card.QuickLinkRibbon
import org.wordpress.android.ui.mysite.MySiteCardAndItemViewHolder
Expand All @@ -33,17 +32,13 @@ class QuickLinkRibbonViewHolder(
setOnTouchItemListener()
(quickLinkRibbonItemList.adapter as QuickLinkRibbonItemAdapter).update(quickLinkRibbon.quickLinkRibbonItems)
if (quickLinkRibbon.showStatsFocusPoint) {
quickLinkRibbonItemList.smoothScrollToPosition(quickLinkRibbon.quickLinkRibbonItems.size)
quickLinkRibbonItemList.smoothScrollToPosition(0)
}
if (quickLinkRibbon.showPagesFocusPoint) {
quickLinkRibbonItemList.smoothScrollToPosition(0)
quickLinkRibbonItemList.smoothScrollToPosition(2)
}
if (quickLinkRibbon.showMediaFocusPoint) {
val mediaItem = quickLinkRibbon.quickLinkRibbonItems.firstOrNull { it.label == R.string.media }
mediaItem?.let {
val mediaItemIndex = quickLinkRibbon.quickLinkRibbonItems.indexOf(it)
quickLinkRibbonItemList.smoothScrollToPosition(mediaItemIndex)
}
quickLinkRibbonItemList.smoothScrollToPosition(quickLinkRibbon.quickLinkRibbonItems.size)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@

<ImageView
android:id="@+id/suggestion_search_icon"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/margin_extra_extra_small"
android:contentDescription="@null"
android:src="@drawable/ic_search_white_24dp"
app:tint="?attr/wpColorOnSurfaceMedium" />
app:tint="?attr/wpColorOnSurfaceMedium"
tools:visibility="visible"/>

<ProgressBar
android:id="@+id/suggestion_progress_bar"
Expand Down
3 changes: 0 additions & 3 deletions WordPress/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1662,16 +1662,13 @@ Language: ar
<string name="quick_start_sites_type_customize">تخصيص موقعك</string>
<string name="quick_start_sites">الخطوات التالية</string>
<string name="quick_start_complete_tasks_header">مكتمل (%d)</string>
<string name="quick_start_dialog_explore_plans_message_short">أنقر على %1$s الخطة %2$s لمشاهدة خطتك الحالية والخطط الأخرى المتاحة</string>
<string name="quick_start_dialog_upload_icon_message">سيرى زائروك أيقونتك في متصفحهم. أضف أيقونة مخصصة للحصول على مظهر جذّاب واحترافي.</string>
<string name="quick_start_sites_type_grow">تنمية جمهورك</string>
<string name="quick_start_dialog_upload_icon_title">اختيار أيقونة موقع فريدة</string>
<string name="quick_start_dialog_upload_site_icon_message_short">أنقر على %1$s أيقونة موقعك %2$s لرفع أيقونة جديدة</string>
<string name="quick_start_dialog_publish_post_message">اكتب مسودّة مقالة ثم أنشرها.</string>
<string name="quick_start_dialog_check_stats_message_short">حدِّد ⁦%1$s⁩ الإحصاءات ⁦%2$s⁩ لمعرفة مستوى أداء موقعك.</string>
<string name="quick_start_dialog_enable_sharing_title">تمكين مشاركة المقالة</string>
<string name="quick_start_dialog_explore_plans_message">معرفة المزيد عن أدوات التسويق وتحسين محركات البحث SEO في خططنا المدفوعة.</string>
<string name="quick_start_dialog_explore_plans_title">استكشاف الخطط</string>
<string name="quick_start_dialog_enable_sharing_message">شارك المقالات الجديدة تلقائيًّا على حساباتك على وسائل التواصل الاجتماعي.</string>
<string name="quick_start_dialog_remove_next_steps_title">إزالة الخطوات التالية</string>
<string name="quick_start_remove_next_steps_menu_title">إزالة هذا</string>
Expand Down
3 changes: 0 additions & 3 deletions WordPress/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,6 @@ Language: cs_CZ
<string name="plans_loading_error_no_plans_title">Nelze načíst plány</string>
<string name="exit">exit</string>
<string name="quick_start_sites">Další kroky</string>
<string name="quick_start_dialog_explore_plans_message_short">Klepnutím na plán %1$s %2$s zobrazíte aktuální plán a další dostupné plány</string>
<string name="quick_start_dialog_upload_icon_message">Návštěvníci uvidí vaši ikonu ve svém prohlížeči. Přidejte vlastní ikonu pro vyleštěný profesionální vzhled.</string>
<string name="quick_start_dialog_upload_icon_title">Nahrát ikonu webu</string>
<string name="quick_start_complete_tasks_header">Kompletní (%d)</string>
Expand All @@ -1647,8 +1646,6 @@ Language: cs_CZ
<string name="quick_start_dialog_upload_site_icon_message_short">Klepnutím na ikonu %1$s vašeho webu %2$s nahrajte novou</string>
<string name="quick_start_dialog_check_stats_message_short">Klepnutím na %1$s Statistiky %2$s zobrazíte výkon svého webu.</string>
<string name="quick_start_dialog_enable_sharing_title">Povolit sdílení příspěvků</string>
<string name="quick_start_dialog_explore_plans_message">Zjistěte více o marketingových a SEO nástrojích v našich placených plánech.</string>
<string name="quick_start_dialog_explore_plans_title">Prozkoumejte plány</string>
<string name="quick_start_dialog_enable_sharing_message">Automaticky sdílejte nové příspěvky se svými účty sociálních médií.</string>
<string name="quick_start_complete_view_subtitle">Gratulujeme k dokončení vašeho seznamu. Dobře odvedená práce.</string>
<string name="quick_start_remove_next_steps_menu_title">Odebrat toto</string>
Expand Down
3 changes: 0 additions & 3 deletions WordPress/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1670,16 +1670,13 @@ Language: de
<string name="quick_start_sites">Nächste Schritte</string>
<string name="quick_start_complete_tasks_header">(%d) komplett</string>
<string name="quick_start_dialog_upload_icon_message">Deine Besucher sehen dein Symbol in ihrem Browser. Füge ein individuelles Symbol hinzu, um einen eleganten, professionellen Look zu erhalten.</string>
<string name="quick_start_dialog_explore_plans_message_short">Tippe auf %1$s Plan %2$s, um deinen aktuellen Plan und andere verfügbare Pläne anzuzeigen</string>
<string name="quick_start_sites_type_grow">Vergrößere deine Reichweite</string>
<string name="quick_start_sites_type_customize">Passe deine Website an</string>
<string name="quick_start_dialog_upload_icon_title">Wähle ein einzigartiges Website-Icon aus</string>
<string name="quick_start_dialog_upload_site_icon_message_short">Tippe auf %1$s Dein Website-Icon %2$s, um ein neues hochzuladen.</string>
<string name="quick_start_dialog_publish_post_message">Entwirf und veröffentliche einen Beitrag.</string>
<string name="quick_start_dialog_check_stats_message_short">Wähle %1$s Statistiken %2$s aus, um zu sehen, wie deine Website funktioniert.</string>
<string name="quick_start_dialog_enable_sharing_title">Teilen der Beiträge aktivieren</string>
<string name="quick_start_dialog_explore_plans_title">Tarife erkunden</string>
<string name="quick_start_dialog_explore_plans_message">Erfahre mehr über die Marketing- und SEO-Tools in unseren kostenpflichtigen Tarifen.</string>
<string name="quick_start_dialog_enable_sharing_message">Neue Beiträge automatisch für deine Social-Media-Konten freigeben.</string>
<string name="quick_start_dialog_check_stats_title">Die Statistiken deiner Website überprüfen</string>
<string name="quick_start_dialog_remove_next_steps_message">Das Entfernen der nächsten Schritte blendet alle Touren auf dieser Seite aus. Diese Aktion kann nicht rückgängig gemacht werden.</string>
Expand Down
Loading

0 comments on commit 572edb0

Please sign in to comment.