Skip to content

Commit 833f3f5

Browse files
committed
Finish Casio watch face
1 parent 7ff39d9 commit 833f3f5

5 files changed

Lines changed: 26 additions & 42 deletions

File tree

InfiniLink.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
E0C0E8782B96D7E80021E4AE /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E0C0E8772B96D7E80021E4AE /* Launch Screen.storyboard */; };
7373
E0C0E87A2B96D8F70021E4AE /* WeatherController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0C0E8792B96D8F70021E4AE /* WeatherController.swift */; };
7474
E0EC91C12B47213F007472EC /* NotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0EC91C02B47213F007472EC /* NotificationManager.swift */; };
75+
E0F5480D2BA9393400153E1B /* 7-Segment.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E05D11DD2B9BB99300D566EA /* 7-Segment.ttf */; };
7576
E0F599412B76CABF00BE96A3 /* FileSystemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F599402B76CABF00BE96A3 /* FileSystemView.swift */; };
7677
E0F69E102B35E44C00D41F94 /* HealthKitManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F69E0F2B35E44C00D41F94 /* HealthKitManager.swift */; };
7778
E515FB0C284C54690040B582 /* BatteryChartComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = E515FB0A284C54690040B582 /* BatteryChartComponents.swift */; };
@@ -185,7 +186,7 @@
185186
26D7817926CAD19F00BBF555 /* ColorPalette.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPalette.swift; sourceTree = "<group>"; };
186187
9255940428BB5342001602F1 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
187188
E021DAB22B489F58005C5E51 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
188-
E05D11DD2B9BB99300D566EA /* 7segment.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = 7segment.ttf; sourceTree = "<group>"; };
189+
E05D11DD2B9BB99300D566EA /* 7-Segment.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "7-Segment.ttf"; sourceTree = "<group>"; };
189190
E06973AA2B35E6F4009C2F7D /* InfiniLink.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = InfiniLink.entitlements; sourceTree = "<group>"; };
190191
E079ED002B78903B0038C0F2 /* WatchSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchSettingsView.swift; sourceTree = "<group>"; };
191192
E09057E52B9AC12B008C0CFD /* NetworkManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = "<group>"; };
@@ -603,7 +604,7 @@
603604
E53195382B792E3C004FECB4 /* navigation.ttf */,
604605
E53195372B792E3C004FECB4 /* open_sans_light.ttf */,
605606
E53195392B792E3C004FECB4 /* repetitionscrolling.ttf */,
606-
E05D11DD2B9BB99300D566EA /* 7segment.ttf */,
607+
E05D11DD2B9BB99300D566EA /* 7-Segment.ttf */,
607608
E53195312B792E3B004FECB4 /* Teko-Light.ttf */,
608609
);
609610
path = Fonts;
@@ -746,6 +747,7 @@
746747
files = (
747748
E53195402B792E3C004FECB4 /* JetBrainsMono-ExtraBold.ttf in Resources */,
748749
E531954E2B792E6B004FECB4 /* infinitime-nb.png in Resources */,
750+
E0F5480D2BA9393400153E1B /* 7-Segment.ttf in Resources */,
749751
E531953F2B792E3C004FECB4 /* JetBrainsMono-Light.ttf in Resources */,
750752
E53195432B792E3C004FECB4 /* repetitionscrolling.ttf in Resources */,
751753
264BFE7826BCAAC00050A223 /* README.md in Resources */,

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/WatchFace.swift

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -723,17 +723,14 @@ struct CasioWF: View {
723723
case .H24:
724724
return true
725725
default:
726-
return true
726+
return false
727727
}
728728
}
729729

730730
var body: some View {
731731
ZStack {
732732
Image("casio")
733733
.scaleEffect(0.81)
734-
CustomTextView(text: String(Int(bleManager.batteryLevel)), font: .custom("open_sans_light", size: geometry.size.width * 0.09), lineSpacing: 0)
735-
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .topTrailing)
736-
.padding(.trailing, 22)
737734
CustomTextView(
738735
text: {
739736
let dateFormatter = DateFormatter()
@@ -746,7 +743,7 @@ struct CasioWF: View {
746743
font: .custom("repetitionscrolling", size: geometry.size.width * 0.16),
747744
lineSpacing: 0
748745
)
749-
.frame(width: geometry.size.width / 1.04, height: geometry.size.height / 1.2, alignment: .topLeading)
746+
.frame(width: geometry.size.width / 1.04, height: geometry.size.height / 1.15, alignment: .topLeading)
750747
CustomTextView(
751748
text: {
752749
let calendar = Calendar.current
@@ -760,10 +757,10 @@ struct CasioWF: View {
760757

761758
return "\(daysIn)-\(daysLeft)"
762759
}(),
763-
font: .custom("open_sans_light ", size: geometry.size.width * 0.13),
760+
font: .custom("7-Segment", size: geometry.size.width * 0.16),
764761
lineSpacing: 0
765762
)
766-
.frame(width: geometry.size.width / 1.04, height: geometry.size.height / 1.3, alignment: .topTrailing)
763+
.frame(width: geometry.size.width / 1.04, height: geometry.size.height / 1.25, alignment: .topTrailing)
767764
CustomTextView(
768765
text: {
769766
let calendar = Calendar.current
@@ -772,42 +769,27 @@ struct CasioWF: View {
772769
let month = calendar.component(.month, from: now)
773770
let day = calendar.component(.day, from: now)
774771

775-
return "\(month)- \(day)"
772+
return "\(month)-\(day)"
776773
}(),
777-
font: .custom("open_sans_light ", size: geometry.size.width * 0.13),
774+
font: .custom("7-Segment", size: geometry.size.width * 0.16),
778775
lineSpacing: 0
779776
)
780777
.frame(width: geometry.size.width / 1.08, height: geometry.size.height / 2.25, alignment: .topTrailing)
781-
if Calendar.current.component(.hour, from: Date()) >= 12 && !hour24 {
782-
CustomTextView(text: "\(Calendar.current.component(.hour, from: Date()) - 12):\(String(format: "%02d", Calendar.current.component(.minute, from: Date())))", font: .custom("7-segment", size: geometry.size.width * 0.36), lineSpacing: 0)
783-
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing)
784-
.position(x: geometry.size.width / 2.0, y: geometry.size.height / 1.30)
785-
} else {
786-
CustomTextView(text: "\(String(format: "%02d", Calendar.current.component(.hour, from: Date()))):\(String(format: "%02d", Calendar.current.component(.minute, from: Date())))", font: .custom("7-segment", size: geometry.size.width * 0.36), lineSpacing: 0)
787-
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing)
788-
.position(x: geometry.size.width / 2.0, y: geometry.size.height / 1.30)
789-
}
790-
HStack(spacing: 4) {
791-
Image(systemName: "heart.fill")
792-
.font(.system(size: geometry.size.width * 0.08))
793-
.foregroundColor(bleManagerVal.heartBPM != 0 ? colorText : .gray)
794-
.opacity(bleManagerVal.heartBPM != 0 ? 1.0 : 0.5)
795-
if bleManagerVal.heartBPM != 0 {
796-
CustomTextView(text: String(Int(bleManagerVal.heartBPM)), font: .custom("open_sans_light", size: geometry.size.width * 0.11), lineSpacing: 0)
778+
CustomTextView(text: {
779+
if hour24 {
780+
return "\(String(format: "%02d", Calendar.current.component(.hour, from: Date()))):\(String(format: "%02d", Calendar.current.component(.minute, from: Date())))"
781+
} else {
782+
return "\(Calendar.current.component(.hour, from: Date()) - 12):\(String(format: "%02d", Calendar.current.component(.minute, from: Date())))"
797783
}
784+
}(), font: .custom("7-Segment", size: geometry.size.width * 0.48), lineSpacing: 0)
785+
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing)
786+
.position(x: geometry.size.width / 2.0, y: geometry.size.height / 1.165)
787+
if !hour24 {
788+
CustomTextView(text: "\(Calendar.current.component(.hour, from: Date()) >= 12 ? "P" : "A")", font: .custom("JetBrainsMono-Bold", size: geometry.size.width * 0.08), lineSpacing: 0)
789+
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .leading)
790+
.padding(.leading, 6)
791+
.padding(.top, -5)
798792
}
799-
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .bottomLeading)
800-
.padding(.leading, 10)
801-
.padding(.bottom, bleManagerVal.heartBPM != 0 ? 0 : -4)
802-
HStack(spacing: 4) {
803-
Image(systemName: "shoeprints.fill")
804-
.rotationEffect(Angle(degrees: 90))
805-
.font(.system(size: geometry.size.width * 0.08))
806-
CustomTextView(text: "\(bleManagerVal.stepCount)", font: .custom("open_sans_light", size: geometry.size.width * 0.11), lineSpacing: 0)
807-
}
808-
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .bottomTrailing)
809-
.padding(.trailing, 10)
810-
.padding(.bottom, -4)
811793
}
812794
.foregroundColor(colorText)
813795
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .center)
@@ -861,7 +843,7 @@ enum InfineatItem {
861843
#Preview {
862844
NavigationView {
863845
GeometryReader { geometry in
864-
WatchFaceView(watchface: .constant(4))
846+
WatchFaceView(watchface: .constant(5))
865847
.padding(22)
866848
.frame(width: geometry.size.width / 1.65, height: geometry.size.width / 1.65, alignment: .center)
867849
.clipped(antialiased: true)

InfiniLink/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<string>open_sans_light.ttf</string>
5050
<string>BebasNeue-Regular.ttf</string>
5151
<string>repetitionscrolling.ttf</string>
52-
<string>7-segment.ttf</string>
52+
<string>7-Segment.ttf</string>
5353
<string>Teko-Light.ttf</string>
5454
</array>
5555
<key>UIApplicationSceneManifest</key>

0 commit comments

Comments
 (0)