Skip to content

Commit

Permalink
Merge branch 'next' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Oct 11, 2022
2 parents ddd496b + 094ae50 commit c8dbff4
Show file tree
Hide file tree
Showing 13 changed files with 865 additions and 120 deletions.
29 changes: 20 additions & 9 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,29 @@ target 'TinodiosDB' do
db_pods
end

def app_pods
pod 'Firebase'
pod 'FirebaseCore'
pod 'FirebaseMessaging'
pod 'FirebaseAnalytics'
pod 'FirebaseCrashlytics'
pod 'Kingfisher', '~> 5.0'
pod 'MobileVLCKit', '~> 3.4.1b9'
pod 'PhoneNumberKit', '~> 3.3'
pod 'WebRTC-lib', '~> 96.0.0'
end

# UI tests.
target 'TinodiosUITests' do
project 'Tinodios'
db_pods
app_pods
end

target 'Tinodios' do
project 'Tinodios'
db_pods
pod 'Firebase'
pod 'FirebaseCore'
pod 'FirebaseMessaging'
pod 'FirebaseAnalytics'
pod 'FirebaseCrashlytics'
pod 'Kingfisher', '~> 5.0'
pod 'MobileVLCKit', '~> 3.4.1b9'
pod 'PhoneNumberKit', '~> 3.3'
pod 'WebRTC-lib', '~> 96.0.0'
app_pods
end

post_install do | installer |
Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,6 @@ SPEC CHECKSUMS:
SwiftKeychainWrapper: 6fc49fbf7d4a6b0772917acb0e53a1639f6078d6
WebRTC-lib: 508fe02efa0c1a3a8867082a77d24c9be5d29aeb

PODFILE CHECKSUM: e9f601f4ca354f5670dce2ce6c24f5977405364d
PODFILE CHECKSUM: 4035dae6b590b3116328f9f6d8a57f4a08a25e48

COCOAPODS: 1.11.3
13 changes: 13 additions & 0 deletions TinodeSDK/model/Acs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ public class Acs: Codable, CustomStringConvertible, Equatable {
self.mode = AcsHelper(str: modeStr)
}
}
public func encode(to encoder: Encoder) throws {
// Used in testing only.
var container = encoder.container(keyedBy: CodingKeys.self)
let givenStr = givenString
if !givenStr.isEmpty { try container.encode(givenStr, forKey: .given) }

let wantStr = wantString
if !wantStr.isEmpty { try container.encode(wantStr, forKey: .want) }

let modeStr = modeString
if !modeStr.isEmpty { try container.encode(modeStr, forKey: .mode) }
}

public func isJoiner(for side: Acs.Side) -> Bool {
switch side {
case .mode: return mode?.isJoiner ?? false
Expand Down
78 changes: 39 additions & 39 deletions TinodeSDK/model/ClientMessages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

import Foundation

public class MsgClientHi: Encodable {
let id: String?
let ver: String?
public class MsgClientHi: Codable {
public let id: String?
public let ver: String?
// User Agent.
let ua: String?
public let ua: String?
// Push notification token.
let dev: String?
let lang: String?
let bkg: Bool?
public let dev: String?
public let lang: String?
public let bkg: Bool?

init(id: String?, ver: String?, ua: String?, dev: String?, lang: String?, background: Bool) {
self.id = id
Expand Down Expand Up @@ -73,7 +73,7 @@ public class Credential: Codable, Comparable, CustomStringConvertible {
}
}

public class MsgClientAcc<Pu: Encodable, Pr: Encodable>: Encodable {
public class MsgClientAcc<Pu: Codable, Pr: Codable>: Codable {
var id: String?
var user: String?
var scheme: String?
Expand Down Expand Up @@ -112,11 +112,11 @@ public class MsgClientAcc<Pu: Encodable, Pr: Encodable>: Encodable {
}
}

public class MsgClientLogin: Encodable {
let id: String?
let scheme: String?
let secret: String?
var cred: [Credential]?
public class MsgClientLogin: Codable {
public let id: String?
public let scheme: String?
public let secret: String?
public var cred: [Credential]?

init(id: String?, scheme: String?, secret: String?, credentials: [Credential]?) {
self.id = id
Expand All @@ -133,7 +133,7 @@ public class MsgClientLogin: Encodable {
}
}

public class MetaGetData: Encodable {
public class MetaGetData: Codable {
/// Load messages/ranges with IDs equal or greater than this (inclusive or closed).
let since: Int?
/// Load messages/ranges with IDs lower than this (exclusive or open).
Expand All @@ -146,14 +146,14 @@ public class MetaGetData: Encodable {
self.limit = limit
}
}
public class MetaGetDesc: Encodable {
public class MetaGetDesc: Codable {
// ims = If modified since...
let ims: Date?
public init(ims: Date? = nil) {
self.ims = ims
}
}
public class MetaGetSub: Encodable {
public class MetaGetSub: Codable {
let user: String?
let ims: Date?
let limit: Int?
Expand All @@ -163,7 +163,7 @@ public class MetaGetSub: Encodable {
self.limit = limit
}
}
public class MsgGetMeta: CustomStringConvertible, Encodable {
public class MsgGetMeta: CustomStringConvertible, Codable {
private static let kDescSet = 0x01
private static let kSubSet = 0x02
private static let kDataSet = 0x04
Expand Down Expand Up @@ -296,7 +296,7 @@ public class MsgGetMeta: CustomStringConvertible, Encodable {
}
}

public class MetaSetDesc<P: Encodable, R: Encodable>: Encodable {
public class MetaSetDesc<P: Codable, R: Codable>: Codable {
var defacs: Defacs?
var pub: P?
var priv: R?
Expand All @@ -321,7 +321,7 @@ public class MetaSetDesc<P: Encodable, R: Encodable>: Encodable {
}
}

public class MetaSetSub: Encodable {
public class MetaSetSub: Codable {
let user: String?
let mode: String?
public init() {
Expand All @@ -337,7 +337,7 @@ public class MetaSetSub: Encodable {
self.mode = mode
}
}
public class MsgSetMeta<Pu: Encodable, Pr: Encodable>: Encodable {
public class MsgSetMeta<Pu: Codable, Pr: Codable>: Codable {
let desc: MetaSetDesc<Pu, Pr>?
let sub: MetaSetSub?
let tags: [String]?
Expand All @@ -351,7 +351,7 @@ public class MsgSetMeta<Pu: Encodable, Pr: Encodable>: Encodable {
}
}

public class MsgClientSub<Pu: Encodable, Pr: Encodable>: Encodable {
public class MsgClientSub<Pu: Codable, Pr: Codable>: Codable {
var id: String?
var topic: String?
var set: MsgSetMeta<Pu, Pr>?
Expand All @@ -364,7 +364,7 @@ public class MsgClientSub<Pu: Encodable, Pr: Encodable>: Encodable {
}
}

public class MsgClientGet: Encodable {
public class MsgClientGet: Codable {
let id: String?
let topic: String?
let what: String?
Expand All @@ -382,7 +382,7 @@ public class MsgClientGet: Encodable {
}
}

public class MsgClientSet<Pu: Encodable, Pr: Encodable>: Encodable {
public class MsgClientSet<Pu: Codable, Pr: Codable>: Codable {
let id: String?
let topic: String?
let desc: MetaSetDesc<Pu, Pr>?
Expand All @@ -402,7 +402,7 @@ public class MsgClientSet<Pu: Encodable, Pr: Encodable>: Encodable {
}
}

public class MsgClientLeave: Encodable {
public class MsgClientLeave: Codable {
let id: String?
let topic: String?
let unsub: Bool?
Expand All @@ -414,7 +414,7 @@ public class MsgClientLeave: Encodable {
}

/// Typing, read/received and video call notifications packet.
public class MsgClientNote: Encodable {
public class MsgClientNote: Codable {
let topic: String?
let what: String?
let seq: Int?
Expand All @@ -432,7 +432,7 @@ public class MsgClientNote: Encodable {
}
}

public class MsgClientPub: Encodable {
public class MsgClientPub: Codable {
let id: String?
let topic: String?
let noecho: Bool?
Expand All @@ -448,7 +448,7 @@ public class MsgClientPub: Encodable {
}
}

public class MsgClientDel: Encodable {
public class MsgClientDel: Codable {
static let kStrTopic = "topic"
static let kStrMsg = "msg"
static let kStrSub = "sub"
Expand Down Expand Up @@ -520,25 +520,25 @@ public class MsgClientDel: Encodable {

}

public class MsgClientExtra: Encodable {
public class MsgClientExtra: Codable {
let attachments: [String]?

init(attachments: [String]?) {
self.attachments = attachments
}
}

public class ClientMessage<Pu: Encodable, Pr: Encodable>: Encodable {
var hi: MsgClientHi?
var acc: MsgClientAcc<Pu, Pr>?
var login: MsgClientLogin?
var sub: MsgClientSub<Pu, Pr>?
var get: MsgClientGet?
var set: MsgClientSet<Pu, Pr>?
var leave: MsgClientLeave?
var note: MsgClientNote?
var pub: MsgClientPub?
var del: MsgClientDel?
public class ClientMessage<Pu: Codable, Pr: Codable>: Codable {
public var hi: MsgClientHi?
public var acc: MsgClientAcc<Pu, Pr>?
public var login: MsgClientLogin?
public var sub: MsgClientSub<Pu, Pr>?
public var get: MsgClientGet?
public var set: MsgClientSet<Pu, Pr>?
public var leave: MsgClientLeave?
public var note: MsgClientNote?
public var pub: MsgClientPub?
public var del: MsgClientDel?

// Optional field for sending attachment references.
var extra: MsgClientExtra?
Expand Down
Loading

0 comments on commit c8dbff4

Please sign in to comment.