From 371f6bbe72eee8ec3dd9d0cc2f35d29294b0dc32 Mon Sep 17 00:00:00 2001 From: Michael Law <1365977+lawmicha@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:12:43 -0500 Subject: [PATCH] add doc comments --- .../AWSDataStorePlugin/AWSDataStorePlugin.swift | 10 ++++++++-- .../Configuration/DataStoreConfiguration+Helper.swift | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/AWSDataStorePlugin.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/AWSDataStorePlugin.swift index ce5de418cd..5f775a0e69 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/AWSDataStorePlugin.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/AWSDataStorePlugin.swift @@ -56,7 +56,10 @@ final public class AWSDataStorePlugin: DataStoreCategoryPlugin { } #if os(watchOS) - /// No-argument init that uses defaults for all providers + /// Initializer + /// - Parameters: + /// - modelRegistration: Register DataStore models. + /// - dataStoreConfiguration: Configuration object for DataStore public init(modelRegistration: AmplifyModelRegistration, configuration dataStoreConfiguration: DataStoreConfiguration) { self.modelRegistration = modelRegistration @@ -79,7 +82,10 @@ final public class AWSDataStorePlugin: DataStoreCategoryPlugin { self.dispatchedModelSyncedEvents = [:] } #else - /// No-argument init that uses defaults for all providers + /// Initializer + /// - Parameters: + /// - modelRegistration: Register DataStore models. + /// - dataStoreConfiguration: Configuration object for DataStore public init(modelRegistration: AmplifyModelRegistration, configuration dataStoreConfiguration: DataStoreConfiguration = .default) { self.modelRegistration = modelRegistration diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Configuration/DataStoreConfiguration+Helper.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Configuration/DataStoreConfiguration+Helper.swift index 4d9d889e8c..cf518f0882 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Configuration/DataStoreConfiguration+Helper.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Configuration/DataStoreConfiguration+Helper.swift @@ -25,6 +25,7 @@ extension DataStoreConfiguration { /// - syncMaxRecords: the number of records to sync per execution /// - syncPageSize: the page size of each sync execution /// - authModeStrategy: authorization strategy (.default | multiauth) + /// - disableSubscriptions: called before establishing subscriptions. Return true to disable subscriptions. /// - Returns: an instance of `DataStoreConfiguration` with the passed parameters. public static func custom( errorHandler: @escaping DataStoreErrorHandler = { error in @@ -84,7 +85,10 @@ extension DataStoreConfiguration { #endif #if os(watchOS) - /// The default configuration. + /// Default configuration with subscriptions disabled for watchOS. DataStore uses subscriptions via websockets, + /// which work on the watchOS simulator but not on the device. Running DataStore on watchOS with subscriptions + /// 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 }) }