Skip to content

Commit

Permalink
Merge branch 'main'
Browse files Browse the repository at this point in the history
  • Loading branch information
garthvh committed Aug 24, 2024
2 parents 5f95ac5 + 3f190f2 commit c36380c
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 44 deletions.
12 changes: 6 additions & 6 deletions Meshtastic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.5.1;
MARKETING_VERSION = 2.5.2;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -1704,7 +1704,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.5.1;
MARKETING_VERSION = 2.5.2;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
Expand All @@ -1730,13 +1730,13 @@
INFOPLIST_FILE = Widgets/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Widgets;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
IPHONEOS_DEPLOYMENT_TARGET = 16.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.5.1;
MARKETING_VERSION = 2.5.2;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1763,13 +1763,13 @@
INFOPLIST_FILE = Widgets/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Widgets;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
IPHONEOS_DEPLOYMENT_TARGET = 16.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.5.1;
MARKETING_VERSION = 2.5.2;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 2 additions & 0 deletions Meshtastic/Persistence/UpdateCoreData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ func upsertSecurityConfigPacket(config: Config.SecurityConfig, nodeNum: Int64, s
newSecurityConfig.serialEnabled = config.serialEnabled
newSecurityConfig.debugLogApiEnabled = config.debugLogApiEnabled
newSecurityConfig.bluetoothLoggingEnabled = config.bluetoothLoggingEnabled
newSecurityConfig.adminChannelEnabled = config.adminChannelEnabled
fetchedNode[0].securityConfig = newSecurityConfig
} else {
fetchedNode[0].securityConfig?.publicKey = config.publicKey
Expand All @@ -827,6 +828,7 @@ func upsertSecurityConfigPacket(config: Config.SecurityConfig, nodeNum: Int64, s
fetchedNode[0].securityConfig?.serialEnabled = config.serialEnabled
fetchedNode[0].securityConfig?.debugLogApiEnabled = config.debugLogApiEnabled
fetchedNode[0].securityConfig?.bluetoothLoggingEnabled = config.bluetoothLoggingEnabled
fetchedNode[0].securityConfig?.adminChannelEnabled = config.adminChannelEnabled
}
if sessionPasskey?.count != 0 {
fetchedNode[0].sessionPasskey = sessionPasskey
Expand Down
67 changes: 42 additions & 25 deletions Meshtastic/Views/Helpers/Weather/LocalWeatherConditions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,21 @@ struct WeatherConditionsCompactWidget: View {
let description: String
var body: some View {
VStack(alignment: .leading) {
Label { Text(description) } icon: { Image(systemName: symbolName).symbolRenderingMode(.multicolor) }
.font(.caption)
HStack(spacing: 5.0) {
Image(systemName: symbolName)
.foregroundColor(.accentColor)
.font(.callout)
Text(description)
.lineLimit(2)
.allowsTightening(/*@START_MENU_TOKEN@*/true/*@END_MENU_TOKEN@*/)
.fixedSize(horizontal: false, vertical: true)
.font(.caption)
}
Text(temperature)
.font(temperature.length < 4 ? .system(size: 80) : .system(size: 60) )
.font(temperature.length < 4 ? .system(size: 76) : .system(size: 60) )
}
.padding(10)
.frame(maxWidth: .infinity)
.frame(height: 175)
.frame(minWidth: 100, idealWidth: 125, maxWidth: 150, minHeight: 120, idealHeight: 130, maxHeight: 140)
.padding()
.background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous))
}
}
Expand All @@ -112,19 +119,24 @@ struct HumidityCompactWidget: View {
let dewPoint: String
var body: some View {
VStack(alignment: .leading) {
Label { Text("HUMIDITY") } icon: { Image(systemName: "humidity").symbolRenderingMode(.multicolor) }
.font(.caption)
HStack(spacing: 5.0) {
Image(systemName: "humidity")
.foregroundColor(.accentColor)
.font(.callout)
Text("HUMIDITY")
.font(.caption)
}
Text("\(humidity)%")
.font(.largeTitle)
.padding(.bottom)
.padding(.bottom, 5)
Text("The dew point is \(dewPoint) right now.")
.lineLimit(3)
.allowsTightening(/*@START_MENU_TOKEN@*/true/*@END_MENU_TOKEN@*/)
.fixedSize(horizontal: false, vertical: true)
.font(.caption)
.font(.caption2)
}
.padding(10)
.frame(maxWidth: .infinity)
.frame(height: 175)
.frame(minWidth: 100, idealWidth: 125, maxWidth: 150, minHeight: 120, idealHeight: 130, maxHeight: 140)
.padding()
.background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous))
}
}
Expand All @@ -135,17 +147,21 @@ struct PressureCompactWidget: View {
let low: Bool
var body: some View {
VStack(alignment: .leading) {
Label { Text("PRESSURE") } icon: { Image(systemName: "gauge").symbolRenderingMode(.multicolor) }
.font(.caption)
HStack(spacing: 5.0) {
Image(systemName: "gauge")
.foregroundColor(.accentColor)
.font(.callout)
Text("PRESSURE")
.font(.caption)
}
Text(pressure)
.font(pressure.length < 7 ? .system(size: 35) : .system(size: 30) )
Text(low ? "LOW" : "HIGH")
.padding(.bottom)
.padding(.bottom, 10)
Text(unit)
}
.padding(10)
.frame(maxWidth: .infinity)
.frame(height: 175)
.frame(minWidth: 100, idealWidth: 125, maxWidth: 150, minHeight: 120, idealHeight: 130, maxHeight: 140)
.padding()
.background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous))
}
}
Expand All @@ -158,15 +174,16 @@ struct WindCompactWidget: View {
VStack(alignment: .leading) {
Label { Text("WIND") } icon: { Image(systemName: "wind").foregroundColor(.accentColor) }
Text("\(direction)")
.font(.caption)
.font(gust.isEmpty ? .callout : .caption)
.padding(.bottom, 10)
Text(speed)
.font(.system(size: 35))
Text("Gusts \(gust)")
.font(gust.isEmpty ? .system(size: 45) : .system(size: 35))
if !gust.isEmpty {
Text("Gusts \(gust)")
}
}
.padding(10)
.frame(maxWidth: .infinity)
.frame(height: 175)
.frame(minWidth: 100, idealWidth: 125, maxWidth: 150, minHeight: 120, idealHeight: 130, maxHeight: 140)
.padding()
.background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous))
}
}
Expand Down
10 changes: 5 additions & 5 deletions Meshtastic/Views/Messages/ChannelMessageList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ struct ChannelMessageList: View {
}
.padding([.top])
.scrollDismissesKeyboard(.immediately)
.onAppear {
if channel.allPrivateMessages.count > 0 {
scrollView.scrollTo(channel.allPrivateMessages.last!.messageId)
.onFirstAppear {
withAnimation {
scrollView.scrollTo(channel.allPrivateMessages.last?.messageId ?? 0, anchor: .bottom)
}
}
.onChange(of: channel.allPrivateMessages, perform: { _ in
if channel.allPrivateMessages.count > 0 {
scrollView.scrollTo(channel.allPrivateMessages.last!.messageId)
withAnimation {
scrollView.scrollTo(channel.allPrivateMessages.last?.messageId ?? 0, anchor: .bottom)
}
})
}
Expand Down
10 changes: 5 additions & 5 deletions Meshtastic/Views/Messages/UserMessageList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ struct UserMessageList: View {
}
.padding([.top])
.scrollDismissesKeyboard(.immediately)
.onAppear {
if user.messageList.count > 0 {
scrollView.scrollTo(user.messageList.last!.messageId)
.onFirstAppear {
withAnimation {
scrollView.scrollTo(user.messageList.last?.messageId ?? 0, anchor: .bottom)
}
}
.onChange(of: user.messageList, perform: { _ in
if user.messageList.count > 0 {
scrollView.scrollTo(user.messageList.last!.messageId)
withAnimation {
scrollView.scrollTo(user.messageList.last?.messageId ?? 0, anchor: .bottom)
}
})
}
Expand Down
6 changes: 4 additions & 2 deletions Meshtastic/Views/Nodes/EnvironmentMetricsLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ struct EnvironmentMetricsLog: View {
}
}
TableColumn("Wind Speed") { em in
Text("\(String(format: "%.1f", em.windSpeed)) hPa")
let windSpeed = Measurement(value: Double(em.windSpeed), unit: UnitSpeed.kilometersPerHour)
Text(windSpeed.formatted(.measurement(width: .abbreviated, numberFormatStyle: .number.precision(.fractionLength(0)))))
}
TableColumn("Wind Direction") { em in
Text("\(String(format: "%.1f", em.windDirection)) hPa")
let direction = cardinalValue(from: Double(em.windDirection))
Text(direction)
}
TableColumn("timestamp") { em in
Text(em.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized)
Expand Down
31 changes: 30 additions & 1 deletion Meshtastic/Views/Nodes/Helpers/NodeDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ struct NodeDetail: View {
PressureCompactWidget(pressure: String(format: "%.2f", node.latestEnvironmentMetrics?.barometricPressure ?? 0.0), unit: "hPA", low: node.latestEnvironmentMetrics?.barometricPressure ?? 0.0 <= 1009.144)
}
if node.latestEnvironmentMetrics?.windSpeed ?? 0.0 > 0.0 {
WindCompactWidget(speed: String(node.latestEnvironmentMetrics?.windSpeed ?? 0.0), gust: String(node.latestEnvironmentMetrics?.windGust ?? 0.0), direction: "")
let windSpeed = Measurement(value: Double(node.latestEnvironmentMetrics?.windSpeed ?? 0.0), unit: UnitSpeed.metersPerSecond)
let windGust = Measurement(value: Double(node.latestEnvironmentMetrics?.windGust ?? 0.0), unit: UnitSpeed.metersPerSecond)
let direction = cardinalValue(from: Double(node.latestEnvironmentMetrics?.windDirection ?? 0))
WindCompactWidget(speed: windSpeed.formatted(.measurement(width: .abbreviated, numberFormatStyle: .number.precision(.fractionLength(0)))),
gust: node.latestEnvironmentMetrics?.windGust ?? 0.0 > 0.0 ? windGust.formatted(.measurement(width: .abbreviated, numberFormatStyle: .number.precision(.fractionLength(0)))) : "", direction: direction)
}
}
.padding(node.latestEnvironmentMetrics?.iaq ?? -1 > 0 ? .bottom : .vertical)
Expand Down Expand Up @@ -411,3 +415,28 @@ struct NodeDetail: View {
}
}
}

func cardinalValue(from heading: Double) -> String {
switch heading {
case 0 ..< 22.5:
return "North"
case 22.5 ..< 67.5:
return "North East"
case 67.5 ..< 112.5:
return "East"
case 112.5 ..< 157.5:
return "South East"
case 157.5 ..< 202.5:
return "South"
case 202.5 ..< 247.5:
return "South West"
case 247.5 ..< 292.5:
return "West"
case 292.5 ..< 337.5:
return "North West"
case 337.5 ... 360.0:
return "North"
default:
return ""
}
}

0 comments on commit c36380c

Please sign in to comment.