Skip to content

Commit f8444d2

Browse files
Merge branch 'trunk' into issue/WOOMOB-727-fix-small-notification-icon-issue
2 parents e69983a + 274f75c commit f8444d2

File tree

165 files changed

+13266
-3108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+13266
-3108
lines changed

RELEASE-NOTES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
*** For entries which are touching the Android Wear app's, start entry with `[WEAR]` too.
44
23.3
55
-----
6+
- [Internal] Migration to POS specific product model [https://github.com/woocommerce/woocommerce-android/pull/14598]
7+
- [*] Enhance the shipping label creation screen by making the selected hazardous box tappable [https://github.com/woocommerce/woocommerce-android/pull/14576]
8+
- [*] Shipping Labels: Enhance selected package UI in the create shipping label flow [https://github.com/woocommerce/woocommerce-android/pull/14579]
69
- [*] Fixed the incorrect size of the notification icon [https://github.com/woocommerce/woocommerce-android/pull/14586]
710

811
23.2
@@ -16,9 +19,11 @@
1619
- [WEAR] Updated UserAgent of API requests to use `http.agent` System Property to fix performance issues related to WebView usage on app launch [https://github.com/woocommerce/woocommerce-android/pull/14431]
1720
- [***] POS: A new settings to customize the POS [https://github.com/woocommerce/woocommerce-android/pull/14527]
1821
- [*] [Login] Improved the detection of WooCommerce API version during login flow [https://github.com/woocommerce/woocommerce-android/pull/14524]
22+
- [*] Shipping Labels: Adds caching to the "Select a Package" screen [https://github.com/woocommerce/woocommerce-android/pull/14541]
1923
- [*] Add more filter options to orders filters sales channel [https://github.com/woocommerce/woocommerce-android/pull/14546]
2024
- [*] Automatically populate the weight field in the create shipment flow [https://github.com/woocommerce/woocommerce-android/pull/14525]
2125
- [*] [Shipping Labels] Fixed displaying incorrect hazardous material option for purchased labels [https://github.com/woocommerce/woocommerce-android/pull/14571]
26+
- [*] Shipping Labels: Updated the disabled button text on the package selection screen [https://github.com/woocommerce/woocommerce-android/pull/14558]
2227

2328
23.1
2429
-----

WooCommerce-Wear/src/main/java/com/woocommerce/android/wear/ui/stats/datasource/StatsRepository.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ class StatsRepository @Inject constructor(
101101
result.granularity,
102102
result.quantity,
103103
result.date,
104-
result.isCustomField
105104
).let {
106105
Result.success(it.values.sum())
107106
}

WooCommerce/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,7 @@ dependencies {
294294
implementation(libs.bumptech.glide.main)
295295
ksp(libs.bumptech.glide.compiler)
296296
implementation(libs.bumptech.glide.volley.integration)
297-
implementation libs.avif
298-
implementation(libs.bumptech.glide.avif.integration) {
299-
exclude group: 'org.aomedia.avif.android', module: 'avif'
300-
}
297+
implementation(libs.bumptech.glide.avif.integration)
301298
implementation(libs.google.play.app.update)
302299
implementation(libs.google.play.review)
303300

WooCommerce/src/androidTest/assets/mocks/mappings/sites/rest_sites_161477129.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"view_stats": true
4848
},
4949
"jetpack": true,
50+
"jetpack_connection": true,
5051
"visible": true,
5152
"is_private": false,
5253
"options": {

WooCommerce/src/androidTest/kotlin/com/woocommerce/android/WooCommerceTest.kt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.woocommerce.android
22

33
import android.app.Application
4-
import androidx.hilt.work.HiltWorkerFactory
54
import androidx.work.Configuration
65
import com.yarolegovich.wellsql.WellSql
76
import dagger.android.AndroidInjector
@@ -19,12 +18,6 @@ interface WooCommerceTest
1918
open class BaseWooCommerce : Application(), HasAndroidInjector, Configuration.Provider {
2019
override val workManagerConfiguration: Configuration
2120
get() = Configuration.Builder()
22-
.setWorkerFactory(
23-
EntryPoints.get(
24-
this,
25-
HiltWorkerFactoryEntryPoint::class.java
26-
).workerFactory()
27-
)
2821
.build()
2922

3023
@EntryPoint
@@ -33,12 +26,6 @@ open class BaseWooCommerce : Application(), HasAndroidInjector, Configuration.Pr
3326
fun injector(): DispatchingAndroidInjector<Any>
3427
}
3528

36-
@EntryPoint
37-
@InstallIn(SingletonComponent::class)
38-
interface HiltWorkerFactoryEntryPoint {
39-
fun workerFactory(): HiltWorkerFactory
40-
}
41-
4229
override fun onCreate() {
4330
super.onCreate()
4431
val wellSqlConfig = WooWellSqlConfig(this)

WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/tests/ui/ProductSelectorScreenTest.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ import com.woocommerce.android.ui.products.selector.ProductSelectorScreen
99
import com.woocommerce.android.ui.products.selector.ProductSelectorViewModel
1010
import com.woocommerce.android.ui.products.selector.ProductSelectorViewModel.ListItem.ProductListItem
1111
import com.woocommerce.android.ui.products.selector.SelectionState
12+
import dagger.hilt.android.testing.HiltAndroidRule
1213
import dagger.hilt.android.testing.HiltAndroidTest
1314
import org.junit.Rule
1415
import org.junit.Test
1516

1617
@HiltAndroidTest
1718
class ProductSelectorScreenTest {
1819

19-
@get:Rule
20+
@get:Rule(order = 0)
21+
val hiltRule = HiltAndroidRule(this)
22+
23+
@get:Rule(order = 1)
2024
val rule = createAndroidComposeRule<ComponentActivity>()
2125

2226
@Test

WooCommerce/src/main/kotlin/com/woocommerce/android/AppInitializer.kt

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import com.woocommerce.android.ui.jitm.JitmStoreInMemoryCache
4444
import com.woocommerce.android.ui.login.AccountRepository
4545
import com.woocommerce.android.ui.main.MainActivity
4646
import com.woocommerce.android.ui.payments.cardreader.onboarding.CardReaderOnboardingChecker
47+
import com.woocommerce.android.ui.woopos.localcatalog.WooPosLocalCatalogSyncScheduler
4748
import com.woocommerce.android.util.AppThemeUtils
4849
import com.woocommerce.android.util.ApplicationEdgeToEdgeEnabler
4950
import com.woocommerce.android.util.ApplicationLifecycleMonitor
@@ -63,6 +64,8 @@ import dagger.android.DispatchingAndroidInjector
6364
import kotlinx.coroutines.CoroutineScope
6465
import kotlinx.coroutines.async
6566
import kotlinx.coroutines.awaitAll
67+
import kotlinx.coroutines.delay
68+
import kotlinx.coroutines.flow.drop
6669
import kotlinx.coroutines.flow.filter
6770
import kotlinx.coroutines.flow.launchIn
6871
import kotlinx.coroutines.flow.onEach
@@ -92,6 +95,7 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {
9295
private const val SECONDS_BETWEEN_SITE_UPDATE = 60 * 60 // 1 hour
9396
private const val UNAUTHORIZED_STATUS_CODE = 401
9497
private const val CARD_READER_USAGE_THIRTY_DAYS = 30
98+
private const val POS_LOCAL_CATALOG_SYNC_INITIAL_DELAY_SECONDS = 20000L
9599
}
96100

97101
@Inject lateinit var crashLogging: CrashLogging
@@ -159,6 +163,8 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {
159163

160164
@Inject lateinit var edgeToEdgeEnabler: ApplicationEdgeToEdgeEnabler
161165

166+
@Inject lateinit var posLocalCatalogScheduler: WooPosLocalCatalogSyncScheduler
167+
162168
private var connectionReceiverRegistered = false
163169

164170
private lateinit var application: Application
@@ -168,19 +174,22 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {
168174
*/
169175
private val updateSelectedSite: RateLimitedTask = object : RateLimitedTask(SECONDS_BETWEEN_SITE_UPDATE) {
170176
override fun run(): Boolean {
171-
selectedSite.getIfExists()?.let {
177+
selectedSite.getIfExists()?.let { site ->
172178
appCoroutineScope.launch {
173-
wooCommerceStore.fetchWooCommerceSite(it).model?.let {
179+
wooCommerceStore.fetchWooCommerceSite(site).model?.let {
174180
if (!it.hasWooCommerce && it.connectionType == ApplicationPasswords) {
175181
// The previously selected site doesn't have Woo anymore, take the user to the login screen
176182
WooLog.w(T.LOGIN, "Selected site no longer has WooCommerce")
177183

178184
selectedSite.reset()
179185
restartMainActivity()
180186
}
187+
if (it.connectionType != ApplicationPasswords && it.isApplicationPasswordsSupported) {
188+
analyticsTracker.track(AnalyticsEvent.JETPACK_SITE_ELIGIBLE_FOR_APP_PASSWORD_SUPPORT)
189+
}
181190
}
182-
wooCommerceStore.fetchSiteGeneralSettings(it)
183-
wooCommerceStore.fetchSiteProductSettings(it)
191+
wooCommerceStore.fetchSiteGeneralSettings(site)
192+
wooCommerceStore.fetchSiteProductSettings(site)
184193
}
185194
}
186195
return true
@@ -238,6 +247,9 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {
238247

239248
// Schedule worker to refresh FCM token periodically
240249
FCMRefreshWorker.schedule(application)
250+
251+
posLocalCatalogScheduler.schedulePeriodicFullCatalogSync()
252+
observeSiteChangesForCatalogSync()
241253
}
242254

243255
@Suppress("DEPRECATION")
@@ -386,6 +398,7 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {
386398
// to prevent duplicate install events being called
387399
prefs.setLastAppVersionCode(versionCode)
388400
}
401+
389402
oldVersionCode < versionCode -> {
390403
// Track upgrade event only if oldVersionCode is not -1, to prevent
391404
// duplicate upgrade events being called
@@ -397,6 +410,7 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {
397410
// is greater than the stored version code
398411
prefs.setLastAppVersionCode(versionCode)
399412
}
413+
400414
versionCode == PackageUtils.PACKAGE_VERSION_CODE_DEFAULT -> {
401415
// we are not able to read the current app version code
402416
// track this event along with the last stored version code
@@ -424,6 +438,19 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {
424438
}
425439
}
426440

441+
fun observeSiteChangesForCatalogSync() {
442+
appCoroutineScope.launch {
443+
selectedSite.observe()
444+
.drop(1) // invoke only on site change not on app initialization
445+
.collect { selectedSite ->
446+
if (selectedSite != null) {
447+
delay(POS_LOCAL_CATALOG_SYNC_INITIAL_DELAY_SECONDS)
448+
posLocalCatalogScheduler.triggerManualFullCatalogSync()
449+
}
450+
}
451+
}
452+
}
453+
427454
@Suppress("unused")
428455
@Subscribe(threadMode = ThreadMode.MAIN)
429456
fun onUnexpectedError(event: OnUnexpectedError) {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv
212212
ORDERS_LIST_AUTOMATIC_TIMEOUT_RETRY,
213213
ORDERS_LIST_TOP_BANNER_TROUBLESHOOT_TAPPED,
214214
TEST_ORDER_START_TAPPED,
215-
ORDERS_LIST_APP_PASSWORDS_FAILURE,
216215

217216
FILTER_ORDERS_BY_STATUS_DIALOG_OPTION_SELECTED,
218217
ORDER_FILTER_LIST_CLEAR_MENU_BUTTON_TAPPED,
@@ -939,6 +938,10 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv
939938
LOGIN_SITE_CREDENTIALS_APP_PASSWORD_LOGIN_EXIT_CONFIRMATION,
940939
LOGIN_SITE_CREDENTIALS_APP_PASSWORD_LOGIN_DISMISSED,
941940

941+
// Application passwords for Jetpack sites
942+
JETPACK_SITE_ELIGIBLE_FOR_APP_PASSWORD_SUPPORT,
943+
JETPACK_SITE_FLAGGED_UNSUPPORTED_FOR_APP_PASSWORDS,
944+
942945
// Free Trial
943946
FREE_TRIAL_UPGRADE_NOW_TAPPED,
944947
PLAN_UPGRADE_SUCCESS,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ class AnalyticsTracker private constructor(
250250
const val KEY_TIME_TAKEN = "time_taken"
251251
const val KEY_IS_EDITING = "is_editing"
252252
const val KEY_POS_ONBOARDING_STATE = "onboarding_state"
253+
const val KEY_API_ERROR_CODE = "api_error_code"
254+
const val KEY_HTTP_STATUS_CODE = "http_status_code"
253255

254256
const val KEY_SORT_ORDER = "order"
255257
const val VALUE_DEVICE_TYPE_REGULAR = "regular"

WooCommerce/src/main/kotlin/com/woocommerce/android/applicationpasswords/ApplicationPasswordsNotifier.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import kotlinx.coroutines.flow.asSharedFlow
1010
import org.wordpress.android.fluxc.model.SiteModel
1111
import org.wordpress.android.fluxc.network.rest.wpapi.WPAPINetworkError
1212
import org.wordpress.android.fluxc.network.rest.wpapi.applicationpasswords.ApplicationPasswordsListener
13+
import org.wordpress.android.fluxc.network.rest.wpapi.applicationpasswords.JetpackSiteFlaggedAsUnsupported
1314
import javax.inject.Inject
1415
import javax.inject.Singleton
1516

@@ -66,6 +67,18 @@ class ApplicationPasswordsNotifier @Inject constructor(
6667
)
6768
}
6869

70+
override fun onJetpackSiteFlaggedAsUnsupported(event: JetpackSiteFlaggedAsUnsupported) {
71+
analyticsTrackerWrapper.track(
72+
stat = AnalyticsEvent.JETPACK_SITE_FLAGGED_UNSUPPORTED_FOR_APP_PASSWORDS,
73+
properties = mapOf(
74+
AnalyticsTracker.KEY_FLOW to event.scenario.name.lowercase(),
75+
AnalyticsTracker.KEY_CAUSE to event.cause.name.lowercase(),
76+
AnalyticsTracker.KEY_API_ERROR_CODE to event.apiErrorCode,
77+
AnalyticsTracker.KEY_HTTP_STATUS_CODE to event.httpStatusCode,
78+
)
79+
)
80+
}
81+
6982
private fun trackGenerationFailure(
7083
cause: GenerationFailureCause,
7184
networkError: WPAPINetworkError,

0 commit comments

Comments
 (0)