Skip to content

Commit

Permalink
Merge branch 'main' into feature/defer-execution-networking
Browse files Browse the repository at this point in the history
  • Loading branch information
calvincestari committed Apr 4, 2024
2 parents 87123d6 + a267368 commit aa5d9a1
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prometheus-project-add.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add to project
uses: actions/add-to-project@v0.6.0
uses: actions/add-to-project@v1.0.0
with:
project-url: https://github.com/orgs/apollographql/projects/21
github-token: ${{ secrets.PROMETHEUS_PROJECT_ACCESS_SECRET }}
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

## v1.9.3

### Fixed

- **Fix injecting of context for UploadRequest:** Any request context passed into an upload request was not being added to the HTTP request and would not be available to the interceptor chain. See PR ([#302](https://github.com/apollographql/apollo-ios-dev/pull/302)). _Thanks to [@RobertDresler](https://github.com/RobertDresler) for the contribution._
- **Added support for SPM Package.resolved format version 3 ([#3355](https://github.com/apollographql/apollo-ios/issues/3355)):** When using Xcode 15.3 the codegen CLI would fail the `generate` command with an error stating the Package.resolve file version is unsupported. Version 3 is now accepted as a valid file format for the codegen version checker. See PR ([#304](https://github.com/apollographql/apollo-ios-dev/pull/304)).
- **PrivacyInfo.xcprivacy file is invalid for Apollo and ApolloApi ([#3359](https://github.com/apollographql/apollo-ios/issues/3359)):** We received reports that when submitting to the App Store the submission would fail with an error stating that the privacy manifests were invalid. We identified the error and updated the privacy files. See PR ([#309](https://github.com/apollographql/apollo-ios-dev/pull/309)). _Thanks to [@azilbershtein](https://github.com/azilbershtein) for raising the issue._

### Improvement

- **Provide a direct means to observe changes in ApolloStore:** `ApolloStore` now exposes it's subscriber mechanism publicly. This means you can now observe and receive notifications about changes to the store. See PR ([#300](https://github.com/apollographql/apollo-ios-dev/pull/300)). _Thanks to [@jamesonwilliams](https://github.com/jamesonwilliams) for the contribution._
- **Remove redundant iteration in EntitySelectionTree merging algorithm:** The conditions for merging selections were revisited and we identified, and removed, a redundant iteration. This is a significant performance improvement as it removes an entire additional iteration through all the conditional scopes in the tree. See PR ([#308](https://github.com/apollographql/apollo-ios-dev/pull/308)).

## v1.9.2

### Fixed
Expand Down
Binary file modified CLI/apollo-ios-cli.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 馃敭 Apollo iOS Roadmap

**Last updated: 2024-03-19**
**Last updated: 2024-04-02**

For up to date release notes, refer to the project's [Changelog](https://github.com/apollographql/apollo-ios/blob/main/CHANGELOG.md).

Expand Down
20 changes: 16 additions & 4 deletions Sources/Apollo/ApolloStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import ApolloAPI

public typealias DidChangeKeysFunc = (Set<CacheKey>, UUID?) -> Void

protocol ApolloStoreSubscriber: AnyObject {
/// The `ApolloStoreSubscriber` provides a means to observe changes to items in the ApolloStore.
/// This protocol is available for advanced use cases only. Most users will prefer using `ApolloClient.watch(query:)`.
public protocol ApolloStoreSubscriber: AnyObject {

/// A callback that can be received by subscribers when keys are changed within the database
///
Expand All @@ -23,7 +25,7 @@ public class ApolloStore {
private let cache: NormalizedCache
private let queue: DispatchQueue

private var subscribers: [ApolloStoreSubscriber] = []
internal var subscribers: [ApolloStoreSubscriber] = []

/// Designated initializer
/// - Parameters:
Expand Down Expand Up @@ -83,13 +85,23 @@ public class ApolloStore {
}
}

func subscribe(_ subscriber: ApolloStoreSubscriber) {
/// Subscribes to notifications of ApolloStore content changes
///
/// - Parameters:
/// - subscriber: A subscriber to receive content change notificatons. To avoid a retain cycle,
/// ensure you call `unsubscribe` on this subscriber before it goes out of scope.
public func subscribe(_ subscriber: ApolloStoreSubscriber) {
queue.async(flags: .barrier) {
self.subscribers.append(subscriber)
}
}

func unsubscribe(_ subscriber: ApolloStoreSubscriber) {
/// Unsubscribes from notifications of ApolloStore content changes
///
/// - Parameters:
/// - subscriber: A subscribe that has previously been added via `subscribe`. To avoid retain cycles,
/// call `unsubscribe` on all active subscribers before they go out of scope.
public func unsubscribe(_ subscriber: ApolloStoreSubscriber) {
queue.async(flags: .barrier) {
self.subscribers = self.subscribers.filter({ $0 !== subscriber })
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Apollo/Constants.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation

public enum Constants {
public static let ApolloVersion: String = "1.9.2"
public static let ApolloVersion: String = "1.9.3"
}
6 changes: 3 additions & 3 deletions Sources/Apollo/GraphQLQueryWatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public final class GraphQLQueryWatcher<Query: GraphQLQuery>: Cancellable, Apollo
client?.store.unsubscribe(self)
}

func store(_ store: ApolloStore,
didChangeKeys changedKeys: Set<CacheKey>,
contextIdentifier: UUID?) {
public func store(_ store: ApolloStore,
didChangeKeys changedKeys: Set<CacheKey>,
contextIdentifier: UUID?) {
if
let incomingIdentifier = contextIdentifier,
incomingIdentifier == self.contextIdentifier {
Expand Down
19 changes: 2 additions & 17 deletions Sources/Apollo/Resources/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,9 @@
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string></string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string></string>
</array>
</dict>
</array>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict/>
</array>
<array/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyTracking</key>
Expand Down
4 changes: 2 additions & 2 deletions Sources/ApolloAPI/GraphQLOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public enum GraphQLOperationType: Hashable {
/// ``GraphQLOperation``. You can configure the the code generation engine to include the
/// ``OperationDefinition``, ``operationIdentifier``, or both using the `OperationDocumentFormat`
/// options in your `ApolloCodegenConfiguration`.
public struct OperationDocument {
public struct OperationDocument: Sendable {
public let operationIdentifier: String?
public let definition: OperationDefinition?

Expand All @@ -35,7 +35,7 @@ public struct OperationDocument {
/// This data represents the `Definition` for a `Document` as defined in the GraphQL Spec.
/// In the case of the Apollo client, the definition will always be an `ExecutableDefinition`.
/// - See: [GraphQLSpec - Document](https://spec.graphql.org/draft/#Document)
public struct OperationDefinition {
public struct OperationDefinition: Sendable {
let operationDefinition: String
let fragments: [any Fragment.Type]?

Expand Down
19 changes: 2 additions & 17 deletions Sources/ApolloAPI/Resources/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,9 @@
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string></string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string></string>
</array>
</dict>
</array>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict/>
</array>
<array/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyTracking</key>
Expand Down
2 changes: 1 addition & 1 deletion Sources/ApolloAPI/SchemaTypes/Interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// # See Also
/// [GraphQLSpec - Interfaces](https://spec.graphql.org/draft/#sec-Interfaces)
public struct Interface: Hashable {
public struct Interface: Hashable, Sendable {
/// The name of the ``Interface`` in the GraphQL schema.
public let name: String

Expand Down
12 changes: 1 addition & 11 deletions Sources/ApolloAPI/SchemaTypes/Object.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// Each `type` defined in the GraphQL schema will have an instance of ``Object`` generated.
/// # See Also
/// [GraphQLSpec - Objects](https://spec.graphql.org/draft/#sec-Objects)
public struct Object: Hashable {
public struct Object: Hashable, Sendable {

/// Designated Initializer
///
Expand Down Expand Up @@ -34,14 +34,4 @@ public struct Object: Hashable {
public func implements(_ interface: Interface) -> Bool {
implementedInterfaces.contains(where: { $0 == interface })
}

public static func == (lhs: Object, rhs: Object) -> Bool {
return lhs.typename == rhs.typename &&
lhs.implementedInterfaces == rhs.implementedInterfaces
}

public func hash(into hasher: inout Hasher) {
hasher.combine(typename)
hasher.combine(implementedInterfaces)
}
}
2 changes: 1 addition & 1 deletion Sources/ApolloAPI/SchemaTypes/Union.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// # See Also
/// [GraphQLSpec - Unions](https://spec.graphql.org/draft/#sec-Unions)
public struct Union: Hashable {
public struct Union: Hashable, Sendable {
/// The name of the ``Union`` in the GraphQL schema.
public let name: String

Expand Down
19 changes: 2 additions & 17 deletions Sources/ApolloSQLite/Resources/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,9 @@
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string></string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string></string>
</array>
</dict>
</array>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict/>
</array>
<array/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyTracking</key>
Expand Down
19 changes: 2 additions & 17 deletions Sources/ApolloWebSocket/Resources/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,9 @@
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string></string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string></string>
</array>
</dict>
</array>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict/>
</array>
<array/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyTracking</key>
Expand Down

0 comments on commit aa5d9a1

Please sign in to comment.