Skip to content

ART Objective-C ADK 1.0.4

Latest

Choose a tag to compare

@sachin854 sachin854 released this 13 Nov 06:19
· 17 commits to main since this release

This release makes connection problems visible and recoverable, moves file storage to temporary media that belong to a conversation thread, and removes the retired push-device APIs.

Breaking changes. Several completion blocks now receive an NSError, agent: and orchestrator: became agent:error: and orchestrator:error:, and storage needs a thread ID. Swift Package Manager and CocoaPods pick this version up on their next update for apps pinned to 1.0.x, so read Upgrading before you update.

Highlights

  • Connection failures you can handle. The new connectionFailed event delivers an ARTConnectionError (an NSError subclass) with a readable message, a connectionCode and the HTTP status when there is one. The ADK then stops reconnecting until you call connect:completion: again.
  • connect:completion: tells you when it fails. It completes once ART has accepted the connection, and reports an ARTConnectionError such as AUTHENTICATION_FAILED or CONNECTION_TIMEOUT when it can't connect. AdkConfig.connectionTimeoutMs (default 30 seconds) sets how long it waits.
  • Agent runs end when the connection fails. done: reports an AgentError whose details have source: connection, so your app doesn't wait forever. A run whose thread was disposed, or whose request couldn't be sent, ends with the code RUN_CLOSED.
  • Rejected credentials stop reconnecting. The new authenticationFailed event fires, and sign-in rejections complete with an ARTAuthHttpError with the HTTP status.
  • No hidden resends. Messages are never queued for later: without a connection, push and run complete with an error and nothing is sent. Encrypted channels now wait for ART to confirm delivery, like targeted channels.
  • Files belong to a conversation thread. Uploads, lists and getFile:threadId:timeoutMs:completion: take a thread ID, which thread uploads and lists fill in for you. Attach files to a message with ARTMediaRef.
  • Also new: -[AgentThread dispose], execution origin for runs started from the ART playground, multipart/form-data requests with ARTFormDataPayload, and ARTNotificationChannel constants for notification delivery. The README's documentation links now open the Objective-C guides.

Upgrading

  • Change the completion blocks of connect:completion: and resume: to ^(NSError *error) { … }, and handle the error.
  • Replace [adk agent:…] and [adk orchestrator:…] with agent:error: and orchestrator:error:. Agent and orchestrator IDs must be lowercase slugs, optionally with a build name (my-agent@release2). If you create them directly, use initWithAgentId:socket:error: and initWithOrchestratorId:socket:error:.
  • Change the completion block of -[BaseSubscription subscribe:] to ^(NSError *error) { … }.
  • Pass a thread ID when you use storage directly: ARTUploadOptions.threadId, ARTListOptions.threadId and getFile:threadId:timeoutMs:completion:.
  • Replace [ARTFileMeta fileMetaWithFileRef:file] with [ARTMediaRef mediaRefWithFileRef:file]. initWithFileId:scope: and scope are gone: use initWithFileId:name:contentType:. Handle ARTUploadStepUpload where you checked ARTUploadStepSignedURL, ARTUploadStepPut or ARTUploadStepConfirm.
  • Check for ARTConnectionErrorCodeAckTimeout where you checked ErrorCodeAckTimeout.
  • If you implement WebsocketHandler or call wait: or sendMessage: on the socket yourself, use the new signatures.
  • Remove calls to registerDevice:completion:, unregisterDeviceToken:completion: and listDevices:, because ART no longer offers these APIs. Use a notifier configured on a connector instead.
  • Replace notification channel strings with the ARTNotificationChannel constants, for example input.channels = @[ ARTNotificationChannelInApp, ARTNotificationChannelEmail ].

Installation

CocoaPods:

pod 'ArtAdk', '~> 1.0.4'
pod 'ArtAdk/Notifications', '~> 1.0.4'   # optional

Swift Package Manager:

.package(url: "https://github.com/aiotrixdev/art-objectivec-adk.git", from: "1.0.4")

Full changelog: CHANGELOG.md · 1.0.3...1.0.4