All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
1.8.1 - 2019-08-06
- Fix race condition related to the usage of
state
property ofPPRepeater
.
1.8.0 - 2019-08-01
- Add ability to set push notification title override for a specific room.
1.7.3 - 2019-07-19
- Synchronized access to members of PCCurrentUser, PCReadCursorDebouncer, PCTokenProvider and ChatManager which are mutable in order to prevent data races between threads
1.7.2 - 2019-07-18
- Synchronized access to members of PCRoom and PCUser which are mutable in order to prevent data races between threads
1.7.1 - 2019-07-17
- Resolved a concurrency bug which could cause app crash when accessing a user store from multiple threads. This tended to manifest while creating lots of subscriptions concurrently, including when returning from the background.
1.7.0 - 2019-07-01
createRoom
now allows passing anid
parameter. Thisid
is then used to refer to the room thereafter. If anid
is not provided, a generatedid
is returned.- Moved to v6 HTTP API.
1.6.0 - 2019-06-24
- Don't allow references to newly deserialised entities to escape once their details have been merged in to the canonical copies of the entity.
- Add
onMessageDeleted
hook that is invoked when a single message is deleted. - Move api version to v5
1.5.3 - 2019-06-24
- Remove unnecessary async operations (internal ones)
- Don't allow references to newly deserialised entities to escape once their details have been merged in to the canonical copies of the entity.
1.5.2 - 2019-06-11
- Potential memory corruptions in PCSynchronizedArrays
1.5.1 - 2019-05-28
- Updated dependency Pusher Beams to the latest version (2.0.2).
1.5.0 - 2019-04-24
unreadCount
andlastMessageAt
properties added to rooms. These reflect values of unread messages and when the last message was sent at in the room.
1.4.4 - 2019-04-01
### Fixed
- Refresh URL's were incorrectly being constructed.
1.4.3 - 2019-03-20
- PCMultipartAttachmentPayload.url is now public.
1.4.2 - 2019-03-20
- Publicly exposed Multipart structs were previously using the
internal
access modifier by default. This has now been changed topublic
.
1.4.1 - 2019-03-12
- Added public initialiser to
PCPartUrlRequest
1.4.0 - 2019-03-08
- Multipart messaging support:
sendMultipartMessage
,sendSimpleMessage
,subscribeToRoomMultipart
andfetchMultipartMessages
methods.onMultipartMessage
delegate method.
sendMessage
,subscribeToRoom
andfetchMessagesFromRoom
are deprecated in favour of their multipart counterparts. They will be removed in a future major release of the SDK.
1.3.1 - 2019-03-05
PCSynchronizedDictionary
uses a serial queue. Previously setting values would happen ansynchronously without any barriers which could give us a wrong result. For sake of simplicity, the queue has been made serial with sync operations.
1.3.0 - 2019-01-25
- You can call
unsubscribe()
on aPCRoom
to unsubscribe from it onNewReadCursor
has been added to thePCChatManagerDelegate
, which allows you to get notified of read cursor updates for the current user. Note that to support existing users of the read cursor functionality,onNewReadCursor
on thePCRoomDelegate
will also still be called for new read cursors for the current user. This functionality will be removed in a future release that contains other breaking changes (i.e. 2.0.0, in all likelihood)
- Appropriate
PCChatManagerDelegate
andPCRoomDelegate
hooks will be called upon reconnection when state has changed during the period of disconnection createdAtDate
,updatedAtDate
, anddeletedAtDate
should no longer lead to crashes- Only call
PCRoomDelegate
functions once a room subscription has been fully established - Removed some race conditions
- Fixed some reference cycles
PCRoomDelegate
no longer has a restriction to ensure that conforming types also conform toNSObjectProtocol
1.2.3 - 2018-12-21
- Push notifications now work regardless of when
registerForRemoteNotifications
is called
1.2.2 - 2018-12-19
- Push notifications now work if
registerDeviceToken
is called before successfully connecting to Chatkit
1.2.1 - 2018-11-30
deletedAt
anddeletedAtDate
properties onPCRoom
1.2.0 - 2018-11-30
- Support for Push Notifications
1.1.0 - 2018-11-29
- Rooms now support
customData
- Message attachments now have a
name
property
deletedAt
onPCRoom
has been removed. It was never set so was never useful
1.0.0 - 2018-10-29
- All
PCChatManagerDelegate
andPCRoomDelegate
functions are now prefixed withon
, e.g.userJoined
has becomeonUserJoined
PCRoomDelegate
'snewMessage
function has had thenew
prefix removed to make it clearer that it is the function that gets called when a new message is received over the room subscription (including historical messages), so in conjunction with the change above it is nowonMessage
- All mentions (mainly relevant to function parameter names) of anything that was previously
Id
is nowID
, e.g.roomId
is nowroomID
sendMessage
parameterattachmentType
renamed toattachment
- The ordering of messages returned by
fetchMessagesFromRoom
is now from oldest to newest - Room members are only populated once you have subscribed to a room
- Message attachments no longer have the
fetchRequired
property because you can no always directly use an attachment's link startedTypingIn
andstoppedTypingIn
have both been removed. Usetyping(in: ...)
instead- Room IDs are now represented using
String
s instead ofInt
s
lastSeenAt
is no longer available onPCUser
objectsfetchAttachment
as it's no longer required (you can use the attachment's link directly)userCameOnline
anduserWentOffline
(replaced byonPresenceChanged
)
onPresenceChanged
(replacinguserCameOnline
anduserWentOffline
)
0.10.3 - 2018-09-10
- No longer crashes if disconnect is called midway through a successful connection process
- Bump PusherPlatform dependency to 0.6.2
0.10.2 - 2018-08-22
- A retry strategy can now be provided to
PCTokenProvider
as part of itsinit
0.10.1 - 2018-08-21
- Fixed potential crash upon reconnection
- Bump PusherPlatform dependency to 0.6.1
0.10.0 - 2018-08-09
subscribeToRoom
now has a (required) completion handler of typePCErrorCompletionHandler
- There is now a version of
subscribeToRoom
that takes aroomID
in place of aPCRoom
0.9.0 - 2018-06-14
sendMessage
now requires a value for thetext
parameter- All
PCMessage
s must have atext
property
0.8.4 - 2018-05-26
- Ensure that
fetchMessagesFromRoom
calls completion handler even if no messages were fetched
0.8.3 - 2018-05-25
- Ensure that
fetchMessagesFromRoom
returns the correct number of messages
0.8.2 - 2018-05-04
- Requests resulting from
setReadCursor
are batched up if made in quick succession - File upload path has been updated to include the user ID
0.8.1 - 2018-04-24
- Fixed memory leak caused by delegates not having only weak references taken
PR: #77 Authored by: @steve228uk
0.8.0 - 2018-04-19
- Bump PusherPlatform dependency to 0.5.0
0.7.2 - 2018-04-16
- Fixed typing events not being delivered properly #72
- Fixed warnings in example app
0.7.1 - 2018-04-16
- Fixed
sendMessage
not working if noattachment
was provided @steve228uk leaveRoom
no longer recursively calls itself #74
0.7.0 - 2018-03-26
PCBaseClient
added as atypealias
forPPBaseClient
subscribeToRoom
will attempt to join thePCCurrentUser
to the room if the user is not already a memberPCRoom
no longer stores the cursors that relate to it; they are now all accessed using thereadCursor
function onPCCurrentUser
, and the return type of this isPCCursor?
(an optionalPCCursor
)PCCurrentUser
'ssetCursor
function has been renamed tosetReadCursor
cursorSet
renamed tonewCursor
inPCRoomDelegate
- Bump PusherPlatform dependency to 0.4.2
fetchToken
calls toPCTokenProvider
are queued if there's an existing request underway
ChatManager
no longer stores a reference to theusers
list, nor theuserSubscription
PCBasicCursorState
has been removed so now if you try to access the read cursors for a givenuserId
-roomId
combination you will either receive aPCCursor
ornil
currentUserCursor
has been removed fromPCRoom
; again, you'll instead need to use thereadCursor
function onPCCurrentUser
getAllRooms
has been removedgetJoinedRooms
has been removed
0.6.4 - 2018-03-01
- Bump PusherPlatform dependency to 0.4.1
- Test target now works as expected
0.6.3 - 2018-02-26
- Use different underlying PusherPlatform
Instance
to connect to presence service
0.6.2 - 2018-02-26
- Ensure connection completion handlers get called even if the connecting user is not a member of any rooms
0.6.1 - 2018-02-26
- Bump PusherPlatform dependency to 0.4.0
- Provide SDK info to PusherPlatform's
Instance
s to add SDK info headers to requests
0.6.0 - 2018-02-16
ChatManager
requires auserId
be provided when it is instantiatedPCTokenProvider
no longer takes auserId
parameter when it is instantiated- The completion handler passed to
connect
ofChatManager
will now only be called once the following has completed, either successfully or unsuccessfully:- User subscription has been established
- Presence subscription has been established
- Initial cursors fetch has completed (getting initial values for read cursors of the current user for the rooms that they are a member of)
- Initial users fetch has completed (getting initial information about user IDs that were seen in the list of members of the rooms that the current user is a member of)
- Bumped PusherPlatform dependency to 0.3.1
-
Support for read cursors:
setCursor
added toPCCurrentUser
, usage of which looks like:
currentUser.setCursor(position: 123, roomId: myRoom.id) { error in guard error == nil else { print("Error setting cursor: \(error!.localizedDescription)") return } print("Succeeded in setting cursor") }
cursorSet
function added toPCRoomDelegate
so that you can be notified of other members in the room updating their read cursors; the function looks like:
func cursorSet(cursor: PCCursor) { print("Cursor set for \(cursor.user.displayName) at position \(cursor.position)") }
0.5.0 - 2018-01-26
- Bump PusherPlatform dependency to 0.3.0
addMessage
onPCCurrentUser
has been deprecatedtext
property onPCMessage
is now optional, i.e.String?
- Support for message attachments
sendMessage
onPCCurrentUser
, which replaces the now deprecatedaddMessage
; usage looks like this:
currentUser.sendMessage(
roomId: roomId,
text: "My message text"
) { messageId, err in
guard err == nil else {
print("Error sending message \(err!.localizedDescription)")
return
}
print("Successfully sent message with ID: \(messageId!)")
}
Note that the room's ID is now required as a parameter, not the whole PCRoom
object as was the case with addMessage
sendMessage
supports sending messages with an attachment; this looks like:
let imageName = Bundle.main.path(forResource: "dog", ofType: "jpg")
let imageURL = URL(fileURLWithPath: imageName!)
currentUser.sendMessage(
roomId: roomId,
text: "My message text",
attachmentType: .fileURL(imageURL, name: "dog.jpg")
) { messageId, err in
guard err == nil else {
print("Error sending message \(err!.localizedDescription)")
return
}
print("Successfully sent message with ID: \(messageId!)")
}
There are currently 3 different attachmentTypes
supported, as described in the PCAttachmentType
enum:
.fileData(_: Data, name: String)
: Use this if you have your file asData
. Thename
parameter is the name that the file will be given when it is stored by our servers..fileURL(_: URL, name: String)
: Use this if you have your file asData
. Thename
parameter is the name that the file will be given when it is stored by our servers..link(_: String, type: String)
: Use this if you have a file stored elsewhere that you would like to attach to a message without it being uploaded to and stored by the Chatkit servers. Thetype
parameter
currently needs to be one of"image"
,"video"
,"audio"
, or"file"
. This will likely eventually be encoded in anenum
but for now we're leaving it as just aString
while we finalise the API.
Here's an example of using the .link(_: String, type: String)
attachment type:
currentUser.sendMessage(
roomId: roomId,
text: "My message text",
attachmentType: .link("https://i.giphy.com/RpByGPT5VlZiE.gif", type: "image")
) { messageId, err in
guard err == nil else {
print("Error sending message \(err!.localizedDescription)")
return
}
print("Successfully sent message with ID: \(messageId!)")
}
PCMessage
s now have an optionalattachment
property of typePCAttachment?
.PCAttachment
looks like this:
public struct PCAttachment {
public let fetchRequired: Bool
public let link: String
public let type: String
}
If fetchRequired
is true
then it means that the attachment is stored on the Chatkit servers and you need to make a request to the Chatkit API to fetch a valid link. To do this you can use the fetchAttachment
function that has been added to the PCCurrentUser
class. You use that like this:
currentUser.fetchAttachment(attachmentLink) { fetchedAttachment, err in
guard err == nil else {
print("Error fetching attachment \(err!.localizedDescription)")
return
}
print("Fetched attachment link: \(fetchedAttachment!.link)")
}
You can then use the fetchedAttachment.link
to download the file, if you so wish.
downloadAttachment
function added toPCCurrentUser
to make downloading Chatkit-stored attachments easier. Once you've got thelink
from aPCFetchedAttachment
you can either use your own download mechanism of choice or you can use thedownloadAttachment
function. Usage of it looks like this:
currentUser.downloadAttachment(
fetchedAttachment.link,
to: myChosenDestination,
onSuccess: { url in
print("Downloaded successfully to \(url.absoluteString)")
},
onError: { error in
print("Failed to download attachment \(error.localizedDescription)")
},
progressHandler: { bytesReceived, totalBytesToReceive in
print("Download progress: \(bytesReceived) / \(totalBytesToReceive)")
}
)
Here myChosenDestination
is an object of type PCDownloadFileDestination
. This is a type based on Alamofire's DownloadFileDestination
. It lets you specify where you'd like to have the download stored (upon completion).
One option for creating a PCDownloadFileDestination
is to use the PCSuggestedDownloadDestination
function, which is again based on an Alamofire construct: DownloadRequest.suggestedDownloadDestination
. You can provide it a PPDownloadOptions
object which determines whether or not the process of moving the downloaded file to the specified destination should be allowed to remove any existing files at the same path and if it should be able to create any required intermediate directories. This is expressed as an OptionSet
with the following options:
.createIntermediateDirectories
.removePreviousFile
- Typealiases for useful PusherPlatform types, specifically:
public typealias PCHTTPTokenProvider = PPHTTPEndpointTokenProvider
public typealias PCTokenProviderRequest = PPHTTPEndpointTokenProviderRequest
public typealias PCLogger = PPLogger
public typealias PCLogLevel = PPLogLevel
public typealias PCDefaultLogger = PPDefaultLogger
public typealias PCDownloadFileDestination = PPDownloadFileDestination
public typealias PCDownloadOptions = PPDownloadOptions
public typealias PCRetryStrategy = PPRetryStrategy
public typealias PCDefaultRetryStrategy = PPDefaultRetryStrategy
public func PCSuggestedDownloadDestination(...) { return PPSuggestedDownloadDestination(...) }
This means that importing PusherPlatform should never need to be done anymore.
PCMessage
conforms toCustomDebugStringConvertible
- Added
Date
versions of timestamp properties on:PCCurrentUser
,PCUser
,PCRoom
, andPCMessage
. For example, if you want aDate
version of thecreatedAt
property of aPCMessage
you can now call.createdAtDate
on the relevantPCMessage
to get aDate
. Thanks @nitrag for the suggestion.
0.4.3 - 2018-01-09
ChatManager
has had adisconnect
function added to it so that you can disconnect from Chatkit.
0.4.2 - 2018-01-06
- Correctly access
user_id
inPCUserSubscription
for typing indicator events. Thanks @neoighodaro!
0.4.1 - 2017-11-01
- Bump
PusherPlatform
dependency to 0.2.1
0.4.0 - 2017-10-27
instanceId
parameter renamed toinstanceLocator
0.3.2 - 2017-10-25
- Allow
PCTokenProvider
to take arequestInjector
- Make
userId
optional when instantiating aPCTokenProvider
- Bump
PusherPlatform
dependency to 0.1.32
0.3.1 - 2017-09-21
- Swift 4 support
0.3.0 - 2017-09-18
- Danger
- Ability to update a room
- User(s) can be added or removed from the room by providing ids or user objects.
- Improved logging
PULL_REQUEST_TEMPLATE.md
templatePusherChat
->PusherChatkit
- Newly created room will be set to public as default
PCTestingTokenProvider
->PCTokenProvider
PCTokenProvider
initialization
0.2.9 - 2017-08-02
PCTestingTokenProvider
parameter name- Move to deneb cluster
0.2.8 - 2017-08-01
avatarURL
property inPCCurrentUser
classisPrivate
property inPCRoom
class- Default implementations of
PCRoomDelegate
andPCChatManagerDelegate
protocol methods
PCRoomDelegate
delegate methods
0.2.7 - 2017-07-28
- Update example code
- Fix path
0.2.6 - 2017-07-26
- Endpoint from
/users
to/users_by_ids
0.2.5 - 2017-07-19
- Namespace
0.2.4 - 2017-07-18
- Token provider URL.
0.2.3 - 2017-07-17
eventType
0.2.2 - 2017-06-29
- Add ability to delete a room
- Add functionality to add a new user to the room