restructure file organization

This commit is contained in:
Bob Sun 2017-02-08 19:57:07 +08:00
parent 7effaa841a
commit 910660ede3
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
19 changed files with 52 additions and 20 deletions

View file

@ -0,0 +1,30 @@
//
// DefaultKeys.swift
// pass
//
// Created by Mingshen Sun on 21/1/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
//
import Foundation
import SwiftyUserDefaults
extension DefaultsKeys {
static let pgpKeyURL = DefaultsKey<URL?>("pgpKeyURL")
static let pgpKeyPassphrase = DefaultsKey<String>("pgpKeyPassphrase")
static let pgpKeyID = DefaultsKey<String>("pgpKeyID")
static let pgpKeyUserID = DefaultsKey<String>("pgpKeyUserID")
static let gitRepositoryURL = DefaultsKey<URL?>("gitRepositoryURL")
static let gitRepositoryAuthenticationMethod = DefaultsKey<String>("gitRepositoryAuthenticationMethod")
static let gitRepositoryUsername = DefaultsKey<String>("gitRepositoryUsername")
static let gitRepositoryPassword = DefaultsKey<String>("gitRepositoryPassword")
static let gitRepositorySSHPublicKeyURL = DefaultsKey<URL?>("gitRepositorySSHPublicKeyURL")
static let gitRepositorySSHPrivateKeyURL = DefaultsKey<URL?>("gitRepositorySSHPrivateKeyURL")
static let gitRepositorySSHPrivateKeyPassphrase = DefaultsKey<String?>("gitRepositorySSHPrivateKeyPassphrase")
static let lastUpdatedTime = DefaultsKey<Date?>("lasteUpdatedTime")
static let isTouchIDOn = DefaultsKey<Bool>("isTouchIDOn")
static let passcodeKey = DefaultsKey<String?>("passcodeKey")
}

View file

@ -0,0 +1,18 @@
//
// Globals.swift
// pass
//
// Created by Mingshen Sun on 21/1/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
//
import Foundation
class Globals {
static let documentPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0];
static let secringPath = "\(documentPath)/secring.gpg"
static let sshPublicKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key.pub")
static let sshPrivateKeyURL = URL(fileURLWithPath: "\(documentPath)/ssh_key")
static var passcodeConfiguration = PasscodeLockConfiguration()
private init() { }
}

View file

@ -0,0 +1,15 @@
//
// Objective-CBridgingHeader.h
// pass
//
// Created by Mingshen Sun on 19/1/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
//
#ifndef Objective_CBridgingHeader_h
#define Objective_CBridgingHeader_h
#import <ObjectivePGP/ObjectivePGP.h>
#import <ObjectiveGit/ObjectiveGit.h>
#endif /* Objective_CBridgingHeader_h */

25
pass/Helpers/Utils.swift Normal file
View file

@ -0,0 +1,25 @@
//
// Utils.swift
// pass
//
// Created by Mingshen Sun on 8/2/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
//
import Foundation
class Utils {
static func removeFileIfExists(atPath path: String) {
let fm = FileManager.default
do {
if fm.fileExists(atPath: path) {
try fm.removeItem(atPath: path)
}
} catch {
print(error)
}
}
static func removeFileIfExists(at url: URL) {
removeFileIfExists(atPath: url.path)
}
}