Skip to content

Commit b153426

Browse files
committed
apply new design, removing generated files from sync
1 parent f4bf7f5 commit b153426

12 files changed

+65
-11
lines changed

iOS-Email-Client/AsyncTasks/CreateCustomJSONFileAsyncTask.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ class CreateCustomJSONFileAsyncTask {
6363
handleRow($0.toDictionary(emailId: emailId))
6464
}
6565

66+
67+
6668
DispatchQueue.main.async {
6769
completion(nil, self.fileURL)
6870
}

iOS-Email-Client/Base.lproj/Main.storyboard

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,7 @@
19001900
<nil key="textColor"/>
19011901
<nil key="highlightedColor"/>
19021902
</label>
1903-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Guayaquil - 12 hours ago" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0bv-pm-gsw">
1903+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Guayaquil - 12 hours ago" textAlignment="natural" lineBreakMode="characterWrap" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0bv-pm-gsw">
19041904
<rect key="frame" x="0.0" y="22" width="196" height="18"/>
19051905
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="13"/>
19061906
<nil key="textColor"/>

iOS-Email-Client/Controllers/ConnectUploadViewController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ class ConnectUploadViewController: UIViewController{
114114
self.presentProcessInterrupted()
115115
return
116116
}
117+
CriptextFileManager.deleteFile(url: myUrl)
118+
CriptextFileManager.deleteFile(path: compressedPath)
117119
self.databasePath = outputPath
118120
self.state = .waiting
119121
self.handleState()
@@ -143,6 +145,7 @@ class ConnectUploadViewController: UIViewController{
143145
self.presentProcessInterrupted()
144146
return
145147
}
148+
CriptextFileManager.deleteFile(path: path)
146149
self.state = .sendData
147150
self.handleState()
148151
}

iOS-Email-Client/Controllers/GenericAlertUIPopover.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ class GenericAlertUIPopover: BaseUIPopover {
1212

1313
var myTitle: String?
1414
var myMessage: String?
15+
var myAttributedMessage: NSAttributedString?
16+
var myButton: String = "Ok"
1517
var onOkPress: (() -> (Void))?
1618
@IBOutlet weak var titleLabel: UILabel!
1719
@IBOutlet weak var messageLabel: UILabel!
20+
@IBOutlet weak var okButton: UIButton!
1821

1922

2023
init(){
@@ -28,7 +31,12 @@ class GenericAlertUIPopover: BaseUIPopover {
2831
override func viewDidLoad() {
2932
super.viewDidLoad()
3033
titleLabel.text = myTitle
31-
messageLabel.text = myMessage
34+
okButton.setTitle(myButton, for: .normal)
35+
if let attributedMessage = myAttributedMessage {
36+
messageLabel.attributedText = attributedMessage
37+
} else {
38+
messageLabel.text = myMessage
39+
}
3240
}
3341

3442
@IBAction func okPress(_ sender: Any) {

iOS-Email-Client/Controllers/Login/ConnectDeviceViewController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ class ConnectDeviceViewController: UIViewController{
133133
self.presentProcessInterrupted()
134134
return
135135
}
136+
CriptextFileManager.deleteFile(path: path)
137+
CriptextFileManager.deleteFile(path: decryptedPath)
136138
state = .processDB(myAccount, decompressedPath, data)
137139
self.handleState()
138140
}
@@ -161,6 +163,7 @@ class ConnectDeviceViewController: UIViewController{
161163
}
162164
}
163165
DBManager.insertBatchRows(rows: dbRows, maps: &maps)
166+
CriptextFileManager.deleteFile(path: path)
164167
DispatchQueue.main.async {
165168
self.connectUIView.progressChange(value: self.PROGRESS_COMPLETE, message: "Decrypting Mailbox") {
166169
self.connectUIView.messageLabel.text = "Mailbox restored successfully!"

iOS-Email-Client/Controllers/Login/LoginDeviceViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class LoginDeviceViewController: UIViewController{
3737
self.sendLinkAuthRequest()
3838
return
3939
}
40+
titleLabel.text = "2-Factor Authentication"
4041
self.scheduleWorker.start()
4142
}
4243

iOS-Email-Client/Controllers/Login/ResetDeviceViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ResetDeviceViewController: UIViewController{
4343

4444
if(loginData.isTwoFactor){
4545
resetButton.setTitle(buttonTitle, for: .normal)
46-
titleLabel.text = "Two-factor Authentication"
46+
titleLabel.text = "2-Factor Authentication"
4747
}
4848
}
4949

iOS-Email-Client/Controllers/SettingsGeneralViewController.swift

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class SettingsGeneralViewController: UITableViewController{
1515
let ROW_HEIGHT: CGFloat = 40.0
1616
let sections = ["ACCOUNT", "ABOUT", "VERSION"] as [String]
1717
let menus = [
18-
"ACCOUNT": ["Profile", "Signature", "Change Password", "Recovery Email", "Two-factor Authentication"],
18+
"ACCOUNT": ["Profile", "Signature", "Change Password", "2-Factor Authentication", "Recovery Email"],
1919
"ABOUT": ["Privacy Policy", "Terms of Service", "Open Source Libraries", "Logout"],
2020
"VERSION": ["Version"]] as [String: [String]]
2121
var generalData: GeneralSettingsData!
@@ -70,7 +70,7 @@ class SettingsGeneralViewController: UITableViewController{
7070
cell.loader.isHidden = true
7171
cell.goImageView.isHidden = false
7272
return cell
73-
case "Two-factor Authentication":
73+
case "2-Factor Authentication":
7474
let cell = tableView.dequeueReusableCell(withIdentifier: "settingsGeneralSwitch") as! GeneralSwitchTableViewCell
7575
cell.optionLabel.text = text
7676
cell.availableSwitch.isOn = generalData.isTwoFactor
@@ -251,6 +251,11 @@ class SettingsGeneralViewController: UITableViewController{
251251
}
252252

253253
func setTwoFactor(enable: Bool){
254+
guard !enable || generalData.recoveryEmailStatus == .verified else {
255+
presentRecoveryPopover()
256+
self.reloadView()
257+
return
258+
}
254259
let initialValue = self.generalData.isTwoFactor
255260
self.generalData.isTwoFactor = enable
256261
APIManager.setTwoFactor(isOn: enable, token: myAccount.jwt) { (responseData) in
@@ -260,8 +265,30 @@ class SettingsGeneralViewController: UITableViewController{
260265
self.reloadView()
261266
return
262267
}
268+
if (self.generalData.isTwoFactor) {
269+
self.presentTwoFactorPopover()
270+
}
263271
}
264272
}
273+
274+
func presentRecoveryPopover() {
275+
let popover = GenericAlertUIPopover()
276+
let attributedRegular = NSMutableAttributedString(string: "To enable Two-Factor Authentication you must set and verify a recovery email on your account", attributes: [NSAttributedStringKey.font: Font.regular.size(15)!])
277+
let attributedSemibold = NSAttributedString(string: "\n\nPlease go to Settings > Recovery Email to complete this step.", attributes: [NSAttributedStringKey.font: Font.semibold.size(15)!])
278+
attributedRegular.append(attributedSemibold)
279+
popover.myTitle = "Recovery Email Not Set"
280+
popover.myAttributedMessage = attributedRegular
281+
popover.myButton = "Got it!"
282+
self.presentPopover(popover: popover, height: 310)
283+
}
284+
285+
func presentTwoFactorPopover() {
286+
let popover = GenericAlertUIPopover()
287+
popover.myTitle = "2FA Enabled!"
288+
popover.myMessage = "Next time you sign into your account on another device you'll have to enter your password and then validate the sign in from an existing device."
289+
popover.myButton = "Got it!"
290+
self.presentPopover(popover: popover, height: 263)
291+
}
265292
}
266293

267294
extension SettingsGeneralViewController: CustomTabsChildController {

iOS-Email-Client/Managers/CriptextFileManager.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,15 @@ class CriptextFileManager {
289289
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
290290
return documentsURL.appendingPathComponent(name)
291291
}
292+
293+
static func deleteFile(path: String) {
294+
let url = URL(fileURLWithPath: path)
295+
try? FileManager.default.removeItem(at: url)
296+
}
297+
298+
static func deleteFile(url: URL) {
299+
try? FileManager.default.removeItem(at: url)
300+
}
292301
}
293302

294303
extension CriptextFileManager: ProgressDelegate {

iOS-Email-Client/Views/EmailTableHeaderView.xib

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1010
</dependencies>
1111
<customFonts key="customFonts">
@@ -26,7 +26,7 @@
2626
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="BFa-V6-her">
2727
<rect key="frame" x="18" y="13" width="291" height="78.5"/>
2828
<subviews>
29-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Your People in The Club" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wTl-IH-UYB">
29+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Your People in The Club" textAlignment="natural" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wTl-IH-UYB">
3030
<rect key="frame" x="0.0" y="0.0" width="291" height="20"/>
3131
<constraints>
3232
<constraint firstAttribute="height" constant="20" id="TTh-wB-JM0"/>

0 commit comments

Comments
 (0)