Skip to content

Commit

Permalink
Prepare 4.1.0 release (#180)
Browse files Browse the repository at this point in the history
* Changes user-device to device model identifier (#75)

* installs new deviceModel into EnvironmentReporter and renames old deviceModel to deviceType

* use CwSysCtl for macos model

* Replaced entire flag store ff array instead of in place manipulation

* Updated CHANGELOG and bumped version number

* Added correct copy behavior to FlagStore delete and update

* Improved CHANGELOG entry for 4.0.1

* Changed version to 4.1.0, updated CHANGELOG

* Update 4.1.0 release date

* Made CHANGELOG entry for macos model change more clear
  • Loading branch information
torchhound authored Jun 19, 2019
1 parent ef54baf commit e20c9c3
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 20 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to the LaunchDarkly iOS SDK will be documented in this file.
### Multiple Environment clients
Version 4.0.0 does not support multiple environments. If you use version `2.14.0` or later and set `LDConfig`'s `secondaryMobileKeys` you will not be able to migrate to version `4.0.0`. Multiple Environments will be added in a future release to the Swift SDK.

## [4.1.0] - 2019-06-19
### Change
- Installs new `deviceModel` into `EnvironmentReporter` and renames old `deviceModel` to `deviceType`.
- Updated MacOS model detection to use `CwSysCtl`.

### Fixed
- Fixed a concurrency bug that caused crashes in FlagStore.swift. This bug could surface during rapid updates to local flags.

## [4.0.0] - 2019-04-18
This is the non-beta first release of the Swift SDK. It follows the beta.3 release from 2019-03-07. Unlike previous Swift SDK releases, this release does not have a `3.0.0` companion tag.
### Changed
Expand Down
4 changes: 2 additions & 2 deletions LaunchDarkly.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |ld|

ld.name = "LaunchDarkly"
ld.version = "4.0.0"
ld.version = "4.1.0"
ld.summary = "iOS SDK for LaunchDarkly"

ld.description = <<-DESC
Expand All @@ -25,7 +25,7 @@ Pod::Spec.new do |ld|
ld.tvos.deployment_target = "9.0"
ld.osx.deployment_target = "10.10"

ld.source = { :git => "https://github.com/launchdarkly/ios-client-sdk.git", :tag => '4.0.0'}
ld.source = { :git => "https://github.com/launchdarkly/ios-client-sdk.git", :tag => '4.1.0'}

ld.source_files = "LaunchDarkly/LaunchDarkly/**/*.{h,m,swift}"

Expand Down
18 changes: 9 additions & 9 deletions LaunchDarkly.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1056,12 +1056,12 @@
TargetAttributes = {
831188372113A16900D77CB5 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1010;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
831EF33A20655D700001C643 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1010;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
8354EFC11F22491C00C05156 = {
Expand All @@ -1076,7 +1076,7 @@
};
83D9EC6A2062DBB7004D7FA6 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1010;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -1696,7 +1696,7 @@
PRODUCT_NAME = LaunchDarkly_tvOS;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down Expand Up @@ -1729,7 +1729,7 @@
PRODUCT_NAME = LaunchDarkly_tvOS;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down Expand Up @@ -1762,7 +1762,7 @@
PRODUCT_NAME = LaunchDarkly_macOS;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1793,7 +1793,7 @@
PRODUCT_NAME = LaunchDarkly_macOS;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -2056,7 +2056,7 @@
PRODUCT_NAME = LaunchDarkly_watchOS;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
Expand Down Expand Up @@ -2093,7 +2093,7 @@
PRODUCT_NAME = LaunchDarkly_watchOS;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,31 @@ struct EnvironmentReporter: EnvironmentReporting {
}
#endif

#if os(iOS)
struct Constants {
fileprivate static let simulatorModelIdentifier = "SIMULATOR_MODEL_IDENTIFIER"
}

var deviceModel: String {
#if os(OSX)
return Sysctl.model
#else
//Obtaining the device model from https://stackoverflow.com/questions/26028918/how-to-determine-the-current-iphone-device-model answer by Jens Schwarzer
if let simulatorModelIdentifier = ProcessInfo().environment[Constants.simulatorModelIdentifier] {
return simulatorModelIdentifier
}
//the physical device code here is not automatically testable. Manual testing on physical devices is required.
var systemInfo = utsname()
_ = uname(&systemInfo)
guard let deviceModel = String(bytes: Data(bytes: &systemInfo.machine, count: Int(_SYS_NAMELEN)), encoding: .ascii)
else {
return deviceType
}
return deviceModel.trimmingCharacters(in: .controlCharacters)
#endif
}

#if os(iOS)
var deviceType: String {
return UIDevice.current.model
}
var systemVersion: String {
Expand All @@ -97,7 +120,7 @@ struct EnvironmentReporter: EnvironmentReporting {
return UIDevice.current.identifierForVendor?.uuidString
}
#elseif os(watchOS)
var deviceModel: String {
var deviceType: String {
return WKInterfaceDevice.current().model
}
var systemVersion: String {
Expand All @@ -119,7 +142,7 @@ struct EnvironmentReporter: EnvironmentReporting {
return nil
}
#elseif os(OSX)
var deviceModel: String {
var deviceType: String {
return Sysctl.modelWithoutVersion
}
var systemVersion: String {
Expand All @@ -141,7 +164,7 @@ struct EnvironmentReporter: EnvironmentReporting {
return nil
}
#elseif os(tvOS)
var deviceModel: String {
var deviceType: String {
return UIDevice.current.model
}
var systemVersion: String {
Expand Down
15 changes: 12 additions & 3 deletions LaunchDarkly/LaunchDarkly/Service Objects/FlagStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ final class FlagStore: FlagMaintaining {
}

Log.debug(self.typeName(and: #function) + "succeeded. new flag: \(newFlag), " + "prior flag: \(String(describing: self.featureFlags[flagKey]))")
self.featureFlags[flagKey] = newFlag

var localFeatureFlags: [LDFlagKey: FeatureFlag] = [:]
self.featureFlags.forEach { key, value in
localFeatureFlags[key] = value
}
localFeatureFlags[flagKey] = newFlag
self.featureFlags = localFeatureFlags
}
}

Expand Down Expand Up @@ -136,7 +140,12 @@ final class FlagStore: FlagMaintaining {
}

Log.debug(self.typeName(and: #function) + "deleted flag with key: " + flagKey)
self.featureFlags.removeValue(forKey: flagKey)
var localFeatureFlags: [LDFlagKey: FeatureFlag] = [:]
self.featureFlags.forEach { key, value in
localFeatureFlags[key] = value
}
localFeatureFlags.removeValue(forKey: flagKey)
self.featureFlags = localFeatureFlags
}
}

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $ gem install cocoapods
```ruby
use_frameworks!
target 'YourTargetName' do
pod 'LaunchDarkly', '4.0.0'
pod 'LaunchDarkly', '4.1.0'
end
```

Expand Down Expand Up @@ -70,7 +70,7 @@ $ brew install carthage
To integrate LaunchDarkly into your Xcode project using Carthage, specify it in your `Cartfile`:

```ogdl
github "launchdarkly/ios-client-sdk" "4.0.0"
github "launchdarkly/ios-client-sdk" "4.1.0"
```

Run `carthage update` to build the framework. Optionally, specify the `--platform` to build only the frameworks that support your platform(s).
Expand Down

0 comments on commit e20c9c3

Please sign in to comment.