Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle connsecutive capital letters in camelCaseToWords function #1003

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Meshtastic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.5.10;
MARKETING_VERSION = 2.5.11;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -1738,7 +1738,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.5.10;
MARKETING_VERSION = 2.5.11;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -1770,7 +1770,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.5.10;
MARKETING_VERSION = 2.5.11;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1803,7 +1803,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.5.10;
MARKETING_VERSION = 2.5.11;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
10 changes: 5 additions & 5 deletions Meshtastic/Extensions/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ extension String {
}

func camelCaseToWords() -> String {
return unicodeScalars.dropFirst().reduce(String(prefix(1))) {
return CharacterSet.uppercaseLetters.contains($1)
? $0 + " " + String($1)
: $0 + String($1)
}
return self
.replacingOccurrences(of: "([a-z])([A-Z](?=[A-Z])[a-z]*)", with: "$1 $2", options: .regularExpression)
.replacingOccurrences(of: "([A-Z])([A-Z][a-z])", with: "$1 $2", options: .regularExpression)
.replacingOccurrences(of: "([a-z])([A-Z][a-z])", with: "$1 $2", options: .regularExpression)
.replacingOccurrences(of: "([a-z])([A-Z][a-z])", with: "$1 $2", options: .regularExpression)
}

var length: Int {
Expand Down
2 changes: 1 addition & 1 deletion Meshtastic/Helpers/BLEManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
@Published var automaticallyReconnect: Bool = true
@Published var mqttProxyConnected: Bool = false
@Published var mqttError: String = ""
public var minimumVersion = "2.0.0"
public var minimumVersion = "2.3.2"
public var connectedVersion: String
public var isConnecting: Bool = false
public var isConnected: Bool = false
Expand Down
103 changes: 77 additions & 26 deletions Meshtastic/Resources/DeviceHardware.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
],
"images": [
"t-echo.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 8,
Expand All @@ -113,7 +114,8 @@
"images": [
"rak4631.svg",
"rak4631_case.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 10,
Expand Down Expand Up @@ -150,7 +152,8 @@
],
"images": [
"tbeam-s3-core.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 13,
Expand Down Expand Up @@ -204,7 +207,8 @@
],
"images": [
"tlora-t3s3-v1.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 16,
Expand All @@ -219,7 +223,8 @@
],
"images": [
"tlora-t3s3-epaper.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 17,
Expand All @@ -243,6 +248,10 @@
"displayName": "Nano G2 Ultra",
"tags": [
"B&Q"
],
"requiresDfu": true,
"images": [
"nano-g2-ultra.svg"
]
},
{
Expand All @@ -258,7 +267,8 @@
],
"images": [
"wio-tracker-wm1110.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 25,
Expand All @@ -282,7 +292,11 @@
"displayName": "RAK WisBlock 11310",
"tags": [
"RAK"
]
],
"images": [
"rak4631.svg"
],
"requiresDfu": true
},
{
"hwModel": 29,
Expand All @@ -294,7 +308,8 @@
"displayName": "Canary One",
"tags": [
"Canary"
]
],
"requiresDfu": true
},
{
"hwModel": 30,
Expand All @@ -306,7 +321,8 @@
"displayName": "RP2040 LoRa",
"tags": [
"Waveshare"
]
],
"requiresDfu": true
},
{
"hwModel": 31,
Expand All @@ -318,6 +334,10 @@
"displayName": "Station G2",
"tags": [
"B&Q"
],
"requiresDfu": true,
"images": [
"station-g2.svg"
]
},
{
Expand Down Expand Up @@ -409,7 +429,8 @@
"tags": [
"Raspberry Pi",
"DIY"
]
],
"requiresDfu": true
},
{
"hwModel": 47,
Expand All @@ -422,7 +443,8 @@
"tags": [
"Raspberry Pi",
"DIY"
]
],
"requiresDfu": true
},
{
"hwModel": 48,
Expand All @@ -437,19 +459,21 @@
],
"images": [
"heltec-wireless-tracker.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 58,
"hwModelSlug": "HELTEC_WIRELESS_TRACKER_V1_0",
"platformioTarget": "heltec-wireless-tracker-V1-0",
"architecture": "esp32-s3",
"activelySupported": true,
"activelySupported": false,
"supportLevel": 3,
"displayName": "Heltec Wireless Tracker V1.0",
"images": [
"heltec-wireless-tracker.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 49,
Expand Down Expand Up @@ -479,7 +503,8 @@
],
"images": [
"t-deck.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 51,
Expand Down Expand Up @@ -525,7 +550,7 @@
"hwModelSlug": "HELTEC_WIRELESS_PAPER_V1_0",
"platformioTarget": "heltec-wireless-paper-v1_0",
"architecture": "esp32-s3",
"activelySupported": true,
"activelySupported": false,
"supportLevel": 3,
"tags": [
"Heltec"
Expand All @@ -542,7 +567,8 @@
"architecture": "esp32-s3",
"activelySupported": true,
"supportLevel": 3,
"displayName": "unPhone"
"displayName": "unPhone",
"requiresDfu": true
},
{
"hwModel": 48,
Expand All @@ -551,7 +577,8 @@
"architecture": "esp32-s3",
"activelySupported": true,
"supportLevel": 3,
"displayName": "TrackSenger (small TFT)"
"displayName": "TrackSenger (small TFT)",
"requiresDfu": true
},
{
"hwModel": 48,
Expand All @@ -560,7 +587,8 @@
"architecture": "esp32-s3",
"activelySupported": true,
"supportLevel": 3,
"displayName": "TrackSenger (big TFT)"
"displayName": "TrackSenger (big TFT)",
"requiresDfu": true
},
{
"hwModel": 48,
Expand All @@ -581,7 +609,8 @@
"displayName": "EBYTE EoRa-S3",
"tags": [
"EByte"
]
],
"requiresDfu": true
},
{
"hwModel": 64,
Expand All @@ -608,7 +637,8 @@
],
"images": [
"heltec-vision-master-t190.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 67,
Expand All @@ -623,7 +653,8 @@
],
"images": [
"heltec-vision-master-e213.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 68,
Expand All @@ -638,7 +669,8 @@
],
"images": [
"heltec-vision-master-e290.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 69,
Expand All @@ -654,7 +686,8 @@
"images": [
"heltec-mesh-node-t114.svg",
"heltec-mesh-node-t114-case.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 70,
Expand Down Expand Up @@ -684,7 +717,8 @@
],
"images": [
"tracker-t1000-e.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 72,
Expand All @@ -699,6 +733,23 @@
],
"images": [
"seeed-xiao-s3.svg"
]
],
"requiresDfu": true
},
{
"hwModel": 84,
"hwModelSlug": "WISMESH_TAP",
"platformioTarget": "rak_wismeshtap",
"architecture": "nrf52840",
"activelySupported": false,
"supportLevel": 1,
"displayName": "RAK WisMesh Tap",
"tags": [
"RAK"
],
"images": [
"rak-wismeshtap.svg"
],
"requiresDfu": true
}
]
2 changes: 0 additions & 2 deletions Meshtastic/Views/Bluetooth/InvalidVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ struct InvalidVersion: View {
Text("Version \(minimumVersion) includes breaking changes to devices and the client apps. Only nodes version \(minimumVersion) and above are supported.")
.font(.callout)
.padding([.leading, .trailing, .bottom])
Link("Version 1.2 End of life (EOL) Info", destination: URL(string: "https://meshtastic.org/docs/1.2-End-of-life/")!)
.font(.callout)

#if targetEnvironment(macCatalyst)
Button {
Expand Down
4 changes: 3 additions & 1 deletion Meshtastic/Views/Settings/Config/BluetoothConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,20 @@ struct BluetoothConfig: View {
.onFirstAppear {
// Need to request a BluetoothConfig from the remote node before allowing changes
if let connectedPeripheral = bleManager.connectedPeripheral, let node {
Logger.mesh.info("empty bluetooth config")

let connectedNode = getNodeInfo(id: connectedPeripheral.num, context: context)
if let connectedNode {
if node.num != connectedNode.num {
if UserDefaults.enableAdministration {
/// 2.5 Administration with session passkey
let expiration = node.sessionExpiration ?? Date()
if expiration < Date() || node.bluetoothConfig == nil {
Logger.mesh.info("⚙️ Empty or expired bluetooth config requesting via PKI admin")
_ = bleManager.requestBluetoothConfig(fromUser: connectedNode.user!, toUser: node.user!, adminIndex: connectedNode.myInfo?.adminIndex ?? 0)
}
} else {
/// Legacy Administration
Logger.mesh.info("☠️ Using insecure legacy admin, empty bluetooth config")
_ = bleManager.requestBluetoothConfig(fromUser: connectedNode.user!, toUser: node.user!, adminIndex: connectedNode.myInfo?.adminIndex ?? 0)
}
}
Expand Down
Loading
Loading