Skip to content

Commit

Permalink
Merge branch 'refs/heads/issue/12967-retry-pagination-error' into iss…
Browse files Browse the repository at this point in the history
…ue/13061-integrate-api-change

# Conflicts:
#	gradle/libs.versions.toml
  • Loading branch information
AnirudhBhat committed Dec 12, 2024
2 parents 70a3a1a + 83b55b4 commit 7f911b1
Show file tree
Hide file tree
Showing 184 changed files with 6,495 additions and 4,437 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<p align="center">A Jetpack-powered mobile app for WooCommerce.</p>

<p align="center">
<a href="https://circleci.com/gh/woocommerce/woocommerce-android">
<img src="https://circleci.com/gh/woocommerce/woocommerce-android.svg?style=shield" alt="CircleCI">
<a href="https://buildkite.com/automattic/woocommerce-android">
<img src="https://badge.buildkite.com/3ac8789ce5bc81e2d078d32ee8e526efbdb7c1ef3b19c70be3.svg?branch=trunk">
</a>
<a href="https://github.com/woocommerce/woocommerce-android/releases">
<img alt="Release" src="https://img.shields.io/github/v/tag/woocommerce/woocommerce-android?label=release&sort=semver">
Expand Down Expand Up @@ -38,7 +38,7 @@
$ cd woocommerce-android
```

1. Create a new `~/.configure/woocommerce-android/secrets.properties` file. See the [Configuration Files](docs/project-overview.md#configuration-files) section for a breakdown of the properties.
1. Copy `defaults.properties` to the secrets directory: `cp defaults.properties ~/.configure/woocommerce-android/secrets/secrets.properties`. See the [Configuration Files](docs/project-overview.md#configuration-files) section for a breakdown of the properties.
1. Generate the developer oauth2 tokens. These values get copied into the `~/.configure/woocommerce-android/secrets.properties` file in the next step. See the [OAuth2 Authentication](docs/project-overview.md#oauth2-authentication) section for details.
1. In Android Studio, open the project from the local repository. This will auto-generate `local.properties` with the SDK location.
1. Optional: Go to Tools → Device Manager and create an emulated device.
Expand Down
7 changes: 7 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
21.3
-----
- [*] "One time shipping" label in Product Subscriptions now matches its availability state correctly. [https://github.com/woocommerce/woocommerce-android/pull/13021]
- [*] "One time shipping" label should not be shown in Simple product after conversion from Subscriptions product. [https://github.com/woocommerce/woocommerce-android/pull/13032]
- [*] Fixed a bug related to incorrect Shipping settings in Product details when converting from Subscriptions to Simple product. [https://github.com/woocommerce/woocommerce-android/pull/13035]
- [Internal] Refactored IPP Payment flow to allow customizing payment collection UI in POS [https://github.com/woocommerce/woocommerce-android/pull/13014]
- [*] Blaze Campaign Intro screen now offers creating a new product if the site has no products yet [https://github.com/woocommerce/woocommerce-android/pull/13001]
- [Internal] Updated androidx-lifecycle to 2.8.7. [https://github.com/woocommerce/woocommerce-android/pull/13046/]
- [*] When entering a wrong WordPress.com account for login, retrying will bring the step back to the email input screen [https://github.com/woocommerce/woocommerce-android/pull/13024]
- [Internal] Replaces a function in WCSSRExt that then removes the need for commons-io dependency. [https://github.com/woocommerce/woocommerce-android/pull/13073]
- [Internal] Removes coupons feature announcement banner [https://github.com/woocommerce/woocommerce-android/pull/13077]

- [Internal] Updated androidx-compose-bom to 2024.09.00 [https://github.com/woocommerce/woocommerce-android/pull/13060]

-----
21.2
Expand Down
2 changes: 0 additions & 2 deletions WooCommerce/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ dependencies {

// ViewModel and LiveData
implementation(libs.androidx.fragment.ktx)
implementation(libs.androidx.activity.ktx)
implementation(libs.androidx.lifecycle.viewmodel.savedstate)
implementation(libs.androidx.lifecycle.process)

Expand All @@ -442,7 +441,6 @@ dependencies {
testImplementation(libs.cashapp.turbine)

implementation(libs.apache.commons.text)
implementation(libs.commons.io)

implementation(libs.tinder.statemachine)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withParentIndex
import androidx.test.espresso.matcher.ViewMatchers.withText
import com.woocommerce.android.R
import com.woocommerce.android.e2e.helpers.util.NestedScrollViewExtension
Expand All @@ -17,7 +16,7 @@ import org.hamcrest.Matchers

class SingleOrderScreen : Screen(R.id.orderDetail_container) {
fun goBackToOrdersScreen(): OrderListScreen {
if (isElementDisplayed(R.id.orderDetail_container)) {
if (!isElementDisplayed(R.id.order_list_view_root) && isElementDisplayed(R.id.orderDetail_container)) {
pressBack()
}

Expand All @@ -44,7 +43,9 @@ class SingleOrderScreen : Screen(R.id.orderDetail_container) {
}

fun assertOrderId(orderId: Int): SingleOrderScreen {
Espresso.onView(Matchers.allOf(withId(R.id.toolbar), withParentIndex(0)))
Espresso.onView(
Matchers.allOf(withId(R.id.toolbar), ViewMatchers.isDescendantOfA(withId(R.id.orderRefreshLayout)))
)
.check(ViewAssertions.matches(hasDescendant(withText("Order #$orderId"))))
.check(ViewAssertions.matches(isDisplayed()))
return this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.woocommerce.android.e2e.screens.products

import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.test.espresso.Espresso
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers
Expand All @@ -16,8 +18,7 @@ import org.hamcrest.Matchers
import org.hamcrest.Matchers.allOf
import org.hamcrest.Matchers.instanceOf

class ProductListScreen : Screen {
constructor() : super(R.id.productsRecycler)
class ProductListScreen : Screen(R.id.productsRecycler) {

fun scrollToProduct(productTitle: String): ProductListScreen {
scrollToListItem(productTitle, R.id.productsRecycler)
Expand All @@ -35,6 +36,12 @@ class ProductListScreen : Screen {
return this
}

fun tapOnAddManually(composeTestRule: ComposeTestRule): ProductListScreen {
val buttonText = getTranslatedString(R.string.product_creation_ai_entry_sheet_manual_option_title)
composeTestRule.onNodeWithText(buttonText).performClick()
return this
}

fun goBackToProductList(): ProductListScreen {
while (!isElementDisplayed(R.id.productsRecycler)) {
pressBack()
Expand Down Expand Up @@ -114,8 +121,8 @@ class ProductListScreen : Screen {
}

fun leaveSearchMode(): ProductListScreen {
var isProductDetailsErrorDisplayed = Screen.isElementDisplayed(R.id.productDetailsErrorImage)
var isSearchTextBarDisplayed = Screen.isElementDisplayed(androidx.appcompat.R.id.search_src_text)
val isProductDetailsErrorDisplayed = Screen.isElementDisplayed(R.id.productDetailsErrorImage)
val isSearchTextBarDisplayed = Screen.isElementDisplayed(androidx.appcompat.R.id.search_src_text)

if (isProductDetailsErrorDisplayed && isSearchTextBarDisplayed) {
clearSearchBar(androidx.appcompat.R.id.search_src_text)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class ScreenshotTest : TestBase(failOnUnmatchedWireMockRequests = false) {
TabNavComponent()
.gotoProductsScreen()
.tapOnCreateProduct()
.tapOnAddManually(composeTestRule)
.thenTakeScreenshot<ProductListScreen>("add-product")
.goBackToProductList()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import org.junit.After
import org.junit.AfterClass
import org.junit.Before
import org.junit.BeforeClass
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test

Expand Down Expand Up @@ -71,11 +70,7 @@ class OrdersRealAPI : TestBase() {

@After
fun tearDown() {
OrderListScreen()
.leaveOrClearSearchMode()

WelcomeScreen
.logoutIfNeeded(composeTestRule)
WelcomeScreen.logoutIfNeeded(composeTestRule)
}

@Retry(numberOfTimes = 1)
Expand Down Expand Up @@ -122,9 +117,7 @@ class OrdersRealAPI : TestBase() {
.assertOrdersCount(2)
}

@Retry(numberOfTimes = 1)
@Test
@Ignore
fun e2eRealApiOrderDetails() {
try {
OrderListScreen()
Expand Down
24 changes: 22 additions & 2 deletions WooCommerce/src/main/kotlin/com/woocommerce/android/AppPrefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import android.content.SharedPreferences.Editor
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import androidx.preference.PreferenceManager
import com.woocommerce.android.AppPrefs.CardReaderOnboardingStatus.CARD_READER_ONBOARDING_NOT_COMPLETED
import com.woocommerce.android.AppPrefs.CardReaderOnboardingStatus.valueOf
Expand Down Expand Up @@ -39,14 +40,17 @@ import com.woocommerce.android.notifications.NotificationChannelType
import com.woocommerce.android.tools.SelectedSite
import com.woocommerce.android.ui.payments.cardreader.onboarding.PersistentOnboardingData
import com.woocommerce.android.ui.payments.cardreader.onboarding.PluginType
import com.woocommerce.android.ui.prefs.DeveloperOptionsViewModel.DeveloperOptionsViewState.UpdateOptions
import com.woocommerce.android.ui.prefs.developer.DeveloperOptionsViewModel.DeveloperOptionsViewState.UpdateFrequencyUiModel
import com.woocommerce.android.ui.prefs.domain.DomainFlowSource
import com.woocommerce.android.ui.products.ProductType
import com.woocommerce.android.ui.products.ai.AiTone
import com.woocommerce.android.ui.promobanner.PromoBannerType
import com.woocommerce.android.util.ThemeOption
import com.woocommerce.android.util.ThemeOption.DEFAULT
import com.woocommerce.commons.prefs.PreferenceUtils
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import java.util.Calendar
import java.util.Date

Expand Down Expand Up @@ -260,7 +264,7 @@ object AppPrefs {
set(value) = setBoolean(DeletablePrefKey.ENABLE_SIMULATED_INTERAC, value)

var updateReaderOptionSelected: String
get() = getString(UPDATE_SIMULATED_READER_OPTION, UpdateOptions.RANDOM.toString())
get() = getString(UPDATE_SIMULATED_READER_OPTION, UpdateFrequencyUiModel.RANDOM.toString())
set(option) = setString(UPDATE_SIMULATED_READER_OPTION, option)

var isEUShippingNoticeDismissed: Boolean
Expand Down Expand Up @@ -1276,6 +1280,22 @@ object AppPrefs {

fun exists(key: PrefKey) = getPreferences().contains(key.toString())

/**
* Observes changes to the preferences
*/
fun observePrefs(): Flow<Unit> {
return callbackFlow {
val listener = OnSharedPreferenceChangeListener { _, _ ->
trySend(Unit)
}
getPreferences().registerOnSharedPreferenceChangeListener(listener)

awaitClose {
getPreferences().unregisterOnSharedPreferenceChangeListener(listener)
}
}
}

/**
* Methods used to store values in SharedPreferences that are not backed up
* when app is installed/uninstalled. Currently, only used for storing appVersionCode.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package com.woocommerce.android

import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import com.woocommerce.android.notifications.NotificationChannelType
import com.woocommerce.android.ui.payments.cardreader.onboarding.PersistentOnboardingData
import com.woocommerce.android.ui.payments.cardreader.onboarding.PluginType
import com.woocommerce.android.ui.prefs.domain.DomainFlowSource
import com.woocommerce.android.ui.promobanner.PromoBannerType
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import javax.inject.Inject

class AppPrefsWrapper @Inject constructor() {
Expand Down Expand Up @@ -325,18 +322,7 @@ class AppPrefsWrapper @Inject constructor() {
/**
* Observes changes to the preferences
*/
fun observePrefs(): Flow<Unit> {
return callbackFlow {
val listener = OnSharedPreferenceChangeListener { _, _ ->
trySend(Unit)
}
AppPrefs.getPreferences().registerOnSharedPreferenceChangeListener(listener)

awaitClose {
AppPrefs.getPreferences().unregisterOnSharedPreferenceChangeListener(listener)
}
}
}
fun observePrefs(): Flow<Unit> = AppPrefs.observePrefs()

fun updateOnboardingCompletedStatus(siteId: Int, completed: Boolean) {
AppPrefs.updateOnboardingCompletedStatus(siteId, completed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ object AppUrls {
"https://automattic.survey.fm/order-creation-shipping-lines-survey-production"
}

// Will be used later when the feature is fully launched.
const val COUPONS_SURVEY = "https://automattic.survey.fm/woo-app-coupon-management-production"

const val WOOCOMMERCE_USER_ROLES =
"https://woocommerce.com/posts/a-guide-to-woocommerce-user-roles-permissions-and-security/"
const val SHIPPING_LABEL_CUSTOMS_ITN = "https://pe.usps.com/text/imm/immc5_010.htm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,14 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv
DASHBOARD_SHARE_YOUR_STORE_BUTTON_TAPPED,
DASHBOARD_MAIN_STATS_DATE,
DASHBOARD_MAIN_STATS_LOADED,
DASHBOARD_TOP_PERFORMERS_DATE,
DASHBOARD_TOP_PERFORMERS_LOADED,
DASHBOARD_NEW_STATS_REVERTED_BANNER_DISMISS_TAPPED,
DASHBOARD_NEW_STATS_REVERTED_BANNER_LEARN_MORE_TAPPED,
DASHBOARD_WAITING_TIME_LOADED,
DASHBOARD_SEE_MORE_ANALYTICS_TAPPED,
DASHBOARD_STORE_TIMEZONE_DIFFER_FROM_DEVICE,
USED_ANALYTICS,
STATS_UNEXPECTED_FORMAT,
DASHBOARD_STATS_CUSTOM_RANGE_ADD_BUTTON_TAPPED,
DASHBOARD_STATS_CUSTOM_RANGE_CONFIRMED,
DASHBOARD_STATS_CUSTOM_RANGE_TAB_SELECTED,
DASHBOARD_STATS_CUSTOM_RANGE_EDIT_BUTTON_TAPPED,
DASHBOARD_STATS_CUSTOM_RANGE_INTERACTED,
DYNAMIC_DASHBOARD_EDIT_LAYOUT_BUTTON_TAPPED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ class AnalyticsTracker private constructor(
const val VALUE_FEEDBACK_GIVEN = "gave_feedback"
const val VALUE_SHIPPING_LABELS_M4_FEEDBACK = "shipping_labels_m4"
const val VALUE_PRODUCT_ADDONS_FEEDBACK = "product_addons"
const val VALUE_COUPONS_FEEDBACK = "coupons"
const val VALUE_ANALYTICS_HUB_FEEDBACK = "analytics_hub"
const val VALUE_ORDER_SHIPPING_LINES_FEEDBACK = "order_shipping_lines"
const val VALUE_STATE_ON = "on"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package com.woocommerce.android.datastore
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.core.DataStoreFactory
import androidx.datastore.core.handlers.ReplaceFileCorruptionHandler
import androidx.datastore.dataStoreFile
import com.automattic.android.tracks.crashlogging.CrashLogging
import com.woocommerce.android.di.SiteComponent
import com.woocommerce.android.di.SiteCoroutineScope
import com.woocommerce.android.di.SiteScope
Expand All @@ -23,12 +25,17 @@ object DashboardDataStoreModule {
@SiteScope
fun provideDashboardDataStore(
appContext: Context,
crashLogging: CrashLogging,
@SiteCoroutineScope siteCoroutineScope: CoroutineScope,
site: SiteModel
): DataStore<DashboardDataModel> = DataStoreFactory.create(
produceFile = {
appContext.dataStoreFile("dashboard_configuration_${site.id}")
},
corruptionHandler = ReplaceFileCorruptionHandler {
crashLogging.recordEvent("Corrupted data store. DataStore Type: DASHBOARD")
DashboardDataModel.getDefaultInstance()
},
scope = CoroutineScope(siteCoroutineScope.coroutineContext + Dispatchers.IO),
serializer = DashboardSerializer
)
Expand Down
Loading

0 comments on commit 7f911b1

Please sign in to comment.