Allow setting git signature

This commit is contained in:
Yishi Lin 2017-04-10 23:02:42 +08:00
parent 91230ac008
commit 30c73841c6
6 changed files with 233 additions and 16 deletions

View file

@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
94BA784B85E071D25EE89B59 /* libPods-pass.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADCE7A5C3CCC67D7D21BB3C4 /* libPods-pass.a */; };
A217ACE21E9AB17C00A1A6CF /* OTPScannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A217ACE11E9AB17C00A1A6CF /* OTPScannerController.swift */; };
A217ACE41E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A217ACE31E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift */; };
A262A58D1E68749C006B0890 /* Base32.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A262A58C1E68749C006B0890 /* Base32.framework */; };
A27424D91E7C35960093F436 /* NotificationNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = A27424D81E7C35960093F436 /* NotificationNames.swift */; };
A2802BF91E70813A00879216 /* SliderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2802BF71E70813A00879216 /* SliderTableViewCell.swift */; };
@ -84,6 +85,7 @@
/* Begin PBXFileReference section */
274CCFCF32444A2FF46BE7F4 /* Pods-pass.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-pass.debug.xcconfig"; path = "Pods/Target Support Files/Pods-pass/Pods-pass.debug.xcconfig"; sourceTree = "<group>"; };
A217ACE11E9AB17C00A1A6CF /* OTPScannerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OTPScannerController.swift; sourceTree = "<group>"; };
A217ACE31E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitConfigSettingTableViewController.swift; sourceTree = "<group>"; };
A262A58C1E68749C006B0890 /* Base32.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Base32.framework; path = Carthage/Build/iOS/Base32.framework; sourceTree = "<group>"; };
A27424D81E7C35960093F436 /* NotificationNames.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationNames.swift; sourceTree = "<group>"; };
A2802BF71E70813A00879216 /* SliderTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SliderTableViewCell.swift; sourceTree = "<group>"; };
@ -223,6 +225,7 @@
DCC441531E916382008A90C4 /* GitSSHKeyArmorSettingTableViewController.swift */,
A2A7813E1E97DBD9001311F5 /* QRScannerController.swift */,
A217ACE11E9AB17C00A1A6CF /* OTPScannerController.swift */,
A217ACE31E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift */,
);
path = Controllers;
sourceTree = "<group>";
@ -549,6 +552,7 @@
DCFB779E1E4F40C7008DE471 /* FillPasswordTableViewCell.swift in Sources */,
A2802BF91E70813A00879216 /* SliderTableViewCell.swift in Sources */,
DC037CB21E4CAB1700609409 /* AboutRepositoryTableViewController.swift in Sources */,
A217ACE41E9BBBBD00A1A6CF /* GitConfigSettingTableViewController.swift in Sources */,
DC037CB01E4CA51F00609409 /* GeneralSettingsTableViewController.swift in Sources */,
DC037CB81E4DD1A500609409 /* AddPasswordTableViewController.swift in Sources */,
DCC441521E8F6C06008A90C4 /* RawPasswordViewController.swift in Sources */,

View file

@ -1058,10 +1058,10 @@ Phone Support PIN #: 84719</string>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<sections>
<tableViewSection id="ugP-R2-9M7">
<tableViewSection headerTitle="GPG Configuration" id="ugP-R2-9M7">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="Jwg-mt-woS" style="IBUITableViewCellStyleDefault" id="tHt-Ro-0HF" userLabel="Discard Changes Table View Cell">
<rect key="frame" x="0.0" y="35" width="414" height="44"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="Jwg-mt-woS" style="IBUITableViewCellStyleDefault" id="tHt-Ro-0HF" userLabel="Encrypt in ASCII-Armored">
<rect key="frame" x="0.0" y="55" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="tHt-Ro-0HF" id="Epj-ei-NtS">
<rect key="frame" x="0.0" y="0.0" width="414" height="43.666666666666664"/>
@ -1079,10 +1079,41 @@ Phone Support PIN #: 84719</string>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection id="aVR-FE-jMg">
<tableViewSection headerTitle="Git Configuration" id="ihT-OG-HTv">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="87a-xY-AbR" detailTextLabel="2qr-d7-0SK" style="IBUITableViewCellStyleValue1" id="SVj-jD-qPT" userLabel="Git Signature">
<rect key="frame" x="0.0" y="155" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="SVj-jD-qPT" id="HaO-5w-qZt">
<rect key="frame" x="0.0" y="0.0" width="381" height="43.666666666666664"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Git Signature" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="87a-xY-AbR">
<rect key="frame" x="15.000000000000007" y="11.999999999999998" width="99.666666666666671" height="20.333333333333332"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Not Set" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2qr-d7-0SK">
<rect key="frame" x="321.33333333333331" y="11.999999999999998" width="57.666666666666664" height="20.333333333333332"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="RHo-mb-ayc" kind="show" id="YZO-oX-Umt"/>
</connections>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="PasswordStore Data" id="aVR-FE-jMg">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="zrl-v3-fxg" style="IBUITableViewCellStyleDefault" id="Jm8-B5-wKx" userLabel="Discard Changes Table View Cell">
<rect key="frame" x="0.0" y="115" width="414" height="44"/>
<rect key="frame" x="0.0" y="255" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Jm8-B5-wKx" id="tjS-Q6-y2M">
<rect key="frame" x="0.0" y="0.0" width="414" height="43.666666666666664"/>
@ -1098,19 +1129,15 @@ Phone Support PIN #: 84719</string>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection id="ujw-Wl-vs1">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="K2K-Bx-g7Z" style="IBUITableViewCellStyleDefault" id="NI1-Kd-hyH">
<rect key="frame" x="0.0" y="195" width="414" height="44"/>
<rect key="frame" x="0.0" y="299" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="NI1-Kd-hyH" id="yLe-T2-TWF">
<rect key="frame" x="0.0" y="0.0" width="414" height="43.666666666666664"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Erase All Password Store Data" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="K2K-Bx-g7Z">
<rect key="frame" x="15" y="0.0" width="384" height="43.666666666666664"/>
<rect key="frame" x="15" y="0.0" width="384" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.50196081400000003" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
@ -1132,6 +1159,7 @@ Phone Support PIN #: 84719</string>
<outlet property="discardChangesTableViewCell" destination="Jm8-B5-wKx" id="rfA-G3-2OE"/>
<outlet property="encryptInASCIIArmoredTableViewCell" destination="tHt-Ro-0HF" id="tOi-Sj-mLJ"/>
<outlet property="eraseDataTableViewCell" destination="NI1-Kd-hyH" id="NtJ-f4-oxb"/>
<outlet property="gitSignatureTableViewCell" destination="SVj-jD-qPT" id="4PE-oy-KPR"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="adh-5o-YYB" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -1586,12 +1614,137 @@ Cgo
</objects>
<point key="canvasLocation" x="7086.9565217391309" y="-1008.4239130434784"/>
</scene>
<!--Git Signature-->
<scene sceneID="eTh-B3-0rv">
<objects>
<tableViewController id="zDo-XK-ymp" customClass="GitConfigSettingTableViewController" customModule="pass" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="9r8-pk-GBf">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<sections>
<tableViewSection id="TCt-zE-c6t">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="pgpKeyURLTableViewCell" rowHeight="52" id="4Bh-1D-w5T">
<rect key="frame" x="0.0" y="35" width="414" height="52"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4Bh-1D-w5T" id="mIL-ig-tbp">
<rect key="frame" x="0.0" y="0.0" width="414" height="52"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hlb-Zh-ega">
<rect key="frame" x="15" y="8" width="391" height="15"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="name" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="fa8-Vc-w8F">
<rect key="frame" x="15" y="23" width="391" height="21"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="URL" returnKeyType="next"/>
<connections>
<outlet property="delegate" destination="zDo-XK-ymp" id="KRG-7d-AfM"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="fa8-Vc-w8F" firstAttribute="top" secondItem="Hlb-Zh-ega" secondAttribute="bottom" id="7dX-q0-fio"/>
<constraint firstItem="fa8-Vc-w8F" firstAttribute="leading" secondItem="Hlb-Zh-ega" secondAttribute="leading" id="N0c-Yi-SOw"/>
<constraint firstAttribute="trailingMargin" secondItem="Hlb-Zh-ega" secondAttribute="trailing" id="QuW-Id-nJ3"/>
<constraint firstAttribute="topMargin" secondItem="Hlb-Zh-ega" secondAttribute="top" id="Wk8-N9-29h"/>
<constraint firstAttribute="trailingMargin" secondItem="fa8-Vc-w8F" secondAttribute="trailing" id="dWA-Zk-8Xs"/>
<constraint firstItem="Hlb-Zh-ega" firstAttribute="leading" secondItem="mIL-ig-tbp" secondAttribute="leadingMargin" constant="7" id="rEw-IA-Jqp"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="pgpKeyURLTableViewCell" rowHeight="52" id="JRY-pY-XtS">
<rect key="frame" x="0.0" y="87" width="414" height="52"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="JRY-pY-XtS" id="KrQ-Ih-dk8">
<rect key="frame" x="0.0" y="0.0" width="414" height="52"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Email" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="m25-Qy-XwU">
<rect key="frame" x="15" y="8" width="391" height="15"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="email" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="YY9-za-MNV">
<rect key="frame" x="15" y="23" width="391" height="21"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="URL" returnKeyType="done"/>
<connections>
<outlet property="delegate" destination="zDo-XK-ymp" id="HX8-SE-uSw"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="topMargin" secondItem="m25-Qy-XwU" secondAttribute="top" id="2Ht-xl-rR3"/>
<constraint firstItem="YY9-za-MNV" firstAttribute="top" secondItem="m25-Qy-XwU" secondAttribute="bottom" id="EL6-fb-eg3"/>
<constraint firstAttribute="trailingMargin" secondItem="YY9-za-MNV" secondAttribute="trailing" id="KpQ-1j-faY"/>
<constraint firstItem="YY9-za-MNV" firstAttribute="leading" secondItem="m25-Qy-XwU" secondAttribute="leading" id="MJG-cs-oIQ"/>
<constraint firstAttribute="trailingMargin" secondItem="m25-Qy-XwU" secondAttribute="trailing" id="brX-cL-blr"/>
<constraint firstItem="m25-Qy-XwU" firstAttribute="leading" secondItem="KrQ-Ih-dk8" secondAttribute="leadingMargin" constant="7" id="dNf-iF-vSC"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="zDo-XK-ymp" id="Q18-Fj-bhC"/>
<outlet property="delegate" destination="zDo-XK-ymp" id="uMh-l3-IeX"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Git Signature" id="pPi-jd-x5U">
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="fQD-Bc-Mcd">
<connections>
<segue destination="M5P-Ab-cIc" kind="unwind" identifier="cancelGitConfigSettingSegue" unwindAction="cancelGitConfigSettingWithSegue:" id="Z2N-nJ-04S"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" systemItem="save" id="kMD-4J-wBb">
<connections>
<segue destination="M5P-Ab-cIc" kind="unwind" identifier="saveGitConfigSettingSegue" unwindAction="saveGitConfigSettingWithSegue:" id="RGN-ff-tuP"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="emailTextField" destination="YY9-za-MNV" id="bpt-uh-1iB"/>
<outlet property="nameTextField" destination="fa8-Vc-w8F" id="UQ7-gG-Qe4"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="FmV-2I-aov" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="M5P-Ab-cIc" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="6109" y="5333"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="9zM-kx-OZU">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="RHo-mb-ayc" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="ch6-Ko-kuU">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="zDo-XK-ymp" kind="relationship" relationship="rootViewController" id="vT1-I7-q3N"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="6nC-pe-hyF" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="4967" y="5333"/>
</scene>
</scenes>
<resources>
<image name="Lock" width="25" height="25"/>
<image name="Settings" width="25" height="25"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="Cpl-XA-cZ9"/>
<segue reference="mPU-tp-J0X"/>
</inferredMetricsTieBreakers>
</document>

View file

@ -13,6 +13,7 @@ import SwiftyUserDefaults
class AdvancedSettingsTableViewController: UITableViewController {
@IBOutlet weak var encryptInASCIIArmoredTableViewCell: UITableViewCell!
@IBOutlet weak var gitSignatureTableViewCell: UITableViewCell!
@IBOutlet weak var eraseDataTableViewCell: UITableViewCell!
@IBOutlet weak var discardChangesTableViewCell: UITableViewCell!
let passwordStore = PasswordStore.shared
@ -30,6 +31,11 @@ class AdvancedSettingsTableViewController: UITableViewController {
encryptInASCIIArmoredSwitch.isOn = Defaults[.encryptInArmored]
encryptInASCIIArmoredTableViewCell.accessoryView = encryptInASCIIArmoredSwitch
encryptInASCIIArmoredTableViewCell.selectionStyle = .none
if Defaults[.gitName]?.isEmpty == false && Defaults[.gitEmail]?.isEmpty == false {
gitSignatureTableViewCell.detailTextLabel?.text = "Set"
} else {
gitSignatureTableViewCell.detailTextLabel?.text = "Not Set"
}
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
@ -79,4 +85,17 @@ class AdvancedSettingsTableViewController: UITableViewController {
Defaults[.encryptInArmored] = encryptInASCIIArmoredSwitch.isOn
}
@IBAction func cancelGitConfigSetting(segue: UIStoryboardSegue) {
}
@IBAction func saveGitConfigSetting(segue: UIStoryboardSegue) {
if let controller = segue.source as? GitConfigSettingTableViewController {
Defaults[.gitName] = controller.nameTextField.text
Defaults[.gitEmail] = controller.emailTextField.text
DispatchQueue.main.async {
self.gitSignatureTableViewCell.detailTextLabel?.text = "Set"
}
}
}
}

View file

@ -0,0 +1,39 @@
//
// GitConfigSettingTableViewController.swift
// pass
//
// Created by Yishi Lin on 10/4/17.
// Copyright © 2017 Yishi Lin. All rights reserved.
//
import UIKit
import SwiftyUserDefaults
class GitConfigSettingTableViewController: UITableViewController {
@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var emailTextField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
tableView.rowHeight = UITableViewAutomaticDimension
nameTextField.text = Defaults[.gitName]
emailTextField.text = Defaults[.gitEmail]
}
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
print("test should perform \(identifier)")
if identifier == "saveGitConfigSettingSegue" {
guard let name = nameTextField.text, !name.isEmpty else {
Utils.alert(title: "Cannot Save", message: "Please set name first.", controller: self, completion: nil)
return false
}
guard let email = emailTextField.text, !email.isEmpty else {
Utils.alert(title: "Cannot Save", message: "Please set email first.", controller: self, completion: nil)
return false
}
}
return true
}
}

View file

@ -24,10 +24,10 @@ extension DefaultsKeys {
static let gitSSHPublicKeyURL = DefaultsKey<URL?>("gitSSHPublicKeyURL")
static let gitSSHPrivateKeyURL = DefaultsKey<URL?>("gitSSHPrivateKeyURL")
static let gitSSHKeySource = DefaultsKey<String?>("gitSSHKeySource")
static let gitSSHPublicKeyArmor = DefaultsKey<String?>("gitSSHPublicKeyArmor")
static let gitSSHPrivateKeyArmor = DefaultsKey<String?>("gitSSHPrivateKeyArmor")
static let gitName = DefaultsKey<String?>("gitName")
static let gitEmail = DefaultsKey<String?>("gitEmail")
static let lastSyncedTime = DefaultsKey<Date?>("lastSyncedTime")

View file

@ -112,7 +112,9 @@ class PasswordStore {
var gitSignatureForNow: GTSignature {
get {
return GTSignature(name: Defaults[.gitUsername]!, email: Defaults[.gitUsername]!+"@passforios", time: Date())!
let name = Defaults[.gitName] ?? Defaults[.gitUsername]!
let email = Defaults[.gitEmail] ?? (Defaults[.gitUsername]!+"@passforios")
return GTSignature(name: name, email: email, time: Date())!
}
}