commit 8e997cc868a679bdb970fcaebd479f4f83fd2e63 Author: Mingshen Sun Date: Thu Jan 19 21:15:47 2017 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fa7f9fa --- /dev/null +++ b/.gitignore @@ -0,0 +1,66 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xcuserstate + +## Obj-C/Swift specific +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +Carthage/Checkouts +Cartfile.resolved + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output diff --git a/Cartfile b/Cartfile new file mode 100644 index 0000000..5d3a705 --- /dev/null +++ b/Cartfile @@ -0,0 +1,2 @@ +github "SwiftGit2/SwiftGit2" +github "SVProgressHUD/SVProgressHUD" diff --git a/pass.xcodeproj/project.pbxproj b/pass.xcodeproj/project.pbxproj new file mode 100644 index 0000000..e5c4354 --- /dev/null +++ b/pass.xcodeproj/project.pbxproj @@ -0,0 +1,389 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + DC3DC8391E2F63240062A988 /* PasswordDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3DC8381E2F63240062A988 /* PasswordDetailViewController.swift */; }; + DC917BD71E2E8231000FDF54 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC917BD61E2E8231000FDF54 /* AppDelegate.swift */; }; + DC917BDC1E2E8231000FDF54 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDA1E2E8231000FDF54 /* Main.storyboard */; }; + DC917BDE1E2E8231000FDF54 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDD1E2E8231000FDF54 /* Assets.xcassets */; }; + DC917BE11E2E8231000FDF54 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDF1E2E8231000FDF54 /* LaunchScreen.storyboard */; }; + DC917BEF1E2F38C5000FDF54 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC917BEE1E2F38C5000FDF54 /* Result.framework */; }; + DC917BF11E2F38C9000FDF54 /* SwiftGit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC917BF01E2F38C9000FDF54 /* SwiftGit2.framework */; }; + DC917BF31E2F3B42000FDF54 /* PasswordTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC917BF21E2F3B42000FDF54 /* PasswordTableViewController.swift */; }; + DC9C451C1E2F8CA7005845CA /* ChangeGitRepositoryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC9C451B1E2F8CA7005845CA /* ChangeGitRepositoryTableViewController.swift */; }; + DCAAF7451E2FA66800AB94BC /* SettingsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCAAF7441E2FA66800AB94BC /* SettingsTableViewController.swift */; }; + DCC277D21E30D6EA00402246 /* pass.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DCC408C81E30BA1300F29B0E /* pass.xcdatamodeld */; }; + DCC408A41E2FCC9E00F29B0E /* PasswordStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCC408A31E2FCC9E00F29B0E /* PasswordStore.swift */; }; + DCC408C71E307DBB00F29B0E /* SVProgressHUD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCC408C61E307DBB00F29B0E /* SVProgressHUD.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + DC3DC8381E2F63240062A988 /* PasswordDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordDetailViewController.swift; sourceTree = ""; }; + DC917BD31E2E8231000FDF54 /* pass.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = pass.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DC917BD61E2E8231000FDF54 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + DC917BDB1E2E8231000FDF54 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + DC917BDD1E2E8231000FDF54 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + DC917BE01E2E8231000FDF54 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + DC917BE21E2E8231000FDF54 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DC917BEE1E2F38C5000FDF54 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/iOS/Result.framework; sourceTree = ""; }; + DC917BF01E2F38C9000FDF54 /* SwiftGit2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftGit2.framework; path = Carthage/Build/iOS/SwiftGit2.framework; sourceTree = ""; }; + DC917BF21E2F3B42000FDF54 /* PasswordTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordTableViewController.swift; sourceTree = ""; }; + DC9C451B1E2F8CA7005845CA /* ChangeGitRepositoryTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChangeGitRepositoryTableViewController.swift; sourceTree = ""; }; + DCAAF7441E2FA66800AB94BC /* SettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsTableViewController.swift; sourceTree = ""; }; + DCC408A31E2FCC9E00F29B0E /* PasswordStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordStore.swift; sourceTree = ""; }; + DCC408C61E307DBB00F29B0E /* SVProgressHUD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SVProgressHUD.framework; path = Carthage/Build/iOS/SVProgressHUD.framework; sourceTree = ""; }; + DCC408C91E30BA1300F29B0E /* pass.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = pass.xcdatamodel; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DC917BD01E2E8231000FDF54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DC917BEF1E2F38C5000FDF54 /* Result.framework in Frameworks */, + DC917BF11E2F38C9000FDF54 /* SwiftGit2.framework in Frameworks */, + DCC408C71E307DBB00F29B0E /* SVProgressHUD.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DC917BCA1E2E8231000FDF54 = { + isa = PBXGroup; + children = ( + DC917BD51E2E8231000FDF54 /* pass */, + DC917BD41E2E8231000FDF54 /* Products */, + DC917BED1E2F38C4000FDF54 /* Frameworks */, + ); + sourceTree = ""; + }; + DC917BD41E2E8231000FDF54 /* Products */ = { + isa = PBXGroup; + children = ( + DC917BD31E2E8231000FDF54 /* pass.app */, + ); + name = Products; + sourceTree = ""; + }; + DC917BD51E2E8231000FDF54 /* pass */ = { + isa = PBXGroup; + children = ( + DC917BF21E2F3B42000FDF54 /* PasswordTableViewController.swift */, + DC917BD61E2E8231000FDF54 /* AppDelegate.swift */, + DC917BDA1E2E8231000FDF54 /* Main.storyboard */, + DCAAF7441E2FA66800AB94BC /* SettingsTableViewController.swift */, + DCC408C81E30BA1300F29B0E /* pass.xcdatamodeld */, + DC9C451B1E2F8CA7005845CA /* ChangeGitRepositoryTableViewController.swift */, + DC3DC8381E2F63240062A988 /* PasswordDetailViewController.swift */, + DC917BDD1E2E8231000FDF54 /* Assets.xcassets */, + DC917BDF1E2E8231000FDF54 /* LaunchScreen.storyboard */, + DC917BE21E2E8231000FDF54 /* Info.plist */, + DCC408A31E2FCC9E00F29B0E /* PasswordStore.swift */, + ); + path = pass; + sourceTree = ""; + }; + DC917BED1E2F38C4000FDF54 /* Frameworks */ = { + isa = PBXGroup; + children = ( + DCC408C61E307DBB00F29B0E /* SVProgressHUD.framework */, + DC917BF01E2F38C9000FDF54 /* SwiftGit2.framework */, + DC917BEE1E2F38C5000FDF54 /* Result.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DC917BD21E2E8231000FDF54 /* pass */ = { + isa = PBXNativeTarget; + buildConfigurationList = DC917BE51E2E8231000FDF54 /* Build configuration list for PBXNativeTarget "pass" */; + buildPhases = ( + DC917BCF1E2E8231000FDF54 /* Sources */, + DC917BD01E2E8231000FDF54 /* Frameworks */, + DC917BD11E2E8231000FDF54 /* Resources */, + DC917BEC1E2F3659000FDF54 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = pass; + productName = pass; + productReference = DC917BD31E2E8231000FDF54 /* pass.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DC917BCB1E2E8231000FDF54 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0820; + LastUpgradeCheck = 0820; + ORGANIZATIONNAME = "Bob Sun"; + TargetAttributes = { + DC917BD21E2E8231000FDF54 = { + CreatedOnToolsVersion = 8.2.1; + DevelopmentTeam = 779BQYPRCF; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = DC917BCE1E2E8231000FDF54 /* Build configuration list for PBXProject "pass" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = DC917BCA1E2E8231000FDF54; + productRefGroup = DC917BD41E2E8231000FDF54 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DC917BD21E2E8231000FDF54 /* pass */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DC917BD11E2E8231000FDF54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC917BE11E2E8231000FDF54 /* LaunchScreen.storyboard in Resources */, + DC917BDE1E2E8231000FDF54 /* Assets.xcassets in Resources */, + DC917BDC1E2E8231000FDF54 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + DC917BEC1E2F3659000FDF54 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 12; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/SwiftGit2.framework", + "$(SRCROOT)/Carthage/Build/iOS/Result.framework", + "$(SRCROOT)/Carthage/Build/iOS/SVProgressHUD.framework", + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/usr/local/bin/carthage copy-frameworks"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DC917BCF1E2E8231000FDF54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC917BF31E2F3B42000FDF54 /* PasswordTableViewController.swift in Sources */, + DCC408A41E2FCC9E00F29B0E /* PasswordStore.swift in Sources */, + DCAAF7451E2FA66800AB94BC /* SettingsTableViewController.swift in Sources */, + DCC277D21E30D6EA00402246 /* pass.xcdatamodeld in Sources */, + DC917BD71E2E8231000FDF54 /* AppDelegate.swift in Sources */, + DC3DC8391E2F63240062A988 /* PasswordDetailViewController.swift in Sources */, + DC9C451C1E2F8CA7005845CA /* ChangeGitRepositoryTableViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + DC917BDA1E2E8231000FDF54 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + DC917BDB1E2E8231000FDF54 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + DC917BDF1E2E8231000FDF54 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + DC917BE01E2E8231000FDF54 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + DC917BE31E2E8231000FDF54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + DC917BE41E2E8231000FDF54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + DC917BE61E2E8231000FDF54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 779BQYPRCF; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = pass/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = me.mssun.pass; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + DC917BE71E2E8231000FDF54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 779BQYPRCF; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); + INFOPLIST_FILE = pass/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = me.mssun.pass; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DC917BCE1E2E8231000FDF54 /* Build configuration list for PBXProject "pass" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC917BE31E2E8231000FDF54 /* Debug */, + DC917BE41E2E8231000FDF54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DC917BE51E2E8231000FDF54 /* Build configuration list for PBXNativeTarget "pass" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC917BE61E2E8231000FDF54 /* Debug */, + DC917BE71E2E8231000FDF54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + DCC408C81E30BA1300F29B0E /* pass.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + DCC408C91E30BA1300F29B0E /* pass.xcdatamodel */, + ); + currentVersion = DCC408C91E30BA1300F29B0E /* pass.xcdatamodel */; + path = pass.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = DC917BCB1E2E8231000FDF54 /* Project object */; +} diff --git a/pass.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/pass.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..3de8ce3 --- /dev/null +++ b/pass.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/pass/AppDelegate.swift b/pass/AppDelegate.swift new file mode 100644 index 0000000..c18364f --- /dev/null +++ b/pass/AppDelegate.swift @@ -0,0 +1,93 @@ +// +// AppDelegate.swift +// pass +// +// Created by Mingshen Sun on 18/1/2017. +// Copyright © 2017 Bob Sun. All rights reserved. +// + +import UIKit +import CoreData + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + // Saves changes in the application's managed object context before the application terminates. + self.saveContext() + } + + // MARK: - Core Data stack + + lazy var persistentContainer: NSPersistentContainer = { + /* + The persistent container for the application. This implementation + creates and returns a container, having loaded the store for the + application to it. This property is optional since there are legitimate + error conditions that could cause the creation of the store to fail. + */ + let container = NSPersistentContainer(name: "pass") + container.loadPersistentStores(completionHandler: { (storeDescription, error) in + if let error = error as NSError? { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + + /* + Typical reasons for an error here include: + * The parent directory does not exist, cannot be created, or disallows writing. + * The persistent store is not accessible, due to permissions or data protection when the device is locked. + * The device is out of space. + * The store could not be migrated to the current model version. + Check the error message to determine what the actual problem was. + */ + fatalError("Unresolved error \(error), \(error.userInfo)") + } + }) + return container + }() + + // MARK: - Core Data Saving support + + func saveContext () { + let context = persistentContainer.viewContext + if context.hasChanges { + do { + try context.save() + } catch { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + let nserror = error as NSError + fatalError("Unresolved error \(nserror), \(nserror.userInfo)") + } + } + } + +} + diff --git a/pass/Assets.xcassets/AppIcon.appiconset/Contents.json b/pass/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..b8236c6 --- /dev/null +++ b/pass/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,48 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/pass/Assets.xcassets/Contents.json b/pass/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/pass/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/pass/Base.lproj/LaunchScreen.storyboard b/pass/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ b/pass/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pass/Base.lproj/Main.storyboard b/pass/Base.lproj/Main.storyboard new file mode 100644 index 0000000..9e13893 --- /dev/null +++ b/pass/Base.lproj/Main.storyboard @@ -0,0 +1,275 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pass/ChangeGitRepositoryTableViewController.swift b/pass/ChangeGitRepositoryTableViewController.swift new file mode 100644 index 0000000..653a56f --- /dev/null +++ b/pass/ChangeGitRepositoryTableViewController.swift @@ -0,0 +1,42 @@ +// +// ChangeGitRepositoryTableViewController.swift +// pass +// +// Created by Mingshen Sun on 18/1/2017. +// Copyright © 2017 Bob Sun. All rights reserved. +// + +import UIKit +import CoreData +import SVProgressHUD + + +class ChangeGitRepositoryTableViewController: UITableViewController { + + let userDefaults = UserDefaults.standard + var gitRepositoryURL: String? + + @IBOutlet weak var gitRepositoryURLTextField: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + if let url = userDefaults.string(forKey: "gitRepositoryURL") { + gitRepositoryURLTextField.text = url + } else { + gitRepositoryURLTextField.text = "https://github.com/mssun/public-password-store.git" + } + } + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + gitRepositoryURLTextField.becomeFirstResponder() + } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + view.endEditing(true) + } + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if segue.identifier == "save" { + gitRepositoryURL = gitRepositoryURLTextField.text! + } + } +} diff --git a/pass/Info.plist b/pass/Info.plist new file mode 100644 index 0000000..e5192f1 --- /dev/null +++ b/pass/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + Main + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/pass/PasswordDetailViewController.swift b/pass/PasswordDetailViewController.swift new file mode 100644 index 0000000..cec80f1 --- /dev/null +++ b/pass/PasswordDetailViewController.swift @@ -0,0 +1,35 @@ +// +// PasswordDetailViewController.swift +// pass +// +// Created by Mingshen Sun on 18/1/2017. +// Copyright © 2017 Bob Sun. All rights reserved. +// + +import UIKit + +class PasswordDetailViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/pass/PasswordStore.swift b/pass/PasswordStore.swift new file mode 100644 index 0000000..b8f6c54 --- /dev/null +++ b/pass/PasswordStore.swift @@ -0,0 +1,93 @@ +// +// PasswordStore.swift +// pass +// +// Created by Mingshen Sun on 19/1/2017. +// Copyright © 2017 Bob Sun. All rights reserved. +// + +import Foundation +import SwiftGit2 +import Result +import CoreData +import UIKit + +class PasswordStore { + static let shared = PasswordStore() + + let storeURL = URL(fileURLWithPath: "\(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0])/password-store") + var storeRepo: Repository? + + let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext + + + private init() { + let result = Repository.at(storeURL) + if case .success(let r) = result { + storeRepo = r + } + } + + func cloneRemoteRepo(remoteRepoURL: URL) -> Bool{ + print("start cloning remote repo") + let fm = FileManager.default + if (storeRepo != nil) { + print("remove item") + do { + try fm.removeItem(at: storeURL) + } catch let error as NSError { + print(error.debugDescription) + } + } + let cloneResult = Repository.clone(from: remoteRepoURL, to: storeURL) + switch cloneResult { + case let .success(clonedRepo): + storeRepo = clonedRepo + print("clone repo: \(storeURL) success") + updatePasswordEntityCoreData() + return true + case let .failure(error): + print(error) + return false + } + } + + func updatePasswordEntityCoreData() { + let fetchRequest = NSFetchRequest(entityName: "PasswordEntity") + let deleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest) + do { + try context.execute(deleteRequest) + } catch let error as NSError { + print(error) + } + + let fm = FileManager.default + fm.enumerator(atPath: storeURL.path)?.forEach({ (e) in + if let e = e as? String, let url = URL(string: e) { + if url.pathExtension == "gpg" { + let entity = PasswordEntity(context: context) + entity.name = url.lastPathComponent + entity.rawPath = url.path + } + } + }) + do { + try context.save() + } catch { + print("Error with save: \(error)") + } + } + + func fetchPasswordEntityCoreData() -> [PasswordEntity] { + let passwordEntityFetch = NSFetchRequest(entityName: "PasswordEntity") + do { + let fetchedPasswordEntities = try context.fetch(passwordEntityFetch) as! [PasswordEntity] + return fetchedPasswordEntities + } catch { + fatalError("Failed to fetch employees: \(error)") + } + } + + func updateRemoteRepo() { + } +} diff --git a/pass/PasswordTableViewController.swift b/pass/PasswordTableViewController.swift new file mode 100644 index 0000000..4863552 --- /dev/null +++ b/pass/PasswordTableViewController.swift @@ -0,0 +1,81 @@ +// +// PasswordTableViewController.swift +// pass +// +// Created by Mingshen Sun on 18/1/2017. +// Copyright © 2017 Bob Sun. All rights reserved. +// + +import UIKit +import SwiftGit2 +import Result +import SVProgressHUD + +class PasswordTableViewController: UITableViewController { + private var passwordNameArray = [String]() + private var passwordEntities: [PasswordEntity]? + + func temporaryURL(forPurpose purpose: String) -> URL { + let globallyUniqueString = ProcessInfo.processInfo.globallyUniqueString + let path = "\(NSTemporaryDirectory())\(globallyUniqueString)_\(purpose)" + print("\(NSHomeDirectory())/vault") + return URL(fileURLWithPath: path) + } + + override func viewDidLoad() { + super.viewDidLoad() + passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData() + NotificationCenter.default.addObserver(self, selector: #selector(PasswordTableViewController.actOnPasswordUpdatedNotification), name: NSNotification.Name(rawValue: "passwordUpdated"), object: nil) + +// SVProgressHUD.setDefaultMaskType(SVProgressHUDMaskType.black) +// SVProgressHUD.show(withStatus: "Cloning Password Repository") +// +// let remoteRepoURL = URL(string: "https://github.com/mssun/public-password-store.git") +// let localURL = self.temporaryURL(forPurpose: "public-remote-clone") +// DispatchQueue.global(qos: .userInitiated).async { +// let cloneResult = Repository.clone(from: remoteRepoURL!, to: localURL) +// if case .success(let clonedRepo) = cloneResult { +// let latestCommit: Result = clonedRepo +// .HEAD() +// .flatMap { clonedRepo.commit($0.oid) } +// print("localURL \(localURL.path)") +// if let commit = latestCommit.value { +// print("Latest Commit: \(commit.message) by \(commit.author.name)") +// } else { +// print("Could not get commit: \(latestCommit.error)") +// } +// let fd = FileManager.default +// fd.enumerator(atPath: localURL.path)?.forEach({ (e) in +// if let e = e as? String, let url = URL(string: e) { +// if url.pathExtension == "gpg" { +// self.passwordNameArray.append(url.lastPathComponent); +// } +// } +// }) +// } +// DispatchQueue.main.async { +// SVProgressHUD.dismiss() +// self.tableView.reloadData() +// } +// +// } + } + + func actOnPasswordUpdatedNotification() { + passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData() + self.tableView.reloadData() + print("actOnPasswordUpdatedNotification") + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return passwordEntities!.count + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "passwordTableViewCell", for: indexPath) + cell.textLabel?.text = passwordEntities![indexPath.row].name + return cell + } + +} diff --git a/pass/SettingsTableViewController.swift b/pass/SettingsTableViewController.swift new file mode 100644 index 0000000..e885b97 --- /dev/null +++ b/pass/SettingsTableViewController.swift @@ -0,0 +1,57 @@ +// +// SettingsTableViewController.swift +// pass +// +// Created by Mingshen Sun on 18/1/2017. +// Copyright © 2017 Bob Sun. All rights reserved. +// + +import UIKit +import SVProgressHUD +import CoreData + +class SettingsTableViewController: UITableViewController { + + @IBOutlet weak var gitRepositoryTableViewCell: UITableViewCell! + + @IBAction func cancel(segue: UIStoryboardSegue) { + } + + @IBAction func save(segue: UIStoryboardSegue) { + if let changeGitRepositoryTableViewController = segue.source as? ChangeGitRepositoryTableViewController { + if let gitRepositoryURL = changeGitRepositoryTableViewController.gitRepositoryURL { + if gitRepositoryTableViewCell.detailTextLabel?.text != gitRepositoryURL { + UserDefaults.standard.set(gitRepositoryURL, forKey: "gitRepositoryURL") + gitRepositoryTableViewCell.detailTextLabel?.text = gitRepositoryURL + } + SVProgressHUD.show(withStatus: "Cloning Remote Repository") + DispatchQueue.global(qos: .userInitiated).async { + let ret = PasswordStore.shared.cloneRemoteRepo(remoteRepoURL: URL(string: gitRepositoryURL)!) + if ret { + DispatchQueue.main.async { + SVProgressHUD.dismiss() + SVProgressHUD.setMaximumDismissTimeInterval(1) + SVProgressHUD.showSuccess(withStatus: "Success") + NotificationCenter.default.post(Notification(name: Notification.Name("passwordUpdated"))) + } + } else { + DispatchQueue.main.async { + SVProgressHUD.showError(withStatus: "Error") + } + } + } + + } + } + + } + + override func viewDidLoad() { + super.viewDidLoad() + if let url = UserDefaults.standard.string(forKey: "gitRepositoryURL") { + gitRepositoryTableViewCell.detailTextLabel?.text = url + } else { + gitRepositoryTableViewCell.detailTextLabel?.text = "Not set" + } + } +} diff --git a/pass/pass.xcdatamodeld/pass.xcdatamodel/contents b/pass/pass.xcdatamodeld/pass.xcdatamodel/contents new file mode 100644 index 0000000..fee499c --- /dev/null +++ b/pass/pass.xcdatamodeld/pass.xcdatamodel/contents @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file