From 22a0cf01b78addcfe7dea06a163707ac38b6105c Mon Sep 17 00:00:00 2001 From: Michael Law <1365977+lawmicha@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:11:35 -0500 Subject: [PATCH] fix(DataStore): watchOS subscription disabled configuration value (#3432) --- .../Configuration/DataStoreConfiguration+Helper.swift | 2 +- .../Core/DataStoreCategoryConfigurationTests.swift | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Configuration/DataStoreConfiguration+Helper.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Configuration/DataStoreConfiguration+Helper.swift index cf518f0882..04487a2ed0 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Configuration/DataStoreConfiguration+Helper.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Configuration/DataStoreConfiguration+Helper.swift @@ -90,7 +90,7 @@ extension DataStoreConfiguration { /// enabled is only possible during special circumstances such as actively streaming audio. /// See https://github.com/aws-amplify/amplify-swift/pull/3368 for more details. public static var subscriptionsDisabled: DataStoreConfiguration { - .custom(disableSubscriptions: { false }) + .custom(disableSubscriptions: { true }) } #else /// The default configuration. diff --git a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/DataStoreCategoryConfigurationTests.swift b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/DataStoreCategoryConfigurationTests.swift index 8aa3354572..490c453cfd 100644 --- a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/DataStoreCategoryConfigurationTests.swift +++ b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/DataStoreCategoryConfigurationTests.swift @@ -14,7 +14,13 @@ class AWSDataStorePluginConfigurationTests: XCTestCase { override func setUp() async throws { await Amplify.reset() } - + + #if os(watchOS) + func testSubscriptionDisabledTrue() throws { + XCTAssertTrue(DataStoreConfiguration.subscriptionsDisabled.disableSubscriptions()) + } + #endif + func testDoesNotThrowOnMissingConfig() throws { #if os(watchOS) let plugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), @@ -33,5 +39,5 @@ class AWSDataStorePluginConfigurationTests: XCTestCase { XCTFail("Should not throw even if not supplied with a plugin-specific config.") } } - + }