Skip to content

Commit cfe950b

Browse files
committed
Merge branch 'settings'
2 parents 2eaa297 + 9dbb18b commit cfe950b

18 files changed

Lines changed: 379 additions & 99 deletions

File tree

Infini-iOS.xcodeproj/project.pbxproj

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
26318B1626CB27E70036051E /* Infini_iOS.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 26318B1426CB27E70036051E /* Infini_iOS.xcdatamodeld */; };
1011
264BFE4226BC51CE0050A223 /* Infini_iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264BFE4126BC51CE0050A223 /* Infini_iOSApp.swift */; };
1112
264BFE4426BC51CE0050A223 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264BFE4326BC51CE0050A223 /* ContentView.swift */; };
1213
264BFE4626BC51CF0050A223 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 264BFE4526BC51CF0050A223 /* Assets.xcassets */; };
@@ -17,7 +18,6 @@
1718
264BFE7426BC526C0050A223 /* BLEManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264BFE7326BC526C0050A223 /* BLEManager.swift */; };
1819
264BFE7626BC52720050A223 /* HexStringToData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264BFE7526BC52720050A223 /* HexStringToData.swift */; };
1920
264BFE7826BCAAC00050A223 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 264BFE7726BCAAC00050A223 /* README.md */; };
20-
264BFE7B26BCB9510050A223 /* Infini_iOS.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 264BFE7926BCB9510050A223 /* Infini_iOS.xcdatamodeld */; };
2121
264DB80B26C62ED600E812C3 /* SideMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264DB80A26C62ED600E812C3 /* SideMenu.swift */; };
2222
264DB80D26C633CF00E812C3 /* PageSwitcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 264DB80C26C633CF00E812C3 /* PageSwitcher.swift */; };
2323
26A6314D26BEFD2C005AE404 /* MusicController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26A6314C26BEFD2C005AE404 /* MusicController.swift */; };
@@ -29,8 +29,11 @@
2929
26A6316326C4C6D6005AE404 /* BLEConnectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26A6316226C4C6D6005AE404 /* BLEConnectView.swift */; };
3030
26D7816526C9EB3800BBF555 /* BLEDelegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D7816426C9EB3800BBF555 /* BLEDelegates.swift */; };
3131
26D7816726C9EC3100BBF555 /* BLEManagerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D7816626C9EC3100BBF555 /* BLEManagerExtensions.swift */; };
32-
26D7816A26C9F04400BBF555 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D7816926C9F04400BBF555 /* SettingsView.swift */; };
33-
26D7816C26C9F9EC00BBF555 /* SettingsFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D7816B26C9F9EC00BBF555 /* SettingsFunctions.swift */; };
32+
26D7816E26CA003B00BBF555 /* SettingsFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D7816D26CA003B00BBF555 /* SettingsFunctions.swift */; };
33+
26D7817026CA004B00BBF555 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D7816F26CA004B00BBF555 /* SettingsView.swift */; };
34+
26D7817326CAB27800BBF555 /* WatchNotificationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D7817226CAB27800BBF555 /* WatchNotificationsView.swift */; };
35+
26D7817526CAB79200BBF555 /* PhoneNotificationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D7817426CAB79200BBF555 /* PhoneNotificationsView.swift */; };
36+
26D7817A26CAD19F00BBF555 /* ColorPalette.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D7817926CAD19F00BBF555 /* ColorPalette.swift */; };
3437
26F426EF26C72D7D00D0866B /* BLEStatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F426EE26C72D7D00D0866B /* BLEStatusView.swift */; };
3538
/* End PBXBuildFile section */
3639

@@ -52,6 +55,7 @@
5255
/* End PBXContainerItemProxy section */
5356

5457
/* Begin PBXFileReference section */
58+
26318B1526CB27E70036051E /* Infini_iOS.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Infini_iOS.xcdatamodel; sourceTree = "<group>"; };
5559
264BFE3E26BC51CE0050A223 /* Infini-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Infini-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
5660
264BFE4126BC51CE0050A223 /* Infini_iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Infini_iOSApp.swift; sourceTree = "<group>"; };
5761
264BFE4326BC51CE0050A223 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
@@ -68,7 +72,6 @@
6872
264BFE7326BC526C0050A223 /* BLEManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BLEManager.swift; sourceTree = "<group>"; };
6973
264BFE7526BC52720050A223 /* HexStringToData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HexStringToData.swift; sourceTree = "<group>"; };
7074
264BFE7726BCAAC00050A223 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
71-
264BFE7A26BCB9510050A223 /* Infini_iOS.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Infini_iOS.xcdatamodel; sourceTree = "<group>"; };
7275
264DB80A26C62ED600E812C3 /* SideMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideMenu.swift; sourceTree = "<group>"; };
7376
264DB80C26C633CF00E812C3 /* PageSwitcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageSwitcher.swift; sourceTree = "<group>"; };
7477
26A6314C26BEFD2C005AE404 /* MusicController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MusicController.swift; sourceTree = "<group>"; };
@@ -79,8 +82,11 @@
7982
26A6316226C4C6D6005AE404 /* BLEConnectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLEConnectView.swift; sourceTree = "<group>"; };
8083
26D7816426C9EB3800BBF555 /* BLEDelegates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLEDelegates.swift; sourceTree = "<group>"; };
8184
26D7816626C9EC3100BBF555 /* BLEManagerExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLEManagerExtensions.swift; sourceTree = "<group>"; };
82-
26D7816926C9F04400BBF555 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
83-
26D7816B26C9F9EC00BBF555 /* SettingsFunctions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsFunctions.swift; sourceTree = "<group>"; };
85+
26D7816D26CA003B00BBF555 /* SettingsFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsFunctions.swift; sourceTree = "<group>"; };
86+
26D7816F26CA004B00BBF555 /* SettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
87+
26D7817226CAB27800BBF555 /* WatchNotificationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchNotificationsView.swift; sourceTree = "<group>"; };
88+
26D7817426CAB79200BBF555 /* PhoneNotificationsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhoneNotificationsView.swift; sourceTree = "<group>"; };
89+
26D7817926CAD19F00BBF555 /* ColorPalette.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPalette.swift; sourceTree = "<group>"; };
8490
26F426EE26C72D7D00D0866B /* BLEStatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLEStatusView.swift; sourceTree = "<group>"; };
8591
/* End PBXFileReference section */
8692

@@ -134,19 +140,19 @@
134140
264BFE4026BC51CE0050A223 /* Infini-iOS */ = {
135141
isa = PBXGroup;
136142
children = (
137-
26D7816826C9F02A00BBF555 /* Settings */,
138143
264BFE4126BC51CE0050A223 /* Infini_iOSApp.swift */,
139144
264BFE4326BC51CE0050A223 /* ContentView.swift */,
140145
264DB80926C62EAC00E812C3 /* View Components */,
141-
264BFE4526BC51CF0050A223 /* Assets.xcassets */,
146+
26D7816826C9F02A00BBF555 /* Settings */,
142147
26A6316126C4C6BB005AE404 /* BLE */,
143148
26A6315926C49839005AE404 /* DFU */,
144149
26A6315326BF5FD6005AE404 /* Notifications */,
145150
26A6314E26BF0FA2005AE404 /* Music */,
146-
264BFE7526BC52720050A223 /* HexStringToData.swift */,
151+
26D7817826CAD18B00BBF555 /* Utilities */,
147152
264BFE4A26BC51CF0050A223 /* Persistence.swift */,
148-
264BFE7926BCB9510050A223 /* Infini_iOS.xcdatamodeld */,
153+
264BFE4526BC51CF0050A223 /* Assets.xcassets */,
149154
264BFE4F26BC51CF0050A223 /* Info.plist */,
155+
26318B1426CB27E70036051E /* Infini_iOS.xcdatamodeld */,
150156
264BFE4726BC51CF0050A223 /* Preview Content */,
151157
);
152158
path = "Infini-iOS";
@@ -228,12 +234,31 @@
228234
26D7816826C9F02A00BBF555 /* Settings */ = {
229235
isa = PBXGroup;
230236
children = (
231-
26D7816926C9F04400BBF555 /* SettingsView.swift */,
232-
26D7816B26C9F9EC00BBF555 /* SettingsFunctions.swift */,
237+
26D7817126CAB25600BBF555 /* Notification Settings */,
238+
26D7816F26CA004B00BBF555 /* SettingsView.swift */,
239+
26D7816D26CA003B00BBF555 /* SettingsFunctions.swift */,
233240
);
234241
path = Settings;
235242
sourceTree = "<group>";
236243
};
244+
26D7817126CAB25600BBF555 /* Notification Settings */ = {
245+
isa = PBXGroup;
246+
children = (
247+
26D7817226CAB27800BBF555 /* WatchNotificationsView.swift */,
248+
26D7817426CAB79200BBF555 /* PhoneNotificationsView.swift */,
249+
);
250+
path = "Notification Settings";
251+
sourceTree = "<group>";
252+
};
253+
26D7817826CAD18B00BBF555 /* Utilities */ = {
254+
isa = PBXGroup;
255+
children = (
256+
264BFE7526BC52720050A223 /* HexStringToData.swift */,
257+
26D7817926CAD19F00BBF555 /* ColorPalette.swift */,
258+
);
259+
path = Utilities;
260+
sourceTree = "<group>";
261+
};
237262
/* End PBXGroup section */
238263

239264
/* Begin PBXNativeTarget section */
@@ -371,11 +396,9 @@
371396
isa = PBXSourcesBuildPhase;
372397
buildActionMask = 2147483647;
373398
files = (
374-
26D7816C26C9F9EC00BBF555 /* SettingsFunctions.swift in Sources */,
375-
264BFE7B26BCB9510050A223 /* Infini_iOS.xcdatamodeld in Sources */,
399+
26D7817026CA004B00BBF555 /* SettingsView.swift in Sources */,
376400
26D7816726C9EC3100BBF555 /* BLEManagerExtensions.swift in Sources */,
377401
264BFE4B26BC51CF0050A223 /* Persistence.swift in Sources */,
378-
26D7816A26C9F04400BBF555 /* SettingsView.swift in Sources */,
379402
264BFE4426BC51CE0050A223 /* ContentView.swift in Sources */,
380403
26A6315526C0297A005AE404 /* Notifications.swift in Sources */,
381404
26A6316026C4BC25005AE404 /* DFUView.swift in Sources */,
@@ -386,10 +409,15 @@
386409
264DB80B26C62ED600E812C3 /* SideMenu.swift in Sources */,
387410
264DB80D26C633CF00E812C3 /* PageSwitcher.swift in Sources */,
388411
264BFE4226BC51CE0050A223 /* Infini_iOSApp.swift in Sources */,
412+
26318B1626CB27E70036051E /* Infini_iOS.xcdatamodeld in Sources */,
389413
264BFE7626BC52720050A223 /* HexStringToData.swift in Sources */,
414+
26D7817326CAB27800BBF555 /* WatchNotificationsView.swift in Sources */,
415+
26D7817526CAB79200BBF555 /* PhoneNotificationsView.swift in Sources */,
416+
26D7816E26CA003B00BBF555 /* SettingsFunctions.swift in Sources */,
390417
26A6316326C4C6D6005AE404 /* BLEConnectView.swift in Sources */,
391418
26D7816526C9EB3800BBF555 /* BLEDelegates.swift in Sources */,
392419
26A6315B26C49841005AE404 /* DFU.swift in Sources */,
420+
26D7817A26CAD19F00BBF555 /* ColorPalette.swift in Sources */,
393421
);
394422
runOnlyForDeploymentPostprocessing = 0;
395423
};
@@ -740,12 +768,12 @@
740768
/* End XCSwiftPackageProductDependency section */
741769

742770
/* Begin XCVersionGroup section */
743-
264BFE7926BCB9510050A223 /* Infini_iOS.xcdatamodeld */ = {
771+
26318B1426CB27E70036051E /* Infini_iOS.xcdatamodeld */ = {
744772
isa = XCVersionGroup;
745773
children = (
746-
264BFE7A26BCB9510050A223 /* Infini_iOS.xcdatamodel */,
774+
26318B1526CB27E70036051E /* Infini_iOS.xcdatamodel */,
747775
);
748-
currentVersion = 264BFE7A26BCB9510050A223 /* Infini_iOS.xcdatamodel */;
776+
currentVersion = 26318B1526CB27E70036051E /* Infini_iOS.xcdatamodel */;
749777
path = Infini_iOS.xcdatamodeld;
750778
sourceTree = "<group>";
751779
versionGroupType = wrapper.xcdatamodel;

Infini-iOS/BLE/BLEDelegates.swift

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,22 @@ extension BLEManager: CBPeripheralDelegate {
2727
if characteristic.properties.contains(.read) {
2828
peripheral.readValue(for: characteristic)
2929
}
30-
30+
// MARK: - Subscribe to services
3131
// subscribe to HRM, battery, and music control characteristics
3232
if characteristic.properties.contains(.notify) {
33-
switch characteristic.uuid {
33+
/*switch characteristic.uuid {
3434
case musicControlCBUUID:
35-
peripheral.setNotifyValue(true, for: characteristic)
35+
//peripheral.setNotifyValue(true, for: characteristic)
3636
case hrmCBUUID:
37-
peripheral.setNotifyValue(true, for: characteristic)
37+
//peripheral.setNotifyValue(true, for: characteristic)
3838
case batCBUUID:
39-
peripheral.setNotifyValue(true, for: characteristic)
39+
//peripheral.setNotifyValue(true, for: characteristic)
40+
break
4041
default:
4142
break
4243
}
43-
peripheral.setNotifyValue(true, for: characteristic)
44+
peripheral.setNotifyValue(true, for: characteristic)*/
45+
print(characteristic.uuid, " can notify")
4446
}
4547

4648
if characteristic.properties.contains(.write) {
@@ -58,6 +60,7 @@ extension BLEManager: CBPeripheralDelegate {
5860
case musicControlCBUUID:
5961
// listen for the music controller notifications
6062
musicChars.control = characteristic
63+
peripheral.setNotifyValue(true, for: characteristic)
6164
let musicControl = [UInt8](characteristic.value!)
6265
controlMusic(controlNumber: Int(musicControl[0]))
6366

@@ -70,14 +73,16 @@ extension BLEManager: CBPeripheralDelegate {
7073
musicChars.artist = characteristic
7174

7275
case hrmCBUUID:
73-
// read heart rate hex, convert to decimal
76+
// subscribe to HRM, read heart rate hex, convert to decimal
7477
heartBPM = "Reading"
78+
peripheral.setNotifyValue(true, for: characteristic)
7579
let bpm = heartRate(from: characteristic)
7680
heartBPM = String(bpm)
7781

7882
case batCBUUID:
79-
// read battery hex data, convert it to decimal
83+
// subscribe to battery updates, read battery hex data, convert it to decimal
8084
batteryLevel = "Reading"
85+
peripheral.setNotifyValue(true, for: characteristic)
8186
let batData = [UInt8](characteristic.value!)
8287
batteryLevel = String(batData[0])
8388

Infini-iOS/BLE/BLEManager.swift

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate {
2222

2323
@Published var musicChars = musicCharacteristics()
2424

25+
let settings = UserDefaults.standard
26+
2527
// UI flag variables
2628
@Published var isSwitchedOn = false // for now this is used to display if bluetooth is on in the main app screen. maybe an alert in the future?
2729
@Published var isScanning = false // another UI flag. Probably not necessary for anything but debugging. I dunno maybe a little swirly animation or something could be triggered by this
2830
@Published var isConnectedToPinetime = false // another flag published to update UI stuff. Can probably be implemented better in the future
2931
@Published var heartBPM: String = "Disconnected" // published var to communicate the HRM data to the UI.
30-
@Published var batteryLevel: String = "Disconnected" // Same as heartBPM but for battery data
32+
@Published var batteryLevel: String = "20"//"Disconnected" // Same as heartBPM but for battery data
3133
@Published var firmwareVersion: String = "Disconnected"
3234

3335
// Selecting and connecting variables
@@ -82,7 +84,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate {
8284
func connect(peripheral: CBPeripheral) {
8385
// Still blocking connections to anything not named "InfiniTime" until I can set up a proper way to test other devices
8486

85-
if peripheral.name == "InfiniTime" {
87+
if peripheral.name == "InfiniTime" || peripheral.name == "Pinetime-JF" {
8688
self.myCentral.stopScan()
8789
isScanning = false
8890

@@ -98,23 +100,35 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate {
98100

99101
var peripheralName: String!
100102

103+
//for item in advertisementData { // DEBUG
104+
// print(item)
105+
//}
106+
107+
// TODO: Recreate the process below.
108+
/*
109+
- the hash I'm using is only unique between PineTimes because the peripheral struct includes an incrementing ID number that's part of the hash.
110+
- this works for getting more than one PT in the menu, but is obviously a drag because it's not at all guaranteed to be persistent
111+
- there's some stuff happening here that doesn't need to happen - ex. there's an array and a dictionary doing basically the same thing?
112+
*/
113+
101114
if let name = advertisementData[CBAdvertisementDataLocalNameKey] as? String {
102115
peripheralName = name
103-
}
104-
else {
105-
peripheralName = "Unknown"
106-
}
107-
108-
let newPeripheral = Peripheral(id: peripheralDictionary.count, name: peripheralName, rssi: RSSI.intValue, peripheralHash: peripheral.hash)
109-
110-
// compare peripheral hashes to make sure we're only adding each device once -- super helpful if you have a very noisy BLE advertiser nearby!
111-
// this hash value is functional only for separating devices during this search, and is not at all guaranteed to be a persistent value. Probably not to be trusted for long-term autoconnect persistence. So far, I have gotten the same value for my PineTime every time I run the app, but based on the Apple docs this is not a guarantee.
112-
if !peripherals.contains(where: {$0.peripheralHash == newPeripheral.peripheralHash}) {
113-
// I think there's probably a way to get rid of this array someday, but for now it's useful for displaying the device names. You cant have a Peripheral struct as a key in the peripheralDictionary, so there has to be some way to pass the names to the UI, and the peripherals array seems like it.
114-
peripherals.append(newPeripheral)
115-
peripheralDictionary[newPeripheral.peripheralHash] = peripheral
116+
let newPeripheral = Peripheral(id: peripheralDictionary.count, name: peripheralName, rssi: RSSI.intValue, peripheralHash: peripheral.hash)
117+
118+
let autoconnect = UserDefaults.standard.object(forKey: "autoconnect") as? Bool ?? true
116119

117-
print(newPeripheral, "added to list")
120+
if autoconnect {
121+
connect(peripheral: peripheral)
122+
}
123+
else {
124+
// compare peripheral hashes to make sure we're only adding each device once -- super helpful if you have a very noisy BLE advertiser nearby!
125+
if !peripherals.contains(where: {$0.peripheralHash == newPeripheral.peripheralHash}) {
126+
peripherals.append(newPeripheral)
127+
peripheralDictionary[newPeripheral.peripheralHash] = peripheral
128+
129+
print(newPeripheral, "added to list")
130+
}
131+
}
118132
}
119133
}
120134

Infini-iOS/ContentView.swift

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,18 @@ struct ContentView: View {
1212

1313
@State var showMenu = false
1414
@EnvironmentObject var pageSwitcher: PageSwitcher
15+
@EnvironmentObject var bleManager: BLEManager
16+
17+
init() {
18+
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: UIBarMetrics.default)
19+
UINavigationBar.appearance().shadowImage = UIImage()
20+
UINavigationBar.appearance().isTranslucent = true
21+
UINavigationBar.appearance().tintColor = .clear
22+
UINavigationBar.appearance().backgroundColor = .clear
23+
}
24+
1525

1626
var body: some View {
17-
1827
let drag = DragGesture()
1928
.onEnded {
2029
if $0.translation.width < -100 {
@@ -27,6 +36,14 @@ struct ContentView: View {
2736
}
2837
}
2938
}
39+
if bleManager.batteryLevel == "20" {
40+
let batNotification = UserDefaults.standard.object(forKey: "batteryNotification") as? Bool ?? false
41+
if batNotification {
42+
bleManager.sendNotification(notification: "Battery at 20%")
43+
print("20")
44+
}
45+
}
46+
3047
return NavigationView {
3148
GeometryReader { geometry in
3249
ZStack(alignment: .leading) {
@@ -38,6 +55,7 @@ struct ContentView: View {
3855
SideMenu(isOpen: self.$showMenu)
3956
.frame(width: geometry.size.width/2)
4057
.transition(.move(edge: .leading))
58+
.ignoresSafeArea()
4159
}
4260
}
4361
}
@@ -52,6 +70,8 @@ struct ContentView: View {
5270
.foregroundColor(Color.gray)
5371
}
5472
))
73+
.background(Color.black)
74+
.navigationBarTitleDisplayMode(.inline)
5575
}
5676
.gesture(drag)
5777
}
@@ -85,3 +105,4 @@ struct ContentView_Previews: PreviewProvider {
85105
.environmentObject(BLEManager())
86106
}
87107
}
108+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict/>
5+
</plist>

0 commit comments

Comments
 (0)