Skip to content

Commit

Permalink
Fixed syncing and importing
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanLipnik committed Sep 28, 2021
1 parent d337014 commit 991293a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
16 changes: 8 additions & 8 deletions OpenSesame.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "AutoFill iOS/AutoFill_iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "AutoFill iOS/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "AutoFill iOS";
Expand Down Expand Up @@ -1580,7 +1580,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "AutoFill iOS/AutoFill_iOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "AutoFill iOS/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "AutoFill iOS";
Expand Down Expand Up @@ -1609,7 +1609,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "AutoFill macOS/AutoFill_macOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1638,7 +1638,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "AutoFill macOS/AutoFill_macOS.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1783,7 +1783,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "OpenSesame (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "OpenSesame--iOS--Info.plist";
Expand Down Expand Up @@ -1819,7 +1819,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "OpenSesame (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
ENABLE_PREVIEWS = YES;
GCC_OPTIMIZATION_LEVEL = z;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1859,7 +1859,7 @@
CODE_SIGN_ENTITLEMENTS = "OpenSesame (macOS).entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1896,7 +1896,7 @@
CODE_SIGN_ENTITLEMENTS = "OpenSesame (macOS).entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 31;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@
<CommandLineArguments>
<CommandLineArgument
argument = "-com.apple.CoreData.CloudKitDebug 0"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-com.apple.CoreData.Logging.stderr 0"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
Expand Down
3 changes: 3 additions & 0 deletions Shared/Documents/ImportDocumentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct ImportDocumentView: View {
}

private func add(encryptionKey: SymmetricKey) throws {
let _ = file.url.startAccessingSecurityScopedResource()
guard let data = FileManager.default.contents(atPath: file.url.path) else { throw CocoaError(.fileReadCorruptFile) }

let type = UTType(filenameExtension: file.url.pathExtension)!
Expand All @@ -93,6 +94,8 @@ struct ImportDocumentView: View {
account.password = try CryptoSecurityService.encrypt(accountDoc.password, encryptionKey: encryptionKey)
account.passwordLength = Int16(accountDoc.password.count)

print(accountDoc)

selectedVault?.addToAccounts(account)
case .cardDocument:
let cardDoc = try JSONDecoder().decode(CardDocument.self, from: data)
Expand Down
4 changes: 2 additions & 2 deletions Shared/Persistence/Persistence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class PersistenceController {
container = NSPersistentContainer.create(inMemory: inMemory)

let coreDataVersion = UserDefaults.group.float(forKey: "coreDataVersion")
if coreDataVersion < 1.3 {
if coreDataVersion < 1.4 {
try? FileManager.default.removeItem(at: PersistenceController.storeURL)

UserDefaults(suiteName: OpenSesameConfig.APP_GROUP)?.set(1.3, forKey: "coreDataVersion")
UserDefaults(suiteName: OpenSesameConfig.APP_GROUP)?.set(1.4, forKey: "coreDataVersion")

do {
try self.downloadStoreFrom(.iCloud)
Expand Down

0 comments on commit 991293a

Please sign in to comment.