Skip to content

Commit 8bc5509

Browse files
committed
Finish week seeking in StepsView, fix hour display bug in Casio watch face, and update pine logo position on Infineat watch face, add full color palette to PineTimeStyle watch face, fix hour display bugs
1 parent 1e50edc commit 8bc5509

6 files changed

Lines changed: 268 additions & 231 deletions

File tree

InfiniLink.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@
10541054
"$(inherited)",
10551055
"@executable_path/Frameworks",
10561056
);
1057-
MARKETING_VERSION = 1.2.0;
1057+
MARKETING_VERSION = 1.2;
10581058
PRODUCT_BUNDLE_IDENTIFIER = com.infinitimeorg.InfiniLink;
10591059
PRODUCT_NAME = "$(TARGET_NAME)";
10601060
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1083,7 +1083,7 @@
10831083
"$(inherited)",
10841084
"@executable_path/Frameworks",
10851085
);
1086-
MARKETING_VERSION = 1.2.0;
1086+
MARKETING_VERSION = 1.2;
10871087
PRODUCT_BUNDLE_IDENTIFIER = com.infinitimeorg.InfiniLink;
10881088
PRODUCT_NAME = "$(TARGET_NAME)";
10891089
PROVISIONING_PROFILE_SPECIFIER = "";

InfiniLink/BLE/BLEUpdateHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct BLEUpdatedCharacteristicHandler {
3737

3838
func handleUpdates(characteristic: CBCharacteristic, peripheral: CBPeripheral) {
3939
// TODO: Fix hang
40-
// weatherController.updateWeatherData(ignoreTimeLimits: false)
40+
weatherController.updateWeatherData(ignoreTimeLimits: false)
4141

4242
switch characteristic.uuid {
4343
case bleManagerVal.cbuuidList.musicControl:

InfiniLink/Core/Home/Steps/Chart/StepWeeklyGraph.swift

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,28 @@ import SwiftUI
1212
import SwiftUICharts
1313

1414
struct StepWeeklyChart: View {
15-
@ObservedObject var bleManager = BLEManager.shared
15+
@ObservedObject var bleManager = BLEManager.shared
1616

1717
@Environment(\.managedObjectContext) var viewContext
18-
@Environment(\.colorScheme) var colorScheme
18+
@Environment(\.colorScheme) var colorScheme
1919

20-
@FetchRequest(sortDescriptors: [NSSortDescriptor(keyPath: \StepCounts.timestamp, ascending: true)]) private var chartPoints: FetchedResults<StepCounts>
20+
@FetchRequest(sortDescriptors: [NSSortDescriptor(keyPath: \StepCounts.timestamp, ascending: true)]) private var chartPoints: FetchedResults<StepCounts>
2121

22-
@Binding var stepCountGoal: Int
22+
@Binding var stepCountGoal: Int
2323
@State var displayDate = Date()
24+
25+
var weekTitle: String {
26+
let calendar = Calendar.current
27+
if calendar.isDateInToday(displayDate) {
28+
return "This Week"
29+
} else if calendar.isDate(displayDate, equalTo: Date().addingTimeInterval(-7*24*60*60), toGranularity: .weekOfYear) {
30+
return "Last Week"
31+
} else {
32+
let dateFormatter = DateFormatter()
33+
dateFormatter.dateFormat = "MM/dd/yyyy"
34+
return dateFormatter.string(from: displayDate)
35+
}
36+
}
2437

2538
func getStepCounts(displayWeek: DateInterval?) -> [BarChartDataPoint] {
2639
var dataPoints = [BarChartDataPoint]()
@@ -84,34 +97,34 @@ struct StepWeeklyChart: View {
8497

8598
VStack {
8699
HStack {
87-
Button {
88-
// Update date here...
89-
} label: {
100+
Button(action: {
101+
self.displayDate = Calendar.current.date(byAdding: .weekOfYear, value: -1, to: self.displayDate)!
102+
}) {
90103
Image(systemName: "chevron.left")
91104
.imageScale(.medium)
92-
.padding(14)
93105
.font(.body.weight(.semibold))
94106
.foregroundColor(colorScheme == .dark ? .white : .darkGray)
95-
.background(Material.thin)
96-
.clipShape(Circle())
97107
}
98108
Spacer()
99-
Text("Weekly Steps")
109+
Text(weekTitle)
100110
.font(.title2.weight(.semibold))
101111
Spacer()
102-
Button {
103-
// Update date here...
104-
} label: {
112+
Button(action: {
113+
let newDate = Calendar.current.date(byAdding: .weekOfYear, value: 1, to: self.displayDate)!
114+
if newDate <= Date() {
115+
self.displayDate = newDate
116+
}
117+
}) {
105118
Image(systemName: "chevron.right")
106119
.imageScale(.medium)
107-
.padding(14)
108120
.font(.body.weight(.semibold))
109121
.foregroundColor(colorScheme == .dark ? .white : .darkGray)
110-
.background(Material.thin)
111-
.clipShape(Circle())
112122
}
123+
.disabled(Calendar.current.date(byAdding: .weekOfYear, value: 1, to: self.displayDate)! > Date())
124+
.opacity(Calendar.current.date(byAdding: .weekOfYear, value: 1, to: self.displayDate)! > Date() ? 0.5 : 1.0)
113125
}
114126
.padding(.bottom, 25)
127+
.padding(.horizontal, 5)
115128
BarChart(chartData: chartData)
116129
.yAxisPOI(chartData: chartData, markerName: "Step Goal", markerValue: Double(stepCountGoal), labelColour: Color(.lightGray).opacity(0.25), lineColour: Color(.lightGray).opacity(0.25), strokeStyle: StrokeStyle.init(dash: [5]))
117130
.floatingInfoBox(chartData: chartData)

InfiniLink/Core/Home/Steps/StepsView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct StepView: View {
9090
.imageScale(.large)
9191
VStack(spacing: 3) {
9292
Text(getStepHistoryAsString(date: Date()))
93+
.font(.system(size: 27).weight(.bold))
9394
Button {
9495
showStepCountAlert.toggle()
9596
} label: {

0 commit comments

Comments
 (0)