Skip to content

Commit 2dd884e

Browse files
committed
Various UI/interface changes
- Tweaked interface structure (StackNavigationView) - Re-added landscape support - Made advanced settings buttons clearer - Swapped hard-coded fonts with system dynamic fonts (thx Apollo) - Corrected typo in License.md
1 parent 1d4c3d5 commit 2dd884e

File tree

12 files changed

+138
-88
lines changed

12 files changed

+138
-88
lines changed

KDE Connect/KDE Connect.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
A01FDD2D26C62E180014B165 /* Share.swift in Sources */ = {isa = PBXBuildFile; fileRef = A01FDD2C26C62E170014B165 /* Share.swift */; };
2323
A01FDD2F26C6FD110014B165 /* FindMyPhone.swift in Sources */ = {isa = PBXBuildFile; fileRef = A01FDD2E26C6FD110014B165 /* FindMyPhone.swift */; };
2424
A01FDD3126C701360014B165 /* Battery.swift in Sources */ = {isa = PBXBuildFile; fileRef = A01FDD3026C701360014B165 /* Battery.swift */; };
25-
A0A04430267BF38700CC21DD /* KDE_Connect_TestApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0A0442F267BF38700CC21DD /* KDE_Connect_TestApp.swift */; };
25+
A0A04430267BF38700CC21DD /* KDE_Connect_App.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0A0442F267BF38700CC21DD /* KDE_Connect_App.swift */; };
2626
A0A04432267BF38700CC21DD /* MainTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0A04431267BF38700CC21DD /* MainTabView.swift */; };
2727
A0A04434267BF38A00CC21DD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A0A04433267BF38A00CC21DD /* Assets.xcassets */; };
2828
A0A04437267BF38A00CC21DD /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A0A04436267BF38A00CC21DD /* Preview Assets.xcassets */; };
@@ -101,7 +101,7 @@
101101
A01FDD3026C701360014B165 /* Battery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Battery.swift; sourceTree = "<group>"; };
102102
A034ADA726BF32F500A7CC70 /* KDE Connect.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "KDE Connect.entitlements"; sourceTree = "<group>"; };
103103
A0A0442C267BF38700CC21DD /* KDE Connect.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "KDE Connect.app"; sourceTree = BUILT_PRODUCTS_DIR; };
104-
A0A0442F267BF38700CC21DD /* KDE_Connect_TestApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KDE_Connect_TestApp.swift; sourceTree = "<group>"; };
104+
A0A0442F267BF38700CC21DD /* KDE_Connect_App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KDE_Connect_App.swift; sourceTree = "<group>"; };
105105
A0A04431267BF38700CC21DD /* MainTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabView.swift; sourceTree = "<group>"; };
106106
A0A04433267BF38A00CC21DD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
107107
A0A04436267BF38A00CC21DD /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
@@ -336,7 +336,7 @@
336336
A0D8CBCB26EF081D00791D07 /* Top Level */ = {
337337
isa = PBXGroup;
338338
children = (
339-
A0A0442F267BF38700CC21DD /* KDE_Connect_TestApp.swift */,
339+
A0A0442F267BF38700CC21DD /* KDE_Connect_App.swift */,
340340
A0A04431267BF38700CC21DD /* MainTabView.swift */,
341341
);
342342
path = "Top Level";
@@ -598,7 +598,7 @@
598598
A0A04432267BF38700CC21DD /* MainTabView.swift in Sources */,
599599
A01FDD2F26C6FD110014B165 /* FindMyPhone.swift in Sources */,
600600
1499A8DC2698BF0F00FDF493 /* BaseLink.m in Sources */,
601-
A0A04430267BF38700CC21DD /* KDE_Connect_TestApp.swift in Sources */,
601+
A0A04430267BF38700CC21DD /* KDE_Connect_App.swift in Sources */,
602602
A0B87283267D2A8600F0EB72 /* PlaceHolderView.swift in Sources */,
603603
A0B87285267E73E700F0EB72 /* SettingsChosenThemeView.swift in Sources */,
604604
A0B8727F267BFE3E00F0EB72 /* SelfDeviceData.swift in Sources */,

KDE Connect/KDE Connect/Info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
<key>UISupportedInterfaceOrientations</key>
4343
<array>
4444
<string>UIInterfaceOrientationPortrait</string>
45+
<string>UIInterfaceOrientationLandscapeLeft</string>
46+
<string>UIInterfaceOrientationLandscapeRight</string>
4547
</array>
4648
<key>UISupportedInterfaceOrientations~ipad</key>
4749
<array>

KDE Connect/KDE Connect/Plugins and Plugin Views/RunCommand/RunCommandView.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ struct RunCommandView: View {
2727
}, label: {
2828
VStack {
2929
Text(commandItemsInsideView[commandkey]?.name ?? "ERROR")
30-
.font(.system(size: 18, weight: .bold))
30+
.font(.headline)
31+
.fontWeight(.bold)
3132
Text(commandItemsInsideView[commandkey]?.command ?? "ERROR")
32-
.font(.system(size: 12))
33+
.font(.caption)
3334
}
3435
})
3536
}

KDE Connect/KDE Connect/Swift Backend/CertificateService.swift

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import CryptoKit
8989
return arrayOf2CharStrings.joined(separator: ":")
9090
}
9191

92+
//@discardableResult
9293
@objc func deleteHostCertificateFromKeychain() -> OSStatus {
9394
let keychainItemQuery: CFDictionary = [
9495
kSecAttrLabel: NetworkPackage.getUUID() as Any,

KDE Connect/KDE Connect/Views/Devices/DevicesDetailView.swift

-2
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,8 @@ struct DevicesDetailView: View {
108108
} else {
109109
HStack {
110110
Image(systemName: ((backgroundService._devices[detailsDeviceId] as! Device)._plugins[PACKAGE_TYPE_BATTERY_REQUEST] as! Battery).getSFSymbolNameFromBatteryStatus())
111-
.font(.system(size: 18))
112111
.foregroundColor(((backgroundService._devices[detailsDeviceId] as! Device)._plugins[PACKAGE_TYPE_BATTERY_REQUEST] as! Battery).getSFSymbolColorFromBatteryStatus())
113112
Text("\(((backgroundService._devices[detailsDeviceId] as! Device)._plugins[PACKAGE_TYPE_BATTERY_REQUEST] as! Battery).remoteChargeLevel)%")
114-
.font(.system(size: 18))
115113
}
116114
}
117115
}

KDE Connect/KDE Connect/Views/Devices/DevicesView.swift

+28-18
Original file line numberDiff line numberDiff line change
@@ -43,55 +43,61 @@ struct DevicesView: View {
4343
Section(header: Text("Connected Devices")) {
4444
if (connectedDevicesIds.isEmpty) {
4545
Text("No devices currently connected.\nConnected devices will appear here. Please Refresh Discovery if a saved device is already online but not shown here.")
46+
.padding(.vertical, 8)
4647
} else {
4748
ForEach(connectedDevicesIds, id: \.self) { key in
4849
NavigationLink(
4950
// How do we know what to pass to the details view?
5051
// Use the "key" from ForEach aka device ID to get it from
5152
// backgroundService's _devices dictionary for the value (Device class objects)
5253
destination: DevicesDetailView(detailsDeviceId: key),
54+
//isActive: .constant(true),
5355
label: {
56+
// TODO: use trailing closure to unindent
5457
HStack {
5558
Image(systemName: "wifi")
5659
.foregroundColor(.green)
57-
.font(.system(size: 23))
60+
.font(.title2)
5861
VStack(alignment: .leading) {
5962
HStack {
6063
Text(connectedDevicesViewModel.connectedDevices[key] ?? "???")
61-
.font(.system(size: 19, weight: .bold))
64+
.font(.title3)
65+
.fontWeight(.bold)
6266
if (backgroundService._devices[key as Any] != nil) {
6367
Image(systemName: getSFSymbolNameFromDeviceType(deviceType: (backgroundService._devices[key as Any] as! Device)._type))
64-
.font(.system(size: 19))
68+
.font(.title3)
6569
}
6670
}
6771
if ((backgroundService._devices[key as Any] as! Device)._pluginsEnableStatus[PACKAGE_TYPE_BATTERY_REQUEST] == nil) {
6872
Text("No battery detected in device")
69-
.font(.system(size: 13))
73+
.font(.footnote)
7074
} else if (!((backgroundService._devices[key as Any] as! Device)._pluginsEnableStatus[PACKAGE_TYPE_BATTERY_REQUEST] as! Bool)) {
7175
Text("Battery Plugin Disabled")
72-
.font(.system(size: 13))
76+
.font(.footnote)
7377
} else {
7478
HStack {
7579
Image(systemName: ((backgroundService._devices[key as Any] as! Device)._plugins[PACKAGE_TYPE_BATTERY_REQUEST] as! Battery).getSFSymbolNameFromBatteryStatus())
76-
.font(.system(size: 13))
80+
.font(.footnote)
7781
.foregroundColor(((backgroundService._devices[key as Any] as! Device)._plugins[PACKAGE_TYPE_BATTERY_REQUEST] as! Battery).getSFSymbolColorFromBatteryStatus())
7882
Text("\(((backgroundService._devices[key as Any] as! Device)._plugins[PACKAGE_TYPE_BATTERY_REQUEST] as! Battery).remoteChargeLevel)%")
79-
.font(.system(size: 13))
83+
.font(.footnote)
8084
}
8185
}
8286
// TODO: Might want to add the device description as
8387
// id:desc dictionary?
8488
//Text(key)
8589
}
8690
}
87-
})
91+
}
92+
)
8893
}
8994
}
9095
}
9196

9297
Section(header: Text("Discoverable Devices")) {
9398
if (visibleDevicesIds.isEmpty) {
9499
Text("No devices discoverable on this network.\nMake sure to Refresh Discovery and check that the other devices are also running KDE Connect & are connected to the same network as this device.")
100+
.padding(.vertical, 8)
95101
} else {
96102
ForEach(visibleDevicesIds, id: \.self) { key in
97103
Button(action: {
@@ -101,18 +107,19 @@ struct DevicesView: View {
101107
HStack {
102108
Image(systemName: "badge.plus.radiowaves.right")
103109
.foregroundColor(.blue)
104-
.font(.system(size: 23))
110+
.font(.title2)
105111
VStack(alignment: .leading) {
106112
HStack {
107113
Text(connectedDevicesViewModel.visibleDevices[key] ?? "???")
108-
.font(.system(size: 19, weight: .bold))
114+
.font(.title3)
115+
.fontWeight(.bold)
109116
if (backgroundService._devices[key as Any] != nil) {
110117
Image(systemName: getSFSymbolNameFromDeviceType(deviceType: (backgroundService._devices[key as Any] as! Device)._type))
111-
.font(.system(size: 19))
118+
.font(.title3)
112119
}
113120
}
114121
Text("Tap to start pairing")
115-
.font(.system(size: 15))
122+
.font(.subheadline)
116123
}
117124
}
118125

@@ -121,32 +128,35 @@ struct DevicesView: View {
121128
}
122129
}
123130

124-
Section(header: Text("Remembered Devices")) {
131+
Section(header: Text("Remembered Devices"), footer: Text("To connect to Remembered Devices, make sure they are connected to the same network as this device.")) {
125132
if (savedDevicesIds.isEmpty) {
126133
Text("No remembered devices.\nDevices that were previously connected will appear here.")
134+
.padding(.vertical, 8)
127135
} else {
128136
ForEach(savedDevicesIds, id: \.self) { key in
129137
Button(action: {
130-
currPairingDeviceId = key
131-
showingOnSelectSavedDeviceAlert = true
138+
//currPairingDeviceId = key
139+
//showingOnSelectSavedDeviceAlert = true
132140
}) {
133141
HStack {
134142
Image(systemName: "wifi.slash")
135143
.foregroundColor(.red)
136-
.font(.system(size: 23))
144+
.font(.title2)
137145
VStack(alignment: .leading) {
138146
HStack {
139147
Text(connectedDevicesViewModel.savedDevices[key] ?? "???")
140-
.font(.system(size: 19, weight: .bold))
148+
.font(.title3)
149+
.fontWeight(.bold)
141150
Image(systemName: getSFSymbolNameFromDeviceType(deviceType: (backgroundService._devices[key as Any] as! Device)._type))
142-
.font(.system(size: 19))
151+
.font(.title3)
143152
}
144153
// TODO: Might want to add the device description as
145154
// id:desc dictionary?
146155
//Text(key)
147156
}
148157
}
149158
}
159+
.disabled(true)
150160
}
151161
.onDelete(perform: deleteDevice)
152162
}

KDE Connect/KDE Connect/Views/Settings/SettingsAdvancedView.swift

+32-28
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,40 @@ import SwiftUI
1010
struct SettingsAdvancedView: View {
1111
var body: some View {
1212
List {
13-
Button(action: {
14-
notificationHapticsGenerator.notificationOccurred(.warning)
15-
certificateService.deleteAllItemsFromKeychain()
16-
UserDefaults.standard.removeObject(forKey: "savedDevices")
17-
}, label: {
18-
HStack {
19-
Image(systemName: "delete.right")
20-
VStack(alignment: .leading) {
21-
Text("Erase saved devices cache")
22-
.font(.system(size: 18, weight: .semibold))
23-
Text("If there are phantom devices or something just doesn't behave correctly, erasing all saved devices data might fix it. Requires the app to be fully restarted.")
24-
.font(.system(size: 12))
13+
Section(header: Text("DANGEROUS OPTIONS"), footer: Text("The options above are irreversible and require a complete app restart to take effect.")) {
14+
Button(action: {
15+
notificationHapticsGenerator.notificationOccurred(.warning)
16+
certificateService.deleteAllItemsFromKeychain()
17+
UserDefaults.standard.removeObject(forKey: "savedDevices")
18+
}, label: {
19+
HStack {
20+
Image(systemName: "delete.right")
21+
VStack(alignment: .leading) {
22+
Text("Erase saved devices cache")
23+
.font(.headline)
24+
Text("If there are phantom devices or something just doesn't behave correctly, erasing all saved devices data might fix it. Requires the app to be fully restarted.")
25+
.font(.caption)
26+
}
2527
}
26-
}
27-
})
28-
29-
Button(action: {
30-
notificationHapticsGenerator.notificationOccurred(.warning)
31-
certificateService.deleteHostCertificateFromKeychain()
32-
}, label: {
33-
HStack {
34-
Image(systemName: "delete.right")
35-
VStack(alignment: .leading) {
36-
Text("Delete host certificate")
37-
.font(.system(size: 18, weight: .semibold))
38-
Text("Delete the host's certificate and re-generate it upon restart. Requires the app to be fully restarted. NOTE: this will make the device unable to connect with previously connected devices. You must unpair this device from the other remote devices and pair them again.")
39-
.font(.system(size: 12))
28+
.accentColor(.red)
29+
})
30+
31+
Button(action: {
32+
notificationHapticsGenerator.notificationOccurred(.warning)
33+
certificateService.deleteHostCertificateFromKeychain()
34+
}, label: {
35+
HStack {
36+
Image(systemName: "delete.right")
37+
VStack(alignment: .leading) {
38+
Text("Delete host certificate")
39+
.font(.headline)
40+
Text("Delete the host's certificate and re-generate it upon restart. Requires the app to be fully restarted. NOTE: this will make the device unable to connect with previously connected devices. You must unpair this device from the other remote devices and pair them again.")
41+
.font(.caption)
42+
}
4043
}
41-
}
42-
})
44+
.accentColor(.red)
45+
})
46+
}
4347
}
4448
.navigationTitle("Advanced Settings")
4549
}

KDE Connect/KDE Connect/Views/Settings/SettingsChosenThemeView.swift

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct SettingsChosenThemeView: View {
1818
Text($0)
1919
}
2020
}
21+
.pickerStyle(.wheel)
2122
}
2223
.navigationTitle("Choose App Theme")
2324
}

0 commit comments

Comments
 (0)