mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Selected sidebar list cleanup, still not perfect
This commit is contained in:
parent
d24b57fb16
commit
b6fd64ac03
2 changed files with 101 additions and 97 deletions
|
|
@ -51,10 +51,10 @@ struct Contacts: View {
|
|||
let currentDay = Calendar.current.dateComponents([.day], from: Date()).day ?? 0
|
||||
|
||||
HStack {
|
||||
VStack {
|
||||
VStack(alignment: .leading) {
|
||||
CircleText(text: user.shortName ?? "???", color: Color.blue)
|
||||
.padding(.trailing, 5)
|
||||
}
|
||||
.padding([.leading, .trailing])
|
||||
VStack {
|
||||
HStack {
|
||||
VStack {
|
||||
|
|
@ -80,8 +80,6 @@ struct Contacts: View {
|
|||
}
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
}
|
||||
.listRowSeparator(.hidden).frame(height: 5)
|
||||
|
||||
HStack(alignment: .top) {
|
||||
Text("\(mostRecent != nil ? mostRecent!.messagePayload! : " ")")
|
||||
.frame(height: 60)
|
||||
|
|
@ -94,10 +92,10 @@ struct Contacts: View {
|
|||
}
|
||||
} else {
|
||||
HStack {
|
||||
VStack {
|
||||
CircleText(text: user.shortName ?? "????", color: Color.blue)
|
||||
VStack(alignment: .leading) {
|
||||
CircleText(text: user.shortName ?? "???", color: Color.blue)
|
||||
.padding(.trailing, 5)
|
||||
}
|
||||
.padding(.trailing)
|
||||
VStack {
|
||||
HStack {
|
||||
VStack {
|
||||
|
|
@ -108,9 +106,16 @@ struct Contacts: View {
|
|||
}
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
}
|
||||
.listRowSeparator(.hidden).frame(height: 5)
|
||||
HStack(alignment: .top) {
|
||||
Text(" ")
|
||||
.frame(height: 60)
|
||||
.truncationMode(.tail)
|
||||
.foregroundColor(Color.gray)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
}.padding()
|
||||
.padding(.top)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -122,11 +127,7 @@ struct Contacts: View {
|
|||
}
|
||||
.hidden()
|
||||
}
|
||||
.navigationTitle("Contacts")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarItems(leading:
|
||||
MeshtasticLogo()
|
||||
)
|
||||
.tint(Color(UIColor.systemGray))
|
||||
}
|
||||
detail: {
|
||||
|
||||
|
|
@ -139,5 +140,11 @@ struct Contacts: View {
|
|||
Text("Select a user")
|
||||
}
|
||||
}
|
||||
.navigationSplitViewStyle(.automatic)
|
||||
.navigationTitle("Contacts")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarItems(leading:
|
||||
MeshtasticLogo()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,101 +44,85 @@ struct NodeList: View {
|
|||
.listRowSeparator(.visible)
|
||||
|
||||
} else {
|
||||
//ForEach( nodes ) { node in
|
||||
|
||||
// let index = nodes.firstIndex(where: { $0.id == node.id })
|
||||
NavigationLink(value: node) {
|
||||
|
||||
NavigationLink(value: node) {
|
||||
let connected: Bool = (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num == node.num)
|
||||
|
||||
let connected: Bool = (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num == node.num)
|
||||
VStack(alignment: .leading) {
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
|
||||
HStack {
|
||||
CircleText(text: node.user?.shortName ?? "???", color: .blue).offset(y: 1).padding(.trailing, 5)
|
||||
.offset(x: -15)
|
||||
|
||||
CircleText(text: node.user?.shortName ?? "???", color: Color.accentColor).offset(y: 1).padding(.trailing, 5)
|
||||
if UIDevice.current.userInterfaceIdiom == .pad { Text(node.user?.longName ?? "Unknown").font(.headline)
|
||||
.offset(x: -15)
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom == .pad { Text(node.user?.longName ?? "Unknown").font(.headline)
|
||||
.offset(x: -15)
|
||||
} else {
|
||||
Text(node.user?.longName ?? "Unknown").font(.title2).offset(x: -15)
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 5)
|
||||
|
||||
if connected {
|
||||
|
||||
HStack(alignment: .bottom) {
|
||||
|
||||
Image(systemName: "repeat.circle.fill").font(.title2)
|
||||
.foregroundColor(.accentColor).symbolRenderingMode(.hierarchical)
|
||||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
|
||||
Text("Currently Connected").font(.callout).foregroundColor(Color.accentColor)
|
||||
} else {
|
||||
|
||||
Text("Currently Connected").font(.title3).foregroundColor(Color.accentColor)
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 2)
|
||||
}
|
||||
if node.positions?.count ?? 0 > 0 && (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num != node.num) {
|
||||
|
||||
HStack(alignment: .bottom) {
|
||||
|
||||
let lastPostion = node.positions!.reversed()[0] as! PositionEntity
|
||||
|
||||
let myCoord = CLLocation(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude)
|
||||
|
||||
if lastPostion.coordinate != nil {
|
||||
|
||||
let nodeCoord = CLLocation(latitude: lastPostion.coordinate!.latitude, longitude: lastPostion.coordinate!.longitude)
|
||||
|
||||
let metersAway = nodeCoord.distance(from: myCoord)
|
||||
|
||||
Image(systemName: "lines.measurement.horizontal").font(.title3)
|
||||
.foregroundColor(.accentColor).symbolRenderingMode(.hierarchical)
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
|
||||
DistanceText(meters: metersAway).font(.subheadline).foregroundColor(.gray)
|
||||
|
||||
} else {
|
||||
|
||||
DistanceText(meters: metersAway).font(.title3).foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 2)
|
||||
|
||||
}
|
||||
HStack(alignment: .bottom) {
|
||||
|
||||
Image(systemName: "clock.badge.checkmark.fill").font(.headline)
|
||||
.foregroundColor(.accentColor).symbolRenderingMode(.hierarchical)
|
||||
|
||||
LastHeardText(lastHeard: node.lastHeard).font(.subheadline).foregroundColor(.gray)
|
||||
} else {
|
||||
Text(node.user?.longName ?? "Unknown").font(.title2).offset(x: -15)
|
||||
}
|
||||
}
|
||||
.padding([.leading, .top, .bottom])
|
||||
.padding(.bottom, 5)
|
||||
|
||||
if connected {
|
||||
|
||||
HStack(alignment: .bottom) {
|
||||
|
||||
Image(systemName: "repeat.circle.fill").font(.title2)
|
||||
.foregroundColor(.accentColor).symbolRenderingMode(.hierarchical)
|
||||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
|
||||
Text("Currently Connected").font(.callout).foregroundColor(Color.accentColor)
|
||||
} else {
|
||||
|
||||
Text("Currently Connected").font(.title3).foregroundColor(Color.accentColor)
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 2)
|
||||
}
|
||||
if node.positions?.count ?? 0 > 0 && (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num != node.num) {
|
||||
|
||||
HStack(alignment: .bottom) {
|
||||
|
||||
let lastPostion = node.positions!.reversed()[0] as! PositionEntity
|
||||
|
||||
let myCoord = CLLocation(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude)
|
||||
|
||||
if lastPostion.coordinate != nil {
|
||||
|
||||
let nodeCoord = CLLocation(latitude: lastPostion.coordinate!.latitude, longitude: lastPostion.coordinate!.longitude)
|
||||
|
||||
let metersAway = nodeCoord.distance(from: myCoord)
|
||||
|
||||
Image(systemName: "lines.measurement.horizontal").font(.title3)
|
||||
.foregroundColor(.accentColor).symbolRenderingMode(.hierarchical)
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
|
||||
DistanceText(meters: metersAway).font(.subheadline).foregroundColor(.gray)
|
||||
|
||||
} else {
|
||||
|
||||
DistanceText(meters: metersAway).font(.title3).foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 2)
|
||||
|
||||
}
|
||||
HStack(alignment: .bottom) {
|
||||
|
||||
Image(systemName: "clock.badge.checkmark.fill").font(.headline)
|
||||
.foregroundColor(.accentColor).symbolRenderingMode(.hierarchical)
|
||||
|
||||
LastHeardText(lastHeard: node.lastHeard).font(.subheadline).foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
//}
|
||||
.padding([.leading, .top, .bottom])
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("All Nodes")
|
||||
.navigationBarItems(leading:
|
||||
MeshtasticLogo()
|
||||
)
|
||||
.onAppear {
|
||||
|
||||
if initialLoad {
|
||||
|
||||
self.bleManager.userSettings = userSettings
|
||||
self.bleManager.context = context
|
||||
self.initialLoad = false
|
||||
}
|
||||
}
|
||||
.tint(Color(UIColor.systemGray))
|
||||
} detail: {
|
||||
|
||||
if let node = selection {
|
||||
|
|
@ -150,5 +134,18 @@ struct NodeList: View {
|
|||
Text("Select a node")
|
||||
}
|
||||
}
|
||||
.navigationTitle("All Nodes")
|
||||
.navigationBarItems(leading:
|
||||
MeshtasticLogo()
|
||||
)
|
||||
.onAppear {
|
||||
|
||||
if initialLoad {
|
||||
|
||||
self.bleManager.userSettings = userSettings
|
||||
self.bleManager.context = context
|
||||
self.initialLoad = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue