Skip to content

Commit c6478d9

Browse files
committed
Remove @MainActor that requires more thread safety checks and use Task @MainActor instead.
1 parent b950ec7 commit c6478d9

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

WooCommerce/Classes/ViewModels/Order Details/Receipts/ReceiptEligibilityUseCase.swift

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,12 @@ final class ReceiptEligibilityUseCase: ReceiptEligibilityUseCaseProtocol {
2525
self.featureFlagService = featureFlagService
2626
}
2727

28-
@MainActor
2928
func isEligibleForBackendReceipts(onCompletion: @escaping (Bool) -> Void) {
30-
let wcPlugin = pluginsService.loadPluginInStorage(siteID: siteID, plugin: .wooCommerce, isActive: true)
31-
// 1. WooCommerce must be installed and active
32-
guard let wcPlugin, wcPlugin.active else {
33-
return onCompletion(false)
29+
Task { @MainActor in
30+
let isWooCommerceSupported = await isPluginSupported(.wooCommerce,
31+
minimumVersion: Constants.BackendReceipt.wcPluginMinimumVersion)
32+
onCompletion(isWooCommerceSupported)
3433
}
35-
// 2. If WooCommerce version is higher than minimum required version, mark as eligible
36-
let isSupported = VersionHelpers.isVersionSupported(version: wcPlugin.version,
37-
minimumRequired: Constants.BackendReceipt.wcPluginMinimumVersion)
38-
onCompletion(isSupported)
3934
}
4035

4136
/// Returns true if Point of Sale allows sending successful payment email receipts via the API.

0 commit comments

Comments
 (0)