Skip to content

Commit

Permalink
Merge pull request #9 from Teknasyon-Teknoloji/obj-c-improvements
Browse files Browse the repository at this point in the history
[feat] Improvements for Objective-C projects
  • Loading branch information
osmanyildirim authored Oct 7, 2022
2 parents d494cd5 + 187c49a commit 50c7297
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 107 deletions.
4 changes: 2 additions & 2 deletions Desk360LiveChat.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Desk360LiveChat"
s.version = "1.0.5"
s.version = "1.0.6"
s.summary = "Desk360 Live Chat provides simplicity and usability in one place. With this feature, you can provide live support to your customers directly within your app just by writing a few lines of code."
s.homepage = "https://github.com/Teknasyon-Teknoloji/desk360-livechat-ios-sdk"
s.license = { :type => "Commercial", :file => "LICENSE" }
Expand All @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.dependency 'PersistenceKit'
s.dependency 'Firebase/Database'
s.dependency 'Firebase/Auth'
s.dependency 'Firebase'
s.dependency 'Firebase', '~> 8.15.0'
s.dependency 'NVActivityIndicatorView'
s.dependency 'Kingfisher'

Expand Down
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ source 'https://github.com/CocoaPods/Specs.git'
project './Desk360LiveChat.xcodeproj'

def firebase
pod 'Firebase'
pod 'Firebase', '8.15.0'
end

target 'Desk360LiveChat' do
firebase
pod 'Alamofire'
pod 'Alamofire', '5.0'
pod 'PersistenceKit'
pod 'Firebase/Database'
pod 'Firebase/Auth'
Expand Down
181 changes: 94 additions & 87 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,102 +1,109 @@
PODS:
- Alamofire (5.4.3)
- Alamofire (5.0.0)
- DiffableDataSources (0.5.0):
- DifferenceKit/AppKitExtension (~> 1.1)
- DifferenceKit/UIKitExtension (~> 1.1)
- DifferenceKit/Core (1.2.0)
- DifferenceKit/UIKitExtension (1.2.0):
- DifferenceKit/Core (1.3.0)
- DifferenceKit/UIKitExtension (1.3.0):
- DifferenceKit/Core
- Firebase (8.2.0):
- Firebase/Core (= 8.2.0)
- Firebase/Auth (8.2.0):
- Firebase (8.15.0):
- Firebase/Core (= 8.15.0)
- Firebase/Auth (8.15.0):
- Firebase/CoreOnly
- FirebaseAuth (~> 8.2.0)
- Firebase/Core (8.2.0):
- FirebaseAuth (~> 8.15.0)
- Firebase/Core (8.15.0):
- Firebase/CoreOnly
- FirebaseAnalytics (~> 8.2.0)
- Firebase/CoreOnly (8.2.0):
- FirebaseCore (= 8.2.0)
- Firebase/Database (8.2.0):
- FirebaseAnalytics (~> 8.15.0)
- Firebase/CoreOnly (8.15.0):
- FirebaseCore (= 8.15.0)
- Firebase/Database (8.15.0):
- Firebase/CoreOnly
- FirebaseDatabase (~> 8.2.0)
- FirebaseAnalytics (8.2.0):
- FirebaseAnalytics/AdIdSupport (= 8.2.0)
- FirebaseDatabase (~> 8.15.0)
- FirebaseAnalytics (8.15.0):
- FirebaseAnalytics/AdIdSupport (= 8.15.0)
- FirebaseCore (~> 8.0)
- FirebaseInstallations (~> 8.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.4)
- GoogleUtilities/MethodSwizzler (~> 7.4)
- GoogleUtilities/Network (~> 7.4)
- "GoogleUtilities/NSData+zlib (~> 7.4)"
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- FirebaseAnalytics/AdIdSupport (8.2.0):
- FirebaseAnalytics/AdIdSupport (8.15.0):
- FirebaseCore (~> 8.0)
- FirebaseInstallations (~> 8.0)
- GoogleAppMeasurement (= 8.2.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.4)
- GoogleUtilities/MethodSwizzler (~> 7.4)
- GoogleUtilities/Network (~> 7.4)
- "GoogleUtilities/NSData+zlib (~> 7.4)"
- GoogleAppMeasurement (= 8.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- FirebaseAuth (8.2.0):
- FirebaseAuth (8.15.0):
- FirebaseCore (~> 8.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.4)
- GoogleUtilities/Environment (~> 7.4)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/Environment (~> 7.7)
- GTMSessionFetcher/Core (~> 1.5)
- FirebaseCore (8.2.0):
- FirebaseCore (8.15.0):
- FirebaseCoreDiagnostics (~> 8.0)
- GoogleUtilities/Environment (~> 7.4)
- GoogleUtilities/Logger (~> 7.4)
- FirebaseCoreDiagnostics (8.2.0):
- GoogleDataTransport (~> 9.0)
- GoogleUtilities/Environment (~> 7.4)
- GoogleUtilities/Logger (~> 7.4)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/Logger (~> 7.7)
- FirebaseCoreDiagnostics (8.15.0):
- GoogleDataTransport (~> 9.1)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/Logger (~> 7.7)
- nanopb (~> 2.30908.0)
- FirebaseDatabase (8.2.0):
- FirebaseDatabase (8.15.0):
- FirebaseCore (~> 8.0)
- leveldb-library (~> 1.22)
- FirebaseInstallations (8.2.0):
- FirebaseInstallations (8.15.0):
- FirebaseCore (~> 8.0)
- GoogleUtilities/Environment (~> 7.4)
- GoogleUtilities/UserDefaults (~> 7.4)
- PromisesObjC (~> 1.2)
- GoogleAppMeasurement (8.2.0):
- GoogleAppMeasurement/AdIdSupport (= 8.2.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.4)
- GoogleUtilities/MethodSwizzler (~> 7.4)
- GoogleUtilities/Network (~> 7.4)
- "GoogleUtilities/NSData+zlib (~> 7.4)"
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/UserDefaults (~> 7.7)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleAppMeasurement (8.15.0):
- GoogleAppMeasurement/AdIdSupport (= 8.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (8.2.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.4)
- GoogleUtilities/MethodSwizzler (~> 7.4)
- GoogleUtilities/Network (~> 7.4)
- "GoogleUtilities/NSData+zlib (~> 7.4)"
- GoogleAppMeasurement/AdIdSupport (8.15.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 8.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- GoogleDataTransport (9.0.1):
- GoogleUtilities/Environment (~> 7.2)
- GoogleAppMeasurement/WithoutAdIdSupport (8.15.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- PromisesObjC (~> 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.4.3):
- GoogleDataTransport (9.2.0):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.8.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.4.3):
- PromisesObjC (~> 1.2)
- GoogleUtilities/Logger (7.4.3):
- GoogleUtilities/Environment (7.8.0):
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.8.0):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (7.4.3):
- GoogleUtilities/MethodSwizzler (7.8.0):
- GoogleUtilities/Logger
- GoogleUtilities/Network (7.4.3):
- GoogleUtilities/Network (7.8.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.4.3)"
- GoogleUtilities/Reachability (7.4.3):
- "GoogleUtilities/NSData+zlib (7.8.0)"
- GoogleUtilities/Reachability (7.8.0):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.4.3):
- GoogleUtilities/UserDefaults (7.8.0):
- GoogleUtilities/Logger
- GTMSessionFetcher/Core (1.6.1)
- Kingfisher (6.3.0)
- GTMSessionFetcher/Core (1.7.2)
- Kingfisher (6.3.1)
- leveldb-library (1.22.1)
- nanopb (2.30908.0):
- nanopb/decode (= 2.30908.0)
Expand All @@ -106,14 +113,14 @@ PODS:
- NVActivityIndicatorView (5.1.1):
- NVActivityIndicatorView/Base (= 5.1.1)
- NVActivityIndicatorView/Base (5.1.1)
- PersistenceKit (1.3)
- PromisesObjC (1.2.12)
- PersistenceKit (1.4)
- PromisesObjC (2.1.1)

DEPENDENCIES:
- Alamofire
- Alamofire (= 5.0)
- DiffableDataSources
- DifferenceKit/UIKitExtension
- Firebase
- Firebase (= 8.15.0)
- Firebase/Auth
- Firebase/Database
- Kingfisher
Expand Down Expand Up @@ -144,27 +151,27 @@ SPEC REPOS:
- PromisesObjC

SPEC CHECKSUMS:
Alamofire: e447a2774a40c996748296fa2c55112fdbbc42f9
Alamofire: 58ff2bfb8daaacaa233d5c36e37b10a5248f59b1
DiffableDataSources: 1ddde2de1978cc02619b2c3bfafab20e68b57279
DifferenceKit: 5659c430bb7fe45876fa32ce5cba5d6167f0c805
Firebase: 12c568897b807321964e89d2b263ef4c6cff3db6
FirebaseAnalytics: 7a744b1e7dc50125cb37714c6bdaea167e412082
FirebaseAuth: 4c4fb0ba1a169f3acb4aa5b724f7ae7c0999ee44
FirebaseCore: 3a83f24c3de69ec9f9a426e2598125ea51f3a2ce
FirebaseCoreDiagnostics: 61384f54989065b15c36b5922b65112e86811d3c
FirebaseDatabase: 9c231733363229ac26a55ee9ae9031e94cdb9a7d
FirebaseInstallations: 9394ea09e242bf0816e95ac30e56a9214cc86ced
GoogleAppMeasurement: b52eafc9dff542d580700e708216568bd2fbf168
GoogleDataTransport: 04c3e9a480bbcaa2ec3f5d27f1cdeb6a92f20c8d
GoogleUtilities: 45dbb24a7f351d69d0a601482b39ad6c32e30dab
GTMSessionFetcher: 36689134877faeb055b27dfa4ccc9ceaa42e029e
Kingfisher: 6c3df386db71d82c0817a429d2c9421a77396529
DifferenceKit: ab185c4d7f9cef8af3fcf593e5b387fb81e999ca
Firebase: 5f8193dff4b5b7c5d5ef72ae54bb76c08e2b841d
FirebaseAnalytics: 7761cbadb00a717d8d0939363eb46041526474fa
FirebaseAuth: 3e73bf8abf4fbb40f8b421f361f4cc48ee57388c
FirebaseCore: 5743c5785c074a794d35f2fff7ecc254a91e08b1
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseDatabase: f567afd233e54a303d84423207736590a6feb419
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
GoogleAppMeasurement: 4c19f031220c72464d460c9daa1fb5d1acce958e
GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
GoogleUtilities: 1d20a6ad97ef46f67bbdec158ce00563a671ebb7
GTMSessionFetcher: 5595ec75acf5be50814f81e9189490412bad82ba
Kingfisher: 016c8b653a35add51dd34a3aba36b580041acc74
leveldb-library: 50c7b45cbd7bf543c81a468fe557a16ae3db8729
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
NVActivityIndicatorView: 1f6c5687f1171810aa27a3296814dc2d7dec3667
PersistenceKit: 510fe7a29039f2820c5dda21ecc1b9d0d99cbdd5
PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
PersistenceKit: 3a9a8e760a686576eed37dbba5da7a11ac2f0603
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb

PODFILE CHECKSUM: 7e3ec3ef48b0f0e7e02f0cac339c8e71a8253a83
PODFILE CHECKSUM: b5cc89223c5c8595a54d71f515aa363185537c3e

COCOAPODS: 1.10.2
COCOAPODS: 1.11.3
25 changes: 13 additions & 12 deletions Sources/LiveChat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import FirebaseCore
import FirebaseDatabase
import UIKit

public struct LiveChatProperties {
public let appKey: String
public let host: String
public let deviceID: String
public let language: String?
public let loginCredentials: Credentials?
public let smartPlug: SmartPlug?
@objc public class LiveChatProperties: NSObject {
@objc public let appKey: String
@objc public let host: String
@objc public let deviceID: String
@objc public let language: String?
@objc public let loginCredentials: Credentials?
@objc public let smartPlug: SmartPlug?

public init(
@objc public init(
appKey: String,
host: String,
deviceID: String,
Expand All @@ -36,8 +36,8 @@ public struct LiveChatProperties {
}
}

public final class Desk360LiveChat {
static public let shared = Desk360LiveChat()
@objc public final class Desk360LiveChat: NSObject {
@objc static public let shared = Desk360LiveChat()

private var appCoordinator: AppCoordinator?

Expand All @@ -57,15 +57,16 @@ public final class Desk360LiveChat {
]
}

private init() {
private override init() {
super.init()
listenForAppLifeCycleEvents()
}

/// Start the live chat view instance and presents it on the given view controller.
/// - Parameters:
/// - properites: The credentials pf the current logged in user of the app or nil if not available.
/// - viewController: The view controll to present the live chat instance on.
public func start(using properites: LiveChatProperties, on viewController: UIViewController) {
@objc public func start(using properites: LiveChatProperties, on viewController: UIViewController) {

if properites.appKey.isEmpty || properites.host.isEmpty {
NSException(
Expand Down
4 changes: 2 additions & 2 deletions Sources/Models/Credentials.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

/// The credentials of the user
public struct Credentials: Codable, Equatable {
@objc public class Credentials: NSObject, Codable {

/// User name
public let name: String
Expand All @@ -20,7 +20,7 @@ public struct Credentials: Codable, Equatable {
/// - Parameters:
/// - name: The user name.
/// - email: The user email.
public init(name: String, email: String) {
@objc public init(name: String, email: String) {
self.name = name
self.email = email
}
Expand Down
14 changes: 12 additions & 2 deletions Sources/Models/SmartPlug.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@ import Foundation

public typealias SmartPlugType = [String: Codable]

public struct SmartPlug: Codable {
@objc public class SmartPlug: NSObject, Codable {

var settings: [String: EncodableValue]

@objc public init(_ settings: [String: Any]) {
var holder: [String: EncodableValue] = [:]

for (key, value) in settings {
let data = NSKeyedArchiver.archivedData(withRootObject: value)
holder[key] = EncodableValue(data)
}
self.settings = holder
}

public init(_ settings: SmartPlugType) {
var holder: [String: EncodableValue] = [:]
Expand All @@ -28,7 +38,7 @@ public struct SmartPlug: Codable {
try container.encode(self.settings, forKey: .settings)
}

public init(from decoder: Decoder) throws {
required public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
if values.contains(.settings), let jsonData = try? values.decode(Data.self, forKey: .settings) {
settings = (try? JSONSerialization.jsonObject(with: jsonData) as? [String: EncodableValue]) ?? [String: EncodableValue]()
Expand Down

0 comments on commit 50c7297

Please sign in to comment.