diff --git a/Resources/Assets.xcassets/ShhShell.appiconset/Contents.json b/Resources/Assets.xcassets/ShhShell.appiconset/Contents.json new file mode 100644 index 0000000..c439001 --- /dev/null +++ b/Resources/Assets.xcassets/ShhShell.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "filename" : "ShhShell-iOS-Default-1024@1x.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "ShhShell-iOS-Dark-1024@1x.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "filename" : "ShhShell-iOS-Dark-1024@1x.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Resources/Assets.xcassets/ShhShell.appiconset/ShhShell-iOS-Dark-1024@1x.png b/Resources/Assets.xcassets/ShhShell.appiconset/ShhShell-iOS-Dark-1024@1x.png new file mode 100644 index 0000000..507c46b Binary files /dev/null and b/Resources/Assets.xcassets/ShhShell.appiconset/ShhShell-iOS-Dark-1024@1x.png differ diff --git a/Resources/Assets.xcassets/ShhShell.appiconset/ShhShell-iOS-Default-1024@1x.png b/Resources/Assets.xcassets/ShhShell.appiconset/ShhShell-iOS-Default-1024@1x.png new file mode 100644 index 0000000..d405674 Binary files /dev/null and b/Resources/Assets.xcassets/ShhShell.appiconset/ShhShell-iOS-Default-1024@1x.png differ diff --git a/Resources/Assets.xcassets/ShhShell.imageset/Contents.json b/Resources/Assets.xcassets/ShhShell.imageset/Contents.json index 3949c8a..dd3e315 100644 --- a/Resources/Assets.xcassets/ShhShell.imageset/Contents.json +++ b/Resources/Assets.xcassets/ShhShell.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "ShhShell-light.png", + "filename" : "ShhShell-iOS-Default-1024@1x.png", "idiom" : "universal" }, { @@ -11,7 +11,7 @@ "value" : "dark" } ], - "filename" : "ShhShell.png", + "filename" : "ShhShell-iOS-Dark-1024@1x.png", "idiom" : "universal" } ], diff --git a/Resources/Assets.xcassets/ShhShell.imageset/ShhShell-iOS-Dark-1024@1x.png b/Resources/Assets.xcassets/ShhShell.imageset/ShhShell-iOS-Dark-1024@1x.png new file mode 100644 index 0000000..507c46b Binary files /dev/null and b/Resources/Assets.xcassets/ShhShell.imageset/ShhShell-iOS-Dark-1024@1x.png differ diff --git a/Resources/Assets.xcassets/ShhShell.imageset/ShhShell-iOS-Default-1024@1x.png b/Resources/Assets.xcassets/ShhShell.imageset/ShhShell-iOS-Default-1024@1x.png new file mode 100644 index 0000000..d405674 Binary files /dev/null and b/Resources/Assets.xcassets/ShhShell.imageset/ShhShell-iOS-Default-1024@1x.png differ diff --git a/Resources/Assets.xcassets/ShhShell.imageset/ShhShell-light.png b/Resources/Assets.xcassets/ShhShell.imageset/ShhShell-light.png deleted file mode 100644 index 2297c0c..0000000 Binary files a/Resources/Assets.xcassets/ShhShell.imageset/ShhShell-light.png and /dev/null differ diff --git a/Resources/Assets.xcassets/ShhShell.imageset/ShhShell.png b/Resources/Assets.xcassets/ShhShell.imageset/ShhShell.png deleted file mode 100644 index 9f5578d..0000000 Binary files a/Resources/Assets.xcassets/ShhShell.imageset/ShhShell.png and /dev/null differ diff --git a/ShhShell/Views/Hosts/ConnectionView.swift b/ShhShell/Views/Hosts/ConnectionView.swift index 4b0b9ac..6060fba 100644 --- a/ShhShell/Views/Hosts/ConnectionView.swift +++ b/ShhShell/Views/Hosts/ConnectionView.swift @@ -139,9 +139,11 @@ Hostkey fingerprint is \(handler.getHostkey() ?? "nil") } } +#if compiler(>=6.2) if #available(iOS 19, *) { ToolbarSpacer() } +#endif ToolbarItem() { Button() { diff --git a/ShhShell/Views/Hosts/HostSymbolPicker.swift b/ShhShell/Views/Hosts/HostSymbolPicker.swift index b5c9040..eac1d7a 100644 --- a/ShhShell/Views/Hosts/HostSymbolPicker.swift +++ b/ShhShell/Views/Hosts/HostSymbolPicker.swift @@ -23,7 +23,6 @@ struct HostSymbolPicker: View { var body: some View { ZStack { Rectangle() - .modifier(glassEffectCompat()) // .foregroundStyle(cScheme == .dark ? .black : .gray) VStack(alignment: .center, spacing: 0) { ScrollView(.horizontal) { diff --git a/ShhShell/Views/Keys/KeyImporterView.swift b/ShhShell/Views/Keys/KeyImporterView.swift index d2dd802..5dc5533 100644 --- a/ShhShell/Views/Keys/KeyImporterView.swift +++ b/ShhShell/Views/Keys/KeyImporterView.swift @@ -9,6 +9,7 @@ import SwiftUI struct KeyImporterView: View { @ObservedObject var keyManager: KeyManager + @ObservedObject var hostsManager: HostsManager @Environment(\.dismiss) var dismiss @@ -21,59 +22,75 @@ struct KeyImporterView: View { } var body: some View { - List { - TextBox(label: "Name", text: $keyName, prompt: "A name for your key") - - HStack { - Text("Key Type") - Picker("Key type", selection: $keyType) { - ForEach(KeyType.allCases, id: \.self) { type in - Text(type.description) - .tag(type) + NavigationStack { + List { + TextBox(label: "Name", text: $keyName, prompt: "A name for your key") + + HStack { + Text("Key Type") + Picker("Key type", selection: $keyType) { + ForEach(KeyType.allCases, id: \.self) { type in + Text(type.description) + .tag(type) + } + } + .pickerStyle(SegmentedPickerStyle()) + } + + Section { + HStack { + Text("Private Key") + Spacer() + Text("Required") + .foregroundStyle(.red) + } + .listRowSeparator(.hidden) + + TextEditor(text: $privkeyStr) + // .background(.gray.opacity(0.5)) + // .clipShape(RoundedRectangle(cornerRadius: 8)) + .padding(.bottom, 5) + .padding(.horizontal, -8) + // .frame(minHeight: 20) + + Button("Paste", systemImage: "doc.on.clipboard.fill") { + privkeyStr = UIPasteboard.general.string ?? privkeyStr } } - .pickerStyle(SegmentedPickerStyle()) - } - - Section { - HStack { - Text("Private Key") - Spacer() - Text("Required") - .foregroundStyle(.red) - } - .listRowSeparator(.hidden) - TextEditor(text: $privkeyStr) - .background(.gray.opacity(0.5)) - .clipShape(RoundedRectangle(cornerRadius: 8)) - .padding(.bottom, 5) - .padding(.horizontal, -8) + if !keypair.openSshPubkey.isEmpty { + Text(keypair.openSshPubkey.trimmingCharacters(in: .whitespacesAndNewlines)) + .foregroundStyle(.gray) + } + } - - if !keypair.openSshPubkey.isEmpty { - Text(keypair.openSshPubkey.trimmingCharacters(in: .whitespacesAndNewlines)) - .foregroundStyle(.gray) + .preferredColorScheme(.dark) + .toolbar { + ToolbarItem(placement: .topBarLeading) { + Button("", systemImage: "xmark") { + dismiss() + } + .tint(.primary) + } + ToolbarItem(placement: .topBarTrailing) { + Button() { + keyManager.importKey(type: keyType, priv: privkeyStr, name: keyName) + UINotificationFeedbackGenerator().notificationOccurred(.success) + dismiss() + } label: { + Label("", systemImage: "checkmark") + .tint(hostsManager.selectedTheme.foreground.suiColor) + } + .disabled(privkeyStr.isEmpty || keyName.isEmpty) + } } - - } - .preferredColorScheme(.dark) - .overlay(alignment: .bottom) { - Button { - keyManager.importKey(type: keyType, priv: privkeyStr, name: keyName) - UINotificationFeedbackGenerator().notificationOccurred(.success) - dismiss() - } label: { - Text("Import") - .font(.title) - .bold() - } - .modifier(glassButton(prominent: true)) - .padding(.bottom, 15) } } } #Preview { - KeyImporterView(keyManager: KeyManager()) + KeyImporterView( + keyManager: KeyManager(), + hostsManager: HostsManager() + ) } diff --git a/ShhShell/Views/Keys/KeyManagerView.swift b/ShhShell/Views/Keys/KeyManagerView.swift index 6eebb7f..8b97a6c 100644 --- a/ShhShell/Views/Keys/KeyManagerView.swift +++ b/ShhShell/Views/Keys/KeyManagerView.swift @@ -62,7 +62,7 @@ struct KeyManagerView: View { showImporter.toggle() } .sheet(isPresented: $showImporter) { - KeyImporterView(keyManager: keyManager) + KeyImporterView(keyManager: keyManager, hostsManager: hostsManager) .colorScheme(hostsManager.selectedTheme.background.luminance > 0.5 ? .light : .dark) } } diff --git a/ShhShell/Views/Misc/ViewModifiers.swift b/ShhShell/Views/Misc/ViewModifiers.swift index 015c864..cc5f01d 100644 --- a/ShhShell/Views/Misc/ViewModifiers.swift +++ b/ShhShell/Views/Misc/ViewModifiers.swift @@ -8,16 +8,6 @@ import Foundation import SwiftUI -struct glassEffectCompat: ViewModifier { - func body(content: Content) -> some View { - if #available(iOS 19, *) { - content.glassEffect() - } else { - content - } - } -} - struct glassButton: ViewModifier { var prominent: Bool @@ -26,6 +16,13 @@ struct glassButton: ViewModifier { } func body(content: Content) -> some View { +#if compiler(>=6.2) + if prominent { + content.buttonStyle(.borderedProminent) + } else { + content + } +#else if #available(iOS 19, *) { if prominent { content.buttonStyle(.glassProminent) @@ -39,6 +36,7 @@ struct glassButton: ViewModifier { content } } +#endif } } diff --git a/ShhShell/Views/Themes/ThemeManagerView.swift b/ShhShell/Views/Themes/ThemeManagerView.swift index c38e292..5f24157 100644 --- a/ShhShell/Views/Themes/ThemeManagerView.swift +++ b/ShhShell/Views/Themes/ThemeManagerView.swift @@ -136,13 +136,15 @@ struct ThemeManagerView: View { Button() { showAlert.toggle() } label: { - Label("URL", systemImage: "link") + Label("URL", systemImage: "document.on.clipboard") } } +#if compiler(>=6.2) if #available(iOS 19, *) { ToolbarSpacer() } +#endif ToolbarItem() { Button() {