Delete old BLE peripherals and messages files

This commit is contained in:
Garth Vander Houwen 2022-03-04 05:18:16 -08:00
parent 809dad5e76
commit 99960f0fa8
4 changed files with 0 additions and 257 deletions

View file

@ -20,8 +20,6 @@
DD47E3CE26F103C600029299 /* NodeList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3CD26F103C600029299 /* NodeList.swift */; };
DD47E3D626F17ED900029299 /* CircleText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D526F17ED900029299 /* CircleText.swift */; };
DD47E3D926F3093800029299 /* MessageBubble.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D826F3093800029299 /* MessageBubble.swift */; };
DD47E3DB26F3901B00029299 /* Channels.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3DA26F3901A00029299 /* Channels.swift */; };
DD47E3DD26F390A000029299 /* Messages.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3DC26F390A000029299 /* Messages.swift */; };
DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4A911D2708C65400501B7E /* AppSettings.swift */; };
DD4DED9027AD2975004BA27E /* cannedmessages.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4DED8F27AD2975004BA27E /* cannedmessages.pb.swift */; };
DD5394FC276993AD00AD86B1 /* SwiftProtobuf in Frameworks */ = {isa = PBXBuildFile; productRef = DD5394FB276993AD00AD86B1 /* SwiftProtobuf */; };
@ -89,8 +87,6 @@
DD47E3CD26F103C600029299 /* NodeList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeList.swift; sourceTree = "<group>"; };
DD47E3D526F17ED900029299 /* CircleText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleText.swift; sourceTree = "<group>"; };
DD47E3D826F3093800029299 /* MessageBubble.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageBubble.swift; sourceTree = "<group>"; };
DD47E3DA26F3901A00029299 /* Channels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Channels.swift; sourceTree = "<group>"; };
DD47E3DC26F390A000029299 /* Messages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Messages.swift; sourceTree = "<group>"; };
DD4A911D2708C65400501B7E /* AppSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSettings.swift; sourceTree = "<group>"; };
DD4DED8F27AD2975004BA27E /* cannedmessages.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = cannedmessages.pb.swift; sourceTree = "<group>"; };
DD5394FD276BA0EF00AD86B1 /* PositionEntityExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionEntityExtension.swift; sourceTree = "<group>"; };
@ -333,8 +329,6 @@
DDC2E18B26CE25A70042C5E4 /* Messages */ = {
isa = PBXGroup;
children = (
DD47E3DA26F3901A00029299 /* Channels.swift */,
DD47E3DC26F390A000029299 /* Messages.swift */,
DD882F5C2772E4640005BF05 /* Contacts.swift */,
DD1BF2F82776FE2E008C8D2F /* UserMessageList.swift */,
);
@ -542,7 +536,6 @@
DDAF8C5326EB1DF10058C060 /* BLEManager.swift in Sources */,
DDC4D568275499A500A4208E /* Persistence.swift in Sources */,
DD90860E26F69BAE00DC5189 /* NodeMap.swift in Sources */,
DD47E3DB26F3901B00029299 /* Channels.swift in Sources */,
DD8169FF272476C700F4AB02 /* LogDocument.swift in Sources */,
DDAF8C6926ED0D070058C060 /* deviceonly.pb.swift in Sources */,
DDAF8C6B26ED0DD80058C060 /* environmental_measurement.pb.swift in Sources */,
@ -573,7 +566,6 @@
DD539502276DAA6A00AD86B1 /* MapLocation.swift in Sources */,
DDAF8C6726ED0C8C0058C060 /* remote_hardware.pb.swift in Sources */,
DDAF8C6526ED0A490058C060 /* channel.pb.swift in Sources */,
DD47E3DD26F390A000029299 /* Messages.swift in Sources */,
DDC2E15826CE248E0042C5E4 /* MeshtasticClientApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View file

@ -98,7 +98,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
self.centralManager.stopScan()
self.isScanning = self.centralManager.isScanning
peripherals.removeAll(where: { $0.peripheral.state == CBPeripheralState.disconnected })
print("🛑 Stopped Scanning")
}
}

View file

@ -1,44 +0,0 @@
//import Foundation
//import SwiftUI
//import CoreBluetooth
//
//struct Channels: View {
//
// @State private var isShowingDetailView = true
//
// var body: some View {
//
// NavigationView {
//
// NavigationLink(destination: Messages(), isActive: $isShowingDetailView) {
//
// List {
//
// HStack {
//
// Image(systemName: "megaphone.fill")
// .font(.largeTitle)
// .symbolRenderingMode(.hierarchical)
// .padding(.trailing)
// .foregroundColor(.accentColor)
//
// Text("All - Broadcast")
// .font(.largeTitle)
//
// }.padding()
// }
// }
// .navigationTitle("Contacts")
// }
// .navigationViewStyle(DoubleColumnNavigationViewStyle())
// }
//}
//
//struct MessageList_Previews: PreviewProvider {
//
// static var previews: some View {
// Group {
// Channels()
// }
// }
//}

View file

@ -1,204 +0,0 @@
//import SwiftUI
//import MapKit
//import Foundation
//import CoreLocation
//
//struct Messages: View {
//
// enum Field: Hashable {
// case messageText
// }
//
// // CoreData
// @Environment(\.managedObjectContext) var context
// @EnvironmentObject var bleManager: BLEManager
//
// @FetchRequest(
// sortDescriptors: [NSSortDescriptor(keyPath: \MessageEntity.messageTimestamp, ascending: true)],
// animation: .default)
// var messages: FetchedResults<MessageEntity>
//
// // Keyboard State
// @State var typingMessage: String = ""
// @State private var totalBytes = 0
// private var maxbytes = 228
// @State private var lastTypingMessage = ""
// @FocusState private var focusedField: Field?
//
// @State var showDeleteMessageAlert = false
// @State private var deleteMessageId: Int64 = 0
//
// public var broadcastNodeId: UInt32 = 4294967295
//
// var body: some View {
//
// Text("\(messages.count) Messages").font(.caption)
// GeometryReader { bounds in
//
// VStack {
//
// ScrollViewReader { scrollView in
//
// if self.messages.count > 0 {
//
// ScrollView {
//
// ForEach(messages) { message in
//
// HStack(alignment: .top) {
// let currentUser: Bool = (bleManager.connectedPeripheral == nil) ? false : ((bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num == message.fromUser?.num) ? true : false )
//
// CircleText(text: (message.fromUser?.shortName ?? "???"), color: currentUser ? .accentColor : Color(.darkGray)).padding(.all, 5)
// .gesture(LongPressGesture(minimumDuration: 2)
// .onEnded {_ in
// print(messages)
// print("I want to delete message: \(message.messageId)")
// self.showDeleteMessageAlert = true
// self.deleteMessageId = message.messageId
//
// print(deleteMessageId)
// })
//
// VStack(alignment: .leading) {
// Text(message.messagePayload ?? "EMPTY MESSAGE")
// .textSelection(.enabled)
// .padding(10)
// .foregroundColor(.white)
// .background(currentUser ? Color.blue : Color(.darkGray))
// .cornerRadius(10)
// HStack(spacing: 4) {
//
// let time = Int32(message.messageTimestamp)
// let messageDate = Date(timeIntervalSince1970: TimeInterval(time))
//
// if time != 0 {
// Text(messageDate, style: .date).font(.caption2).foregroundColor(.gray)
// Text(messageDate, style: .time).font(.caption2).foregroundColor(.gray)
// } else {
// Text("Unknown").font(.caption2).foregroundColor(.gray)
// }
// }
// .padding(.bottom, 10)
// }
// Spacer()
// }
// .alert(isPresented: $showDeleteMessageAlert) {
// Alert(title: Text("Are you sure you want to delete this message?"), message: Text("This action is permanent."),
// primaryButton: .destructive(Text("Delete")) {
// print("OK button tapped")
// if deleteMessageId > 0 {
//
// let message = messages.first(where: { $0.messageId == deleteMessageId })
//
// context.delete(message!)
// do {
// try context.save()
//
// deleteMessageId = 0
//
// } catch {
// print("Failed to delete message \(deleteMessageId)")
// }
//
// }
// },
// secondaryButton: .cancel()
// )
// }
// }
// .onChange(of: messages.count, perform: { newValue in
//
// if messages.count > 0 {
//
// scrollView.scrollTo(messages[messages.count-1].id, anchor: .bottom)
// }
// }
// )
// .onAppear(perform: {
//
// self.bleManager.context = context
// if messages.count > 0 {
//
// scrollView.scrollTo(messages[messages.count-1].id, anchor: .bottom)
// }
// })
// }
// .padding(.horizontal)
// }
// }
//
// HStack(alignment: .top) {
//
// ZStack {
//
// let kbType = UIKeyboardType(rawValue: UserDefaults.standard.object(forKey: "keyboardType") as? Int ?? 0)
// TextEditor(text: $typingMessage)
// .onChange(of: typingMessage, perform: { value in
//
// let size = value.utf8.count
// totalBytes = size
// if totalBytes <= maxbytes {
// // Allow the user to type
// lastTypingMessage = typingMessage
// } else {
// // Set the message back and remove the bytes over the count
// self.typingMessage = lastTypingMessage
// }
// })
// .keyboardType(kbType!)
// .toolbar {
// ToolbarItemGroup(placement: .keyboard) {
//
// Button("Dismiss Keyboard") {
// focusedField = nil
// }
// .font(.subheadline)
//
// Spacer()
//
// ProgressView("Bytes: \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
// .frame(width: 130)
// .padding(5)
// .font(.subheadline)
// .accentColor(.accentColor)
// }
// }
// .padding(.horizontal, 8)
// .focused($focusedField, equals: .messageText)
// .multilineTextAlignment(.leading)
// .frame(minHeight: bounds.size.height / 4, maxHeight: bounds.size.height / 4)
//
// Text(typingMessage).opacity(0).padding(.all, 0)
//
// }
// .overlay(RoundedRectangle(cornerRadius: 20).stroke(.tertiary, lineWidth: 1))
// .padding(.bottom, 15)
//
// Button(action: {
// if self.bleManager.sendMessage(message: typingMessage, toUserNum: Int64(self.bleManager.broadcastNodeNum)) {
// typingMessage = ""
// focusedField = nil
// }
//
// }) {
// Image(systemName: "arrow.up.circle.fill").font(.largeTitle).foregroundColor(.blue)
// }
//
// }
// .padding(.all, 15)
// }
// }
// .navigationTitle("All - Broadcast")
// .navigationBarTitleDisplayMode(.inline)
// .navigationBarItems(trailing:
//
// ZStack {
//
// ConnectedDevice(
// bluetoothOn: self.bleManager.isSwitchedOn,
// deviceConnected: self.bleManager.connectedPeripheral != nil,
// name: (self.bleManager.connectedPeripheral != nil) ? self.bleManager.connectedPeripheral.shortName : "???")
// }
// )
// }
//}