File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99Pod ::Spec . new do |s |
1010 s . name = 'NStackSDK'
11- s . version = '5.1.6 '
11+ s . version = '5.1.7 '
1212 s . summary = 'NStackSDK is the companion software development kit to the NStack backend.'
1313
1414# This description is used to generate tags and improve search results.
@@ -29,7 +29,7 @@ Pod::Spec.new do |s|
2929 s . swift_version = '5.2'
3030
3131 s . default_subspecs = "Core"
32- s . dependency 'NLocalizationManager' , '~> 3.1.4 '
32+ s . dependency 'NLocalizationManager' , '~> 3.1.5 '
3333
3434 s . subspec 'Core' do |core |
3535 core . source_files = [ 'NStackSDK/**/*.swift' ]
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ public protocol LocalizationWrappable {
4949
5050 var bestFitLanguage : DefaultLanguage ? { get }
5151 var languageOverride : Locale ? { get }
52+ var lastUpdatedDate : Date ? { get set }
5253
5354 func localization< L: LocalizableModel > ( ) throws -> L
5455 func fetchAvailableLanguages( completion: @escaping ( ( [ DefaultLanguage ] ) -> Void ) )
@@ -88,6 +89,15 @@ extension LocalizationWrapper: LocalizationWrappable {
8889 return localizationManager? . bestFitLanguage
8990 }
9091
92+ public var lastUpdatedDate : Date ? {
93+ get {
94+ return localizationManager? . lastUpdatedDate
95+ }
96+ set {
97+ localizationManager? . lastUpdatedDate = newValue
98+ }
99+ }
100+
91101 public func fetchAvailableLanguages( completion: @escaping ( ( [ DefaultLanguage ] ) -> Void ) ) {
92102 localizationManager? . fetchAvailableLanguages ( completion: completion)
93103 }
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public class NStack {
2929 public fileprivate( set) var configuration : Configuration !
3030
3131 /// The manager responsible for fetching, updating and persisting localizations.
32- public fileprivate ( set ) var localizationManager : LocalizationWrappable ?
32+ public var localizationManager : LocalizationWrappable ?
3333
3434 /// The manager responsible for fetching Country, Continent, Language & Timezone configurations
3535 public fileprivate( set) var geographyManager : GeographyManager ?
@@ -149,7 +149,7 @@ public class NStack {
149149 update ( )
150150 }
151151 }
152-
152+
153153 func setupLocalizations( ) {
154154 // Setup localizations
155155 let manager = LocalizationManager < DefaultLanguage , LocalizationConfig > (
Original file line number Diff line number Diff line change @@ -22,21 +22,27 @@ enum VersionUtilities {
2222
2323 static var lastUpdatedIso8601DateString : String {
2424 get {
25- return UserDefaults . standard . string ( forKey : Constants . CacheKeys . lastUpdatedDate) ?? " "
25+ return lastUpdatedDate? . iso8601 ?? " "
2626 }
2727 set {
28- UserDefaults . standard. setValue ( newValue, forKey: Constants . CacheKeys. lastUpdatedDate)
28+ if #available( iOS 10 . 0 , OSX 10 . 12 , * ) {
29+ if let date = DateFormatter . iso8601. date ( from: newValue) {
30+ lastUpdatedDate = date
31+ }
32+ } else {
33+ if let date = DateFormatter . iso8601Fallback. date ( from: newValue) {
34+ lastUpdatedDate = date
35+ }
36+ }
2937 }
3038 }
3139
3240 static var lastUpdatedDate : Date ? {
3341 get {
34- return UserDefaults . standard . object ( forKey : Constants . CacheKeys . lastUpdatedDate) as? Date
42+ return NStack . sharedInstance . localizationManager ? . lastUpdatedDate
3543 }
3644 set {
37- if let date = newValue {
38- UserDefaults . standard. setCodable ( date, forKey: Constants . CacheKeys. lastUpdatedDate)
39- }
45+ NStack . sharedInstance. localizationManager? . lastUpdatedDate = newValue
4046 }
4147 }
4248
Original file line number Diff line number Diff line change 99enum Constants {
1010 enum CacheKeys {
1111 static let previousVersion = " PreviousVersionKey "
12- static let lastUpdatedDate = " LastUpdatedKey "
1312 static let prevAcceptedLanguage = " PrevAcceptedLanguageKey "
1413 static let countries = " CountriesKey "
1514 static let continents = " ContinentsKey "
You can’t perform that action at this time.
0 commit comments