Skip to content

Commit

Permalink
Release/0.1.1 (#9)
Browse files Browse the repository at this point in the history
* Set pump initial settings and pump popover

* Check reservoir

* fix initial setup

* open CGM source

* fix initial pump setup

* Hide debug options

* fix initial preferences

* use xcconfig

* Autoupdate build number

* Create README_RU.md

* Display version and build number

* English README

* Disclaimer

* disallow bolus 0

* possible fix wrong layout after start

* fix glucose Y range

* Optional api secret

* fix suggestion parsing

* Face id access

* fix clock

* build autoupdate

* Fix temp targets layout and pump view

* Fix pump updating logic

* fix omnipod reservooir

* Background timers

* legend

* Remove unused dependecies

* show temp target range

* FAQ_RU

* FAQ eng

* bump buils number

* clear signing

* fix reservoir bug

* Libre 2 glucose filter

* fix glucose filter logic

* skip_neutral_temps option fix

* Fix bild number update script

* Fix BloodGlucose parsing

* update charts on UIApplication.willEnterForegroundNotification

* Fix autotune deletion

* README updated

* Bump version
  • Loading branch information
ivalkou authored Apr 1, 2021
1 parent 25b4ee4 commit 9c18e30
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 20 deletions.
4 changes: 2 additions & 2 deletions FreeAPS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 0.1.1;
PRODUCT_BUNDLE_IDENTIFIER = ru.artpancreas.FreeAPS;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -1983,7 +1983,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 0.1.1;
PRODUCT_BUNDLE_IDENTIFIER = ru.artpancreas.FreeAPS;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion FreeAPS/Resources/Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 0.1.0
CURRENT_PROJECT_VERSION = 0.1.1
2 changes: 1 addition & 1 deletion FreeAPS/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>248</string>
<string>259</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>dexcomg6</string>
Expand Down
2 changes: 1 addition & 1 deletion FreeAPS/Resources/javascript/prepare/determine-basal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var printLog = function(...args) {};
var process = { stderr: { write: printLog } };


function generate(iob_data, currenttemp, glucose_data, profile, autosens_input = false, meal_input = false, microbolus = false, reservoir_input = false, clock = null){
function generate(iob_data, currenttemp, glucose_data, profile, autosens_input = false, meal_input = false, microbolus = false, reservoir_input = false, clock = new Date()){
var glucose_status = freeaps_glucoseGetLast(glucose_data);
var autosens_data = null;

Expand Down
1 change: 1 addition & 0 deletions FreeAPS/Resources/json/defaults/monitor/reservoir.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
300
2 changes: 1 addition & 1 deletion FreeAPS/Sources/APS/APSManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ final class BaseAPSManager: APSManager, Injectable {
.eraseToAnyPublisher()
}

return Just(true).eraseToAnyPublisher()
return Just(false).eraseToAnyPublisher()
}

func determineBasal() -> AnyPublisher<Bool, Never> {
Expand Down
4 changes: 2 additions & 2 deletions FreeAPS/Sources/APS/GlucoseManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ final class BaseGlucoseManager: GlucoseManager, Injectable {
timer.publisher
.receive(on: processQueue)
.flatMap { date -> AnyPublisher<[BloodGlucose], Never> in
guard self.glucoseStogare.syncDate().timeIntervalSince1970 + 4.minutes.timeInterval <= date.timeIntervalSince1970
guard self.glucoseStogare.syncDate().timeIntervalSince1970 <= date.timeIntervalSince1970
else {
return Just([]).eraseToAnyPublisher()
}
return self.nightscoutManager.fetchGlucose()
}
.sink { glucose in
if !glucose.isEmpty {
if !self.glucoseStogare.filterTooFrequentGlucose(glucose).isEmpty {
self.apsManager.heartbeatNow()
}
}
Expand Down
25 changes: 23 additions & 2 deletions FreeAPS/Sources/APS/Storage/GlucoseStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,28 @@ protocol GlucoseStorage {
func storeGlucose(_ glucose: [BloodGlucose])
func recent() -> [BloodGlucose]
func syncDate() -> Date
func filterTooFrequentGlucose(_ glucose: [BloodGlucose]) -> [BloodGlucose]
}

final class BaseGlucoseStorage: GlucoseStorage, Injectable {
private let processQueue = DispatchQueue(label: "BaseGlucoseStorage.processQueue")
@Injected() private var storage: FileStorage!
@Injected() private var broadcaster: Broadcaster!

private enum Config {
static let filterTime: TimeInterval = 4.75 * 60
}

init(resolver: Resolver) {
injectServices(resolver)
}

func storeGlucose(_ glucose: [BloodGlucose]) {
processQueue.sync {
let filtered = self.filterTooFrequentGlucose(glucose)
let file = OpenAPS.Monitor.glucose
self.storage.transaction { storage in
storage.append(glucose, to: file, uniqBy: \.dateString)
storage.append(filtered, to: file, uniqBy: \.dateString)
let uniqEvents = storage.retrieve(file, as: [BloodGlucose].self)?
.filter { $0.dateString.addingTimeInterval(1.days.timeInterval) > Date() }
.sorted { $0.dateString > $1.dateString } ?? []
Expand All @@ -43,12 +49,27 @@ final class BaseGlucoseStorage: GlucoseStorage, Injectable {
else {
return Date().addingTimeInterval(-1.days.timeInterval)
}
return recent.dateString.addingTimeInterval(1.minutes.timeInterval)
return recent.dateString.addingTimeInterval(Config.filterTime)
}

func recent() -> [BloodGlucose] {
storage.retrieve(OpenAPS.Monitor.glucose, as: [BloodGlucose].self)?.reversed() ?? []
}

func filterTooFrequentGlucose(_ glucose: [BloodGlucose]) -> [BloodGlucose] {
var lastDate = recent().first?.dateString ?? .distantPast
var filtered: [BloodGlucose] = []

for entry in glucose.reversed() {
guard entry.dateString.addingTimeInterval(-Config.filterTime) > lastDate else {
continue
}
filtered.append(entry)
lastDate = entry.dateString
}

return filtered
}
}

protocol GlucoseObserver {
Expand Down
2 changes: 1 addition & 1 deletion FreeAPS/Sources/Models/BloodGlucose.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct BloodGlucose: JSON, Identifiable, Hashable {

var sgv: Int?
let direction: Direction?
let date: UInt64
let date: Decimal
let dateString: Date
let filtered: Double?
let noise: Int?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ extension AutotuneConfig {
func delete() {
provider.deleteAutotune()
autotune = nil
apsManager.makeProfiles()
.sink { _ in }
.store(in: &lifetime)
}
}
}
6 changes: 3 additions & 3 deletions FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ struct MainChartView: View {
.onChange(of: didAppearTrigger) { _ in
update(fullSize: fullSize)
}
.onReceive(Foundation.NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
update(fullSize: fullSize)
}
}

private func bolusView(fullSize: CGSize) -> some View {
Expand Down Expand Up @@ -329,9 +332,6 @@ struct MainChartView: View {
.onChange(of: suggestion) { _ in
update(fullSize: fullSize)
}
.onChange(of: didAppearTrigger) { _ in
update(fullSize: fullSize)
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ FreeAPS X is in an active development state

If you want to test it, there is a beta-version available

## Implemented in version 0.1.0 (Beta)
## Implemented

- All base functions of oref0
- All base functions of oref1 (SMB, UAM and others)
Expand Down Expand Up @@ -60,3 +60,8 @@ If you want to test it, there is a beta-version available

*In progress*

## Community

- [English Telegram group](https://t.me/freeapsx_eng)
- [Russian Telegram group](https://t.me/freeapsx)

5 changes: 4 additions & 1 deletion README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ FreeAPS X находится в состоянии активной разраб

Для тестирования на текущий момент доступна бета-версия приложения

## Реализовано в версия 0.1.0 (Beta)
## Реализовано

- Все базовые функции oref0
- Все базовые функции oref1 (SMB, UAM и другие)
Expand Down Expand Up @@ -60,4 +60,7 @@ FreeAPS X находится в состоянии активной разраб

*В разработке*

## Сообщество

- [Английская Telegram группа](https://t.me/freeapsx_eng)
- [Русская Telegram группа](https://t.me/freeapsx)
8 changes: 4 additions & 4 deletions scripts/build-number-update.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ func checkdSYM(buildNumber: String?) {
// MARK: Implementation

guard let currentBranch = execute(command: "/usr/bin/git", args: ["rev-parse", "--abbrev-ref", "HEAD"]).map(Branch.init) else {
print("error: Can't determine current branch!")
exit(1)
print("Can't determine current branch! Skiping...")
exit(0)
}

guard let commitsCount = execute(command: "/usr/bin/git", args: ["rev-list", "--count", "HEAD"]), !commitsCount.isEmpty else {
print("error: Can't determine commits count!")
exit(1)
print("Can't determine commits count! Skiping..")
exit(0)
}

guard let targetBuildDir = ProcessInfo.processInfo.environment["TARGET_BUILD_DIR"], !targetBuildDir.isEmpty else {
Expand Down

0 comments on commit 9c18e30

Please sign in to comment.