From 2f3a9174c1b2221d738dfa34652e331170a6c3a6 Mon Sep 17 00:00:00 2001 From: Meng Li Date: Sun, 25 Oct 2020 20:52:02 +0900 Subject: [PATCH] Get current pluto user --- Example/Podfile.lock | 6 +++--- Pluto/Classes/Core/Pluto+User.swift | 7 +++++++ PlutoSDK.podspec | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index fd4243e..648a06a 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -3,11 +3,11 @@ PODS: - Kingfisher (5.15.6): - Kingfisher/Core (= 5.15.6) - Kingfisher/Core (5.15.6) - - PlutoSDK/Core (0.8.4): + - PlutoSDK/Core (0.8.5): - Alamofire (~> 5) - SwiftyJSON (~> 5) - SwiftyUserDefaults (~> 5) - - PlutoSDK/Rx (0.8.4): + - PlutoSDK/Rx (0.8.5): - PlutoSDK/Core (~> 0) - RxCocoa (~> 5) - RxCocoa (5.1.1): @@ -40,7 +40,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Alamofire: 2c792affbdc2f18016e08fdbcacd60aebe1ba593 Kingfisher: b3554e7bf6106115b44e8795300bad580ef2fdc7 - PlutoSDK: 4d156962bbd58309a9eb2652bb7b3368caf4e082 + PlutoSDK: 294baf549a38c403a94fc17ab34b20623971166c RxCocoa: 32065309a38d29b5b0db858819b5bf9ef038b601 RxRelay: d77f7d771495f43c556cbc43eebd1bb54d01e8e9 RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178 diff --git a/Pluto/Classes/Core/Pluto+User.swift b/Pluto/Classes/Core/Pluto+User.swift index 530c32c..2f47be6 100644 --- a/Pluto/Classes/Core/Pluto+User.swift +++ b/Pluto/Classes/Core/Pluto+User.swift @@ -28,6 +28,13 @@ import SwiftyJSON extension Pluto { + public var currentUser: PlutoUser? { + guard state == .signin, let user = DefaultsManager.shared.user else { + return nil + } + return user + } + public func myInfo(isForceRefresh: Bool = false, success: @escaping (PlutoUser) -> Void, error: ErrorCompletion? = nil) { if !isForceRefresh, let user = DefaultsManager.shared.user { success(user) diff --git a/PlutoSDK.podspec b/PlutoSDK.podspec index 2c7e908..1d643a4 100644 --- a/PlutoSDK.podspec +++ b/PlutoSDK.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'PlutoSDK' - s.version = '0.8.4' + s.version = '0.8.5' s.summary = 'Swift SDK for Pluto login microservice.' # This description is used to generate tags and improve search results.