Releases: awslabs/aws-mobile-appsync-sdk-ios
2.10.3
2.10.3
New Features
- The AppSyncClient's
subscribe
method now accepts an optionalstatusChangeHandler
. If provided, then theAWSAppSyncSubscriptionWatcher
returned by thesubscribe
method will invoke that method when it is notified of changes to the state of the underlying MQTT client.
AWSAppSyncSubscriptionWatcherStatus
for a description of the statuses and their progression. Thanks @fans3210, @shannon-hager-skookum, and @achager for
contributing your thoughts to the original request (Issue #42) and to
@MarioBajr for contributing the original implementation on PR #75. - Added a
queuedMutationCount
property to AppSyncClient (Issue #192)
Bug fixes
- Fixed incorrect AWSCore dependency version in podspec (Issue #190)
- Fixed data races in AppSyncMQTTClient that were causing crashes (Issue #184)
Misc. Updates
-
Added
AWSAppSyncClientLogFormatter
utility class. Developers who want to use it can add it to the appropriate logger. For example, a configuration like:AWSDDLog.sharedInstance.logLevel = .verbose AWSDDTTYLogger.sharedInstance.logFormatter = AWSAppSyncClientLogFormatter() AWSDDLog.sharedInstance.add(AWSDDTTYLogger.sharedInstance)
would output log messages like:
2019-03-04 07:21:32.131-0800 [I AWSAppSyncClient.init(appSyncConfig:reachabilityFactory:), L75] Initializing AppSyncClient 2019-03-04 07:21:32.135-0800 [V AWSPerformMutationQueue.init(appSyncClient:networkClient:reachabiltyChangeNotifier:cacheFileURL:), L24] Initializing AWSPerformMutationQueue 2019-03-04 07:21:32.135-0800 [V AWSPerformMutationQueue.resume(), L95] Resuming OperationQueue
Please note that
verbose
logging is quite verbose, and there is a significant difference betweenverbose
anddebug
. We will be making
debug
more useful as we go. (See Issue #145)As always, we recommend turning off logging when deploying to production.
-
Added some verbose logging around mutation queue handling and subscription connections; minor log additions elsewhere
-
Minor dead code removal & miscellaneous cleanup
2.10.2
Bug fixes
- Fixed a bug where queries with dots (
"."
) in the arguments were not being properly cached (Issue #110, #165) AWSAppSyncClient.perform(mutation:queue:optimisticUpdate:conflictResolutionBlock:resultHandler:)
now properly invokes its result handler callbacks on the suppliedqueue
instead of always usingDispatchQueue.main
2.10.1
Bug fixes
-
Prepopulate the queries cache with an empty
QUERY_ROOT
record, to allow optimistic updates of the cache where no queries have been previously performed. (Issue #92, #101) -
Fix how "cache hits" are determined in queries, to match Apollo behavior. (#90)
A "cache hit" is defined as all members of the selection set having a non-nil value. For a simple query, (e.g., theHeroNameQuery
of the StarWars API), that is an easy mental map:Cache hit
{ "QUERY_ROOT": { "hero": "#hero" }, "#hero": { "hero": {"name": "R2-D2", "__typename": "Droid"} } }
Cache misses
{} { "QUERY_ROOT": null } { "QUERY_ROOT": {} } { "QUERY_ROOT": { "hero": "#hero" }, "#hero": { "hero": null } } // Misses because type data is incomplete { "QUERY_ROOT": { "hero": "#hero" }, "#hero": { "hero": {"name": "R2-D2"} } }
For more complex queries (like the
TwoHeroesQuery
), only all values being non-nil will result in a cache hit:
Cache Hit{ "QUERY_ROOT": { "hero": "#hero", "hero(episode:EMPIRE)": "#hero(episode:EMPIRE)" }, "#hero": {"name": "R2-D2", "__typename": "Droid"}, "#hero(episode:EMPIRE)": {"name": "Luke Skywalker", "__typename": "Human"} }
Cache Misses
{} { "QUERY_ROOT": null } { "QUERY_ROOT": {} } { "QUERY_ROOT": { "hero": "#hero" }, "#hero": { "hero": null } } { "QUERY_ROOT": { "hero": "#hero" }, "#hero": {"name": "R2-D2", "__typename": "Droid"} }
These definitions match the existing Apollo behavior, as verified in additional tests against the
unmodified Apollo codebase.
Misc. Updates
- Updated CloudFormation template to include S3 buckets and associated configuration to support complex object integration tests, and added integration tests for S3 uploads and downloads.
2.10.0
Bug fixes
- Merged Apollo iOS PR #427 to fix incompatibility with EnumeratedIterator in latest Xcode 10.2 beta.
- Fixed an issue where performing a mutation with no parameters would crash clients using a backing database. Issue #33
- Reduced database contention to fix crash resuming from background (See Issue #160). Thanks @larryonoff for contributing to this fix! 🎉
Misc. Updates
AWSAppSyncCacheConfiguration
AppSync persistent caches for queries (used by the Apollo store), mutations,
and subscription metadata are now stored in separate files. A new
AWSAppSyncCacheConfiguration
API has been added that allows clients to
specify persistent caches for all, some, or none of these caches:
// Specify persistent caches that live in the app's Cache directory
let cacheConfiguration = try AWSAppSyncCacheConfiguration()
// ... or specify persistent caches that live in `rootDirectory`
let cacheConfiguration = try AWSAppSyncCacheConfiguration(withRootDirectory: rootDirectory)
// ... or specify a database path for the query cache and the subscriptionMetadata cache, but an in-memory cache for mutation queue
let cacheConfiguration = AWSAppSyncCacheConfiguration(offlineMutations: nil,
queries: queriesDatabasePath,
subscriptionMetadataCache: subscriptionDatabasePath)
// ... or specify all caches to be in-memory
let cacheConfiguration = AWSAppSyncCacheConfiguration.inMemory
// ... then use the cache config in the AWSAppSyncClientConfiguration constructor
let appSyncConfig = try AWSAppSyncClientConfiguration(appSyncServiceConfig: serviceConfig, cacheConfiguration: cacheConfiguration)
let appSyncClient = AWSAppSyncClient(appSyncConfig: appSyncConfig)
// Alternately, specify all in-memory caches by passing no `cacheConfiguration`
let appSyncConfig = try AWSAppSyncClientConfiguration(appSyncServiceConfig: serviceConfig)
let appSyncClient = AWSAppSyncClient(appSyncConfig: appSyncConfig)
Migration
Clients can migrate to the new AWSAppSyncCacheConfiguration with a utility
method that performs a one-time move of data from the previous databaseURL to
the new cache configuration directory:
// Specify persistent caches that live in the app's Cache directory
let cacheConfiguration = try AWSAppSyncCacheConfiguration()
let databaseURL = // whatever your old databaseURL was
// Upon successful completion, this method sets a flag in UserDefaults, making it safe
// to call at startup for as long as this method exists.
AWSAppSyncCacheConfigurationMigration.migrate(from: databaseURL, to: cacheConfiguration)
-
Breaking API Changes
AWSSQLLiteNormalizedCacheError
has been renamed to
AWSAppSyncQueriesCacheError
. Error conditions during manipulations of the
Apollo store will now throw this type.
-
Deprecations
AWSSQLLiteNormalizedCache
is deprecated and will be removed in an
upcoming minor version of AWSAppSync, as that implementation is an internal
detail. Clients that wish to do cleanup of database files can use
AWSAppSyncCacheConfiguration
to get the path of the appropriate database
file.- The
databaseURL
option toAWSAppSyncClientConfiguration
is deprecated.
Please use thecacheConfiguration
option (See above) - The
MutationCache
protocol is deprecated because it is unused.
2.9.2
New Features
- Added an
AWSAppSyncClient.clearCache()
method to clear the local Apollo cache. See Issue #36, PR #141 Thanks @larryonoff! 🎉
Bug fixes
- AppSyncClient.sync() now properly invokes its subscription callbacks on the supplied
handlerQueue
instead of always usingDispatchQueue.main
Misc. Updates
- AWSAppSync now uses Xcode 10.1 to build its Carthage binaries. This will make the binaries compatible with Swift 4.2.1. Projects that have not yet upgraded to use Swift 4.2.1 will fall back to building from source.
- The AWSAppSync target no longer specifies values for
VALID_ARCH
in its build settings but instead uses defaults. See PR#156 Thanks @larryonoff! 🎉
2.9.1
Bug Fixes
- Updated the Cartfile to depend on the correct version of the AWS iOS SDK. (Note, this is advisory only; we do not retrieve dependencies via Carthage.)
- Added Pods to source control so Carthage users (or anyone else who builds from source) will no longer need to issue a
pod update
before building (#150)
This release also includes changes from the previous, broken release, 2.9.0:
Bug Fixes
- Mutation queue handling is rewritten to use
OperationQueue
, to fix cases where mutations would either deadlock (#81), or not execute (#106). Thanks @larryonoff! 🎉 - S3Objects now correctly upload whether they are included as part of a mutation's parameters or an input type (#122)
Misc. Updates
-
Breaking API Changes
AWSPerformMutationOperation
waspublic
, now it'sinternal
AWSAppSyncClient.perform
now returnsCancellable
instead ofAWSPerformMutationOperation
-
Refactored internal network change notifications (#139)
-
Refactored structure & tests to make future maintenance easier. As part of this, we deprecated the
AWSAppSyncClientInfo
class in favor of theAWSAppSyncServiceConfigProvider
protocol. We provide a default implementationAWSAppSyncServiceConfig
.AWSAppSyncClientInfo
will be removed in a future minor version.- Thanks to @larryonoff for contributing code and PR feedback to this refactor! 🎉
-
Refactored tests into Unit and Integration tests. Currently, any test that requires network activity is placed in Integration tests, even if the test hits localhost and not a valid service.
- Updated the README to include new instructions for setting up your integration test environment.
- The project now includes an AWS CloudFormation template to bootstrap your test setups. This will be updated in the future to include S3 buckets and associated configuration to support complex object integration tests.
Known Issues
- The
AWSAppSync.podspec
file incorrectly declares a dependency on version 2.9.0 ofAWSCore
. The correct dependency version is 2.8.0, and is updated in the CocoaPods trunk spec repo.
[DEPRECATED] 2.9.0
This release has been deprecated. Carthage build failed for this release. Please use 2.9.1 instead.
2.8.0
Misc. Updates
- Use Swift 4.2's
Float.random(in:)
instead ofarc4random()
to generate request retry jitter. See PR #108. Thanks @larryonoff! 🎉 - Added SwiftLint to project. See PR #121 and issue #107. Thanks @larryonoff! 🎉
- Increase stability of the integration tests; removed subscription integration test since its functionality is now covered by sync operation test.
- Upgraded SQLite.swift to 0.11.5, which fixes compiler warnings when compiling AWSAppSync in Xcode. Thanks @larryonoff! 🎉
- Breaking API Changes
SyncConfiguration
:- The type changed from a
class
to astruct
- The initializer parameter is now optional, and the previous
defaultSyncConfiguration
method has been removed. Create a default configuration by invoking the initializer with no arguments,SyncConfiguration()
- The type changed from a
2.7.0
New Features
- Added support for Delta Sync Feature
Delta Sync allows you to perform automatic synchronization with an AWS AppSync GraphQL server. The client will perform reconnection, exponential backoff, and retries when network errors take place for simplified data replication to devices. For more details, please refer documentation.
Bug Fixes
- Fixed issue where if a timeout error occurred due to lack of network availability, the callback would not be given back to the developer. See issue #91
Misc. Updates
- Officially convert project to Swift 4.2. Previously, the project used some Swift 4.2 idioms even though the
SWIFT_VERSION
was officially set to 3. This change makes the support explicit in the project files and README. - Updated SwiftReachability dependency to 4.3.0. (See PR #84)[https://github.com//pull/84] Thanks @larryonoff! 🎉
- Replaced generic struct based AWSAppSyncClientError by a typed enum. (See PR #35)[https://github.com//pull/35] Thanks @MarioBajr! 🎉
2.6.24
Misc. Updates
AWSAppSync
now depends onAWSCore
version2.7.x
instead of2.6.x
.