You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: InfiniLink/BLE/BLEManager.swift
+16-22Lines changed: 16 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -193,11 +193,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
193
193
}
194
194
}
195
195
196
-
func resetDevice(){
197
-
BLEFSHandler.shared.writeSettings(Settings())
198
-
deviceManager.settings =Settings()
199
-
}
200
-
201
196
func unpair(device:Device?=nil){
202
197
Task{
203
198
iflet pairedDevice {
@@ -206,23 +201,22 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
206
201
}
207
202
// Update the list of user watches
208
203
await deviceManager.fetchAllDevices()
209
-
}
210
-
211
-
iflet first = deviceManager.watches.first, deviceManager.watches.count <=1{
212
-
// Switch to the user's next watch
213
-
pairedDeviceID = first.uuid
214
-
pairedDevice = deviceManager.fetchDevice()
215
-
}else{
216
-
// The user doesn't have another watch, this will show the welcome view
217
-
pairedDeviceID =nil
218
-
}
219
-
220
-
log("Unpaired from \(pairedDevice?.name ??"InfiniTime")", type:.info, caller:"BLEManager", target:.ble)
221
-
222
-
if device ==nil{
223
-
// FIXME: this only disconnects and removes the watch from the recognized device list in the app. If using secure pairing, iOS will still keep the bond
224
-
disconnect()
225
-
startScanning()
204
+
205
+
iflet first = deviceManager.watches.first, deviceManager.watches.count <=1{
206
+
// Switch to the user's next watch
207
+
pairedDeviceID = first.uuid
208
+
}else{
209
+
// The user doesn't have another watch, this will show the welcome view
210
+
pairedDeviceID =nil
211
+
}
212
+
213
+
log("Unpaired from \(pairedDevice?.name ??"InfiniTime")", type:.info, caller:"BLEManager", target:.ble)
214
+
215
+
if device ==nil{
216
+
// FIXME: this only disconnects and removes the watch from the recognized device list in the app. If using secure pairing, iOS will still keep the bond
.alert("Are you sure you want to reset all content and settings from \(deviceManager.name)? You'll need to restart \(deviceManager.name) for the changes to take effect.", isPresented: $showResetConfirmation){
Copy file name to clipboardExpand all lines: InfiniLink/Utils/PersistenceController.swift
+3-29Lines changed: 3 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -12,32 +12,6 @@ struct PersistenceController {
12
12
13
13
letcontainer:NSPersistentContainer
14
14
15
-
@MainActor
16
-
staticletpreview:PersistenceController={
17
-
letresult=PersistenceController(inMemory:true)
18
-
letviewContext= result.container.viewContext
19
-
20
-
for_in0..<1{
21
-
letexercise=UserExercise(context: viewContext)
22
-
23
-
exercise.exerciseId ="soccer"
24
-
exercise.startDate =Date.distantPast
25
-
exercise.endDate =Date()
26
-
exercise.heartPoints =[]
27
-
exercise.id =UUID()
28
-
}
29
-
30
-
do{
31
-
try viewContext.save()
32
-
}catch{
33
-
// Replace this implementation with code to handle the error appropriately.
34
-
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
0 commit comments