Skip to content

Commit fec6279

Browse files
authored
chore: upgrade min OS from 9 to 10 (#284)
* upgrade min OS from 9 to 10
1 parent e555d02 commit fec6279

File tree

13 files changed

+69
-209
lines changed

13 files changed

+69
-209
lines changed

DemoObjCApp/DemoObjcApp.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,12 +717,12 @@
717717
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
718718
GCC_WARN_UNUSED_FUNCTION = YES;
719719
GCC_WARN_UNUSED_VARIABLE = YES;
720-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
720+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
721721
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
722722
MTL_FAST_MATH = YES;
723723
ONLY_ACTIVE_ARCH = YES;
724724
SDKROOT = iphoneos;
725-
TVOS_DEPLOYMENT_TARGET = 9.0;
725+
TVOS_DEPLOYMENT_TARGET = 10.0;
726726
};
727727
name = Debug;
728728
};
@@ -772,11 +772,11 @@
772772
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
773773
GCC_WARN_UNUSED_FUNCTION = YES;
774774
GCC_WARN_UNUSED_VARIABLE = YES;
775-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
775+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
776776
MTL_ENABLE_DEBUG_INFO = NO;
777777
MTL_FAST_MATH = YES;
778778
SDKROOT = iphoneos;
779-
TVOS_DEPLOYMENT_TARGET = 9.0;
779+
TVOS_DEPLOYMENT_TARGET = 10.0;
780780
VALIDATE_PRODUCT = YES;
781781
};
782782
name = Release;

DemoSwiftApp/DemoSwiftApp.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,15 +856,15 @@
856856
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
857857
GCC_WARN_UNUSED_FUNCTION = YES;
858858
GCC_WARN_UNUSED_VARIABLE = YES;
859-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
859+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
860860
MTL_ENABLE_DEBUG_INFO = YES;
861861
ONLY_ACTIVE_ARCH = YES;
862862
SDKROOT = iphoneos;
863863
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
864864
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
865865
SWIFT_VERSION = 5.0;
866866
TARGETED_DEVICE_FAMILY = "1,2";
867-
TVOS_DEPLOYMENT_TARGET = 9.0;
867+
TVOS_DEPLOYMENT_TARGET = 10.0;
868868
};
869869
name = Debug;
870870
};
@@ -914,13 +914,13 @@
914914
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
915915
GCC_WARN_UNUSED_FUNCTION = YES;
916916
GCC_WARN_UNUSED_VARIABLE = YES;
917-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
917+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
918918
MTL_ENABLE_DEBUG_INFO = NO;
919919
SDKROOT = iphoneos;
920920
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
921921
SWIFT_VERSION = 5.0;
922922
TARGETED_DEVICE_FAMILY = "1,2";
923-
TVOS_DEPLOYMENT_TARGET = 9.0;
923+
TVOS_DEPLOYMENT_TARGET = 10.0;
924924
VALIDATE_PRODUCT = YES;
925925
};
926926
name = Release;

OptimizelySwiftSDK.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Pod::Spec.new do |s|
66
s.homepage = "https://docs.developers.optimizely.com/full-stack/docs"
77
s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" }
88
s.author = { "Optimizely" => "support@optimizely.com" }
9-
s.ios.deployment_target = "9.0"
10-
s.tvos.deployment_target = "9.0"
9+
s.ios.deployment_target = "10.0"
10+
s.tvos.deployment_target = "10.0"
1111
s.source = {
1212
:git => "https://github.com/optimizely/swift-sdk.git",
1313
:tag => "v"+s.version.to_s

OptimizelySwiftSDK.xcodeproj/project.pbxproj

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
0B11272E2242D817002A9C20 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EBAEB6C21E3FEF800D13AA9 /* Optimizely.framework */; };
11-
0BAB9B0122567E34000DC388 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
11+
0BAB9B0122567E34000DC388 /* (null) in Sources */ = {isa = PBXBuildFile; };
1212
6E12B1CA22C55A250005E9E6 /* optimizely_6372300739_v4.json in Resources */ = {isa = PBXBuildFile; fileRef = 6E75196222C5211100B2B157 /* optimizely_6372300739_v4.json */; };
1313
6E12B1CB22C55A250005E9E6 /* feature_rollout_toggle_on.json in Resources */ = {isa = PBXBuildFile; fileRef = 6E75196722C5211100B2B157 /* feature_rollout_toggle_on.json */; };
1414
6E12B1CC22C55A250005E9E6 /* feature_rollout_toggle_off.json in Resources */ = {isa = PBXBuildFile; fileRef = 6E75196822C5211100B2B157 /* feature_rollout_toggle_off.json */; };
@@ -1169,8 +1169,8 @@
11691169
6EA425602218E58400B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E614DCD21E3F389005982A1 /* Optimizely.framework */; };
11701170
6EA4256F2218E60A00B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EBAEB6C21E3FEF800D13AA9 /* Optimizely.framework */; };
11711171
6EA4257E2218E61F00B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EBAEB6C21E3FEF800D13AA9 /* Optimizely.framework */; settings = {ATTRIBUTES = (Required, ); }; };
1172-
6EA425962218E6AD00B074B5 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
1173-
6EA425A52218E6AE00B074B5 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
1172+
6EA425962218E6AD00B074B5 /* (null) in Sources */ = {isa = PBXBuildFile; };
1173+
6EA425A52218E6AE00B074B5 /* (null) in Sources */ = {isa = PBXBuildFile; };
11741174
6EA426602219242100B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EBAEB6C21E3FEF800D13AA9 /* Optimizely.framework */; };
11751175
6EA4266F2219243D00B074B5 /* Optimizely.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E614DCD21E3F389005982A1 /* Optimizely.framework */; };
11761176
6ECB270222C526A7005D52DC /* Optimizely.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E75167A22C520D400B2B157 /* Optimizely.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -2791,7 +2791,7 @@
27912791
isa = PBXSourcesBuildPhase;
27922792
buildActionMask = 2147483647;
27932793
files = (
2794-
0BAB9B0122567E34000DC388 /* BuildFile in Sources */,
2794+
0BAB9B0122567E34000DC388 /* (null) in Sources */,
27952795
6E7517D822C520D400B2B157 /* DefaultNotificationCenter.swift in Sources */,
27962796
6E75177622C520D400B2B157 /* SDKVersion.swift in Sources */,
27972797
6E7516FE22C520D400B2B157 /* OptimizelyLogLevel.swift in Sources */,
@@ -3102,7 +3102,7 @@
31023102
6E7516BC22C520D400B2B157 /* DefaultUserProfileService.swift in Sources */,
31033103
6E7517A022C520D400B2B157 /* DataStoreQueueStackImpl+Extension.swift in Sources */,
31043104
6E7517AC22C520D400B2B157 /* Array+Extension.swift in Sources */,
3105-
6EA425A52218E6AE00B074B5 /* BuildFile in Sources */,
3105+
6EA425A52218E6AE00B074B5 /* (null) in Sources */,
31063106
6E75180E22C520D400B2B157 /* DataStoreFile.swift in Sources */,
31073107
6E9B11B822C5489600C22D81 /* OTUtils.swift in Sources */,
31083108
6E9B119022C5488300C22D81 /* AttributeValueTests.swift in Sources */,
@@ -3290,7 +3290,7 @@
32903290
6E7516B722C520D400B2B157 /* DefaultUserProfileService.swift in Sources */,
32913291
6E75179B22C520D400B2B157 /* DataStoreQueueStackImpl+Extension.swift in Sources */,
32923292
6E7517A722C520D400B2B157 /* Array+Extension.swift in Sources */,
3293-
6EA425962218E6AD00B074B5 /* BuildFile in Sources */,
3293+
6EA425962218E6AD00B074B5 /* (null) in Sources */,
32943294
6E75180922C520D400B2B157 /* DataStoreFile.swift in Sources */,
32953295
6E9B11AE22C5489300C22D81 /* OTUtils.swift in Sources */,
32963296
6E9B117A22C5488100C22D81 /* AttributeValueTests.swift in Sources */,
@@ -3704,7 +3704,7 @@
37043704
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
37053705
GCC_WARN_UNUSED_FUNCTION = YES;
37063706
GCC_WARN_UNUSED_VARIABLE = YES;
3707-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
3707+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
37083708
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
37093709
MTL_FAST_MATH = YES;
37103710
ONLY_ACTIVE_ARCH = YES;
@@ -3765,7 +3765,7 @@
37653765
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
37663766
GCC_WARN_UNUSED_FUNCTION = YES;
37673767
GCC_WARN_UNUSED_VARIABLE = YES;
3768-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
3768+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
37693769
MTL_ENABLE_DEBUG_INFO = NO;
37703770
MTL_FAST_MATH = YES;
37713771
SDKROOT = iphoneos;
@@ -3801,7 +3801,7 @@
38013801
SKIP_INSTALL = YES;
38023802
SWIFT_VERSION = 5.0;
38033803
TARGETED_DEVICE_FAMILY = 3;
3804-
TVOS_DEPLOYMENT_TARGET = 9.0;
3804+
TVOS_DEPLOYMENT_TARGET = 10.0;
38053805
};
38063806
name = Debug;
38073807
};
@@ -3828,7 +3828,7 @@
38283828
SKIP_INSTALL = YES;
38293829
SWIFT_VERSION = 5.0;
38303830
TARGETED_DEVICE_FAMILY = 3;
3831-
TVOS_DEPLOYMENT_TARGET = 9.0;
3831+
TVOS_DEPLOYMENT_TARGET = 10.0;
38323832
};
38333833
name = Release;
38343834
};
@@ -3870,7 +3870,7 @@
38703870
SDKROOT = appletvos;
38713871
SWIFT_VERSION = 5.0;
38723872
TARGETED_DEVICE_FAMILY = 3;
3873-
TVOS_DEPLOYMENT_TARGET = 9.0;
3873+
TVOS_DEPLOYMENT_TARGET = 10.0;
38743874
};
38753875
name = Release;
38763876
};
@@ -3900,7 +3900,7 @@
39003900
CLANG_ENABLE_MODULES = YES;
39013901
CODE_SIGN_STYLE = Automatic;
39023902
INFOPLIST_FILE = Tests/Info.plist;
3903-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
3903+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
39043904
LD_RUNPATH_SEARCH_PATHS = (
39053905
"$(inherited)",
39063906
"@executable_path/Frameworks",
@@ -3936,7 +3936,7 @@
39363936
buildSettings = {
39373937
CODE_SIGN_STYLE = Automatic;
39383938
INFOPLIST_FILE = Tests/Info.plist;
3939-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
3939+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
39403940
LD_RUNPATH_SEARCH_PATHS = (
39413941
"$(inherited)",
39423942
"@executable_path/Frameworks",
@@ -4189,7 +4189,7 @@
41894189
DYLIB_INSTALL_NAME_BASE = "@rpath";
41904190
INFOPLIST_FILE = "Sources/Supporting Files/Info.plist";
41914191
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
4192-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
4192+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
41934193
LD_RUNPATH_SEARCH_PATHS = (
41944194
"$(inherited)",
41954195
"@executable_path/Frameworks",
@@ -4215,7 +4215,7 @@
42154215
DYLIB_INSTALL_NAME_BASE = "@rpath";
42164216
INFOPLIST_FILE = "Sources/Supporting Files/Info.plist";
42174217
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
4218-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
4218+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
42194219
LD_RUNPATH_SEARCH_PATHS = (
42204220
"$(inherited)",
42214221
"@executable_path/Frameworks",

Podfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ end
1515

1616
target 'DemoSwiftiOS' do
1717
project 'DemoSwiftApp/DemoSwiftApp.xcodeproj/'
18-
platform :ios, '9.0'
18+
platform :ios, '10.0'
1919
use_frameworks!
2020
analytics_pods
2121
linter_pods
@@ -24,23 +24,23 @@ end
2424

2525
target 'DemoSwifttvOS' do
2626
project 'DemoSwiftApp/DemoSwiftApp.xcodeproj/'
27-
platform :tvos, '9.0'
27+
platform :tvos, '10.0'
2828
use_frameworks!
2929
linter_pods
3030
#pod 'OptimizelySwiftSDK','3.0.0'
3131
end
3232

3333
target 'DemoObjciOS' do
3434
project 'DemoObjcApp/DemoObjcApp.xcodeproj/'
35-
platform :ios, '9.0'
35+
platform :ios, '10.0'
3636
use_frameworks!
3737
analytics_pods
3838
#pod 'OptimizelySwiftSDK','3.0.0'
3939
end
4040

4141
target 'DemoObjctvOS' do
4242
project 'DemoObjcApp/DemoObjcApp.xcodeproj/'
43-
platform :tvos, '9.0'
43+
platform :tvos, '10.0'
4444
use_frameworks!
4545
#pod 'OptimizelySwiftSDK','3.0.0'
4646
end

Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
PODS:
2-
- SwiftLint (0.34.0)
2+
- SwiftLint (0.38.2)
33

44
DEPENDENCIES:
55
- SwiftLint
66

77
SPEC REPOS:
8-
https://github.com/CocoaPods/Specs.git:
8+
trunk:
99
- SwiftLint
1010

1111
SPEC CHECKSUMS:
12-
SwiftLint: 79d48a17c6565dc286c37efb8322c7b450f95c67
12+
SwiftLint: 8f5d2f903e1c9bcbc832fd16771e80a263ac6cbb
1313

14-
PODFILE CHECKSUM: 94877e134bcac3007b5b3e8cdbd17fa6eb0fd375
14+
PODFILE CHECKSUM: 159491f53ea704c30be049e048d854a49f9b7433
1515

1616
COCOAPODS: 1.8.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ See the [Mobile developer documentation](https://docs.developers.optimizely.com/
2121
up an Optimizely X project and start using the SDK.
2222

2323
### Requirements
24-
* iOS 9.0+ / tvOS 9.0+
24+
* iOS 10.0+ / tvOS 10.0+
2525
* Swift 5+
2626

2727
### Installing the SDK

Sources/Customization/DefaultEventDispatcher.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ open class DefaultEventDispatcher: BackgroundingCallbacks, OPTEventDispatcher {
215215
}
216216

217217
func startTimer() {
218-
// timer is activated only for iOS10+ and non-zero interval value
219-
guard #available(iOS 10.0, tvOS 10.0, *), timerInterval > 0 else {
218+
// timer is activated only for non-zero interval value
219+
guard timerInterval > 0 else {
220220
flushEvents()
221221
return
222222
}

Sources/Customization/DefaultLogger.swift

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,20 @@ open class DefaultLogger: OPTLogger {
4141
return
4242
}
4343

44-
if #available(iOS 10.0, tvOS 10.0, *) {
45-
var osLogType: OSLogType
46-
47-
switch level {
48-
case .error: osLogType = .error
49-
case .info: osLogType = .info
50-
case .debug: osLogType = .debug
51-
default: osLogType = .default
52-
}
53-
54-
os_log("[%{public}@] %{public}@", log: .optimizely, type: osLogType, level.name, message)
55-
osLogUsed = true
56-
} else {
57-
let message = "[OPTIMIZELY][" + level.name + "] " + message
58-
NSLog(message)
44+
var osLogType: OSLogType
45+
46+
switch level {
47+
case .error: osLogType = .error
48+
case .info: osLogType = .info
49+
case .debug: osLogType = .debug
50+
default: osLogType = .default
5951
}
52+
53+
os_log("[%{public}@] %{public}@", log: .optimizely, type: osLogType, level.name, message)
54+
osLogUsed = true
6055
}
6156
}
6257

63-
@available(iOS 10.0, tvOS 10.0, *)
6458
extension OSLog {
6559
static let optimizely = OSLog(subsystem: "com.optimizely.swift-sdk", category: "OPTIMIZELY")
6660
}

Sources/Implementation/DefaultDatafileHandler.swift

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -135,47 +135,27 @@ class DefaultDatafileHandler: OPTDatafileHandler {
135135
func startPeriodicUpdates(sdkKey: String, updateInterval: Int, datafileChangeNotification: ((Data) -> Void)?) {
136136

137137
let now = Date()
138-
if #available(iOS 10.0, tvOS 10.0, *) {
139-
DispatchQueue.main.async {
140-
if let timer = self.timers.property?[sdkKey]?.timer, timer.isValid {
141-
return
142-
}
143-
144-
let timer = Timer.scheduledTimer(withTimeInterval: TimeInterval(updateInterval), repeats: false) { (timer) in
145-
146-
self.performPerodicDownload(sdkKey: sdkKey,
147-
startTime: now,
148-
updateInterval: updateInterval,
149-
datafileChangeNotification: datafileChangeNotification)
150-
151-
timer.invalidate()
152-
}
153-
self.timers.performAtomic(atomicOperation: { (timers) in
154-
if let interval = timers[sdkKey]?.interval {
155-
timers[sdkKey] = (timer, interval)
156-
} else {
157-
timers[sdkKey] = (timer, updateInterval)
158-
}
159-
})
138+
DispatchQueue.main.async {
139+
if let timer = self.timers.property?[sdkKey]?.timer, timer.isValid {
140+
return
160141
}
161-
} else {
162-
// Fallback on earlier versions
163-
DispatchQueue.main.async {
164-
if let timer = self.timers.property?[sdkKey]?.timer, timer.isValid {
165-
return
166-
}
167-
168-
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)
142+
143+
let timer = Timer.scheduledTimer(withTimeInterval: TimeInterval(updateInterval), repeats: false) { (timer) in
169144

170-
self.timers.performAtomic(atomicOperation: { (timers) in
171-
if let interval = timers[sdkKey]?.interval {
172-
timers[sdkKey] = (timer, interval)
173-
} else {
174-
timers[sdkKey] = (timer, updateInterval)
175-
}
176-
})
145+
self.performPerodicDownload(sdkKey: sdkKey,
146+
startTime: now,
147+
updateInterval: updateInterval,
148+
datafileChangeNotification: datafileChangeNotification)
149+
150+
timer.invalidate()
177151
}
178-
152+
self.timers.performAtomic(atomicOperation: { (timers) in
153+
if let interval = timers[sdkKey]?.interval {
154+
timers[sdkKey] = (timer, interval)
155+
} else {
156+
timers[sdkKey] = (timer, updateInterval)
157+
}
158+
})
179159
}
180160
}
181161

0 commit comments

Comments
 (0)