Skip to content

Commit 7a1f6bd

Browse files
authored
Merge pull request #434 from ps2/dev
Version 2.0.3
2 parents 859b5af + 2dc3830 commit 7a1f6bd

File tree

363 files changed

+12143
-1306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

363 files changed

+12143
-1306
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ project.xcworkspace
3131
# Pods/
3232

3333
Carthage/
34+
.gitmodules

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode9.3
2+
osx_image: xcode9.4
33
xcode_project: RileyLink.xcodeproj
44
xcode_scheme: RileyLink
55
script:

Cartfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github "LoopKit/LoopKit" == 2.1.2

Cartfile.resolved

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github "LoopKit/LoopKit" "v2.1.2"

Common/HKUnit.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// HKUnit.swift
3+
// Naterade
4+
//
5+
// Created by Nathan Racklyeft on 1/17/16.
6+
// Copyright © 2016 Nathan Racklyeft. All rights reserved.
7+
//
8+
9+
import HealthKit
10+
11+
12+
extension HKUnit {
13+
static let milligramsPerDeciliter: HKUnit = {
14+
return HKUnit.gramUnit(with: .milli).unitDivided(by: .literUnit(with: .deci))
15+
}()
16+
17+
static let millimolesPerLiter: HKUnit = {
18+
return HKUnit.moleUnit(with: .milli, molarMass: HKUnitMolarMassBloodGlucose).unitDivided(by: .liter())
19+
}()
20+
21+
var foundationUnit: Unit? {
22+
if self == HKUnit.milligramsPerDeciliter {
23+
return UnitConcentrationMass.milligramsPerDeciliter
24+
}
25+
26+
if self == HKUnit.millimolesPerLiter {
27+
return UnitConcentrationMass.millimolesPerLiter(withGramsPerMole: HKUnitMolarMassBloodGlucose)
28+
}
29+
30+
if self == HKUnit.gram() {
31+
return UnitMass.grams
32+
}
33+
34+
return nil
35+
}
36+
}

Common/LocalizedString.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// LocalizedString.swift
3+
// RileyLink
4+
//
5+
// Created by Kathryn DiSimone on 8/15/18.
6+
// Copyright © 2018 Pete Schwamb. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
private class FrameworkBundle {
12+
static let main = Bundle(for: FrameworkBundle.self)
13+
}
14+
15+
func LocalizedString(_ key: String, tableName: String? = nil, value: String = "", comment: String) -> String {
16+
return NSLocalizedString(key, tableName: tableName, bundle: FrameworkBundle.main, value: value, comment: comment)
17+
}

Common/Locked.swift

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// Locked.swift
3+
// LoopKit
4+
//
5+
// Copyright © 2018 LoopKit Authors. All rights reserved.
6+
//
7+
8+
import os.lock
9+
10+
11+
internal class Locked<T> {
12+
private var lock = os_unfair_lock()
13+
private var _value: T
14+
15+
init(_ value: T) {
16+
os_unfair_lock_lock(&lock)
17+
defer { os_unfair_lock_unlock(&lock) }
18+
_value = value
19+
}
20+
21+
var value: T {
22+
get {
23+
os_unfair_lock_lock(&lock)
24+
defer { os_unfair_lock_unlock(&lock) }
25+
return _value
26+
}
27+
set {
28+
os_unfair_lock_lock(&lock)
29+
defer { os_unfair_lock_unlock(&lock) }
30+
_value = newValue
31+
}
32+
}
33+
34+
func mutate(_ changes: (_ value: inout T) -> Void) -> T {
35+
os_unfair_lock_lock(&lock)
36+
defer { os_unfair_lock_unlock(&lock) }
37+
changes(&_value)
38+
return _value
39+
}
40+
}

Common/NumberFormatter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
extension NumberFormatter {
1111
func decibleString(from decibles: Int?) -> String? {
1212
if let decibles = decibles, let formatted = string(from: NSNumber(value: decibles)) {
13-
return String(format: NSLocalizedString("%@ dB", comment: "Unit format string for an RSSI value in decibles"), formatted)
13+
return String(format: LocalizedString("%@ dB", comment: "Unit format string for an RSSI value in decibles"), formatted)
1414
} else {
1515
return nil
1616
}

0 commit comments

Comments
 (0)