Skip to content

Commit

Permalink
Add option to send first connect notification, minor UI improvements,…
Browse files Browse the repository at this point in the history
… remove manual step adding, update What's New and Onboarding views
  • Loading branch information
liamcharger committed Mar 1, 2024
1 parent 0f1d9eb commit 34ee420
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 224 deletions.
8 changes: 0 additions & 8 deletions InfiniLink.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
266F53E426F7FCA6007481A6 /* ChartManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 266F53E326F7FCA6007481A6 /* ChartManager.swift */; };
266F53EA26FA91F3007481A6 /* DeviceInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 266F53E926FA91F3007481A6 /* DeviceInfo.swift */; };
267C2EF8273C8AB300F464B0 /* StepWeeklyGraph.swift in Sources */ = {isa = PBXBuildFile; fileRef = 267C2EF7273C8AB300F464B0 /* StepWeeklyGraph.swift */; };
267C2EFA273DB62800F464B0 /* StepsSettingsSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 267C2EF9273DB62800F464B0 /* StepsSettingsSheet.swift */; };
268E773C27174A2B000DF90D /* ChartSettingsSheetMain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 268E773B27174A2B000DF90D /* ChartSettingsSheetMain.swift */; };
26914730272A09D8004A61BD /* StepCountPersistenceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2691472F272A09D8004A61BD /* StepCountPersistenceManager.swift */; };
26A40E852704E6F3007966F6 /* SheetManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26A40E842704E6F3007966F6 /* SheetManager.swift */; };
Expand Down Expand Up @@ -65,7 +64,6 @@
E079ED012B78903B0038C0F2 /* WatchSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E079ED002B78903B0038C0F2 /* WatchSettingsView.swift */; };
E097C1192B4F0B7E005293D8 /* BatteryChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = E097C1182B4F0B7E005293D8 /* BatteryChart.swift */; };
E0A1477F2B5EC57F000193E9 /* WeatherSetLocationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0A1477E2B5EC57F000193E9 /* WeatherSetLocationView.swift */; };
E0BFBF772B3662A600055A2B /* ConnectionHelpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0BFBF762B3662A600055A2B /* ConnectionHelpView.swift */; };
E0EC91C12B47213F007472EC /* NotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0EC91C02B47213F007472EC /* NotificationManager.swift */; };
E0F599412B76CABF00BE96A3 /* FileSystemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F599402B76CABF00BE96A3 /* FileSystemView.swift */; };
E0F69E102B35E44C00D41F94 /* HealthKitManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F69E0F2B35E44C00D41F94 /* HealthKitManager.swift */; };
Expand Down Expand Up @@ -159,7 +157,6 @@
266F53E326F7FCA6007481A6 /* ChartManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartManager.swift; sourceTree = "<group>"; };
266F53E926FA91F3007481A6 /* DeviceInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceInfo.swift; sourceTree = "<group>"; };
267C2EF7273C8AB300F464B0 /* StepWeeklyGraph.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepWeeklyGraph.swift; sourceTree = "<group>"; };
267C2EF9273DB62800F464B0 /* StepsSettingsSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsSettingsSheet.swift; sourceTree = "<group>"; };
268E773B27174A2B000DF90D /* ChartSettingsSheetMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartSettingsSheetMain.swift; sourceTree = "<group>"; };
2691472F272A09D8004A61BD /* StepCountPersistenceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepCountPersistenceManager.swift; sourceTree = "<group>"; };
26A40E842704E6F3007966F6 /* SheetManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SheetManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -188,7 +185,6 @@
E079ED002B78903B0038C0F2 /* WatchSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchSettingsView.swift; sourceTree = "<group>"; };
E097C1182B4F0B7E005293D8 /* BatteryChart.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryChart.swift; sourceTree = "<group>"; };
E0A1477E2B5EC57F000193E9 /* WeatherSetLocationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherSetLocationView.swift; sourceTree = "<group>"; };
E0BFBF762B3662A600055A2B /* ConnectionHelpView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionHelpView.swift; sourceTree = "<group>"; };
E0EC91C02B47213F007472EC /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; };
E0F599402B76CABF00BE96A3 /* FileSystemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileSystemView.swift; sourceTree = "<group>"; };
E0F69E0F2B35E44C00D41F94 /* HealthKitManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HealthKitManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -384,7 +380,6 @@
E5EEB1D828034EA500FB0C11 /* BatteryView.swift */,
E5EEB1D728034EA500FB0C11 /* HeartView.swift */,
26D7816F26CA004B00BBF555 /* SettingsView.swift */,
E0BFBF762B3662A600055A2B /* ConnectionHelpView.swift */,
2601AF68272210EB00D999EF /* Steps View Components */,
26A40E872704E964007966F6 /* Debug View */,
26C5FAD626FC126F00921207 /* Sheets */,
Expand Down Expand Up @@ -470,7 +465,6 @@
26C5FAD626FC126F00921207 /* Sheets */ = {
isa = PBXGroup;
children = (
267C2EF9273DB62800F464B0 /* StepsSettingsSheet.swift */,
26A6316226C4C6D6005AE404 /* BLEConnectView.swift */,
26A40E842704E6F3007966F6 /* SheetManager.swift */,
268E773B27174A2B000DF90D /* ChartSettingsSheetMain.swift */,
Expand Down Expand Up @@ -736,7 +730,6 @@
263462EA2729B71500D3278D /* StepCalendarView.swift in Sources */,
E5EEB1D42803438200FB0C11 /* RenameView.swift in Sources */,
264AE04627026BD6001504A7 /* UptimeManager.swift in Sources */,
267C2EFA273DB62800F464B0 /* StepsSettingsSheet.swift in Sources */,
266F53E426F7FCA6007481A6 /* ChartManager.swift in Sources */,
268E773C27174A2B000DF90D /* ChartSettingsSheetMain.swift in Sources */,
E5286050282C5ED300C06FA0 /* ChartViewComponents.swift in Sources */,
Expand Down Expand Up @@ -765,7 +758,6 @@
2632388626F2548600D72B43 /* DFUWithoutBLE.swift in Sources */,
26914730272A09D8004A61BD /* StepCountPersistenceManager.swift in Sources */,
E57AD5772823F85D00E33EEA /* DeviceData.swift in Sources */,
E0BFBF772B3662A600055A2B /* ConnectionHelpView.swift in Sources */,
E515FB0D284C54690040B582 /* HeartChartComponents.swift in Sources */,
E0A1477F2B5EC57F000193E9 /* WeatherSetLocationView.swift in Sources */,
26C5FADC26FE7EB000921207 /* SheetCloseButton.swift in Sources */,
Expand Down
6 changes: 5 additions & 1 deletion InfiniLink/BLE/BLEDiscoveredCharacteristics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@

import CoreBluetooth
import UIKit
import SwiftUI

struct BLEDiscoveredCharacteristics {
let bleManager = BLEManager.shared
let bleManagerVal = BLEManagerVal.shared

@AppStorage("sendFirstConnectNotification") var sendFirstConnectNotification: Bool = true

func handleDiscoveredCharacteristics(characteristic: CBCharacteristic, peripheral: CBPeripheral) {
switch characteristic.uuid {
case bleManagerVal.cbuuidList.musicControl:
Expand All @@ -38,7 +42,7 @@ struct BLEDiscoveredCharacteristics {
peripheral.setNotifyValue(true, for: characteristic)
case bleManagerVal.cbuuidList.notify:
bleManagerVal.notifyCharacteristic = characteristic
if bleManager.firstConnect {
if bleManager.firstConnect && sendFirstConnectNotification {
BLEWriteManager.init().sendNotification(title: "", body: "\(UIDevice.current.name) Connected!")
bleManager.firstConnect = false
}
Expand Down
47 changes: 0 additions & 47 deletions InfiniLink/View Components/ConnectionHelpView.swift

This file was deleted.

5 changes: 5 additions & 0 deletions InfiniLink/View Components/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct Settings_Page: View {
@AppStorage("heartChartFill") var heartChartFill: Bool = true
@AppStorage("batChartFill") var batChartFill: Bool = true
@AppStorage("debugMode") var debugMode: Bool = false
@AppStorage("sendFirstConnectNotification") var sendFirstConnectNotification: Bool = true
@AppStorage("weatherData") var weatherData: Bool = true
@AppStorage("useCurrentLocation") var useCurrentLocation: Bool = true
@AppStorage("displayLocation") var displayLocation : String = "Cupertino"
Expand Down Expand Up @@ -132,6 +133,10 @@ struct Settings_Page: View {
Toggle(NSLocalizedString("filled_battery_graph", comment: ""), isOn: $batChartFill)
.modifier(RowModifier(style: .capsule))
}
Spacer()
.frame(height: 6)
Toggle(NSLocalizedString("enable_first_connect_notification", comment: ""), isOn: $sendFirstConnectNotification)
.modifier(RowModifier(style: .capsule))
Spacer()
.frame(height: 6)
VStack {
Expand Down
4 changes: 2 additions & 2 deletions InfiniLink/View Components/Sheets/BLEConnectView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ struct Connect: View {
.alert(isPresented: $showUnsupportedDeviceAlert) {
Alert(title: Text(NSLocalizedString("oops", comment: "Oops!")), message: Text(NSLocalizedString("not_infinitime_device", comment: "It doesn't look like the device you selected is running InfiniTime.")), dismissButton: .cancel())
}
.sheet(isPresented: $showHelpView) {
ConnectionHelpView(isDisplayed: $showHelpView)
.alert(isPresented: $showHelpView) {
Alert(title: Text(NSLocalizedString("connection_help", comment: "Connection Help")), message: Text(NSLocalizedString("other_notes_4", comment: "")), dismissButton: .cancel(Text(NSLocalizedString("ok", comment: ""))))
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions InfiniLink/View Components/Sheets/Onboarding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ struct Onboarding: View {
ScrollView {
VStack(alignment: .leading, spacing: 20) {
Text(NSLocalizedString("onboarding_text", comment: ""))
VStack(alignment: .leading, spacing: 20) {
Text(NSLocalizedString("other_notes", comment: ""))
.font(.title2.weight(.semibold))
Text(NSLocalizedString("other_notes_1", comment: ""))
Text(NSLocalizedString("other_notes_2", comment: ""))
Text(NSLocalizedString("other_notes_3", comment: ""))
Text(NSLocalizedString("other_notes_4", comment: ""))
ForEach(0...3, id: \.self) { index in
Text(NSLocalizedString("other_notes_\(index + 1)", comment: ""))
}
}
.padding()
Expand Down
3 changes: 0 additions & 3 deletions InfiniLink/View Components/Sheets/SheetManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ enum SheetSelection {
case notification
case whatsNew
case chartSettings
case stepSettings
}

class SheetManager: ObservableObject {
Expand Down Expand Up @@ -78,8 +77,6 @@ class SheetManager: ObservableObject {
WhatsNew()
case .chartSettings:
ChartSettingsSheet()
case .stepSettings:
StepSettingsSheet()
}
}
}
Expand Down
74 changes: 0 additions & 74 deletions InfiniLink/View Components/Sheets/StepsSettingsSheet.swift

This file was deleted.

7 changes: 4 additions & 3 deletions InfiniLink/View Components/Sheets/WhatsNewSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ struct WhatsNew: View {
.frame(maxWidth: .infinity, alignment: .trailing)
Divider()
ScrollView {
VStack(alignment: .leading, spacing: 15) {
Text(NSLocalizedString("whats_new_body_1", comment: ""))
Text(NSLocalizedString("whats_new_body_2", comment: ""))
VStack(alignment: .leading, spacing: 20) {
ForEach(0...5, id: \.self) { index in
Text(NSLocalizedString("whats_new_\(index + 1)", comment: ""))
}
}
.padding()
}
Expand Down
12 changes: 0 additions & 12 deletions InfiniLink/View Components/StepsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,6 @@ struct StepView: View {
.foregroundColor(.primary)
.font(.title.weight(.bold))
Spacer()
Button {
SheetManager.shared.sheetSelection = .stepSettings
SheetManager.shared.showSheet = true
} label: {
Image(systemName: "plus")
.imageScale(.medium)
.padding(14)
.font(.body.weight(.semibold))
.foregroundColor(colorScheme == .dark ? .white : .darkGray)
.background(Material.regular)
.clipShape(Circle())
}
}
.padding()
.frame(maxWidth: .infinity, alignment: .center)
Expand Down
Loading

0 comments on commit 34ee420

Please sign in to comment.