* Add notification action to copy OTP or just inform about the copied OTP The notification either shows the current OTP which can be copied by a notification action or it shows just a hint to inform about the copied OTP. This depends on the new option "autoCopyOTP". * Extract method * Set type and style one-time
68 lines
2.8 KiB
Swift
68 lines
2.8 KiB
Swift
//
|
|
// Globals.swift
|
|
// passKit
|
|
//
|
|
// Created by Mingshen Sun on 21/1/2017.
|
|
// Copyright © 2017 Bob Sun. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
public final class Globals {
|
|
public static let bundleIdentifier: String = {
|
|
#if BETA
|
|
return "me.mssun.passforiosbeta"
|
|
#else
|
|
return "me.mssun.passforios"
|
|
#endif
|
|
}()
|
|
|
|
public static let groupIdentifier = "group." + bundleIdentifier
|
|
public static let passKitBundleIdentifier = bundleIdentifier + ".passKit"
|
|
|
|
public static let sharedContainerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: groupIdentifier)!
|
|
public static let documentPath = sharedContainerURL.appendingPathComponent("Documents").path
|
|
public static let libraryPath = sharedContainerURL.appendingPathComponent("Library").path
|
|
public static let pgpPublicKeyPath = documentPath + "/gpg_key.pub"
|
|
public static let pgpPrivateKeyPath = documentPath + "/gpg_key"
|
|
public static let gitSSHPrivateKeyPath = documentPath + "/ssh_key"
|
|
public static let gitSSHPrivateKeyURL = URL(fileURLWithPath: gitSSHPrivateKeyPath)
|
|
public static let repositoryPath = libraryPath + "/password-store"
|
|
public static let dbPath = documentPath + "/pass.sqlite"
|
|
|
|
public static let iTunesFileSharingPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
|
|
public static let iTunesFileSharingPGPPublic = iTunesFileSharingPath + "/gpg_key.pub"
|
|
public static let iTunesFileSharingPGPPrivate = iTunesFileSharingPath + "/gpg_key"
|
|
public static let iTunesFileSharingSSHPrivate = iTunesFileSharingPath + "/ssh_key"
|
|
|
|
public static let gitPassword = "gitPassword"
|
|
public static let gitSSHPrivateKeyPassphrase = "gitSSHPrivateKeyPassphrase"
|
|
public static let pgpKeyPassphrase = "pgpKeyPassphrase"
|
|
|
|
public static let gitSignatureDefaultName = "Pass for iOS"
|
|
public static let gitSignatureDefaultEmail = "user@passforios"
|
|
|
|
public static let passwordDots = "••••••••••••"
|
|
public static let oneTimePasswordDots = "••••••"
|
|
public static let passwordFont = UIFont(name: "Courier-Bold", size: UIFont.labelFontSize - 1)
|
|
|
|
public static let otpNotification = bundleIdentifier + ".notification.otp"
|
|
public static let otpNotificationCategory = bundleIdentifier + ".notification.otp.category"
|
|
public static let otpNotificationCopyAction = bundleIdentifier + ".notification.otp.action.copy"
|
|
|
|
// UI related
|
|
public static let tableCellButtonSize = CGFloat(20.0)
|
|
|
|
private init() {}
|
|
}
|
|
|
|
public extension Bundle {
|
|
var releaseVersionNumber: String? {
|
|
infoDictionary?["CFBundleShortVersionString"] as? String
|
|
}
|
|
|
|
var buildVersionNumber: String? {
|
|
infoDictionary?["CFBundleVersion"] as? String
|
|
}
|
|
}
|