Skip to content

Commit

Permalink
Merge branch 'trunk' into issue/add-package-ui-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomazFB committed Nov 15, 2024
2 parents c721fe7 + 66014e5 commit a1a0e33
Show file tree
Hide file tree
Showing 108 changed files with 1,724 additions and 824 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@ local-builds.gradle
# gitignore for retrocompatibility, so that it won't appear as a new file and
# be accidentally checked in the repository.
google-upload-credentials.json

# Kotlin
.kotlin/
5 changes: 3 additions & 2 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
*** For entries which are touching the Android Wear app's, start entry with `[WEAR]` too.
21.2
-----

- [**][Payments] Fixed a bug when IPP onboarding was not possible to finish from the app [https://github.com/woocommerce/woocommerce-android/pull/12917]
- [*] Fixed shipping lines being editable at all states [https://github.com/woocommerce/woocommerce-android/pull/12890]
- [*] 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]

21.1
-----
- [*] Disable Edit option for orders whose currency does not match with store currency [https://github.com/woocommerce/woocommerce-android/pull/12880]
- [*] Fixed shipping lines being editable at all states [https://github.com/woocommerce/woocommerce-android/pull/12890]
- [*] Show web views on the payments hub screen in 3/4 of the screen [https://github.com/woocommerce/woocommerce-android/pull/12875]
- [*] Receipts can be shared via a google's sms application now [https://github.com/woocommerce/woocommerce-android/pull/12874]
- [*] Fixed a bug where picking date ranges (for Stats and Analytics) did not use the correct timezone [https://github.com/woocommerce/woocommerce-android/pull/12887]
Expand Down
11 changes: 3 additions & 8 deletions WooCommerce-Wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import io.sentry.android.gradle.extensions.InstrumentationFeature
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.google.dagger.hilt)
alias(libs.plugins.ksp)
Expand Down Expand Up @@ -77,19 +78,13 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
sourceCompatibility libs.versions.java.get()
targetCompatibility libs.versions.java.get()
}
buildFeatures {
buildConfig true
compose true
}
composeOptions {
kotlinCompilerExtensionVersion libs.versions.androidx.compose.compiler.get()
}
packaging {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
Expand Down
9 changes: 3 additions & 6 deletions WooCommerce/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import io.sentry.android.gradle.extensions.InstrumentationFeature
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.google.dagger.hilt)
alias(libs.plugins.sentry)
Expand Down Expand Up @@ -145,15 +146,11 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility libs.versions.java.get()
targetCompatibility libs.versions.java.get()
coreLibraryDesugaringEnabled true
}

composeOptions {
kotlinCompilerExtensionVersion libs.versions.androidx.compose.compiler.get()
}

flavorDimensions "buildType"

productFlavors {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"request": {
"method": "GET",
"urlPathPattern": "/rest/v1.1/jetpack-blogs/161477129/rest-api/",
"queryParameters": {
"json": {
"equalTo": "true"
},
"path": {
"matches": "/wc/v1/connect/label/2787(.*)"
}
}
},
"response": {
"status": 200,
"jsonBody": {
"data": {}
},
"headers": {
"Content-Type": "application/json",
"Connection": "keep-alive"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"request": {
"method": "GET",
"urlPathPattern": "/rest/v1.1/jetpack-blogs/161477129/rest-api/",
"queryParameters": {
"json": {
"equalTo": "true"
},
"path": {
"matches": "/wc/v3/orders/2787/refunds(.*)"
}
}
},
"response": {
"status": 200,
"jsonBody": {
"data": []
},
"headers": {
"Content-Type": "application/json",
"Connection": "keep-alive"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"request": {
"method": "GET",
"urlPathPattern": "/rest/v1.1/jetpack-blogs/161477129/rest-api/",
"queryParameters": {
"json": {
"equalTo": "true"
},
"path": {
"equalTo": "/wc/v3/shipping_methods/&_method=get"
}
}
},
"response": {
"status": 200,
"jsonBody": {
"data": []
},
"headers": {
"Content-Type": "application/json",
"Connection": "keep-alive"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"path": {
"equalTo": "/wc/v3/orders/&_method=get"
},
"query": {
"matches": "(.*)include(.*)"
},
"locale": {
"matches": "(.*)"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"path": {
"matches": "/wc/v3/payment_gateways(.*)"
},
},
"locale": {
"matches": "(.*)"
}
Expand Down Expand Up @@ -112,7 +112,7 @@
"title": "Cash on delivery",
"description": "Pay with cash upon delivery.",
"order": 2,
"enabled": false,
"enabled": true,
"method_title": "Cash on delivery",
"method_description": "Have your customers pay with cash (or by other means) upon delivery.",
"method_supports": ["products"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
}, {
"plugin": "woocommerce-gateway-stripe/woocommerce-gateway-stripe.php",
"name": "WooCommerce Stripe Gateway",
"version": "6.1.0",
"version_latest": "6.1.0",
"version": "8.8.2",
"version_latest": "8.8.2",
"url": "https://wordpress.org/plugins/woocommerce-gateway-stripe/",
"author_name": "WooCommerce",
"author_url": "https://woocommerce.com/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
"jsonBody": {
"data": {
"country": "US",
"storeCurrencies": {
"store_currencies": {
"default": "USD"
}
},
"status": "enabled"
}
},
"headers": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MockCardReaderManagerModule {
override val id: String
get() = "ADEE123"
override val type: String
get() = "reader"
get() = "COTS_DEVICE"
override val currentBatteryLevel: Float
get() = 1f
override val firmwareVersion: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import org.hamcrest.Matchers

class OrderListScreen : Screen(R.id.ordersList) {
fun selectOrder(index: Int): SingleOrderScreen {
val correctedIndex = index + 1 // account for the header
selectItemAtIndexInRecyclerView(correctedIndex, R.id.ordersList, R.id.linearLayout)
selectItemAtIndexInRecyclerView(index, R.id.ordersList, R.id.linearLayout)
return SingleOrderScreen()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.woocommerce.android.e2e.helpers.util.ProductData
import com.woocommerce.android.e2e.helpers.util.Screen
import org.hamcrest.Matchers

class SingleOrderScreen : Screen(R.id.toolbar) {
class SingleOrderScreen : Screen(R.id.orderStatus_subtitle) {
fun goBackToOrdersScreen(): OrderListScreen {
if (isElementDisplayed(R.id.orderDetail_container)) {
pressBack()
Expand Down Expand Up @@ -136,6 +136,7 @@ class SingleOrderScreen : Screen(R.id.toolbar) {
}

fun tapOnCollectPayment(): PaymentSelectionScreen {
scrollTo(R.id.paymentInfo_collectCardPresentPaymentButton)
clickOn(R.id.paymentInfo_collectCardPresentPaymentButton)
return PaymentSelectionScreen()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.woocommerce.android.e2e.tests.screenshot

import android.Manifest
import android.util.Log
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.GrantPermissionRule
import com.woocommerce.android.AppPrefs
import com.woocommerce.android.BuildConfig
import com.woocommerce.android.e2e.helpers.InitializationRule
Expand Down Expand Up @@ -45,6 +47,22 @@ class ScreenshotTest : TestBase(failOnUnmatchedWireMockRequests = false) {
val localeTestRule = LocaleTestRule()

@get:Rule(order = 4)
var locationPermissionRule: GrantPermissionRule? = GrantPermissionRule
.grant(Manifest.permission.ACCESS_FINE_LOCATION)

@get:Rule(order = 5)
var bluetoothConnectPermissionRule: GrantPermissionRule? = GrantPermissionRule
.grant(Manifest.permission.BLUETOOTH_CONNECT)

@get:Rule(order = 6)
var bluetoothScanPermissionRule: GrantPermissionRule? = GrantPermissionRule
.grant(Manifest.permission.BLUETOOTH_SCAN)

@get:Rule(order = 7)
var notificationsPermissionRule: GrantPermissionRule? = GrantPermissionRule
.grant(Manifest.permission.POST_NOTIFICATIONS)

@get:Rule(order = 8)
var activityRule = ActivityScenarioRule(MainActivity::class.java)

@Inject lateinit var wooNotificationBuilder: WooNotificationBuilder
Expand Down Expand Up @@ -106,7 +124,7 @@ class ScreenshotTest : TestBase(failOnUnmatchedWireMockRequests = false) {
AppPrefs.setShowCardReaderConnectedTutorial(false) // Skip card reader tutorial
TabNavComponent()
.gotoOrdersScreen()
.selectOrder(2)
.selectOrder(5)
.tapOnCollectPayment()
.chooseCardPayment()
.thenTakeScreenshot<CardReaderPaymentScreen>("in-person-payments")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,7 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv
BLAZE_CREATION_EDIT_DESTINATION_SAVE_TAPPED,
BLAZE_CAMPAIGN_CREATION_FEEDBACK,
BLAZE_CAMPAIGN_OBJECTIVE_SAVED,
BLAZE_SUGGESTIONS_LOADING_FAILED,

// Hazmat Shipping Declaration
CONTAINS_HAZMAT_CHECKED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ class BlazeRepository @Inject constructor(

suspend fun fetchAdSuggestions(productId: Long): Result<List<AiSuggestionForAd>> {
fun List<BlazeAdSuggestion>.mapToUiModel(): List<AiSuggestionForAd> {
return map { AiSuggestionForAd(it.tagLine, it.description) }
return map { AiSuggestionForAd(it.tagLine, it.description, it.ctaText) }
}

val result = blazeCampaignsStore.fetchBlazeAdSuggestions(selectedSite.get(), productId)

return when {
result.isError -> {
WooLog.w(WooLog.T.BLAZE, "Failed to fetch ad suggestions: ${result.error}")
Result.failure(OnChangedException(result.error))
Result.failure(OnChangedException(result.error, result.error.message))
}

else -> Result.success(result.model?.mapToUiModel() ?: emptyList())
Expand Down Expand Up @@ -194,7 +194,8 @@ class BlazeRepository @Inject constructor(
targetUrl = product.permalink,
parameters = emptyMap()
),
objectiveId = appPrefsWrapper.blazeCampaignSelectedObjective
objectiveId = appPrefsWrapper.blazeCampaignSelectedObjective,
ctaText = ""
)
}

Expand Down Expand Up @@ -273,6 +274,7 @@ class BlazeRepository @Inject constructor(
)
}

@Suppress("LongMethod")
suspend fun createCampaign(
campaignDetails: CampaignDetails,
paymentMethodId: String
Expand All @@ -297,6 +299,7 @@ class BlazeRepository @Inject constructor(
targetResourceId = campaignDetails.productId,
tagLine = campaignDetails.tagLine,
description = campaignDetails.description,
ctaText = campaignDetails.ctaText,
startDate = campaignDetails.budget.startDate,
endDate = campaignDetails.budget.endDate,
budget = BlazeCampaignCreationRequestBudget(
Expand Down Expand Up @@ -394,6 +397,7 @@ class BlazeRepository @Inject constructor(
val productId: Long,
val tagLine: String,
val description: String,
val ctaText: String,
val campaignImage: BlazeCampaignImage,
val budget: Budget,
val targetingParameters: TargetingParameters,
Expand Down Expand Up @@ -446,6 +450,7 @@ class BlazeRepository @Inject constructor(
data class AiSuggestionForAd(
val tagLine: String,
val description: String,
val ctaText: String
) : Parcelable

@Parcelize
Expand Down
Loading

0 comments on commit a1a0e33

Please sign in to comment.