Skip to content

Commit

Permalink
Updates (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahsmartin authored Oct 11, 2024
1 parent f650ede commit a06761f
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 8 deletions.
12 changes: 12 additions & 0 deletions ETDistribution.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Pod::Spec.new do |spec|
spec.name = 'ETDistribution'
spec.version = '0.1.1'
spec.summary = 'iOS app installer.'
spec.homepage = 'https://github.com/EmergeTools/ETDistribution'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.author = { 'YourName' => '[email protected]' }
spec.source = { :git => 'https://github.com/EmergeTools/ETDistribution.git', :tag => 'v0.1.1' }
spec.platform = :ios, '13.0'
spec.swift_version = '5.10'
spec.source_files = 'Sources/**/*.{swift,h,m}'
end
3 changes: 1 addition & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ let package = Package(
targets: [
.target(
name: "ETDistribution",
dependencies: [],
path: "ETDistribution"
dependencies: []
),
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public final class ETDistribution: NSObject {
#if targetEnvironment(simulator)
// Not checking for updates on the simulator
return
#endif
#else
guard !isDebuggerAttached() else {
// Not checking for updates when the debugger is attached
return
Expand All @@ -136,13 +136,14 @@ public final class ETDistribution: NSObject {
request.httpMethod = "GET"

session.checkForUpdate(request) { [weak self] result in
var mappedResult = result.map { $0.updateInfo }
let mappedResult = result.map { $0.updateInfo }
if let completion = completion {
completion(mappedResult)
} else if let response = try? mappedResult.get() {
self?.handleResponse(response: response)
}
}
#endif
}

private func handleResponse(response: DistributionReleaseInfo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ struct BinaryParser {

for i in 0..<_dyld_image_count() {
guard let header = _dyld_get_image_header(i) else { continue }
let imageName = _dyld_get_image_name(0)
let imagePath = String(cString: _dyld_get_image_name(i))

guard imagePath == executablePath else {
continue
}

var _uuid = UUID().uuid
let result = withUnsafeMutablePointer(to: &_uuid) {
let _ = withUnsafeMutablePointer(to: &_uuid) {
_dyld_get_image_uuid(header, $0)
}
return formatUUID(_uuid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension URLSession {
return
}
guard (200...299).contains(httpResponse.statusCode) else {
var errorMessage = (
let errorMessage = (
try? JSONDecoder().decode(
DistributionUpdateCheckErrorResponse.self,
from: data
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension UserDefaults {

class var postponeTimeout: Date? {
get {
let epoch = UserDefaults(suiteName: "com.emerge.distribution")!.double(forKey: Keys.skipedRelease) ?? 0
let epoch = UserDefaults(suiteName: "com.emerge.distribution")!.double(forKey: Keys.skipedRelease)
return Date(timeIntervalSince1970: epoch)
}
set {
Expand Down

0 comments on commit a06761f

Please sign in to comment.