Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ jobs:
env: SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=11.4 NAME='iPhone 7 Plus'
name: PLATFORM='iOS Simulator' OS=11.4 NAME='iPhone 7 Plus'
- <<: *unittests
env: SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=9.3 NAME='iPad Air'
name: PLATFORM='iOS Simulator' OS=9.3 NAME='iPad Air'
env: SCHEME=OptimizelySwiftSDK-iOS TEST_SDK=iphonesimulator PLATFORM='iOS Simulator' OS=11.1 NAME='iPad Air'
name: PLATFORM='iOS Simulator' OS=11.1 NAME='iPad Air'
- <<: *unittests
env: SCHEME=OptimizelySwiftSDK-tvOS TEST_SDK=appletvsimulator PLATFORM='tvOS Simulator' OS=12.1 NAME='Apple TV 4K'
name: PLATFORM='tvOS Simulator' OS=12.1 NAME='Apple TV 4K'
Expand Down
8 changes: 4 additions & 4 deletions DemoObjCApp/DemoObjcApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -717,12 +717,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Debug;
};
Expand Down Expand Up @@ -772,11 +772,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
8 changes: 4 additions & 4 deletions DemoSwiftApp/DemoSwiftApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -856,15 +856,15 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Debug;
};
Expand Down Expand Up @@ -914,13 +914,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
4 changes: 2 additions & 2 deletions OptimizelySwiftSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Pod::Spec.new do |s|
s.homepage = "https://docs.developers.optimizely.com/full-stack/docs"
s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" }
s.author = { "Optimizely" => "support@optimizely.com" }
s.ios.deployment_target = "9.0"
s.tvos.deployment_target = "9.0"
s.ios.deployment_target = "10.0"
s.tvos.deployment_target = "10.0"
s.source = {
:git => "https://github.com/optimizely/swift-sdk.git",
:tag => "v"+s.version.to_s
Expand Down
30 changes: 15 additions & 15 deletions OptimizelySwiftSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/* Begin PBXBuildFile section */
0B11272E2242D817002A9C20 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EBAEB6C21E3FEF800D13AA9 /* Optimizely.framework */; };
0BAB9B0122567E34000DC388 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
0BAB9B0122567E34000DC388 /* (null) in Sources */ = {isa = PBXBuildFile; };
6E12B1CA22C55A250005E9E6 /* optimizely_6372300739_v4.json in Resources */ = {isa = PBXBuildFile; fileRef = 6E75196222C5211100B2B157 /* optimizely_6372300739_v4.json */; };
6E12B1CB22C55A250005E9E6 /* feature_rollout_toggle_on.json in Resources */ = {isa = PBXBuildFile; fileRef = 6E75196722C5211100B2B157 /* feature_rollout_toggle_on.json */; };
6E12B1CC22C55A250005E9E6 /* feature_rollout_toggle_off.json in Resources */ = {isa = PBXBuildFile; fileRef = 6E75196822C5211100B2B157 /* feature_rollout_toggle_off.json */; };
Expand Down Expand Up @@ -1169,8 +1169,8 @@
6EA425602218E58400B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E614DCD21E3F389005982A1 /* Optimizely.framework */; };
6EA4256F2218E60A00B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EBAEB6C21E3FEF800D13AA9 /* Optimizely.framework */; };
6EA4257E2218E61F00B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EBAEB6C21E3FEF800D13AA9 /* Optimizely.framework */; settings = {ATTRIBUTES = (Required, ); }; };
6EA425962218E6AD00B074B5 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
6EA425A52218E6AE00B074B5 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
6EA425962218E6AD00B074B5 /* (null) in Sources */ = {isa = PBXBuildFile; };
6EA425A52218E6AE00B074B5 /* (null) in Sources */ = {isa = PBXBuildFile; };
6EA426602219242100B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EBAEB6C21E3FEF800D13AA9 /* Optimizely.framework */; };
6EA4266F2219243D00B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E614DCD21E3F389005982A1 /* Optimizely.framework */; };
6ECB270222C526A7005D52DC /* Optimizely.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E75167A22C520D400B2B157 /* Optimizely.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -2791,7 +2791,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0BAB9B0122567E34000DC388 /* BuildFile in Sources */,
0BAB9B0122567E34000DC388 /* (null) in Sources */,
6E7517D822C520D400B2B157 /* DefaultNotificationCenter.swift in Sources */,
6E75177622C520D400B2B157 /* SDKVersion.swift in Sources */,
6E7516FE22C520D400B2B157 /* OptimizelyLogLevel.swift in Sources */,
Expand Down Expand Up @@ -3102,7 +3102,7 @@
6E7516BC22C520D400B2B157 /* DefaultUserProfileService.swift in Sources */,
6E7517A022C520D400B2B157 /* DataStoreQueueStackImpl+Extension.swift in Sources */,
6E7517AC22C520D400B2B157 /* Array+Extension.swift in Sources */,
6EA425A52218E6AE00B074B5 /* BuildFile in Sources */,
6EA425A52218E6AE00B074B5 /* (null) in Sources */,
6E75180E22C520D400B2B157 /* DataStoreFile.swift in Sources */,
6E9B11B822C5489600C22D81 /* OTUtils.swift in Sources */,
6E9B119022C5488300C22D81 /* AttributeValueTests.swift in Sources */,
Expand Down Expand Up @@ -3290,7 +3290,7 @@
6E7516B722C520D400B2B157 /* DefaultUserProfileService.swift in Sources */,
6E75179B22C520D400B2B157 /* DataStoreQueueStackImpl+Extension.swift in Sources */,
6E7517A722C520D400B2B157 /* Array+Extension.swift in Sources */,
6EA425962218E6AD00B074B5 /* BuildFile in Sources */,
6EA425962218E6AD00B074B5 /* (null) in Sources */,
6E75180922C520D400B2B157 /* DataStoreFile.swift in Sources */,
6E9B11AE22C5489300C22D81 /* OTUtils.swift in Sources */,
6E9B117A22C5488100C22D81 /* AttributeValueTests.swift in Sources */,
Expand Down Expand Up @@ -3704,7 +3704,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -3765,7 +3765,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -3801,7 +3801,7 @@
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Debug;
};
Expand All @@ -3828,7 +3828,7 @@
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Release;
};
Expand Down Expand Up @@ -3870,7 +3870,7 @@
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Release;
};
Expand Down Expand Up @@ -3900,7 +3900,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -3936,7 +3936,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -4189,7 +4189,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "Sources/Supporting Files/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -4215,7 +4215,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "Sources/Supporting Files/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
8 changes: 4 additions & 4 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ end

target 'DemoSwiftiOS' do
project 'DemoSwiftApp/DemoSwiftApp.xcodeproj/'
platform :ios, '9.0'
platform :ios, '10.0'
use_frameworks!
analytics_pods
linter_pods
Expand All @@ -24,23 +24,23 @@ end

target 'DemoSwifttvOS' do
project 'DemoSwiftApp/DemoSwiftApp.xcodeproj/'
platform :tvos, '9.0'
platform :tvos, '10.0'
use_frameworks!
linter_pods
#pod 'OptimizelySwiftSDK','3.0.0'
end

target 'DemoObjciOS' do
project 'DemoObjcApp/DemoObjcApp.xcodeproj/'
platform :ios, '9.0'
platform :ios, '10.0'
use_frameworks!
analytics_pods
#pod 'OptimizelySwiftSDK','3.0.0'
end

target 'DemoObjctvOS' do
project 'DemoObjcApp/DemoObjcApp.xcodeproj/'
platform :tvos, '9.0'
platform :tvos, '10.0'
use_frameworks!
#pod 'OptimizelySwiftSDK','3.0.0'
end
8 changes: 4 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- SwiftLint (0.34.0)
- SwiftLint (0.38.2)

DEPENDENCIES:
- SwiftLint

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
trunk:
- SwiftLint

SPEC CHECKSUMS:
SwiftLint: 79d48a17c6565dc286c37efb8322c7b450f95c67
SwiftLint: 8f5d2f903e1c9bcbc832fd16771e80a263ac6cbb

PODFILE CHECKSUM: 94877e134bcac3007b5b3e8cdbd17fa6eb0fd375
PODFILE CHECKSUM: 159491f53ea704c30be049e048d854a49f9b7433

COCOAPODS: 1.8.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ See the [Mobile developer documentation](https://docs.developers.optimizely.com/
up an Optimizely X project and start using the SDK.

### Requirements
* iOS 9.0+ / tvOS 9.0+
* iOS 10.0+ / tvOS 10.0+
* Swift 5+

### Installing the SDK
Expand Down
2 changes: 1 addition & 1 deletion Sources/Customization/DefaultEventDispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ open class DefaultEventDispatcher: BackgroundingCallbacks, OPTEventDispatcher {

func startTimer() {
// timer is activated only for iOS10+ and non-zero interval value
guard #available(iOS 10.0, tvOS 10.0, *), timerInterval > 0 else {
guard timerInterval > 0 else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update header.

flushEvents()
return
}
Expand Down
26 changes: 10 additions & 16 deletions Sources/Customization/DefaultLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,20 @@ open class DefaultLogger: OPTLogger {
return
}

if #available(iOS 10.0, tvOS 10.0, *) {
var osLogType: OSLogType

switch level {
case .error: osLogType = .error
case .info: osLogType = .info
case .debug: osLogType = .debug
default: osLogType = .default
}

os_log("[%{public}@] %{public}@", log: .optimizely, type: osLogType, level.name, message)
osLogUsed = true
} else {
let message = "[OPTIMIZELY][" + level.name + "] " + message
NSLog(message)
var osLogType: OSLogType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

header.


switch level {
case .error: osLogType = .error
case .info: osLogType = .info
case .debug: osLogType = .debug
default: osLogType = .default
}

os_log("[%{public}@] %{public}@", log: .optimizely, type: osLogType, level.name, message)
osLogUsed = true
}
}

@available(iOS 10.0, tvOS 10.0, *)
extension OSLog {
static let optimizely = OSLog(subsystem: "com.optimizely.swift-sdk", category: "OPTIMIZELY")
}
56 changes: 18 additions & 38 deletions Sources/Implementation/DefaultDatafileHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,47 +135,27 @@ class DefaultDatafileHandler: OPTDatafileHandler {
func startPeriodicUpdates(sdkKey: String, updateInterval: Int, datafileChangeNotification: ((Data) -> Void)?) {

let now = Date()
if #available(iOS 10.0, tvOS 10.0, *) {
DispatchQueue.main.async {
if let timer = self.timers.property?[sdkKey]?.timer, timer.isValid {
return
}

let timer = Timer.scheduledTimer(withTimeInterval: TimeInterval(updateInterval), repeats: false) { (timer) in

self.performPerodicDownload(sdkKey: sdkKey,
startTime: now,
updateInterval: updateInterval,
datafileChangeNotification: datafileChangeNotification)

timer.invalidate()
}
self.timers.performAtomic(atomicOperation: { (timers) in
if let interval = timers[sdkKey]?.interval {
timers[sdkKey] = (timer, interval)
} else {
timers[sdkKey] = (timer, updateInterval)
}
})
DispatchQueue.main.async {
if let timer = self.timers.property?[sdkKey]?.timer, timer.isValid {
return
}
} else {
// Fallback on earlier versions
DispatchQueue.main.async {
if let timer = self.timers.property?[sdkKey]?.timer, timer.isValid {
return
}

let timer = Timer.scheduledTimer(timeInterval: TimeInterval(updateInterval), target: self, selector: #selector(self.timerFired(timer:)), userInfo: ["sdkKey": sdkKey, "startTime": Date(), "updateInterval": updateInterval, "datafileChangeNotification": datafileChangeNotification ?? { (data) in }], repeats: false)

let timer = Timer.scheduledTimer(withTimeInterval: TimeInterval(updateInterval), repeats: false) { (timer) in

self.timers.performAtomic(atomicOperation: { (timers) in
if let interval = timers[sdkKey]?.interval {
timers[sdkKey] = (timer, interval)
} else {
timers[sdkKey] = (timer, updateInterval)
}
})
self.performPerodicDownload(sdkKey: sdkKey,
startTime: now,
updateInterval: updateInterval,
datafileChangeNotification: datafileChangeNotification)

timer.invalidate()
}

self.timers.performAtomic(atomicOperation: { (timers) in
if let interval = timers[sdkKey]?.interval {
timers[sdkKey] = (timer, interval)
} else {
timers[sdkKey] = (timer, updateInterval)
}
})
}
}

Expand Down
Loading