Skip to content

Commit

Permalink
Merge pull request #434 from ps2/dev
Browse files Browse the repository at this point in the history
Version 2.0.3
  • Loading branch information
ps2 authored Aug 20, 2018
2 parents 859b5af + 2dc3830 commit 7a1f6bd
Show file tree
Hide file tree
Showing 363 changed files with 12,143 additions and 1,306 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ project.xcworkspace
# Pods/

Carthage/
.gitmodules
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode9.3
osx_image: xcode9.4
xcode_project: RileyLink.xcodeproj
xcode_scheme: RileyLink
script:
Expand Down
1 change: 1 addition & 0 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "LoopKit/LoopKit" == 2.1.2
1 change: 1 addition & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "LoopKit/LoopKit" "v2.1.2"
File renamed without changes.
36 changes: 36 additions & 0 deletions Common/HKUnit.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// HKUnit.swift
// Naterade
//
// Created by Nathan Racklyeft on 1/17/16.
// Copyright © 2016 Nathan Racklyeft. All rights reserved.
//

import HealthKit


extension HKUnit {
static let milligramsPerDeciliter: HKUnit = {
return HKUnit.gramUnit(with: .milli).unitDivided(by: .literUnit(with: .deci))
}()

static let millimolesPerLiter: HKUnit = {
return HKUnit.moleUnit(with: .milli, molarMass: HKUnitMolarMassBloodGlucose).unitDivided(by: .liter())
}()

var foundationUnit: Unit? {
if self == HKUnit.milligramsPerDeciliter {
return UnitConcentrationMass.milligramsPerDeciliter
}

if self == HKUnit.millimolesPerLiter {
return UnitConcentrationMass.millimolesPerLiter(withGramsPerMole: HKUnitMolarMassBloodGlucose)
}

if self == HKUnit.gram() {
return UnitMass.grams
}

return nil
}
}
17 changes: 17 additions & 0 deletions Common/LocalizedString.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// LocalizedString.swift
// RileyLink
//
// Created by Kathryn DiSimone on 8/15/18.
// Copyright © 2018 Pete Schwamb. All rights reserved.
//

import Foundation

private class FrameworkBundle {
static let main = Bundle(for: FrameworkBundle.self)
}

func LocalizedString(_ key: String, tableName: String? = nil, value: String = "", comment: String) -> String {
return NSLocalizedString(key, tableName: tableName, bundle: FrameworkBundle.main, value: value, comment: comment)
}
40 changes: 40 additions & 0 deletions Common/Locked.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// Locked.swift
// LoopKit
//
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import os.lock


internal class Locked<T> {
private var lock = os_unfair_lock()
private var _value: T

init(_ value: T) {
os_unfair_lock_lock(&lock)
defer { os_unfair_lock_unlock(&lock) }
_value = value
}

var value: T {
get {
os_unfair_lock_lock(&lock)
defer { os_unfair_lock_unlock(&lock) }
return _value
}
set {
os_unfair_lock_lock(&lock)
defer { os_unfair_lock_unlock(&lock) }
_value = newValue
}
}

func mutate(_ changes: (_ value: inout T) -> Void) -> T {
os_unfair_lock_lock(&lock)
defer { os_unfair_lock_unlock(&lock) }
changes(&_value)
return _value
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion Common/NumberFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
extension NumberFormatter {
func decibleString(from decibles: Int?) -> String? {
if let decibles = decibles, let formatted = string(from: NSNumber(value: decibles)) {
return String(format: NSLocalizedString("%@ dB", comment: "Unit format string for an RSSI value in decibles"), formatted)
return String(format: LocalizedString("%@ dB", comment: "Unit format string for an RSSI value in decibles"), formatted)
} else {
return nil
}
Expand Down
6 changes: 6 additions & 0 deletions Common/OSLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ extension OSLog {
log(message, type: .info, args)
}

func `default`(_ message: StaticString, _ args: CVarArg...) {
log(message, type: .default, args)
}

func error(_ message: StaticString, _ args: CVarArg...) {
log(message, type: .error, args)
}
Expand All @@ -37,6 +41,8 @@ extension OSLog {
os_log(message, log: self, type: type, args[0], args[1], args[2])
case 4:
os_log(message, log: self, type: type, args[0], args[1], args[2], args[3])
case 5:
os_log(message, log: self, type: type, args[0], args[1], args[2], args[3], args[4])
default:
os_log(message, log: self, type: type, args)
}
Expand Down
5 changes: 5 additions & 0 deletions Common/TimeZone.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
// Copyright © 2016 Pete Schwamb. All rights reserved.
//

import Foundation

extension TimeZone {
static var currentFixed: TimeZone {
return TimeZone(secondsFromGMT: TimeZone.current.secondsFromGMT())!
}

var fixed: TimeZone {
return TimeZone(secondsFromGMT: secondsFromGMT())!
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion Crypto/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.2</string>
<string>2.0.3</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* (No Comment) */
/* Bundle name */
"CFBundleName" = "$(PRODUCT_NAME)";

2 changes: 1 addition & 1 deletion Crypto/es.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* (No Comment) */
/* Bundle name */
"CFBundleName" = "$(PRODUCT_NAME)";

3 changes: 3 additions & 0 deletions Crypto/fr.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Bundle name */
"CFBundleName" = "$(PRODUCT_NAME)";

3 changes: 3 additions & 0 deletions Crypto/it.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Bundle name */
"CFBundleName" = "$(PRODUCT_NAME)";

3 changes: 3 additions & 0 deletions Crypto/nb.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Bundle name */
"CFBundleName" = "$(PRODUCT_NAME)";

3 changes: 3 additions & 0 deletions Crypto/nl.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Bundle name */
"CFBundleName" = "$(PRODUCT_NAME)";

3 changes: 3 additions & 0 deletions Crypto/pl.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Bundle name */
"CFBundleName" = "$(PRODUCT_NAME)";

4 changes: 3 additions & 1 deletion Crypto/ru.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/* No Localized Strings */
/* Bundle name */
"CFBundleName" = "$(PRODUCT_NAME)";

3 changes: 3 additions & 0 deletions Crypto/zh-Hans.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Bundle name */
"CFBundleName" = "$(PRODUCT_NAME)";

99 changes: 99 additions & 0 deletions MinimedKit/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/* Communications error for a bolus currently running */
"A bolus is already in progress" = "A bolus is already in progress";

/* The description of AlarmClockReminderPumpEvent */
"AlarmClockReminder" = "AlarmClockReminder";

/* The description of AlarmSensorPumpEvent */
"AlarmSensor" = "AlarmSensor";

/* Describing the battery chemistry as Alkaline */
"Alkaline" = "Alkaline";

/* The format string description of a BasalProfileStartPumpEvent. (1: The index of the profile)(2: The basal rate) */
"Basal Profile %1$@: %2$@ U/hour" = "Basal Profile %1$@: %2$@ U/hour";

/* Pump error code when bolus is in progress */
"Bolus in progress" = "Bolus en progreso";

/* Suggestions for diagnosing a command refused pump error */
"Check that the pump is not suspended or priming, or has a percent temp basal type" = "Check that the pump is not suspended or priming, or has a percent temp basal type";

/* Pump error code returned when command refused */
"Command refused" = "Command refused";

/* No comment provided by engineer. */
"Comms with another pump detected" = "Comms with another pump detected.";

/* Error description */
"Decoding Error" = "Decoding Error";

/* Error description */
"Device Error" = "Device Error";

/* Describing the pump history insulin data source */
"Event History" = "Event History";

/* Format string for failure reason. (1: The operation being performed) (2: The response data) */
"Invalid response during %1$@: %2$@" = "Invalid response during %1$@: %2$@";

/* Describing the battery chemistry as Lithium */
"Lithium" = "Lithium";

/* Recovery suggestion */
"Make sure your RileyLink is nearby and powered on" = "Make sure your RileyLink is nearby and powered on";

/* Pump error code describing max setting exceeded */
"Max setting exceeded" = "Max setting exceeded";

/* Pump title (1: model number) */
"Minimed %@" = "Minimed %@";

/* Generic title of the minimed pump manager */
"Minimed 500/700 Series" = "Minimed 500/700 Series";

/* Describing the North America pump region */
"North America" = "North America";

/* No comment provided by engineer. */
"Pump did not respond" = "Pump did not respond";

/* Error description */
"Pump Error" = "Pump Error";

/* No comment provided by engineer. */
"Pump is suspended" = "Pump is suspended";

/* No comment provided by engineer. */
"Pump responded unexpectedly" = "Pump responded unexpectedly";

/* The format string describing a pump message. (1: The packet type)(2: The message type)(3: The message address)(4: The message data */
"PumpMessage(%1$@, %2$@, %3$@, %4$@)" = "PumpMessage(%1$@, %2$@, %3$@, %4$@)";

/* Describing the reservoir insulin data source */
"Reservoir" = "Reservoir";

/* Error description */
"RileyLink radio tune failed" = "RileyLink radio tune failed";

/* The format string description of a TempBasalPumpEvent. (1: The rate of the temp basal in minutes) */
"Temporary Basal: %1$.3f U/hour" = "Temporary Basal: %1$.3f U/hour";

/* The format string description of a TempBasalDurationPumpEvent. (1: The duration of the temp basal in minutes) */
"Temporary Basal: %1$d min" = "Temporary Basal: %1$d min";

/* The format string description of a TempBasalPumpEvent. (1: The rate of the temp basal in percent) */
"Temporary Basal: %1$d%%" = "Temporary Basal: %1$d%%";

/* The format string description of an unknown pump error code. (1: The specific error code raw value) */
"Unknown pump error code: %1$@" = "Unknown pump error code: %1$@";

/* No comment provided by engineer. */
"Unknown pump model: %@" = "Unknown pump model: %@";

/* Format string for an unknown response. (1: The operation being performed) (2: The response data) */
"Unknown response during %1$@: %2$@" = "Unknown response during %1$@: %2$@";

/* Describing the worldwide pump region */
"World-Wide" = "World-Wide";

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//
// MySentryPumpStatusMessageBody.swift
// Loop
//
// Created by Nate Racklyeft on 7/28/16.
// Copyright © 2016 Nathan Racklyeft. All rights reserved.
//

import LoopKit


extension MySentryPumpStatusMessageBody: SensorDisplayable {
public var isStateValid: Bool {
switch glucose {
case .active:
return true
default:
return false
}
}

public var trendType: LoopKit.GlucoseTrend? {
guard case .active = glucose else {
return nil
}

switch glucoseTrend {
case .down:
return .down
case .downDown:
return .downDown
case .up:
return .up
case .upUp:
return .upUp
case .flat:
return .flat
}
}

public var isLocal: Bool {
return true
}

var batteryPercentage: Int {
return batteryRemainingPercent
}

var glucoseSyncIdentifier: String? {
guard let date = glucoseDateComponents,
let year = date.year,
let month = date.month,
let day = date.day,
let hour = date.hour,
let minute = date.minute,
let second = date.second
else {
return nil
}

return "\(year)-\(month)-\(day) \(hour)-\(minute)-\(second)"
}
}
26 changes: 26 additions & 0 deletions MinimedKit/CGMManager/SensorValueGlucoseEvent+CGMManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// SensorValueGlucoseEvent.swift
// Loop
//
// Copyright © 2018 LoopKit Authors. All rights reserved.
//


extension SensorValueGlucoseEvent {
var glucoseSyncIdentifier: String? {
let date = timestamp

guard
let year = date.year,
let month = date.month,
let day = date.day,
let hour = date.hour,
let minute = date.minute,
let second = date.second
else {
return nil
}

return "\(year)-\(month)-\(day) \(hour)-\(minute)-\(second)"
}
}
Loading

0 comments on commit 7a1f6bd

Please sign in to comment.