Skip to content

Commit

Permalink
chore: kickoff release
Browse files Browse the repository at this point in the history
  • Loading branch information
5d authored Dec 4, 2023
2 parents 3d0c9d8 + 92e4297 commit c6bcf26
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Dependency Review

on:
pull_request:
branches:
- main

permissions:
contents: read

jobs:
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
persist-credentials: false

- name: Dependency Review
uses: actions/dependency-review-action@7d90b4f05fea31dde1c4a1fb3fa787e197ea93ab # v3.0.7
with:
config-file: aws-amplify/amplify-ci-support/.github/dependency-review-config.yml@main
18 changes: 18 additions & 0 deletions .github/workflows/kickoff-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Kickoff release

on: [workflow_dispatch]

permissions:
pull-requests: write

jobs:
prepare-release:
name: Prepare release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Create PR to push main to release branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: "gh pr create --title 'chore: kickoff release' --body 'kickoff release' --head main --base release"
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ public class RealtimeConnectionProvider: ConnectionProvider {
self.serialCallbackQueue = serialCallbackQueue
self.connectivityMonitor = connectivityMonitor

// On a physical watchOS device, it is showing "unsatisfied" despite connected to the internet
// according to https://developer.apple.com/forums/thread/729568
// To avoid an incorrect network status state for the system, do not use connectivity monitor
// for watchOS apps.
#if !os(watchOS)
connectivityMonitor.start(onUpdates: handleConnectivityUpdates(connectivity:))
#endif

if #available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) {
subscribeToLimitExceededThrottle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ public class RealtimeConnectionProviderAsync: ConnectionProvider {
self.serialCallbackQueue = serialCallbackQueue
self.connectivityMonitor = connectivityMonitor

// On a physical watchOS device, it is showing "unsatisfied" despite connected to the internet
// according to https://developer.apple.com/forums/thread/729568
// To avoid an incorrect network status state for the system, do not use connectivity monitor
// for watchOS apps.
#if !os(watchOS)
connectivityMonitor.start(onUpdates: handleConnectivityUpdates(connectivity:))
#endif

subscribeToLimitExceededThrottle()
}

Expand Down
31 changes: 31 additions & 0 deletions AppSyncRealTimeClient/Websocket/Starscream/StarscreamAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class StarscreamAdapter: AppSyncWebsocketProvider {
}
}

let watchOSConnectivityTimer: CountdownTimer

public init() {
let serialQueue = DispatchQueue(label: "com.amazonaws.StarscreamAdapter.serialQueue")
let callbackQueue = DispatchQueue(
Expand All @@ -32,6 +34,7 @@ public class StarscreamAdapter: AppSyncWebsocketProvider {
self._isConnected = false
self.serialQueue = serialQueue
self.callbackQueue = callbackQueue
self.watchOSConnectivityTimer = CountdownTimer()
}

public func connect(urlRequest: URLRequest, protocols: [String], delegate: AppSyncWebsocketDelegate?) {
Expand All @@ -49,6 +52,7 @@ public class StarscreamAdapter: AppSyncWebsocketProvider {
self.socket?.delegate = self
self.socket?.callbackQueue = self.callbackQueue
self.socket?.connect()
self.startWatchOSConnectivityTimer()
}
}

Expand All @@ -66,4 +70,31 @@ public class StarscreamAdapter: AppSyncWebsocketProvider {
self.socket?.write(string: message)
}
}

private func startWatchOSConnectivityTimer() {
#if os(watchOS)
let watchOSConnectTimeoutInSeconds = TimeInterval(5)
AppSyncLogger.debug(
"[StarscreamAdapter] Starting connectivity timer for watchOS for \(watchOSConnectTimeoutInSeconds)s."
)
self.watchOSConnectivityTimer.start(interval: watchOSConnectTimeoutInSeconds) {
AppSyncLogger.debug(
"[StarscreamAdapter] watchOS connectivity timer is up."
)
self.serialQueue.async {
if !self._isConnected {
AppSyncLogger.debug(
"[StarscreamAdapter] Subscriptions not connected after \(watchOSConnectTimeoutInSeconds)s. Manually disconnecting"
)
let error = ConnectionProviderError.connection
self.delegate?.websocketDidDisconnect(provider: self, error: error)
} else {
AppSyncLogger.debug(
"[StarscreamAdapter] Subscriptions are connected within \(watchOSConnectTimeoutInSeconds)s."
)
}
}
}
#endif
}
}
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GEM
specs:
CFPropertyList (3.0.5)
rexml
activesupport (6.1.7.3)
activesupport (6.1.7.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -201,15 +201,15 @@ GEM
http-cookie (1.0.4)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jmespath (1.6.1)
json (2.6.1)
jwt (2.3.0)
memoist (0.16.2)
mini_magick (4.11.0)
mini_mime (1.1.2)
minitest (5.18.0)
minitest (5.19.0)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.0.0)
Expand Down Expand Up @@ -271,7 +271,7 @@ GEM
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
zeitwerk (2.6.7)
zeitwerk (2.6.11)

PLATFORMS
ruby
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[![Open Bugs](https://img.shields.io/github/issues/aws-amplify/aws-appsync-realtime-client-ios/bug?color=d73a4a&label=bugs)](https://github.com/aws-amplify/aws-appsync-realtime-client-ios/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
[![Feature Requests](https://img.shields.io/github/issues/aws-amplify/aws-appsync-realtime-client-ios/feature-request?color=ff9001&label=feature%20requests)](https://github.com/aws-amplify/aws-appsync-realtime-client-ios/issues?q=is%3Aissue+label%3Afeature-request+is%3Aopen)

A client implementation in Swift for the AWS AppSync service on the iOS platform. It's used as a dependency by [amplify-swift](https://github.com/aws-amplify/amplify-swift).
> [!IMPORTANT]
> AWS AppSync Realtime Client iOS is not intended to be used directly; it is used as a dependency of [Amplify Swift](https://github.com/aws-amplify/amplify-swift) and [AWS AppSync SDK iOS](https://github.com/awslabs/aws-mobile-appsync-sdk-ios). If you have any issues stemming from the library, please open an issue in the applicable repository for the product that you’re using directly.
## Contributing

Expand Down

0 comments on commit c6bcf26

Please sign in to comment.