diff --git a/BPBleOTA.podspec b/BPBleOTA.podspec index e9f8999..066213e 100644 --- a/BPBleOTA.podspec +++ b/BPBleOTA.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'BPBleOTA' - s.version = '0.6.0' + s.version = '0.6.2' s.summary = 'a swift library aggregating NordicDFU and SMPDFU implement' # This description is used to generate tags and improve search results. @@ -46,5 +46,5 @@ Pod::Spec.new do |s| # s.frameworks = 'UIKit', 'MapKit' s.requires_arc = true s.dependency 'iOSDFULibrary'#, '~> 4.13.0' - s.dependency 'iOSMcuManagerLibrary' #,"~> 1.3.1" + s.dependency 'iOSMcuManagerLibrary' #,"~> 1.3.3" end diff --git a/BPBleOTA.xcodeproj/project.pbxproj b/BPBleOTA.xcodeproj/project.pbxproj index 2c734d5..2951ff1 100644 --- a/BPBleOTA.xcodeproj/project.pbxproj +++ b/BPBleOTA.xcodeproj/project.pbxproj @@ -1209,7 +1209,7 @@ buildSettings = { CODE_SIGNING_ALLOWED = NO; CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1.3.1; + CURRENT_PROJECT_VERSION = 1.3.3; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = ""; DYLIB_CURRENT_VERSION = 1; @@ -1222,7 +1222,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.3.1; + MARKETING_VERSION = 1.3.3; PRODUCT_BUNDLE_IDENTIFIER = com.bbb.zhxf.iOSMcuManagerLibrary; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -1276,7 +1276,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1334,7 +1334,7 @@ buildSettings = { CODE_SIGNING_ALLOWED = NO; CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1.3.1; + CURRENT_PROJECT_VERSION = 1.3.3; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = ""; DYLIB_CURRENT_VERSION = 1; @@ -1347,7 +1347,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.3.1; + MARKETING_VERSION = 1.3.3; PRODUCT_BUNDLE_IDENTIFIER = com.bbb.zhxf.iOSMcuManagerLibrary; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -1361,7 +1361,7 @@ buildSettings = { CODE_SIGNING_ALLOWED = NO; CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 0.6.20230509; + CURRENT_PROJECT_VERSION = 0.6.0220231010; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = ""; DYLIB_CURRENT_VERSION = 1; @@ -1373,7 +1373,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 0.6.0; + MARKETING_VERSION = 0.6.2; PRODUCT_BUNDLE_IDENTIFIER = com.bbb.zhxf.BPBleOTA; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -1505,7 +1505,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -1522,7 +1522,7 @@ buildSettings = { CODE_SIGNING_ALLOWED = NO; CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 0.6.20230509; + CURRENT_PROJECT_VERSION = 0.6.0220231010; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = ""; DYLIB_CURRENT_VERSION = 1; @@ -1534,7 +1534,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 0.6.0; + MARKETING_VERSION = 0.6.2; PRODUCT_BUNDLE_IDENTIFIER = com.bbb.zhxf.BPBleOTA; SDKROOT = iphoneos; SKIP_INSTALL = YES; @@ -1635,7 +1635,7 @@ repositoryURL = "https://github.com/NordicSemiconductor/IOS-nRF-Connect-Device-Manager"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 1.3.1; + minimumVersion = 1.3.3; }; }; 85117379E56A26AA7EF5BF99 /* XCRemoteSwiftPackageReference "ZIPFoundation" */ = { diff --git a/BPBleOTA.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/BPBleOTA.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 90cce62..54f58bc 100644 --- a/BPBleOTA.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/BPBleOTA.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/NordicSemiconductor/IOS-nRF-Connect-Device-Manager", "state" : { - "revision" : "2fcdf9a5b20e6ab0c2215cec37ed3f26c0888126", - "version" : "1.3.1" + "revision" : "34dc64baa17c6e0847c96d6043f41bb89e0c1a9c", + "version" : "1.3.3" } }, { diff --git a/Cartfile b/Cartfile index 7608c80..35511a4 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ github "NordicSemiconductor/IOS-DFU-Library" ~> 4.13.0 -github "NordicSemiconductor/IOS-nRF-Connect-Device-Manager" ~> 1.3.1 +github "NordicSemiconductor/IOS-nRF-Connect-Device-Manager" ~> 1.3.3 diff --git a/Cartfile.resolved b/Cartfile.resolved index 9f5770e..404074f 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ github "NordicSemiconductor/IOS-DFU-Library" "4.13.0" -github "NordicSemiconductor/IOS-nRF-Connect-Device-Manager" "1.3.1" -github "bgiori/SwiftCBOR" "v0.3.2" +github "NordicSemiconductor/IOS-nRF-Connect-Device-Manager" "1.3.3" +github "bgiori/SwiftCBOR" "v0.4.4" github "weichsel/ZIPFoundation" "0.9.11" diff --git a/Package.resolved b/Package.resolved index 4658baa..5bf8910 100644 --- a/Package.resolved +++ b/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/NordicSemiconductor/IOS-nRF-Connect-Device-Manager.git", "state" : { - "revision" : "2fcdf9a5b20e6ab0c2215cec37ed3f26c0888126", - "version" : "1.3.1" + "revision" : "34dc64baa17c6e0847c96d6043f41bb89e0c1a9c", + "version" : "1.3.3" } }, { diff --git a/Package.swift b/Package.swift index d69b08e..a7aa875 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "BPBleOTA", - platforms: [.iOS(.v11),.macOS(.v10_14)], + platforms: [.iOS(.v12),.macOS(.v10_14)], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( @@ -17,7 +17,7 @@ let package = Package( // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), .package(url: "https://github.com/NordicSemiconductor/IOS-nRF-Connect-Device-Manager.git", - exact:"1.3.1" + exact:"1.3.3" ), .package( diff --git a/Sources/BPBleOTA/Classes/BPOTAUtil.swift b/Sources/BPBleOTA/Classes/BPOTAUtil.swift index cad5a05..1c80ccd 100644 --- a/Sources/BPBleOTA/Classes/BPOTAUtil.swift +++ b/Sources/BPBleOTA/Classes/BPOTAUtil.swift @@ -1,12 +1,18 @@ // -// BPenOTAUtil.swift -// BPenOTASDK +// UTI.swift +// nRF Connect Device Manager // -// Created by xingfa on 2023/2/16. +// Created by Dinesh Harjani on 18/1/22. +// Copyright © 2022 Nordic Semiconductor ASA. All rights reserved. // import Foundation import UniformTypeIdentifiers +#if os(macOS) +import AppKit +#else +import UIKit +#endif // MARK: - UTI @@ -32,25 +38,18 @@ enum UTI: String, CaseIterable { $0.typeIdentifiers.contains(fileType) } } -} - -extension Data { - internal struct HexEncodingOptions: OptionSet { - public let rawValue: Int - public static let upperCase = HexEncodingOptions(rawValue: 1 << 0) - public static let space = HexEncodingOptions(rawValue: 1 << 1) - public init(rawValue: Int) { - self.rawValue = rawValue - } + private static func typeOf(_ url: URL) -> String? { +#if os(macOS) + return try? NSWorkspace.shared.type(ofFile: url.path) +#else + let document = UIDocument(fileURL: url) + return document.fileType +#endif } - internal func hexEncodedString(options: HexEncodingOptions = []) -> String { - var format = options.contains(.upperCase) ? "%02hhX" : "%02hhx" - if options.contains(.space) { - format.append(" ") - } - return map { String(format: format, $0) }.joined() + static func forFile(_ file: URL) -> UTI? { + return typeOf(file).flatMap({ from($0) }) } - } + diff --git a/project.yml b/project.yml index 7287ce5..f571a26 100644 --- a/project.yml +++ b/project.yml @@ -2,14 +2,14 @@ name: BPBleOTA options: #carthage: true deploymentTarget: - iOS: "11.0" + iOS: "12.0" bundleIdPrefix: com.bbb.zhxf - version: 0.6.0 + version: 0.6.2 packages: iOSMcuManagerLibrary: url: https://github.com/NordicSemiconductor/IOS-nRF-Connect-Device-Manager - from: 1.3.1 + from: 1.3.3 SwiftCBOR: url: https://github.com/unrelentingtech/SwiftCBOR from: 0.4.4 @@ -42,7 +42,7 @@ targets: - Framework templateAttributes: frameworSourceFolder: .build/checkouts/IOS-nRF-Connect-Device-Manager/Source - PACKAGE_VERSION: 1.3.1 + PACKAGE_VERSION: 1.3.3 dependencies: - package: SwiftCBOR @@ -74,13 +74,13 @@ targets: - Framework templateAttributes: frameworSourceFolder: Sources - PACKAGE_VERSION: 0.6.0 + PACKAGE_VERSION: 0.6.2 dependencies: - package: iOSMcuManagerLibrary - package: NordicDFU settings: SWIFT_ACTIVE_COMPILATION_CONDITIONS: "$(inherited) SWIFT_PACKAGE" - CURRENT_PROJECT_VERSION: 0.6.20230509 + CURRENT_PROJECT_VERSION: 0.6.0220231010 BPBleOTATests: type: bundle.unit-test