Skip to content

Commit

Permalink
Small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
buh committed Sep 6, 2019
1 parent 978619e commit 5ffdd74
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Example/ChatExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {

extension User {
static let user1 = User(id: "broken-waterfall-5", name: "Jon Snow", avatarURL: URL(string: "https://bit.ly/2u9Vc0r"))
static let user2 = User(id: "noisy-mountain-3", name: "Noisy mountain")
static let user2 = User(id: "steep-moon-9", name: "Steep moon")
}

extension Token {
static let token1 = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYnJva2VuLXdhdGVyZmFsbC01In0.d1xKTlD_D0G-VsBoDBNbaLjO-2XWNA8rlTm4ru4sMHg"
static let token2 = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoibm9pc3ktbW91bnRhaW4tMyJ9.GAhzrzo8SsDn_RGzX4Fob5bZB0nKXXPKya8okbr9WB0"
static let token2 = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3RlZXAtbW9vbi05In0.K7uZEqKmiVb5_Y7XFCmlz64SzOV34hoMpeqRSz7g4YI"
}
23 changes: 17 additions & 6 deletions Sources/Core/Model/Reaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,30 @@ import Foundation

/// A reaction type.
public enum ReactionType: String, Codable, Hashable, CaseIterable {
// A like reaction 👍.
/// A like reaction 👍.
case like
// A love reaction ❤️.
/// A love reaction ❤️.
case love
// A haha reaction 😂.
/// A haha reaction 😂.
case haha
// A wow reaction 😲.
/// A wow reaction 😲.
case wow
// A sad reaction 😔.
/// A sad reaction 😔.
case sad
// A angry reaction 😠.
/// A angry reaction 😠.
case angry

public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()

if let value = try? container.decode(String.self),
let type = ReactionType(rawValue: value) {
self = type
} else {
self = .like
}
}

/// An reaction type as emoji.
public var emoji: String {
switch self {
Expand Down
4 changes: 2 additions & 2 deletions StreamChatCoreTests/Integration Tests/ChannelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import RxBlocking
final class ChannelTests: TestCase {

let channel = Channel(id: "integration")

func testQuery() {
do {
let response = try channel.query(pagination: .limit(1))
Expand All @@ -28,7 +28,7 @@ final class ChannelTests: TestCase {
}
} catch {
XCTFail("\(error)")
}
}
}

func testSendAndDeleteMessage() {
Expand Down

0 comments on commit 5ffdd74

Please sign in to comment.