Compare commits

..

No commits in common. "4124e8f87cbbe1bd6aa8e618774aa02abed6dbd3" and "94c39fb5c54c5acf43549096dc8e44d01edc1173" have entirely different histories.

10 changed files with 22 additions and 60 deletions

View File

@ -337,7 +337,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1300;
LastUpgradeCheck = 1530;
LastUpgradeCheck = 1300;
TargetAttributes = {
D61479D226D0AF1C00710B79 = {
CreatedOnToolsVersion = 13.0;
@ -522,7 +522,6 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@ -584,7 +583,6 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@ -619,7 +617,7 @@
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -650,7 +648,7 @@
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -668,7 +666,6 @@
D6147A0926D141F800710B79 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
@ -676,7 +673,6 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@ -686,7 +682,6 @@
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
PRODUCT_BUNDLE_IDENTIFIER = net.shadowfacts.OTPKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
@ -701,7 +696,6 @@
D6147A0A26D141F800710B79 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
@ -709,7 +703,6 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@ -719,7 +712,6 @@
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
PRODUCT_BUNDLE_IDENTIFIER = net.shadowfacts.OTPKit;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;

View File

@ -7,12 +7,12 @@
<key>OTP.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
<key>OTPKit.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>

View File

@ -43,15 +43,6 @@ struct KeyData: Codable {
}
}
mutating func addOrUpdateFolders(_ folders: [Folder]) {
for f in folders {
guard !self.folders.contains(where: { $0.id == f.id }) else {
continue
}
self.folders.append(f)
}
}
mutating func updateKey(entryID id: UUID, newKey: TOTPKey) {
guard let index = entries.firstIndex(where: { $0.id == id }) else {
return

View File

@ -51,7 +51,6 @@ class KeyStore: ObservableObject {
data = newStore
} else {
data.addOrUpdateEntries(newStore.entries)
data.addOrUpdateFolders(newStore.folders)
}
}

View File

@ -18,7 +18,7 @@ struct AddQRView: View {
@State private var isShowingConfirmView = false
var body: some View {
NavigationStack {
NavigationView {
CodeScannerView(codeTypes: [.qr], scanMode: .once) { (result) in
switch result {
case .success(let code):
@ -44,9 +44,15 @@ struct AddQRView: View {
}
}
}
.navigationDestination(isPresented: $isShowingConfirmView) {
EditKeyForm(editingKey: scannedKey, showCancelButton: false, dismiss: dismiss)
.navigationTitle("Add Key")
.overlay {
NavigationLink(isActive: $isShowingConfirmView) {
EditKeyForm(editingKey: scannedKey, showCancelButton: false, dismiss: dismiss)
.navigationTitle("Add Key")
} label: {
// EmptyView because this is only used to trigger programatic navigation
EmptyView()
}
}
}
.alert("Unable to get OTP key from QR code", isPresented: $isPresentingScanFailedAlert) {
@ -78,8 +84,6 @@ extension AddQRView {
return "Scanner: Bad Input"
case .scanner(.badOutput):
return "Scanner: Bad Output"
case .scanner(.initError(let e)):
return ("Scanner: Initialization: \(e)")
}
}
}

View File

@ -67,12 +67,10 @@ struct AddURLForm: View {
.disabled(!isValid)
}
}
.onChange(of: inputURL) {
self.updateExtractedKey()
}
.onChange(of: inputURL, perform: self.updateExtractedKey(inputURL:))
}
private func updateExtractedKey() {
private func updateExtractedKey(inputURL: String) {
let text = inputURL.trimmingCharacters(in: .whitespacesAndNewlines)
if !text.isEmpty,
let components = URLComponents(string: inputURL),

View File

@ -23,7 +23,7 @@ struct AppView: View {
}
var body: some View {
NavigationSplitView {
NavigationView {
List {
if searchQuery.isEmpty {
KeysSection(codeHolder: entryHolder)
@ -39,7 +39,7 @@ struct AppView: View {
KeysSection(codeHolder: allEntriesHolder, searchQuery: searchQuery)
}
}
.listStyle(.sidebar)
.listStyle(.insetGrouped)
.navigationTitle("OTP")
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
@ -54,8 +54,6 @@ struct AppView: View {
AddKeyButton(folderID: nil, canAddFolder: true)
}
}
} detail: {
ContentUnavailableView("No Folder", systemImage: "folder.fill")
}
.searchable(text: $searchQuery)
.sheet(isPresented: $isPresentingPreferences, content: self.preferencesSheet)

View File

@ -6,7 +6,6 @@
//
import SwiftUI
import UniformTypeIdentifiers
struct FoldersSection: View {
@ObservedObject private var store: KeyStore = .shared
@ -16,20 +15,6 @@ struct FoldersSection: View {
Section {
ForEach(store.sortedFolders) { (folder) in
FolderRow(store: store, folder: folder)
.onDrop(of: [.text], isTargeted: nil) { providers in
guard let provider = providers.first,
provider.canLoadObject(ofClass: NSString.self) else {
return false
}
provider.loadObject(ofClass: NSString.self) { object, _ in
guard let str = object as? NSString,
let id = UUID(uuidString: str as String) else {
return
}
store.moveEntryToFolder(entryID: id, folderID: folder.id)
}
return true
}
}
.onDelete { (indices) in
let folderIDs = indices.map { store.sortedFolders[$0].id }

View File

@ -79,9 +79,6 @@ struct KeyView: View {
}
}
.tint(Color(UIColor.label))
#if targetEnvironment(macCatalyst)
.padding(.vertical, 8)
#endif
}
private func progress(at date: Date) -> Double {

View File

@ -35,11 +35,9 @@ struct KeysSection: View {
ForEach(filteredEntries) { (entry) in
KeyView(key: entry.key, currentCode: entry.code)
// disabled because dropping onto list rows does not work :/
.onDrag {
let provider = NSItemProvider()
provider.registerObject(entry.id.uuidString as NSString, visibility: .ownProcess)
return provider
}
// .onDrag {
// NSItemProvider(object: entry.id.uuidString as NSString)
// }
.contextMenu {
self.keyMenu(entry: entry)
}