diff --git a/.travis.yml b/.travis.yml index c0b8c1f..6dbd6d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,10 @@ language: objective-c os: - osx -language: generic dist: trusty -osx_image: xcode8.3 +osx_image: xcode12.4 script: - xcodebuild -version; xcodebuild -showsdks; - ./run_tests.sh; + travis_wait 60 ./run_tests.sh; diff --git a/Cartfile b/Cartfile index 12c2ee5..a9f863b 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "ReactiveX/RxSwift" ~> 4.2.0 +github "ReactiveX/RxSwift" "6.1.0" \ No newline at end of file diff --git a/Cartfile.resolved b/Cartfile.resolved index 00b43a8..dc33243 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1 @@ -github "ReactiveX/RxSwift" "4.2.0" +github "ReactiveX/RxSwift" "6.1.0" diff --git a/LifxDomain/LifxDomain.xcodeproj/project.pbxproj b/LifxDomain/LifxDomain.xcodeproj/project.pbxproj index 0feb2a4..d79dada 100644 --- a/LifxDomain/LifxDomain.xcodeproj/project.pbxproj +++ b/LifxDomain/LifxDomain.xcodeproj/project.pbxproj @@ -3,10 +3,12 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ + 102D621F26148D4E0072B226 /* RxSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 102D621E26148D4E0072B226 /* RxSwift.xcframework */; }; + 102D622026148D4E0072B226 /* RxSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 102D621E26148D4E0072B226 /* RxSwift.xcframework */; }; 107C08871E23989500552E9F /* LifxDomain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 107C087D1E23989500552E9F /* LifxDomain.framework */; }; 107C088C1E23989500552E9F /* DataInputStreamTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 107C088B1E23989500552E9F /* DataInputStreamTests.swift */; }; 107C088E1E23989600552E9F /* LifxDomain.h in Headers */ = {isa = PBXBuildFile; fileRef = 107C08801E23989500552E9F /* LifxDomain.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -27,13 +29,13 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 102D621E26148D4E0072B226 /* RxSwift.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = RxSwift.xcframework; path = ../Carthage/Build/RxSwift.xcframework; sourceTree = ""; }; 107C087D1E23989500552E9F /* LifxDomain.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LifxDomain.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 107C08801E23989500552E9F /* LifxDomain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LifxDomain.h; sourceTree = ""; }; 107C08811E23989500552E9F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 107C08861E23989500552E9F /* LifxDomainTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LifxDomainTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 107C088B1E23989500552E9F /* DataInputStreamTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataInputStreamTests.swift; sourceTree = ""; }; 107C088D1E23989600552E9F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 107C08A11E23993900552E9F /* RxLifx.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxLifx.framework; path = "../../../Library/Developer/Xcode/DerivedData/RxLifx-dhhbjuuutiyklddmrqllkyqirybj/Build/Products/Debug-iphonesimulator/RxLifx.framework"; sourceTree = ""; }; 107C08A31E23994C00552E9F /* DomainModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DomainModel.swift; sourceTree = ""; }; 107C08A51E23996100552E9F /* DataStreams.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataStreams.swift; sourceTree = ""; }; 107C08A71E23997000552E9F /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = ""; }; @@ -45,6 +47,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 102D621F26148D4E0072B226 /* RxSwift.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -53,6 +56,7 @@ buildActionMask = 2147483647; files = ( 107C08871E23989500552E9F /* LifxDomain.framework in Frameworks */, + 102D622026148D4E0072B226 /* RxSwift.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -103,7 +107,7 @@ 107C08A01E23993900552E9F /* Frameworks */ = { isa = PBXGroup; children = ( - 107C08A11E23993900552E9F /* RxLifx.framework */, + 102D621E26148D4E0072B226 /* RxSwift.xcframework */, ); name = Frameworks; sourceTree = ""; @@ -165,12 +169,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0810; - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1240; ORGANIZATIONNAME = "Florian Sprenger"; TargetAttributes = { 107C087C1E23989500552E9F = { CreatedOnToolsVersion = 8.1; - LastSwiftMigration = 0920; + LastSwiftMigration = 1240; ProvisioningStyle = Automatic; }; 107C08851E23989500552E9F = { @@ -182,10 +186,11 @@ }; buildConfigurationList = 107C08771E23989500552E9F /* Build configuration list for PBXProject "LifxDomain" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 107C08731E23989500552E9F; productRefGroup = 107C087E1E23989500552E9F /* Products */; @@ -250,6 +255,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -270,6 +276,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -296,7 +303,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.1; + IPHONEOS_DEPLOYMENT_TARGET = 14.4; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -312,6 +319,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -332,6 +340,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -352,10 +361,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.1; + IPHONEOS_DEPLOYMENT_TARGET = 14.4; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -369,18 +379,23 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = LifxDomain/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = wo.lf.LifxDomain; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -390,17 +405,22 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = LifxDomain/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = wo.lf.LifxDomain; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -408,8 +428,14 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = LifxDomainTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = wo.lf.LifxDomainTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.0; @@ -420,8 +446,14 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = LifxDomainTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = wo.lf.LifxDomainTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.0; diff --git a/LifxDomain/LifxDomain.xcodeproj/xcshareddata/xcschemes/LifxDomain.xcscheme b/LifxDomain/LifxDomain.xcodeproj/xcshareddata/xcschemes/LifxDomain.xcscheme index 895d717..65bb0e3 100644 --- a/LifxDomain/LifxDomain.xcodeproj/xcshareddata/xcschemes/LifxDomain.xcscheme +++ b/LifxDomain/LifxDomain.xcodeproj/xcshareddata/xcschemes/LifxDomain.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -39,17 +48,6 @@ - - - - - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - - - - - (lightSource: LightSource, light:Light?, message:Message, sideEffect: (() -> ())? = nil) -> Observable>{ return Observable.create { subscriber in diff --git a/RxLifxApi/RxLifxApi/Light.swift b/RxLifxApi/RxLifxApi/Light.swift index 6995505..3d7a670 100644 --- a/RxLifxApi/RxLifxApi/Light.swift +++ b/RxLifxApi/RxLifxApi/Light.swift @@ -39,7 +39,7 @@ public protocol LightsChangeDispatcher { func lightAdded(light: Light) } -public enum LightPropertyName{ +public enum LightPropertyName { case color case zones case power @@ -72,29 +72,51 @@ public class Light: Equatable { public static let productsSupportingTile = [55] - public lazy var color:LightProperty = { LightProperty(light: self, name: .color) }() + public lazy var color: LightProperty = { + LightProperty(light: self, name: .color) + }() - public lazy var zones:LightProperty = { LightProperty(light: self, name: .zones) }() + public lazy var zones: LightProperty = { + LightProperty(light: self, name: .zones) + }() - public lazy var power: LightProperty = { LightProperty(light: self, name: .power) }() + public lazy var power: LightProperty = { + LightProperty(light: self, name: .power) + }() - public lazy var label: LightProperty = { LightProperty(light: self, name: .label) }() + public lazy var label: LightProperty = { + LightProperty(light: self, name: .label) + }() - public lazy var hostFirmware: LightProperty = { LightProperty(light: self, name: .hostFirmware) }() + public lazy var hostFirmware: LightProperty = { + LightProperty(light: self, name: .hostFirmware) + }() - public lazy var wifiFirmware: LightProperty = { LightProperty(light: self, name: .wifiFirmware) }() + public lazy var wifiFirmware: LightProperty = { + LightProperty(light: self, name: .wifiFirmware) + }() - public lazy var version: LightProperty = { LightProperty(light: self, name: .version) }() + public lazy var version: LightProperty = { + LightProperty(light: self, name: .version) + }() - public lazy var group: LightProperty = { LightProperty(light: self, name: .group, defaultValue: LightGroup.defaultGroup) }() + public lazy var group: LightProperty = { + LightProperty(light: self, name: .group, defaultValue: LightGroup.defaultGroup) + }() - public lazy var location: LightProperty = { LightProperty(light: self, name: .location, defaultValue: LightLocation.defaultLocation) }() + public lazy var location: LightProperty = { + LightProperty(light: self, name: .location, defaultValue: LightLocation.defaultLocation) + }() - public lazy var infraredBrightness: LightProperty = { LightProperty(light: self, name: .infraredBrightness) }() + public lazy var infraredBrightness: LightProperty = { + LightProperty(light: self, name: .infraredBrightness) + }() - public lazy var reachable: LightProperty = { LightProperty(light: self, name: .reachable, defaultValue: false) }() + public lazy var reachable: LightProperty = { + LightProperty(light: self, name: .reachable, defaultValue: false) + }() - public var lastSeenAt:Date = Date.distantPast + public var lastSeenAt: Date = Date.distantPast public var powerState: Bool { get { @@ -137,10 +159,10 @@ public class Light: Equatable { } public func updateReachability() { - reachable.updateFromClient(value: lastSeenAt.timeIntervalSinceNow > -11 ) + reachable.updateFromClient(value: lastSeenAt.timeIntervalSinceNow > -11) } - public func attach(observable: GroupedObservable) -> Light{ + public func attach(observable: GroupedObservable) -> Light { dispose() disposeBag = CompositeDisposable() @@ -159,7 +181,7 @@ public class Light: Equatable { c in self.pollState() self.updateReachability() - if(c % Light.refreshMutablePropertiesTickModulo == 0){ + if (c % Light.refreshMutablePropertiesTickModulo == 0) { self.pollMutableProperties() } return @@ -170,34 +192,34 @@ public class Light: Equatable { return self } - private func pollState(){ + private func pollState() { LightGetCommand.create(light: self).fireAndForget() - if(supportsMultiZone) { + if (supportsMultiZone) { MultiZoneGetColorZonesCommand.create(light: self, startIndex: UInt8.min, endIndex: UInt8.max).fireAndForget() } - if(supportsInfrared) { + if (supportsInfrared) { LightGetInfraredCommand.create(light: self).fireAndForget() } } - private func pollProperties(){ + private func pollProperties() { DeviceGetHostFirmwareCommand.create(light: self).fireAndForget() DeviceGetWifiFirmwareCommand.create(light: self).fireAndForget() DeviceGetVersionCommand.create(light: self).fireAndForget() pollMutableProperties() } - private func pollMutableProperties(){ + private func pollMutableProperties() { DeviceGetGroupCommand.create(light: self).fireAndForget() DeviceGetLocationCommand.create(light: self).fireAndForget() } - public static func == (lhs: Light, rhs: Light) -> Bool { + public static func ==(lhs: Light, rhs: Light) -> Bool { return lhs.target == rhs.target } } -public class LightProperty { +public class LightProperty { private var _value: T? = nil public var value: T? { @@ -239,37 +261,37 @@ public class LightProperty { } } -public class FirmwareVersion: Equatable{ +public class FirmwareVersion: Equatable { public let build: UInt64 public let version: UInt32 - init(build: UInt64, version: UInt32){ + init(build: UInt64, version: UInt32) { self.build = build self.version = version } - public static func == (lhs: FirmwareVersion, rhs: FirmwareVersion) -> Bool { + public static func ==(lhs: FirmwareVersion, rhs: FirmwareVersion) -> Bool { return lhs.build == rhs.build && lhs.version == rhs.version } } -public class LightVersion: Equatable{ +public class LightVersion: Equatable { public let vendor: UInt32 public let product: UInt32 public let version: UInt32 - init(vendor: UInt32, product: UInt32, version: UInt32){ + init(vendor: UInt32, product: UInt32, version: UInt32) { self.vendor = vendor self.product = product self.version = version } - public static func == (lhs: LightVersion, rhs: LightVersion) -> Bool { + public static func ==(lhs: LightVersion, rhs: LightVersion) -> Bool { return lhs.vendor == rhs.vendor && lhs.product == rhs.product && lhs.version == rhs.version } } -public class LightLocation: Equatable{ +public class LightLocation: Equatable { static let defaultLocation = LightLocation(id: Array(repeating: 48, count: 8), label: "", updatedAt: Date(timeIntervalSince1970: 0)) public let id: [UInt8] @@ -277,18 +299,18 @@ public class LightLocation: Equatable{ public let updatedAt: Date public lazy var identifier: String = String(describing: id.map({ UnicodeScalar($0) })) - init(id: [UInt8], label:String, updatedAt: Date){ + init(id: [UInt8], label: String, updatedAt: Date) { self.id = id self.label = label self.updatedAt = updatedAt } - public static func == (lhs: LightLocation, rhs: LightLocation) -> Bool { + public static func ==(lhs: LightLocation, rhs: LightLocation) -> Bool { return lhs.id == rhs.id && lhs.label == rhs.label && lhs.updatedAt == rhs.updatedAt } } -public class LightGroup: Equatable{ +public class LightGroup: Equatable { static let defaultGroup = LightGroup(id: Array(repeating: 48, count: 8), label: "", updatedAt: Date(timeIntervalSince1970: 0)) public let id: [UInt8] @@ -296,29 +318,29 @@ public class LightGroup: Equatable{ public let updatedAt: Date public lazy var identifier: String = String(describing: id.map({ UnicodeScalar($0) })) - init(id: [UInt8], label:String, updatedAt: Date){ + init(id: [UInt8], label: String, updatedAt: Date) { self.id = id self.label = label self.updatedAt = updatedAt } - public static func == (lhs: LightGroup, rhs: LightGroup) -> Bool { + public static func ==(lhs: LightGroup, rhs: LightGroup) -> Bool { return lhs.id == rhs.id && lhs.label == rhs.label && lhs.updatedAt == rhs.updatedAt } } -public class MultiZones: Equatable{ - public var colors:[HSBK] = [] +public class MultiZones: Equatable { + public var colors: [HSBK] = [] - public static func == (lhs: MultiZones, rhs: MultiZones) -> Bool { + public static func ==(lhs: MultiZones, rhs: MultiZones) -> Bool { return false } func dimTo(_ count: Int) { - while(colors.count < count){ - colors.append(HSBK(hue: 0, saturation:0, brightness: 0, kelvin: 0)) + while (colors.count < count) { + colors.append(HSBK(hue: 0, saturation: 0, brightness: 0, kelvin: 0)) } - while(colors.count > count){ + while (colors.count > count) { colors.removeLast() } } diff --git a/RxLifxApi/RxLifxApi/LightService.swift b/RxLifxApi/RxLifxApi/LightService.swift index 28587d9..b70f7d4 100644 --- a/RxLifxApi/RxLifxApi/LightService.swift +++ b/RxLifxApi/RxLifxApi/LightService.swift @@ -23,7 +23,7 @@ import RxLifx import LifxDomain public struct LightServiceConstants{ - public static let transportRetryTimeout = RxTimeInterval(5) + public static let transportRetryTimeout = RxTimeInterval.seconds(5) } public protocol LightServiceExtension: LightsChangeDispatcher { @@ -69,7 +69,7 @@ public class LightService: LightSource where T:Transport, T.TMG == LightMessa } self.extensions = extensions self.lightsChangeDispatcher = changeDispatcher - self.tick = Observable.interval(5, scheduler: mainScheduler).publish().refCount() + self.tick = Observable.interval(.seconds(5), scheduler: mainScheduler).publish().refCount() self.mainScheduler = mainScheduler self.ioScheduler = ioScheduler @@ -77,8 +77,8 @@ public class LightService: LightSource where T:Transport, T.TMG == LightMessa legacyUdpTransport = transportGenerator.init(port: String(Header.LIFX_DEFAULT_PORT), generator: LightMessageGenerator()) messages = Observable.of( - udpTransport.messages.retryWhen({ (errors: Observable) in return errors.flatMap{ (error:Error) -> Observable in Observable.timer(LightServiceConstants.transportRetryTimeout, scheduler: ioScheduler)}}), - legacyUdpTransport.messages.retryWhen({ (errors: Observable) in return errors.flatMap{ (error:Error) -> Observable in Observable.timer(LightServiceConstants.transportRetryTimeout, scheduler: ioScheduler)}}) + udpTransport.messages.retry(when: { (errors: Observable) in return errors.flatMap{ (error:Error) -> Observable in Observable.timer(LightServiceConstants.transportRetryTimeout, scheduler: ioScheduler)}}), + legacyUdpTransport.messages.retry(when: { (errors: Observable) in return errors.flatMap{ (error:Error) -> Observable in Observable.timer(LightServiceConstants.transportRetryTimeout, scheduler: ioScheduler)}}) ).merge().publish().refCount() } @@ -86,8 +86,8 @@ public class LightService: LightSource where T:Transport, T.TMG == LightMessa disposeBag.dispose() disposeBag = CompositeDisposable() let _ = disposeBag.insert( - messages.subscribeOn(ioScheduler) - .observeOn(mainScheduler) + messages.subscribe(on: ioScheduler) + .observe(on: mainScheduler) .filter({ (message: SourcedMessage) in return message.message.header.target != 0 }) @@ -130,7 +130,7 @@ public class LightService: LightSource where T:Transport, T.TMG == LightMessa } private func broadcastStateServiceDelayed() -> Disposable { - return Observable.timer(1, period: nil, scheduler: self.ioScheduler).subscribe{ event in + return Observable.timer(.seconds(1), period: nil, scheduler: self.ioScheduler).subscribe{ event in switch(event){ case .next(_): BroadcastGetServiceCommand.create(lightSource: self).fireAndForget() diff --git a/RxLifxApi/RxLifxApi/LightTileService.swift b/RxLifxApi/RxLifxApi/LightTileService.swift index 3bb6376..e7e5003 100644 --- a/RxLifxApi/RxLifxApi/LightTileService.swift +++ b/RxLifxApi/RxLifxApi/LightTileService.swift @@ -88,7 +88,7 @@ public class LightTileService: LightServiceExtension { } }) - _ = disposables.insert(source.messages.observeOn(source.mainScheduler).filter { + _ = disposables.insert(source.messages.observe(on: source.mainScheduler).filter { self.tilesById[$0.message.header.target] != nil }.subscribe(onNext: { message in switch (message.message.header.type) { diff --git a/RxLifxApi/RxLifxApi/LightsGroupLocationService.swift b/RxLifxApi/RxLifxApi/LightsGroupLocationService.swift index ca279e2..05d3eb0 100644 --- a/RxLifxApi/RxLifxApi/LightsGroupLocationService.swift +++ b/RxLifxApi/RxLifxApi/LightsGroupLocationService.swift @@ -51,7 +51,7 @@ public class LightsGroup { } fileprivate func remove(light: Light) { - if let index = lights.index(of: light) { + if let index = lights.firstIndex(of: light) { lights.remove(at: index) } } diff --git a/RxLifxExample/RxLifxExample.xcodeproj/project.pbxproj b/RxLifxExample/RxLifxExample.xcodeproj/project.pbxproj index 4cae6fa..e81f6f1 100644 --- a/RxLifxExample/RxLifxExample.xcodeproj/project.pbxproj +++ b/RxLifxExample/RxLifxExample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -11,6 +11,8 @@ 10246EA11E4DD77800ED98C7 /* RxLifx.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 10246E9F1E4DD77800ED98C7 /* RxLifx.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 10246EA31E4DD77800ED98C7 /* LifxDomain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 10246EA21E4DD77800ED98C7 /* LifxDomain.framework */; }; 10246EA41E4DD77800ED98C7 /* LifxDomain.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 10246EA21E4DD77800ED98C7 /* LifxDomain.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 102D623926148E110072B226 /* RxSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 102D621C26148D2F0072B226 /* RxSwift.xcframework */; }; + 102D623A26148E110072B226 /* RxSwift.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 102D621C26148D2F0072B226 /* RxSwift.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 107C08B61E239A0B00552E9F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 107C08B51E239A0B00552E9F /* AppDelegate.swift */; }; 107C08B91E239A0B00552E9F /* RxLifxExample.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 107C08B71E239A0B00552E9F /* RxLifxExample.xcdatamodeld */; }; 107C08BB1E239A0B00552E9F /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 107C08BA1E239A0B00552E9F /* MasterViewController.swift */; }; @@ -20,8 +22,6 @@ 107C08C51E239A0B00552E9F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 107C08C31E239A0B00552E9F /* LaunchScreen.storyboard */; }; 10DE9AB31E5B05F9007D0095 /* RxLifxApi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 10DE9AB21E5B05F9007D0095 /* RxLifxApi.framework */; }; 10DE9AB41E5B05F9007D0095 /* RxLifxApi.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 10DE9AB21E5B05F9007D0095 /* RxLifxApi.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 10DE9AB61E5B06DC007D0095 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 10DE9AB51E5B06DC007D0095 /* RxSwift.framework */; }; - 10DE9AB71E5B06DC007D0095 /* RxSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 10DE9AB51E5B06DC007D0095 /* RxSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; DD1E1E8622D39B88FCDA7890 /* LightsChangeNotificationDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD1E1AE0FAEF56BA8659D993 /* LightsChangeNotificationDispatcher.swift */; }; /* End PBXBuildFile section */ @@ -32,8 +32,8 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 10DE9AB71E5B06DC007D0095 /* RxSwift.framework in Embed Frameworks */, 10246EA41E4DD77800ED98C7 /* LifxDomain.framework in Embed Frameworks */, + 102D623A26148E110072B226 /* RxSwift.xcframework in Embed Frameworks */, 10246EA11E4DD77800ED98C7 /* RxLifx.framework in Embed Frameworks */, 10DE9AB41E5B05F9007D0095 /* RxLifxApi.framework in Embed Frameworks */, ); @@ -45,6 +45,7 @@ /* Begin PBXFileReference section */ 10246E9F1E4DD77800ED98C7 /* RxLifx.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RxLifx.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 10246EA21E4DD77800ED98C7 /* LifxDomain.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = LifxDomain.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 102D621C26148D2F0072B226 /* RxSwift.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = RxSwift.xcframework; path = ../Carthage/Build/RxSwift.xcframework; sourceTree = ""; }; 107C08B21E239A0B00552E9F /* RxLifxExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RxLifxExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 107C08B51E239A0B00552E9F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 107C08B81E239A0B00552E9F /* RxLifxExample.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = RxLifxExample.xcdatamodel; sourceTree = ""; }; @@ -55,7 +56,6 @@ 107C08C41E239A0B00552E9F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 107C08C61E239A0B00552E9F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 10DE9AB21E5B05F9007D0095 /* RxLifxApi.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RxLifxApi.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 10DE9AB51E5B06DC007D0095 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = ../Carthage/Build/iOS/RxSwift.framework; sourceTree = ""; }; DD1E1AE0FAEF56BA8659D993 /* LightsChangeNotificationDispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LightsChangeNotificationDispatcher.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -64,8 +64,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 10DE9AB61E5B06DC007D0095 /* RxSwift.framework in Frameworks */, 10246EA31E4DD77800ED98C7 /* LifxDomain.framework in Frameworks */, + 102D623926148E110072B226 /* RxSwift.xcframework in Frameworks */, 10DE9AB31E5B05F9007D0095 /* RxLifxApi.framework in Frameworks */, 10246EA01E4DD77800ED98C7 /* RxLifx.framework in Frameworks */, ); @@ -110,7 +110,7 @@ 107C08D01E239BDB00552E9F /* Frameworks */ = { isa = PBXGroup; children = ( - 10DE9AB51E5B06DC007D0095 /* RxSwift.framework */, + 102D621C26148D2F0072B226 /* RxSwift.xcframework */, 10DE9AB21E5B05F9007D0095 /* RxLifxApi.framework */, 10246EA21E4DD77800ED98C7 /* LifxDomain.framework */, 10246E9F1E4DD77800ED98C7 /* RxLifx.framework */, @@ -147,12 +147,11 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0810; - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1240; ORGANIZATIONNAME = "Florian Sprenger"; TargetAttributes = { 107C08B11E239A0B00552E9F = { CreatedOnToolsVersion = 8.1; - DevelopmentTeam = HSVZA7GLYN; LastSwiftMigration = 0920; ProvisioningStyle = Automatic; }; @@ -160,7 +159,7 @@ }; buildConfigurationList = 107C08AD1E239A0B00552E9F /* Build configuration list for PBXProject "RxLifxExample" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -246,6 +245,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -266,6 +266,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -291,7 +292,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.1; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -305,6 +306,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -325,6 +327,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -344,10 +347,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.1; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -357,17 +361,20 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = HSVZA7GLYN; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/../Carthage/Build/iOS", ); INFOPLIST_FILE = RxLifxExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = wo.lf.RxLifxExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -375,17 +382,20 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = HSVZA7GLYN; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/../Carthage/Build/iOS", ); INFOPLIST_FILE = RxLifxExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = wo.lf.RxLifxExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/RxLifxExample/RxLifxExample/AppDelegate.swift b/RxLifxExample/RxLifxExample/AppDelegate.swift index d84675f..d3aebac 100644 --- a/RxLifxExample/RxLifxExample/AppDelegate.swift +++ b/RxLifxExample/RxLifxExample/AppDelegate.swift @@ -25,7 +25,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let splitViewController = self.window!.rootViewController as! UISplitViewController let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem diff --git a/RxLifxExample/RxLifxExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/RxLifxExample/RxLifxExample/Assets.xcassets/AppIcon.appiconset/Contents.json index 1d060ed..9221b9b 100644 --- a/RxLifxExample/RxLifxExample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/RxLifxExample/RxLifxExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -2,92 +2,97 @@ "images" : [ { "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" + "scale" : "3x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" + "scale" : "3x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" + "scale" : "3x", + "size" : "40x40" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" + "scale" : "2x", + "size" : "60x60" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" + "scale" : "3x", + "size" : "60x60" }, { "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" + "scale" : "1x", + "size" : "20x20" }, { "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" + "scale" : "1x", + "size" : "29x29" }, { "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" + "scale" : "1x", + "size" : "40x40" }, { "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" + "scale" : "1x", + "size" : "76x76" }, { "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" + "scale" : "2x", + "size" : "76x76" }, { "idiom" : "ipad", - "size" : "83.5x83.5", - "scale" : "2x" + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/run_tests.sh b/run_tests.sh index bfef5a0..577b640 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,10 +1,10 @@ #!/bin/bash -carthage bootstrap +carthage bootstrap --no-use-binaries --use-xcframeworks CONFIGURATION=(Debug) BUILD_DIRECTORY="build" -DESTINATION="platform=iOS Simulator,name=iPhone 5" +DESTINATION="platform=iOS Simulator,name=iPhone 8" ACTION="test" WORKSPACE="RxLifx.xcworkspace" @@ -17,7 +17,7 @@ xcodebuild -workspace "${WORKSPACE}" \ -configuration "${CONFIGURATION}" \ -derivedDataPath "${BUILD_DIRECTORY}" \ -destination "$DESTINATION" \ - $ACTION | tee build/last-build-output.txt | xcpretty -c + $ACTION | tee build/last-build-output.txt SCHEME="RxLifxTests" @@ -26,7 +26,7 @@ xcodebuild -workspace "${WORKSPACE}" \ -configuration "${CONFIGURATION}" \ -derivedDataPath "${BUILD_DIRECTORY}" \ -destination "$DESTINATION" \ - $ACTION | tee build/last-build-output.txt | xcpretty -c + $ACTION | tee build/last-build-output.txt SCHEME="RxLifxApiTests" @@ -35,4 +35,4 @@ xcodebuild -workspace "${WORKSPACE}" \ -configuration "${CONFIGURATION}" \ -derivedDataPath "${BUILD_DIRECTORY}" \ -destination "$DESTINATION" \ - $ACTION | tee build/last-build-output.txt | xcpretty -c \ No newline at end of file + $ACTION | tee build/last-build-output.txt \ No newline at end of file