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

chore: Renamed ChronosData to Vault #3

Merged
merged 1 commit into from
Jun 13, 2024
Merged
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 Chronos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/* Begin PBXBuildFile section */
6B12B0A02C19DB7800E9ED2D /* ExportService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B12B09F2C19DB7800E9ED2D /* ExportService.swift */; };
6B12B0A22C19F1E600E9ED2D /* ChronosData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B12B0A12C19F1E600E9ED2D /* ChronosData.swift */; };
6B12B0A22C19F1E600E9ED2D /* Vault.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B12B0A12C19F1E600E9ED2D /* Vault.swift */; };
6B19CA722B7A70B800690390 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B19CA712B7A70B800690390 /* WelcomeView.swift */; };
6B19CA742B7A769900690390 /* PasswordSetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B19CA732B7A769900690390 /* PasswordSetupView.swift */; };
6B2583AF2B96048700938F3A /* SettingsTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B2583AE2B96048700938F3A /* SettingsTab.swift */; };
Expand Down Expand Up @@ -53,7 +53,7 @@

/* Begin PBXFileReference section */
6B12B09F2C19DB7800E9ED2D /* ExportService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExportService.swift; sourceTree = "<group>"; };
6B12B0A12C19F1E600E9ED2D /* ChronosData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChronosData.swift; sourceTree = "<group>"; };
6B12B0A12C19F1E600E9ED2D /* Vault.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Vault.swift; sourceTree = "<group>"; };
6B19CA712B7A70B800690390 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
6B19CA732B7A769900690390 /* PasswordSetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordSetupView.swift; sourceTree = "<group>"; };
6B2583AE2B96048700938F3A /* SettingsTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTab.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -258,7 +258,7 @@
isa = PBXGroup;
children = (
6B4B48F22BD7BB3C007D357D /* Token.swift */,
6B12B0A12C19F1E600E9ED2D /* ChronosData.swift */,
6B12B0A12C19F1E600E9ED2D /* Vault.swift */,
);
path = Data;
sourceTree = "<group>";
Expand Down Expand Up @@ -410,7 +410,7 @@
files = (
6B3BB0B32B4EA87C00DCEF0B /* ContentView.swift in Sources */,
6B3BB0B12B4EA87C00DCEF0B /* ChronosApp.swift in Sources */,
6B12B0A22C19F1E600E9ED2D /* ChronosData.swift in Sources */,
6B12B0A22C19F1E600E9ED2D /* Vault.swift in Sources */,
6B7383E52B9C4230008E8867 /* Container.swift in Sources */,
6B3C7A382BE764E70043FEBD /* StorageSetupView.swift in Sources */,
6BC3C3B52BA6B91E00B181B9 /* BiometricsSetupView.swift in Sources */,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

class ChronosData: Codable {
class Vault: Codable {
var tokens: [Token]?
var errors: [String]?
}
10 changes: 5 additions & 5 deletions Chronos/Services/ExportService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ExportService {
let context = ModelContext(swiftDataService.getModelContainer())
let encryptedTokenArr = try! context.fetch(FetchDescriptor<EncryptedToken>())

let chronosData = ChronosData()
let vault = Vault()

var tokens: [Token] = []
var errors: [String] = []
Expand All @@ -39,15 +39,15 @@ public class ExportService {
errors.append("\(numOfTokenFailedToDecode) out of \(encryptedTokenArr.count) tokens failed to be export")
}

chronosData.tokens = tokens
chronosData.errors = errors
vault.tokens = tokens
vault.errors = errors

let url = FileManager.default.temporaryDirectory
.appendingPathComponent("Chronos_" + Date().formatted(verbatimStyle))
.appendingPathExtension("json")

guard let jsonData = try? JSONEncoder().encode(chronosData) else {
logger.error("Unable to encode ChronosData")
guard let jsonData = try? JSONEncoder().encode(vault) else {
logger.error("Unable to encode vault")
return nil
}

Expand Down