From cd3b5cc7bab07926a5754b9aa671fa33f7006d67 Mon Sep 17 00:00:00 2001 From: Peter Csajtai Date: Thu, 30 Jan 2020 10:12:48 -0800 Subject: [PATCH] Remove the parameters of onconfigchange --- ConfigCat.podspec | 2 +- Sources/AutoPollingPolicy.swift | 2 +- Sources/ConfigCatClient.swift | 2 +- Tests/AutoPollingTests.swift | 9 ++++----- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ConfigCat.podspec b/ConfigCat.podspec index cc6d5a8..5038164 100755 --- a/ConfigCat.podspec +++ b/ConfigCat.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = "ConfigCat" - spec.version = "3.0.0" + spec.version = "3.1.0" spec.summary = "ConfigCat Swift SDK" spec.swift_version = "4.2" diff --git a/Sources/AutoPollingPolicy.swift b/Sources/AutoPollingPolicy.swift index e7b66d6..9e81a24 100755 --- a/Sources/AutoPollingPolicy.swift +++ b/Sources/AutoPollingPolicy.swift @@ -49,7 +49,7 @@ final class AutoPollingPolicy : RefreshPolicy { let cached = self.cache.get() if response.isFetched() && response.body != cached { self.cache.set(value: response.body) - self.onConfigChanged?(response.body, AutoPollingPolicy.parser) + self.onConfigChanged?() } if !self.initialized.getAndSet(new: true) { diff --git a/Sources/ConfigCatClient.swift b/Sources/ConfigCatClient.swift index 6a4fdc4..8f238e3 100755 --- a/Sources/ConfigCatClient.swift +++ b/Sources/ConfigCatClient.swift @@ -2,7 +2,7 @@ import Foundation import os.log extension ConfigCatClient { - public typealias ConfigChangedHandler = (String, ConfigParser) -> () + public typealias ConfigChangedHandler = () -> () } /// A client for handling configurations provided by ConfigCat. diff --git a/Tests/AutoPollingTests.swift b/Tests/AutoPollingTests.swift index 1ca8b57..9c29102 100755 --- a/Tests/AutoPollingTests.swift +++ b/Tests/AutoPollingTests.swift @@ -56,21 +56,20 @@ class AutoPollingTests: XCTestCase { mockSession.enqueueResponse(response: Response(body: "test", statusCode: 200)) mockSession.enqueueResponse(response: Response(body: "test2", statusCode: 200)) - var newConfig = "" + var called = false - let mode = PollingModes.autoPoll(autoPollIntervalInSeconds: 2, onConfigChanged: { (config, parser) in - newConfig = config + let mode = PollingModes.autoPoll(autoPollIntervalInSeconds: 2, onConfigChanged: { () in + called = true }) let fetcher = ConfigFetcher(session: mockSession, apiKey: "", mode: mode) let policy = mode.accept(visitor: RefreshPolicyFactory(fetcher: fetcher, cache: InMemoryConfigCache())) sleep(1) - XCTAssertEqual("test", newConfig) + XCTAssertTrue(called) sleep(3) - XCTAssertEqual("test2", newConfig) XCTAssertEqual("test2", try policy.getConfiguration().get()) } }