Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "loudnate/LoopKit" ~> 0.3.3
github "loudnate/LoopKit" ~> 0.3.4
github "loudnate/xDripG5" ~> 0.5.0
github "loudnate/SwiftCharts" "loudnate/naterade"
github "mddub/dexcom-share-client-swift" ~> 0.1
Expand Down
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github "amplitude/Amplitude-iOS" "a3d6720626e72a678489bce83ed9dacadb505dd7"
github "loudnate/Crypto" "13fee45175b88629aeabe60b4b4fc3daf86fa0a3"
github "loudnate/LoopKit" "v0.3.3"
github "loudnate/LoopKit" "v0.3.4"
github "loudnate/SwiftCharts" "8671287afb29640f9cffced6521b1098b7aac085"
github "mddub/dexcom-share-client-swift" "v0.1.3"
github "loudnate/xDripG5" "0.5.0"
Expand Down
Binary file modified Carthage/Build/iOS/CarbKit.framework/CarbKit
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/CarbKit.framework/Info.plist
Binary file not shown.
Binary file modified Carthage/Build/iOS/GlucoseKit.framework/GlucoseKit
Binary file not shown.
Binary file modified Carthage/Build/iOS/GlucoseKit.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/InsulinKit.framework/Info.plist
Binary file not shown.
Binary file modified Carthage/Build/iOS/InsulinKit.framework/InsulinKit
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/LoopKit.framework/Info.plist
Binary file not shown.
Binary file modified Carthage/Build/iOS/LoopKit.framework/LoopKit
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/LoopKit.framework/TextFieldTableViewCell.nib
Binary file not shown.
20 changes: 1 addition & 19 deletions Loop.xcodeproj/xcshareddata/xcschemes/Loop.xcscheme
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
version = "1.7">
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand Down Expand Up @@ -108,23 +108,5 @@
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
<PostActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "#!/bin/bash&#10;&#10;if [[ ! -d $SRCROOT ]]; then&#10;echo &quot;This script must be run from an Xcode Build Phase&quot;&#10;exit 1;&#10;fi&#10;&#10;# Globals&#10;Tag=&#10;Logfile=&#10;CFBundleVersion=&#10;CFBundleShortVersionString=&#10;&#10;function init_logging () {&#10; logdir=&quot;$HOME/Library/Logs/$PRODUCT_BUNDLE_IDENTIFIER&quot;&#10; mkdir -p $logdir&#10; Logfile=&quot;$logdir/archive_post_actions.log&quot;&#10; exec &gt;&gt; $Logfile 2&gt;&amp;1&#10;&#10; echo &quot;\n\n\n$(date) Beginning archive post-actions for $CONFIGURATION&quot;&#10;}&#10;&#10;function increment_bundle_version () {&#10; srcPlist=&quot;$1&quot;&#10; PlistBuddy=&quot;/usr/libexec/PlistBuddy&quot;&#10;&#10; CFBundleVersion=`$PlistBuddy -c &quot;Print CFBundleVersion&quot; $srcPlist`&#10; CFBundleShortVersionString=`$PlistBuddy -c &quot;Print CFBundleShortVersionString&quot; $srcPlist`&#10; Tag=&quot;v$CFBundleShortVersionString&quot;&#10;&#10; # Increment the bundle version for future builds&#10; CFBundleVersionNext=$(($CFBundleVersion + 1))&#10; $PlistBuddy -c &quot;Set :CFBundleVersion $CFBundleVersionNext&quot; $srcPlist&#10;&#10; echo &quot;Updated build number of $srcPlist to $CFBundleVersionNext&quot;&#10;&#10; # Copy the new version to the settings bundle&#10; # settingsPlist=&quot;$SRCROOT/$PRODUCT_NAME/Settings.bundle/Root.plist&quot;&#10; # $PlistBuddy -c &quot;Set :PreferenceSpecifiers:0:DefaultValue $CFBundleShortVersionString ($CFBundleVersionNext)&quot; $settingsPlist&#10;&#10; git add $srcPlist &gt;&gt; $Logfile 2&gt;&amp;1&#10;}&#10;&#10;function commit_and_tag_changes () {&#10; cd &quot;$SRCROOT&quot;&#10;&#10; git commit -m &quot;Auto-commit with archive $Tag&quot; &gt;&gt; $Logfile 2&gt;&amp;1&#10; git tag $Tag &gt;&gt; $Logfile 2&gt;&amp;1&#10; git push &gt;&gt; $Logfile 2&gt;&amp;1&#10; git push --tags &gt;&gt; $Logfile 2&gt;&amp;1&#10;&#10; cd -&#10;}&#10;&#10;function merge_to_master () {&#10; cd &quot;$SRCROOT&quot;&#10;&#10; branch=$(git symbolic-ref --short HEAD)&#10;&#10; git checkout master &gt;&gt; $Logfile 2&gt;&amp;1&#10; git merge &quot;$branch&quot; &gt;&gt; $Logfile 2&gt;&amp;1&#10; git push &gt;&gt; $Logfile 2&gt;&amp;1&#10; git checkout &quot;$branch&quot; &gt;&gt; $Logfile 2&gt;&amp;1&#10;&#10; cd -&#10;}&#10;&#10;## Run&#10;&#10;init_logging&#10;increment_bundle_version &quot;$SRCROOT/$INFOPLIST_FILE&quot;&#10;increment_bundle_version &quot;$SRCROOT/WatchApp/Info.plist&quot;&#10;commit_and_tag_changes&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "43776F8B1B8022E90074EA36"
BuildableName = "Loop.app"
BlueprintName = "Loop"
ReferencedContainer = "container:Loop.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
</ArchiveAction>
</Scheme>
20 changes: 9 additions & 11 deletions Loop/Managers/DeviceDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -483,23 +483,21 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate {
return
}

shareClient.fetchLast(1) { (error, glucose) in
if let error = error {
self.logger.addError(error, fromSource: "ShareClient")
}
shareClient.fetchLast(6) { (error, glucose) in
guard let glucose = glucose else {
if let error = error {
self.logger.addError(error, fromSource: "ShareClient")
}

guard let glucose = glucose?.first else {
completion?()
return
}

// Ignore glucose values that are less than a minute newer than our previous value
if let latestGlucose = glucoseStore.latestGlucose where latestGlucose.startDate.timeIntervalSinceDate(glucose.startDate) > -NSTimeInterval(minutes: 1) {
completion?()
return
// Ignore glucose values that are up to a minute newer than our previous value, to account for possible time shifting in Share data
let newGlucose = glucose.filterDateRange(glucoseStore.latestGlucose?.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 1)), nil).map {
return (quantity: $0.quantity, date: $0.startDate, displayOnly: false)
}

glucoseStore.addGlucose(glucose.quantity, date: glucose.startDate, displayOnly: false, device: nil) { (_, value, error) -> Void in
glucoseStore.addGlucoseValues(newGlucose, device: nil) { (_, _, error) -> Void in
if let error = error {
self.logger.addError(error, fromSource: "GlucoseStore")
}
Expand Down