Skip to content

Commit e4d06fb

Browse files
committed
Committing before trying to add shortcuts
1 parent dfcfbf2 commit e4d06fb

6 files changed

Lines changed: 39 additions & 41 deletions

File tree

Infini-iOS/ContentView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct ContentView: View {
105105
.foregroundColor(Color.gray)
106106
}
107107
))
108-
.background(Color.black)
108+
//.background(Color.black)
109109
.navigationBarTitleDisplayMode(.inline)
110110
}
111111
.gesture(drag)
@@ -122,9 +122,9 @@ struct MainView: View {
122122
var body: some View {
123123
switch pageSwitcher.currentPage {
124124
case .dfu:
125-
DFU_Page()
125+
DFUView()
126126
case .status:
127-
DeviceView()
127+
StatusView()
128128
case .settings:
129129
Settings_Page()
130130
}

Infini-iOS/View Components/BLEConnectView.swift

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,37 +47,7 @@ struct Connect: View {
4747
}
4848
}
4949

50-
Spacer()/*
51-
if scanOrStopScan {
52-
Button(action: {
53-
self.bleManager.startScanning()
54-
self.scanOrStopScan.toggle()
55-
}) {
56-
Text("Scan")
57-
.padding()
58-
.padding(.vertical, 7)
59-
.frame(maxWidth: .infinity, alignment: .center)
60-
.background(Color.gray)
61-
.foregroundColor(Color.white)
62-
.cornerRadius(10)
63-
.padding(.horizontal, 20)
64-
}
65-
} else {
66-
67-
Button(action: {
68-
self.bleManager.stopScanning()
69-
self.scanOrStopScan.toggle()
70-
}) {
71-
Text("Stop Scanning")
72-
.padding()
73-
.padding(.vertical, 7)
74-
.frame(maxWidth: .infinity, alignment: .center)
75-
.background(Color.gray)
76-
.foregroundColor(Color.white)
77-
.cornerRadius(10)
78-
.padding(.horizontal, 20)
79-
}
80-
}*/
50+
Spacer()
8151
}
8252
}
8353
}

Infini-iOS/View Components/BLEStatusView.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99
import SwiftUI
1010

11-
struct DeviceView: View {
11+
struct StatusView: View {
1212

1313
@EnvironmentObject var bleManager: BLEManager
1414

@@ -19,11 +19,10 @@ struct DeviceView: View {
1919
.padding()
2020
.frame(maxWidth: .infinity, alignment: .leading)
2121

22-
23-
24-
StatusTabs().environmentObject(bleManager)
2522
Spacer()
2623
if bleManager.isConnectedToPinetime {
24+
StatusTabs().environmentObject(bleManager)
25+
2726
Button(action: {
2827
self.bleManager.disconnect()
2928
}) {
@@ -35,6 +34,7 @@ struct DeviceView: View {
3534
.foregroundColor(Color.white)
3635
.cornerRadius(10)
3736
.padding(.horizontal, 20)
37+
.padding(.bottom)
3838
}
3939
} else {
4040
Text("Disconnected")
@@ -45,7 +45,16 @@ struct DeviceView: View {
4545
.foregroundColor(Color.gray)
4646
.cornerRadius(10)
4747
.padding(.horizontal, 20)
48+
.padding(.bottom)
4849
}
4950
}//.padding()
5051
}
5152
}
53+
54+
struct StatusView_Previews: PreviewProvider {
55+
static var previews: some View {
56+
StatusView()
57+
.environmentObject(PageSwitcher())
58+
.environmentObject(BLEManager())
59+
}
60+
}

Infini-iOS/View Components/DFU/DFUProgressBar.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ struct DFUProgressBar: View {
3131
}
3232
}
3333
}
34+
35+
struct DFUProgressBar_Previews: PreviewProvider {
36+
static var previews: some View {
37+
DFUProgressBar()
38+
.environmentObject(PageSwitcher())
39+
.environmentObject(DFU_Updater())
40+
}
41+
}

Infini-iOS/View Components/DFU/DFUView.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99
import SwiftUI
1010

11-
struct DFU_Page: View {
11+
struct DFUView: View {
1212

1313
@EnvironmentObject var bleManager: BLEManager
1414
@ObservedObject var dfuUpdater = DFU_Updater()
@@ -96,6 +96,7 @@ struct DFU_Page: View {
9696
.foregroundColor(firmwareSelected ? Color.white : Color.gray)
9797
.cornerRadius(10)
9898
.padding(.horizontal, 20)
99+
.padding(.bottom)
99100
}.disabled(!firmwareSelected)
100101
} else {
101102
Button(action:{
@@ -111,8 +112,17 @@ struct DFU_Page: View {
111112
.foregroundColor(firmwareSelected ? Color.white : Color.gray)
112113
.cornerRadius(10)
113114
.padding(.horizontal, 20)
115+
.padding(.bottom)
114116
}.disabled(!firmwareSelected)
115117
}
116118
}
117119
}
118120
}
121+
122+
struct DFUView_Previews: PreviewProvider {
123+
static var previews: some View {
124+
DFUView()
125+
.environmentObject(BLEManager())
126+
.environmentObject(DFU_Updater())
127+
}
128+
}

Infini-iOS/View Components/SettingsView.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import SwiftUI
1313
struct Settings_Page: View {
1414

1515
@EnvironmentObject var bleManager: BLEManager
16+
@Environment(\.colorScheme) var colorScheme
1617

1718
@AppStorage("watchNotifications") var watchNotifications: Bool = true
1819
@AppStorage("autoconnect") var autoconnect: Bool = false
@@ -34,14 +35,14 @@ struct Settings_Page: View {
3435
print(autoconnectUUID)
3536
} label: {
3637
Text("Use Current Device for Autoconnect")
37-
.foregroundColor(Color.white)
38+
.foregroundColor(colorScheme == .dark ? Color.white : Color.black)
3839
}
3940
Button {
4041
autoconnectUUID = ""
4142
print(autoconnectUUID)
4243
} label: {
4344
Text("Clear Autoconnect Device")
44-
.foregroundColor(Color.white)
45+
.foregroundColor(colorScheme == .dark ? Color.white : Color.black)
4546
}
4647
}
4748

0 commit comments

Comments
 (0)