Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bump 4.6.0 * Adding bootstrap script to the Github action * [CIS-1378] Safely access indexes of collections (#1692) * Add safe subscript to avoid crashing on accessing an array element * Centralize logging + assertions in Collections extension * Add tests for SafeSubscript * Update Sources/StreamChatUI/Utils/Array+SafeSubscript.swift Co-authored-by: Boris Bielik <h3sperian@gmail.com> * Remove unneeded guard * Apply SwiftFormat * Update Changelog Co-authored-by: Boris Bielik <h3sperian@gmail.com> * Execute generateSPMFileLists * Add smoke checks for PRs pointing to a release branch * Add more safety when data source index is not present by returning a valid cell * Added docs for inline replies in the SwiftUI SDK (#1694) * Fix reload rows out of bounds (#1697) * Remove layout options from chat message layout options (#1698) * Expose `QueryOptions` and `start/stopWatching` (#1696) * UnknownEvent is now deprecated and was renamed to UnknownChannelEvent (#1695) Provides new UnknownUserEvent model for custom user events * Linting * SwiftyGif 5.4.2 * Adds missing reference for source file - SwiftyGif * Remove smoke checks * Update CHANGELOG.md Co-authored-by: Boris Bielik <h3sperian@gmail.com> * Update CHANGELOG.md * 4.6.0 Release (#1690) Release 4.6.0. * We need to setup the ENV for bootstrap to run correctly (including SSH Bot) * Fixing the YML validation and fixing the CHANGELOG date entry * Removing duplicate inside the full checks yml file * Release 4.6.0 (#1700) * Disabling automatic signing for both StreamChat and StreamChatUI framework * Move away from submodules (#1709) * Move away from submodules * Remove cloned repos after dependencies updates * Pod trunk push all specs (#1711) * Pod trunk push all specs * Updating workflow scripts along with fastfile (#1714) * Updating workflow scripts along with fastfile * Pulling in changes for updating podspecs across all Pods Co-authored-by: Adam Rush <adam.rush@getstream.io> * Update CHANGELOG.md Co-authored-by: Boris Bielik <h3sperian@gmail.com> Co-authored-by: Adam Rush <adam.rush@getstream.io> Co-authored-by: Boris Bielik <h3sperian@gmail.com> Co-authored-by: Martin Mitrevski <martinmitrevski.oh@gmail.com> Co-authored-by: Tommaso Barbugli <tbarbugli@gmail.com> Co-authored-by: Nuno Vieira <nuno.fcvieira93@gmail.com> Co-authored-by: Bahadır Öncel <bahadir@getstream.io> Co-authored-by: Boris Bielik <boris.bielik@getstream.io> Co-authored-by: Adam Rush <adam@adr-studio.co.uk>
- Loading branch information
1 parent
48f13c1
commit 2b868ca
Showing
62 changed files
with
890 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,3 +77,6 @@ docusaurus/.env | |
|
||
# Ignore Products folder | ||
Products/ | ||
|
||
# Ignore Dependencies folder | ||
Dependencies/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule Nuke
deleted from
c0b32b
Submodule Starscream
deleted from
df8d82
Submodule SwiftyGif
deleted from
652b34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Sources/StreamChat/APIClient/Endpoints/Payloads/UnknownUserEvent.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Copyright © 2021 Stream.io Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// An event type SDK fallbacks to if incoming event was failed to be | ||
/// decoded as a system event. | ||
public struct UnknownUserEvent: Event, Hashable { | ||
/// An event type. | ||
public let type: EventType | ||
|
||
/// A user the event is triggered for. | ||
public let userId: UserId | ||
|
||
/// An event creation date. | ||
public let createdAt: Date | ||
|
||
/// A dictionary containing the entire event JSON. | ||
public let payload: [String: RawJSON] | ||
} | ||
|
||
extension UnknownUserEvent: Decodable { | ||
public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: EventPayload.CodingKeys.self) | ||
|
||
self.init( | ||
type: try container.decode(EventType.self, forKey: .eventType), | ||
userId: try container.decode(UserPayload.self, forKey: .user).id, | ||
createdAt: try container.decode(Date.self, forKey: .createdAt), | ||
payload: try decoder | ||
.singleValueContainer() | ||
.decode([String: RawJSON].self) | ||
) | ||
} | ||
} | ||
|
||
// MARK: - Payload | ||
|
||
public extension UnknownUserEvent { | ||
/// Decodes a payload of the given type from the event. | ||
/// | ||
/// - Parameter ofType: The type of payload the custom fields should be treated as. | ||
/// - Returns: A payload of the given type if decoding succeeds and if event type matches the one declared in custom payload type. Otherwise `nil` is returned. | ||
func payload<T: CustomEventPayload>(ofType: T.Type) -> T? { | ||
guard | ||
T.eventType == type, | ||
let payloadData = try? JSONEncoder.default.encode(payload), | ||
let payload = try? JSONDecoder.default.decode(T.self, from: payloadData) | ||
else { return nil } | ||
|
||
return payload | ||
} | ||
} |
Oops, something went wrong.