Skip to content

Commit

Permalink
Release 2.2.5
Browse files Browse the repository at this point in the history
**Bug fixes**
* Snoozing fix (#207), by @tymh. Glucose alarms can now be snoozed. 

**Miscellaneous**
* Add back sensor start and transmitter activation date (to display SAGE in Nightscout for Dexcom G6 sensors). Thanks @BJørn Ole!
*  Typos fixed by Brandon Nielsen (GitHub: bniels707).
* Make the iAPS App URL configurable.
* Hide the snooze modal (screen) when tapping "Snooze"-button.
  • Loading branch information
Jon-b-m committed Sep 22, 2023
2 parents 9a2090b + f0f991e commit a0daab8
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 43 deletions.
3 changes: 2 additions & 1 deletion Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
APP_DISPLAY_NAME = iAPS
APP_VERSION = 2.2.4
APP_VERSION = 2.2.5
APP_BUILD_NUMBER = 1
COPYRIGHT_NOTICE =
DEVELOPER_TEAM = ##TEAM_ID##
BUNDLE_IDENTIFIER = ru.artpancreas.$(DEVELOPMENT_TEAM).FreeAPS
APP_GROUP_ID = group.com.$(DEVELOPMENT_TEAM).loopkit.LoopGroup
APP_ICON = pod_colorful
APP_URL_SCHEME = freeaps-x

#include? "ConfigOverride.xcconfig"
//#include? "../../ConfigOverride.xcconfig"
1 change: 1 addition & 0 deletions FreeAPS/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<string>com.artificial-pancreas-iaps</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$(APP_URL_SCHEME)</string>
<string>freeaps-x</string>
</array>
</dict>
Expand Down
46 changes: 28 additions & 18 deletions FreeAPS/Sources/APS/CGM/DexcomSourceG6.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,25 +145,35 @@ extension DexcomSourceG6: CGMManagerDelegate {
debug(.deviceManager, "DEXCOM - Process CGM Reading Result launched with \(readingResult)")
switch readingResult {
case let .newData(values):
let bloodGlucose = values.compactMap { newGlucoseSample -> BloodGlucose? in
let quantity = newGlucoseSample.quantity
let value = Int(quantity.doubleValue(for: .milligramsPerDeciliter))
return BloodGlucose(
_id: newGlucoseSample.syncIdentifier,
sgv: value,
direction: .init(trendType: newGlucoseSample.trend),
date: Decimal(Int(newGlucoseSample.date.timeIntervalSince1970 * 1000)),
dateString: newGlucoseSample.date,
unfiltered: Decimal(value),
filtered: nil,
noise: nil,
glucose: value,
type: "sgv",
transmitterID: self.transmitterID
)
if let cgmG6Manager = cgmManager as? G6CGMManager,
let activationDate = cgmG6Manager.latestReading?.activationDate,
let sessionStartDate = cgmG6Manager.latestReading?.sessionStartDate
{
let bloodGlucose = values.compactMap { newGlucoseSample -> BloodGlucose? in
let quantity = newGlucoseSample.quantity
let value = Int(quantity.doubleValue(for: .milligramsPerDeciliter))
return BloodGlucose(
_id: newGlucoseSample.syncIdentifier,
sgv: value,
direction: .init(trendType: newGlucoseSample.trend),
date: Decimal(Int(newGlucoseSample.date.timeIntervalSince1970 * 1000)),
dateString: newGlucoseSample.date,
unfiltered: Decimal(value),
filtered: nil,
noise: nil,
glucose: value,
type: "sgv",
activationDate: activationDate,
sessionStartDate: sessionStartDate,
transmitterID: self.transmitterID
)
}
promise?(.success(bloodGlucose))
completion()
} else {
// Handle the case where activationDate or sessionStartDate is nil
completion()
}
promise?(.success(bloodGlucose))
completion()
case .unreliableData:
// loopManager.receivedUnreliableCGMReading()
promise?(.failure(GlucoseDataError.unreliableData))
Expand Down
1 change: 1 addition & 0 deletions FreeAPS/Sources/Modules/Snooze/View/SnoozeRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ extension Snooze {
debug(.default, "will snooze for \(snoozeFor) until \(dateFormatter.string(from: untilDate))")
snoozeDescription = getSnoozeDescription()
BaseUserNotificationsManager.stopSound()
state.hideModal()
} label: {
Text("Click to Snooze Alerts")
.padding()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ final class BaseUserNotificationsManager: NSObject, UserNotificationsManager, In

ensureCanSendNotification {
var titles: [String] = []

var notificationAlarm = false

switch self.glucoseStorage.alarm {
Expand All @@ -210,32 +209,29 @@ final class BaseUserNotificationsManager: NSObject, UserNotificationsManager, In
notificationAlarm = true
}

if self.snoozeUntilDate > Date() {
titles.append(NSLocalizedString("(Snoozed)", comment: "(Snoozed)"))
notificationAlarm = false
}

let delta = glucose.count >= 2 ? glucoseValue - (glucose[glucose.count - 2].glucose ?? 0) : nil

let body = self.glucoseText(glucoseValue: glucoseValue, delta: delta, direction: lastGlucose.direction) + self
.infoBody()

titles.append(body)

let content = UNMutableNotificationContent()
content.title = titles.joined(separator: " ")
content.body = body
if self.snoozeUntilDate > Date() {
titles.append(NSLocalizedString("(Snoozed)", comment: "(Snoozed)"))
notificationAlarm = false
} else {
titles.append(body)
let content = UNMutableNotificationContent()
content.title = titles.joined(separator: " ")
content.body = body

if notificationAlarm {
self.playSoundIfNeeded()
content.sound = .default
content.userInfo[NotificationAction.key] = NotificationAction.snooze.rawValue
}

if notificationAlarm {
self.playSoundIfNeeded()
content.sound = .default
content.userInfo[NotificationAction.key] = NotificationAction.snooze.rawValue
self.addRequest(identifier: .glucocoseNotification, content: content, deleteOld: true)
}

self.addRequest(identifier: .glucocoseNotification, content: content, deleteOld: true)
}
}

private func glucoseText(glucoseValue: Int, delta: Int?, direction: BloodGlucose.Direction?) -> String {
let units = settingsManager.settings.units
let glucoseText = glucoseFormatter
Expand Down
10 changes: 5 additions & 5 deletions fastlane/testflight.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ There are more detailed instructions in LoopDocs for doing Browser Builds of Loo

## Generate App Store Connect API Key

This step is common for all "Browser Builds", and should be done ony once. Please save the API key somewhere safe, so it can be re-used for other builds, or if needing to start from scratch.
This step is common for all "Browser Builds", and should be done only once. Please save the API key somewhere safe, so it can be re-used for other builds, or if needing to start from scratch.

1. Sign in to the [Apple developer portal page](https://developer.apple.com/account/resources/certificates/list).
1. Copy the team id from the upper right of the screen. Record this as your `TEAMID`.
Expand Down Expand Up @@ -71,18 +71,18 @@ If you have previously built Loop or another app using the "browser build" metho
## Create App Group

If you have already built iAPS via Xcode using this Apple ID, you can skip on to [Create iAPS App in App Store Connect](#create-FreeAPS-X-app-in-app-store-connect).
_Please note that in default builds of iAPS, the app group is actually identical to the one used with Loop, so please enter these details exactly as described below. This is to ease the setup of apps such as Xdrip4iOS. It may require some caution if transfering between FreAPS X and Loop._
_Please note that in default builds of iAPS, the app group is actually identical to the one used with Loop, so please enter these details exactly as described below. This is to ease the setup of apps such as Xdrip4iOS. It may require some caution if transfering between iAPS and Loop._

1. Go to [Register an App Group](https://developer.apple.com/account/resources/identifiers/applicationGroup/add/) on the apple developer site.
1. For Description, use "Loop App Group".
1. For Identifier, enter "group.com.TEAMID.loopkit.LoopGroup", subsituting your team id for `TEAMID`.
1. For Identifier, enter "group.com.TEAMID.loopkit.LoopGroup", substituting your team id for `TEAMID`.
1. Click "Continue" and then "Register".

## Add App Group to Bundle Identifiers

1. Go to [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers/list) on the apple developer site.
1. Go to [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers/list) on the Apple developer site.
1. For each of the following identifier names:
* FreeeAPS
* FreeAPS
* FreeAPS watchkitapp
* FreeAPS watchkitapp watchkitextension
1. Click on the identifier's name.
Expand Down

0 comments on commit a0daab8

Please sign in to comment.