Skip to content

Commit

Permalink
prepare 9.2.1 release (#319)
Browse files Browse the repository at this point in the history
## [9.2.1] - 2023-10-31
### Changed:
- Calling `identify()` with the current context is now more efficient
and no longer results in re-establishing a connection.

### Fixed:
- Fixed issue where flag change listeners were not being triggered when
`identify()` was called.

---------

Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: torchhound <5600929+torchhound@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Matthew Keeler <mkeeler@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com>
Co-authored-by: Ember Stevens <79482775+ember-stevens@users.noreply.github.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: ld-repository-standards[bot] <113625520+ld-repository-standards[bot]@users.noreply.github.com>
Co-authored-by: Kane Parkinson <93555788+kparkinson-ld@users.noreply.github.com>
  • Loading branch information
12 people authored Oct 31, 2023
1 parent 5f8aae1 commit 0fedd19
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 21 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to the LaunchDarkly iOS SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [9.2.1] - 2023-10-31
### Changed:
- Calling `identify()` with the current context is now more efficient and no longer results in re-establishing a connection.

### Fixed:
- Fixed issue where flag change listeners were not being triggered when `identify()` was called.

## [9.2.0] - 2023-10-24
### Changed:
- Updated swift-tools-version from 5.2 to 5.3.
Expand Down Expand Up @@ -35,6 +42,13 @@ All notable changes to the LaunchDarkly iOS SDK will be documented in this file.
### Removed
- Removed LDUser and related functionality. Use LDContext instead. To learn more, read https://docs.launchdarkly.com/home/contexts.

## [8.3.1] - 2023-10-31
### Changed:
- Calling `identify()` with the current context is now more efficient and no longer results in re-establishing a connection.

### Fixed:
- Fixed issue where flag change listeners were not being triggered when `identify()` was called.

## [8.3.0] - 2023-09-08
### Changed:
- Deprecated `LDValue.init(integerLiteral: Double)` as this method signature is misleading. A new `LDValue.init(integerLiteral: Int)` signature has been added for clarity.
Expand Down
2 changes: 1 addition & 1 deletion LaunchDarkly.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Pod::Spec.new do |ld|

ld.name = "LaunchDarkly"
ld.version = "9.2.0"
ld.version = "9.2.1"
ld.summary = "iOS SDK for LaunchDarkly"

ld.description = <<-DESC
Expand Down
36 changes: 18 additions & 18 deletions LaunchDarkly.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1560,12 +1560,12 @@
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = NO;
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "$(PROJECT_DIR)/LaunchDarkly/LaunchDarkly/Support/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
MARKETING_VERSION = 9.2.0;
MARKETING_VERSION = 9.2.1;
MODULEMAP_FILE = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.launchdarkly.Darkly-tvOS";
PRODUCT_NAME = LaunchDarkly_tvOS;
Expand All @@ -1586,12 +1586,12 @@
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = NO;
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "$(PROJECT_DIR)/LaunchDarkly/LaunchDarkly/Support/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
MARKETING_VERSION = 9.2.0;
MARKETING_VERSION = 9.2.1;
MODULEMAP_FILE = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.launchdarkly.Darkly-tvOS";
PRODUCT_NAME = LaunchDarkly_tvOS;
Expand All @@ -1612,12 +1612,12 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = NO;
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "$(PROJECT_DIR)/LaunchDarkly/LaunchDarkly/Support/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
MARKETING_VERSION = 9.2.0;
MARKETING_VERSION = 9.2.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.launchdarkly.Darkly-macOS";
PRODUCT_NAME = LaunchDarkly_macOS;
SDKROOT = macosx;
Expand All @@ -1635,12 +1635,12 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = NO;
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "$(PROJECT_DIR)/LaunchDarkly/LaunchDarkly/Support/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
MARKETING_VERSION = 9.2.0;
MARKETING_VERSION = 9.2.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.launchdarkly.Darkly-macOS";
PRODUCT_NAME = LaunchDarkly_macOS;
SDKROOT = macosx;
Expand Down Expand Up @@ -1684,7 +1684,7 @@
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_VERSION = F;
Expand Down Expand Up @@ -1755,7 +1755,7 @@
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_VERSION = F;
Expand Down Expand Up @@ -1791,13 +1791,13 @@
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = NO;
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(PROJECT_DIR)/LaunchDarkly/LaunchDarkly/Support/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
MARKETING_VERSION = 9.2.0;
MARKETING_VERSION = 9.2.1;
MODULEMAP_FILE = "$(PROJECT_DIR)/Framework/module.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = com.launchdarkly.Darkly;
PRODUCT_NAME = LaunchDarkly;
Expand All @@ -1814,13 +1814,13 @@
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = NO;
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(PROJECT_DIR)/LaunchDarkly/LaunchDarkly/Support/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
MARKETING_VERSION = 9.2.0;
MARKETING_VERSION = 9.2.1;
MODULEMAP_FILE = "$(PROJECT_DIR)/Framework/module.modulemap";
PRODUCT_BUNDLE_IDENTIFIER = com.launchdarkly.Darkly;
PRODUCT_NAME = LaunchDarkly;
Expand Down Expand Up @@ -1859,12 +1859,12 @@
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = NO;
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "$(PROJECT_DIR)/LaunchDarkly/LaunchDarkly/Support/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
MARKETING_VERSION = 9.2.0;
MARKETING_VERSION = 9.2.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.launchdarkly.Darkly-watchOS";
PRODUCT_NAME = LaunchDarkly_watchOS;
SDKROOT = watchos;
Expand All @@ -1883,12 +1883,12 @@
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = NO;
DYLIB_COMPATIBILITY_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.0;
DYLIB_CURRENT_VERSION = 9.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "$(PROJECT_DIR)/LaunchDarkly/LaunchDarkly/Support/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
MARKETING_VERSION = 9.2.0;
MARKETING_VERSION = 9.2.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.launchdarkly.Darkly-watchOS";
PRODUCT_NAME = LaunchDarkly_watchOS;
SDKROOT = watchos;
Expand Down
8 changes: 8 additions & 0 deletions LaunchDarkly/LaunchDarkly/LDClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,21 @@ public class LDClient {
}

internalIdentifyQueue.sync {
if self.context == updatedContext {
self.eventReporter.record(IdentifyEvent(context: self.context))
completion?()
return
}

self.context = updatedContext
Log.debug(self.typeName(and: #function) + "new context set with key: " + self.context.fullyQualifiedKey() )
let wasOnline = self.isOnline
self.internalSetOnline(false)

let cachedContextFlags = self.flagCache.retrieveFeatureFlags(contextKey: self.context.fullyQualifiedHashedKey()) ?? [:]
let oldItems = flagStore.storedItems.featureFlags
flagStore.replaceStore(newStoredItems: cachedContextFlags)
flagChangeNotifier.notifyObservers(oldFlags: oldItems, newFlags: flagStore.storedItems.featureFlags)
self.service.context = self.context
self.service.clearFlagResponseCache()
flagSynchronizer = serviceFactory.makeFlagSynchronizer(streamingMode: ConnectionInformation.effectiveStreamingMode(config: config, ldClient: self),
Expand Down
8 changes: 7 additions & 1 deletion LaunchDarkly/LaunchDarkly/Models/Context/Reference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ extension ReferenceError: CustomStringConvertible {
/// - Reference("name") or Reference("/name") would refer to the value "xyz"
/// - Reference("/address/street") would refer to the value "99 Main St."
/// - Reference("a/b") or Reference("/a~1b") would refer to the value "ok"
public struct Reference: Codable, Equatable, Hashable {
public struct Reference: Codable, Hashable {
private var error: ReferenceError?
private var rawPath: String
private var components: [String] = []
Expand Down Expand Up @@ -230,3 +230,9 @@ public struct Reference: Codable, Equatable, Hashable {
return self.components[index]
}
}

extension Reference: Equatable {
public static func == (lhs: Reference, rhs: Reference) -> Bool {
return lhs.error == rhs.error && lhs.components == rhs.components
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

struct ReportingConsts {
static let sdkVersion = "9.2.0"
static let sdkVersion = "9.2.1"
static let sdkName = "ios-client-sdk"
}
20 changes: 20 additions & 0 deletions LaunchDarkly/LaunchDarklyTests/LDClientSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ final class LDClientSpec: QuickSpec {
expect(testContext.flagStoreMock.replaceStoreCallCount) == 1
expect(testContext.flagStoreMock.replaceStoreReceivedNewFlags) == stubFlags
}

it("when we have opted into auto environment attributes") {
let testContext = TestContext(startOnline: true)
testContext.config.autoEnvAttributes = true
Expand All @@ -628,6 +629,25 @@ final class LDClientSpec: QuickSpec {
expect(kinds.contains(AutoEnvContextModifier.ldDeviceKind)) == true
expect(kinds.contains(AutoEnvContextModifier.ldApplicationKind)) == true
}

it("only triggered if context is different") {
let testContext = TestContext(startOnline: true)
testContext.start()
testContext.featureFlagCachingMock.reset()

testContext.subject.internalIdentify(newContext: testContext.context)
testContext.subject.internalIdentify(newContext: testContext.context)
testContext.subject.internalIdentify(newContext: testContext.context)
testContext.subject.internalIdentify(newContext: testContext.context)

expect(testContext.flagStoreMock.replaceStoreCallCount) == 0
expect(testContext.makeFlagSynchronizerService?.context) == testContext.context

expect(testContext.subject.isOnline) == true
expect(testContext.subject.eventReporter.isOnline) == true
expect(testContext.subject.flagSynchronizer.isOnline) == true
expect(testContext.eventReporterMock.recordReceivedEvent?.kind == .identify).to(beTrue())
}
}
}

Expand Down
41 changes: 41 additions & 0 deletions LaunchDarkly/LaunchDarklyTests/Models/Context/LDContextSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,47 @@ import XCTest
@testable import LaunchDarkly

final class LDContextSpec: XCTestCase {
func testContextsAreEquatable() throws {
var originalBuilder = LDContextBuilder(key: "context-key")
originalBuilder.kind("user")
originalBuilder.name("Example name")
originalBuilder.trySetValue("groups", LDValue.array(["test", "it", "here"]))
originalBuilder.trySetValue("address", LDValue.object(["address": "123 Easy St", "city": "Every Town"]))
originalBuilder.addPrivateAttribute(Reference(literal: "name"))

var duplicateBuilder = LDContextBuilder(key: "context-key")
duplicateBuilder.kind("user")
duplicateBuilder.name("Example name")
duplicateBuilder.trySetValue("groups", LDValue.array(["test", "it", "here"]))
duplicateBuilder.trySetValue("address", LDValue.object(["address": "123 Easy St", "city": "Every Town"]))
duplicateBuilder.addPrivateAttribute(Reference("/name"))

let original = try originalBuilder.build().get()
let duplicate = try duplicateBuilder.build().get()

XCTAssertEqual(original, duplicate)
}

func testContextsAreNotTheSame() throws {
let values: [String: LDValue] = [
"kind": "org",
"name": "Example name",
"groups": "This is a string",
"address": LDValue.array(["wrong type again"])
]

for (name, value) in values {
var originalBuilder = LDContextBuilder(key: "context-key")
var slightlyDifferent = LDContextBuilder(key: "context-key")
slightlyDifferent.trySetValue(name, value)

let original = try originalBuilder.build().get()
let duplicate = try slightlyDifferent.build().get()

XCTAssertNotEqual(original, duplicate)
}
}

func testBuildCanCreateSimpleContext() throws {
var builder = LDContextBuilder(key: "context-key")
builder.name("Name")
Expand Down
18 changes: 18 additions & 0 deletions LaunchDarkly/LaunchDarklyTests/Models/Context/ReferenceSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ import XCTest
@testable import LaunchDarkly

final class ReferenceSpec: XCTestCase {
func testVerifyEquality() {
let tests: [(Reference, Reference, Bool)] = [
(Reference("name"), Reference("name"), true),
(Reference("name"), Reference("/name"), true),
(Reference("/first/name"), Reference("/first/name"), true),
(Reference(literal: "/name"), Reference(literal: "/name"), true),
(Reference(literal: "/name"), Reference("/~1name"), true),
(Reference(literal: "~name"), Reference("/~0name"), true),

(Reference("different"), Reference("values"), false),
(Reference("name/"), Reference("/name"), false),
(Reference("/first/name"), Reference("/first//name"), false)
]

for (lhs, rhs, expected) in tests {
XCTAssertEqual(lhs == rhs, expected)
}
}
func testFailsWithCorrectError() {
let tests: [(String, ReferenceError)] = [
("", .empty),
Expand Down

0 comments on commit 0fedd19

Please sign in to comment.