Skip to content

Commit 6519340

Browse files
Merge branch 'trunk' into issue/12836-media-upload-wpv2
2 parents 5f284c8 + af5b7a5 commit 6519340

28 files changed

+412
-473
lines changed

RELEASE-NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
21.2
66
- [Internal] Changed a way how authenticated web view opened in the IPP flows [https://github.com/woocommerce/woocommerce-android/pull/12908]
7+
- [Internal][POS] Onboarding to the IPP now is part of the POS [https://github.com/woocommerce/woocommerce-android/pull/12942]
78
- [*] Fixed an inconsistent state while refreshing the orders list [https://github.com/woocommerce/woocommerce-android/pull/12948]
89
- [**][Payments] Fixed a bug when IPP onboarding was not possible to finish from the app [https://github.com/woocommerce/woocommerce-android/pull/12917]
910
- [*] Fixed shipping lines being editable at all states [https://github.com/woocommerce/woocommerce-android/pull/12890]
1011
- [*] Fixed a crash that occurred when tapping on the customer shipping address in the order details screen [https://github.com/woocommerce/woocommerce-android/pull/12920]
1112
- [*][Payments] Fixed a bug when loading indicator was shown forever after fetching of a receipt failed [https://github.com/woocommerce/woocommerce-android/pull/12950]
1213
- [**] Enables creating a new WP.com account during Jetpack activation flow [https://github.com/woocommerce/woocommerce-android/issues/11114]
1314
- [*] Switched to use `/wp/v2` for media uploads on Jetpack sites, this fixes media upload issues caused by XMLRPC problems [https://github.com/woocommerce/woocommerce-android/pull/12938]
15+
- [*] Renamed Deposits to Payouts [https://github.com/woocommerce/woocommerce-android/pull/12961]
1416

1517
21.1
1618
-----

WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv
539539
PAYMENTS_HUB_TAP_TO_PAY_FEEDBACK_TAPPED,
540540
PAYMENTS_HUB_TAP_TO_PAY_ABOUT_TAPPED,
541541

542-
// -- Payments Hub - Deposit Summary
542+
// -- Payments Hub - Payout Summary (Previously called Deposit summary)
543543
PAYMENTS_HUB_DEPOSIT_SUMMARY_SHOWN,
544544
PAYMENTS_HUB_DEPOSIT_SUMMARY_EXPANDED,
545545
PAYMENTS_HUB_DEPOSIT_SUMMARY_ERROR,

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/jetpack/wpcom/JetpackActivationWPComEmailViewModel.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,20 @@ class JetpackActivationWPComEmailViewModel @Inject constructor(
131131
triggerEvent(ShowSnackbar(R.string.error_generic))
132132
}
133133
}
134-
135-
trackLoginFlowAuthOptionError(failure, isSignup)
134+
if (!isSignup) {
135+
trackLoginFlowAuthOptionError(failure)
136+
}
136137
}
137138
)
138139
isLoadingDialogShown.value = false
139140
}
140141

141-
private fun trackLoginFlowAuthOptionError(
142-
failure: AuthOptionsError?,
143-
isSignup: Boolean
144-
) {
142+
private fun trackLoginFlowAuthOptionError(failure: AuthOptionsError?) {
145143
analyticsTrackerWrapper.track(
146144
JETPACK_SETUP_LOGIN_FLOW,
147145
mapOf(
148146
AnalyticsTracker.KEY_STEP to AnalyticsTracker.VALUE_JETPACK_SETUP_STEP_EMAIL_ADDRESS,
149147
AnalyticsTracker.KEY_FAILURE to (failure?.type?.name ?: "Unknown error"),
150-
AnalyticsTracker.KEY_IS_SIGN_UP to isSignup
151148
)
152149
)
153150
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/wooshippinglabels/ShippingRatesSection.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.woocommerce.android.ui.orders.wooshippinglabels
22

33
import android.content.Context
4+
import android.content.res.Configuration
45
import androidx.annotation.DrawableRes
56
import androidx.annotation.StringRes
67
import androidx.compose.animation.animateColorAsState
@@ -17,6 +18,7 @@ import androidx.compose.foundation.layout.sizeIn
1718
import androidx.compose.foundation.pager.HorizontalPager
1819
import androidx.compose.foundation.pager.rememberPagerState
1920
import androidx.compose.foundation.shape.RoundedCornerShape
21+
import androidx.compose.material.Colors
2022
import androidx.compose.material.DropdownMenu
2123
import androidx.compose.material.DropdownMenuItem
2224
import androidx.compose.material.Icon
@@ -49,6 +51,7 @@ import androidx.compose.ui.text.capitalize
4951
import androidx.compose.ui.text.font.FontWeight
5052
import androidx.compose.ui.text.intl.Locale
5153
import androidx.compose.ui.text.withStyle
54+
import androidx.compose.ui.tooling.preview.Devices
5255
import androidx.compose.ui.tooling.preview.Preview
5356
import androidx.compose.ui.unit.dp
5457
import com.woocommerce.android.R
@@ -58,6 +61,9 @@ import com.woocommerce.android.util.StringUtils
5861
import kotlinx.coroutines.launch
5962
import kotlin.random.Random
6063

64+
@Suppress("MagicNumber")
65+
val Colors.selectedRateBackgroundColor: Color get() = if (isLight) Color(0xFFF2EDFF) else Color(0x22F2EDFF)
66+
6167
@Composable
6268
internal fun ShippingRatesCard(
6369
selected: ShippingRate?,
@@ -86,7 +92,8 @@ internal fun ShippingRatesCard(
8692
}
8793
}
8894

89-
@Preview
95+
@Preview(name = "dark", uiMode = Configuration.UI_MODE_NIGHT_YES, device = Devices.PIXEL)
96+
@Preview(name = "light", uiMode = Configuration.UI_MODE_NIGHT_NO, device = Devices.PIXEL)
9097
@Composable
9198
private fun ShippingRatesCardPreview() {
9299
val rates = generateShippingRates()
@@ -300,7 +307,7 @@ private fun ShippingRateItem(
300307
}
301308

302309
val backgroundColor = if (isSelected) {
303-
animateColorAsState(targetValue = Color(0xFFF2EDFF), label = "colorAnimation")
310+
animateColorAsState(targetValue = MaterialTheme.colors.selectedRateBackgroundColor, label = "colorAnimation")
304311
} else {
305312
animateColorAsState(targetValue = MaterialTheme.colors.surface, label = "colorAnimation")
306313
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/wooshippinglabels/WooShippingLabelCreationScreen.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.woocommerce.android.ui.orders.wooshippinglabels
33
import android.content.res.Configuration
44
import androidx.compose.foundation.background
55
import androidx.compose.foundation.clickable
6+
import androidx.compose.foundation.isSystemInDarkTheme
67
import androidx.compose.foundation.layout.Box
78
import androidx.compose.foundation.layout.Column
89
import androidx.compose.foundation.layout.Row
@@ -66,7 +67,14 @@ fun WooShippingLabelCreationScreen(
6667
onSelectPackageClick = onSelectPackageClick,
6768
scaffoldState = scaffoldState
6869
)
69-
val elevation = if (scaffoldState.bottomSheetState.isCollapsed) { 0.dp } else { 4.dp }
70+
val isDarkTheme = isSystemInDarkTheme()
71+
val isCollapsed = scaffoldState.bottomSheetState.isCollapsed
72+
val elevation = when {
73+
isDarkTheme && isCollapsed -> { 7.dp }
74+
!isDarkTheme && isCollapsed -> { 0.dp }
75+
isDarkTheme && !isCollapsed -> { 16.dp }
76+
else -> { 8.dp }
77+
}
7078
Box(
7179
modifier = Modifier
7280
.fillMaxWidth()

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/payments/hub/PaymentsHubAdapter.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class PaymentsHubAdapter :
3030
is LearnMoreListItem -> {
3131
VIEW_TYPE_LEARN_MORE
3232
}
33-
is PaymentsHubViewState.ListItem.DepositSummaryListItem -> {
34-
VIEW_TYPE_DEPOSIT_SUMMARY
33+
is PaymentsHubViewState.ListItem.PayoutSummaryListItem -> {
34+
VIEW_TYPE_PAYOUT_SUMMARY
3535
}
3636
}
3737
}
@@ -53,8 +53,8 @@ class PaymentsHubAdapter :
5353
VIEW_TYPE_LEARN_MORE -> {
5454
PaymentsHubViewHolder.LearnMoreViewHolder(parent)
5555
}
56-
VIEW_TYPE_DEPOSIT_SUMMARY -> {
57-
PaymentsHubViewHolder.DepositSummaryViewHolder(ComposeView(parent.context))
56+
VIEW_TYPE_PAYOUT_SUMMARY -> {
57+
PaymentsHubViewHolder.PayoutSummaryViewHolder(ComposeView(parent.context))
5858
}
5959
else -> error("Unknown section")
6060
}
@@ -91,6 +91,6 @@ class PaymentsHubAdapter :
9191
const val VIEW_TYPE_NON_TOGGELABLE = 2
9292
const val VIEW_TYPE_GAP_BETWEEN_SECTIONS = 3
9393
const val VIEW_TYPE_LEARN_MORE = 4
94-
const val VIEW_TYPE_DEPOSIT_SUMMARY = 5
94+
const val VIEW_TYPE_PAYOUT_SUMMARY = 5
9595
}
9696
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/payments/hub/PaymentsHubViewHolder.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import com.woocommerce.android.databinding.CardReaderLearnMoreSectionBinding
1313
import com.woocommerce.android.databinding.PaymentsHubHeaderBinding
1414
import com.woocommerce.android.databinding.PaymentsHubListItemBinding
1515
import com.woocommerce.android.databinding.PaymentsHubToggelableItemBinding
16-
import com.woocommerce.android.ui.payments.hub.depositsummary.PaymentsHubDepositSummaryView
16+
import com.woocommerce.android.ui.payments.hub.payoutsummary.PaymentsHubPayoutSummaryView
1717
import com.woocommerce.android.util.UiHelpers
1818

1919
private const val DISABLED_BUTTON_ALPHA = 0.5f
@@ -122,10 +122,10 @@ abstract class PaymentsHubViewHolder(val view: View) : RecyclerView.ViewHolder(v
122122
}
123123
}
124124

125-
class DepositSummaryViewHolder(private val composeView: ComposeView) : PaymentsHubViewHolder(composeView) {
125+
class PayoutSummaryViewHolder(private val composeView: ComposeView) : PaymentsHubViewHolder(composeView) {
126126
override fun onBind(uiState: PaymentsHubViewState.ListItem) {
127127
composeView.setContent {
128-
PaymentsHubDepositSummaryView()
128+
PaymentsHubPayoutSummaryView()
129129
}
130130
}
131131
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/payments/hub/PaymentsHubViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ import com.woocommerce.android.ui.payments.hub.PaymentsHubViewModel.CashOnDelive
3939
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewModel.PaymentsHubEvents.ShowToast
4040
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewModel.PaymentsHubEvents.ShowToastString
4141
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem
42-
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.DepositSummaryListItem
4342
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.HeaderItem
4443
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.LearnMoreListItem
4544
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.NonToggleableListItem
45+
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.PayoutSummaryListItem
4646
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.ListItem.ToggleableListItem
4747
import com.woocommerce.android.ui.payments.hub.PaymentsHubViewState.OnboardingErrorAction
4848
import com.woocommerce.android.ui.payments.taptopay.TapToPayAvailabilityStatus
@@ -185,7 +185,7 @@ class PaymentsHubViewModel @Inject constructor(
185185
isOnboardingComplete: Boolean,
186186
cashOnDeliveryItem: ToggleableListItem
187187
): List<ListItem> = mutableListOf(
188-
DepositSummaryListItem(index = 0),
188+
PayoutSummaryListItem(index = 0),
189189
HeaderItem(
190190
label = UiStringRes(R.string.card_reader_hub_actions_category_header),
191191
index = 1

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/payments/hub/PaymentsHubViewState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ data class PaymentsHubViewState(
1515
abstract val index: Int
1616
abstract var isEnabled: Boolean
1717

18-
data class DepositSummaryListItem(override val index: Int = 0) : ListItem() {
18+
data class PayoutSummaryListItem(override val index: Int = 0) : ListItem() {
1919
override val label: UiString? = null
2020
override val icon: Int? = null
2121
override val onClick: (() -> Unit)? = null
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.woocommerce.android.ui.payments.hub.depositsummary
1+
package com.woocommerce.android.ui.payments.hub.payoutsummary
22

33
import com.woocommerce.android.tools.SelectedSite
44
import kotlinx.coroutines.flow.flow
@@ -7,34 +7,34 @@ import org.wordpress.android.fluxc.network.rest.wpcom.wc.WooError
77
import org.wordpress.android.fluxc.store.WCWooPaymentsStore
88
import javax.inject.Inject
99

10-
class PaymentsHubDepositSummaryRepository @Inject constructor(
10+
class PaymentsHubPayoutSummaryRepository @Inject constructor(
1111
private val store: WCWooPaymentsStore,
1212
private val site: SelectedSite,
1313
) {
14-
suspend fun retrieveDepositOverview() =
14+
suspend fun retrievePayoutOverview() =
1515
flow {
1616
val cachedData = store.getDepositsOverviewAll(site.get())
1717
if (cachedData != null) {
18-
emit(RetrieveDepositOverviewResult.Cache(cachedData))
18+
emit(RetrievePayoutOverviewResult.Cache(cachedData))
1919
}
2020

2121
val fetchedData = store.fetchDepositsOverview(site.get())
2222
val data = fetchedData.result
2323
if (fetchedData.isError || data == null) {
2424
store.deleteDepositsOverview(site.get())
25-
emit(RetrieveDepositOverviewResult.Error(fetchedData.error))
25+
emit(RetrievePayoutOverviewResult.Error(fetchedData.error))
2626
} else {
2727
store.insertDepositsOverview(site.get(), data)
28-
emit(RetrieveDepositOverviewResult.Remote(data))
28+
emit(RetrievePayoutOverviewResult.Remote(data))
2929
}
3030
}
3131
}
3232

33-
sealed class RetrieveDepositOverviewResult {
34-
data class Error(val error: WooError) : RetrieveDepositOverviewResult()
33+
sealed class RetrievePayoutOverviewResult {
34+
data class Error(val error: WooError) : RetrievePayoutOverviewResult()
3535
data class Cache(val overview: WooPaymentsDepositsOverview) :
36-
RetrieveDepositOverviewResult()
36+
RetrievePayoutOverviewResult()
3737

3838
data class Remote(val overview: WooPaymentsDepositsOverview) :
39-
RetrieveDepositOverviewResult()
39+
RetrievePayoutOverviewResult()
4040
}

0 commit comments

Comments
 (0)