Skip to content

Commit f272b6b

Browse files
authored
Merge pull request #197 from Hirobreak/bold
Bold Setting and Event Handler
2 parents 3944005 + 6862288 commit f272b6b

File tree

8 files changed

+160
-151
lines changed

8 files changed

+160
-151
lines changed

iOS-Email-Client.xcodeproj/project.pbxproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,9 +1652,10 @@
16521652
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
16531653
CODE_SIGN_IDENTITY = "iPhone Developer";
16541654
COPY_PHASE_STRIP = NO;
1655-
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1656-
ENABLE_NS_ASSERTIONS = NO;
1655+
DEBUG_INFORMATION_FORMAT = dwarf;
1656+
ENABLE_NS_ASSERTIONS = YES;
16571657
ENABLE_STRICT_OBJC_MSGSEND = YES;
1658+
ENABLE_TESTABILITY = YES;
16581659
GCC_C_LANGUAGE_STANDARD = gnu11;
16591660
GCC_NO_COMMON_BLOCKS = YES;
16601661
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -1664,10 +1665,10 @@
16641665
GCC_WARN_UNUSED_FUNCTION = YES;
16651666
GCC_WARN_UNUSED_VARIABLE = YES;
16661667
IPHONEOS_DEPLOYMENT_TARGET = 11.2;
1667-
MTL_ENABLE_DEBUG_INFO = NO;
1668+
MTL_ENABLE_DEBUG_INFO = YES;
16681669
SDKROOT = iphoneos;
16691670
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
1670-
VALIDATE_PRODUCT = YES;
1671+
VALIDATE_PRODUCT = NO;
16711672
};
16721673
name = Support;
16731674
};

iOS-Email-Client.xcodeproj/xcshareddata/xcschemes/iOS-Email-Client.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
</BuildableProductRunnable>
9393
</ProfileAction>
9494
<AnalyzeAction
95-
buildConfiguration = "Debug">
95+
buildConfiguration = "Support">
9696
</AnalyzeAction>
9797
<ArchiveAction
9898
buildConfiguration = "Release"

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
<nil key="highlightedColor"/>
205205
</label>
206206
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="128MB" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7vv-dj-mcZ">
207-
<rect key="frame" x="240" y="17" width="80" height="16.5"/>
207+
<rect key="frame" x="240" y="16.5" width="80" height="16.5"/>
208208
<constraints>
209209
<constraint firstAttribute="width" constant="80" id="GRk-7K-MUR"/>
210210
</constraints>
@@ -572,9 +572,6 @@
572572
<navigationItem key="navigationItem" id="krw-PA-Tbd">
573573
<barButtonItem key="leftBarButtonItem" image="close-rounded" id="PUh-NZ-FkO">
574574
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
575-
<connections>
576-
<action selector="didPressCancel:" destination="Rmr-j3-9Sc" id="pso-hq-CFO"/>
577-
</connections>
578575
</barButtonItem>
579576
<barButtonItem key="rightBarButtonItem" image="send" id="Y6z-A3-fE9">
580577
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -594,7 +591,6 @@
594591
<outlet property="buttonCollapse" destination="cYK-my-H1N" id="XIQ-Uc-lxc"/>
595592
<outlet property="ccField" destination="yYI-7o-3ig" id="N4z-qE-bgu"/>
596593
<outlet property="ccHeightConstraint" destination="IXs-HW-4pm" id="goD-9X-366"/>
597-
<outlet property="closeBarButton" destination="PUh-NZ-FkO" id="Tap-WD-AlC"/>
598594
<outlet property="contactTableView" destination="c58-aV-hT9" id="ilI-ci-0NA"/>
599595
<outlet property="contactTableViewTopConstraint" destination="skq-DN-03B" id="KnZ-Hx-0QL"/>
600596
<outlet property="editorHeightConstraint" destination="BJ6-ET-T1U" id="fyu-nL-dzp"/>
@@ -973,7 +969,7 @@
973969
<nil key="highlightedColor"/>
974970
</label>
975971
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Yesterday" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="38w-hq-5ve">
976-
<rect key="frame" x="295" y="34" width="60" height="15.5"/>
972+
<rect key="frame" x="295" y="34.5" width="60" height="15.5"/>
977973
<constraints>
978974
<constraint firstAttribute="width" constant="60" id="Npk-B4-BKI"/>
979975
</constraints>
@@ -1284,7 +1280,7 @@
12841280
<autoresizingMask key="autoresizingMask"/>
12851281
<subviews>
12861282
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Recovery Email" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ddn-zH-dU7">
1287-
<rect key="frame" x="27" y="10.5" width="117" height="23.5"/>
1283+
<rect key="frame" x="27" y="11" width="117" height="23.5"/>
12881284
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="17"/>
12891285
<color key="textColor" red="0.21568627450980393" green="0.22745098039215686" blue="0.27058823529411763" alpha="1" colorSpace="calibratedRGB"/>
12901286
<nil key="highlightedColor"/>
@@ -1476,7 +1472,7 @@
14761472
<nil key="highlightedColor"/>
14771473
</label>
14781474
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Not Confirmed" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Upi-pd-9ph">
1479-
<rect key="frame" x="228" y="47" width="120" height="20.5"/>
1475+
<rect key="frame" x="228" y="47.5" width="120" height="20.5"/>
14801476
<constraints>
14811477
<constraint firstAttribute="width" constant="120" id="Lo0-SR-aHk"/>
14821478
</constraints>
@@ -1760,7 +1756,7 @@
17601756
<rect key="frame" x="0.0" y="20" width="375" height="65"/>
17611757
<subviews>
17621758
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="On" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wbm-oq-FDu">
1763-
<rect key="frame" x="27" y="21" width="23" height="23.5"/>
1759+
<rect key="frame" x="27" y="21.5" width="23" height="23.5"/>
17641760
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="17"/>
17651761
<color key="textColor" red="0.21568627450980393" green="0.22745098039215686" blue="0.27058823529411763" alpha="1" colorSpace="calibratedRGB"/>
17661762
<nil key="highlightedColor"/>
@@ -1861,7 +1857,7 @@
18611857
<nil key="highlightedColor"/>
18621858
</label>
18631859
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="amW-Di-fUH">
1864-
<rect key="frame" x="61" y="13" width="159" height="40"/>
1860+
<rect key="frame" x="61" y="13.5" width="159" height="40"/>
18651861
<subviews>
18661862
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Samsung Galaxy S8" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="K3s-zY-auf">
18671863
<rect key="frame" x="0.0" y="0.0" width="159" height="22"/>
@@ -1917,7 +1913,7 @@
19171913
<autoresizingMask key="autoresizingMask"/>
19181914
<subviews>
19191915
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Cryptext System Version 1.3.1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Snm-6a-b2Z">
1920-
<rect key="frame" x="27" y="21.5" width="321" height="23.5"/>
1916+
<rect key="frame" x="27" y="22" width="321" height="23.5"/>
19211917
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="17"/>
19221918
<color key="textColor" red="0.72549019607843135" green="0.72549019607843135" blue="0.72549019607843135" alpha="1" colorSpace="calibratedRGB"/>
19231919
<nil key="highlightedColor"/>

iOS-Email-Client/Controllers/ComposeViewController.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ class ComposeViewController: UIViewController {
6262
@IBOutlet weak var contactTableView: UITableView!
6363
@IBOutlet weak var contactTableViewTopConstraint: NSLayoutConstraint!
6464

65-
@IBOutlet weak var closeBarButton: UIBarButtonItem!
6665
@IBOutlet weak var attachmentButtonContainerView: UIView!
6766
@IBOutlet weak var buttonCollapse: UIButton!
6867

@@ -86,9 +85,6 @@ class ComposeViewController: UIViewController {
8685
var selectedTokenInputView:CLTokenInputView?
8786

8887
var isEdited = false
89-
90-
var sendBarButton:UIBarButtonItem!
91-
var sendSecureBarButton:UIBarButtonItem!
9288
var attachmentBarButton:MIBadgeButton!
9389

9490
var dismissTapGestureRecognizer: UITapGestureRecognizer!
@@ -98,6 +94,9 @@ class ComposeViewController: UIViewController {
9894

9995
var delegate : ComposerSendMailDelegate?
10096

97+
var enableSendButton: UIBarButtonItem!
98+
var disableSendButton: UIBarButtonItem!
99+
101100
//MARK: - View lifecycle
102101
override func viewDidLoad() {
103102
super.viewDidLoad()
@@ -109,9 +108,10 @@ class ComposeViewController: UIViewController {
109108
activeAccount = DBManager.getAccountByUsername(defaults.string(forKey: "activeAccount")!)
110109
fileManager.token = activeAccount.jwt
111110

112-
self.sendBarButton = UIBarButtonItem(image: Icon.send.image, style: .plain, target: self, action: #selector(didPressSend(_:)))
113-
self.sendSecureBarButton = UIBarButtonItem(image: Icon.send.image, style: .plain, target: self, action: #selector(didPressSend(_:)))
114-
self.sendSecureBarButton.tintColor = .white
111+
let sendImage = Icon.send.image?.tint(with: .white)
112+
self.enableSendButton = UIBarButtonItem(image: sendImage, style: .plain, target: self, action: #selector(didPressSend(_:)))
113+
let disableImage = Icon.send.image?.tint(with: UIColor.white.withAlphaComponent(0.6))
114+
self.disableSendButton = UIBarButtonItem(image: disableImage, style: .plain, target: self, action: nil)
115115

116116
self.editorView.placeholder = "Message"
117117
self.editorView.delegate = self
@@ -189,11 +189,12 @@ class ComposeViewController: UIViewController {
189189
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didPressAttachment(_:)))
190190
self.attachmentButtonContainerView.addGestureRecognizer(tapGesture)
191191
self.title = "New Secure Email"
192-
self.navigationItem.rightBarButtonItem = self.sendSecureBarButton
192+
self.navigationItem.rightBarButtonItem = self.enableSendButton
193193
activityButton.setImage(Icon.attachment.vertical.image, for: .normal)
194194
activityButton.badgeEdgeInsets = UIEdgeInsetsMake(5, 12, 0, 13)
195195

196-
self.closeBarButton.tintColor = UIColor.white.withAlphaComponent(0.4)
196+
let closeImage = UIImage(named: "close-rounded")!.tint(with: UIColor.white.withAlphaComponent(0.6))
197+
self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: closeImage, style: .plain, target: self, action: #selector(didPressCancel(_:)))
197198

198199
subjectField.text = composerData.initSubject
199200
editorView.html = "\(composerData.initContent)\(composerData.emailDraft == nil && !activeAccount.signature.isEmpty && activeAccount.signatureEnabled ? "<br/> \(activeAccount.signature)" : "")"
@@ -213,6 +214,10 @@ class ComposeViewController: UIViewController {
213214
self.coachMarksController.dataSource = self
214215
}
215216

217+
func toggleSendButton(){
218+
219+
}
220+
216221
@objc func onDonePress(_ sender: Any){
217222
switch(sender as? UIView){
218223
case toField:
@@ -222,8 +227,8 @@ class ComposeViewController: UIViewController {
222227
editorView.becomeFirstResponder()
223228
break
224229
default:
225-
if(self.sendBarButton.isEnabled){
226-
self.didPressSend(sendBarButton)
230+
if(self.navigationItem.rightBarButtonItem == self.enableSendButton){
231+
self.didPressSend(self.enableSendButton)
227232
}
228233
}
229234
}
@@ -249,8 +254,7 @@ class ComposeViewController: UIViewController {
249254
}
250255

251256
if self.toField.allTokens.isEmpty {
252-
self.sendSecureBarButton.isEnabled = false
253-
self.sendBarButton.isEnabled = false
257+
self.navigationItem.rightBarButtonItem = self.disableSendButton
254258
}
255259
}
256260

@@ -470,17 +474,16 @@ class ComposeViewController: UIViewController {
470474
}
471475

472476
func toggleInteraction(_ flag:Bool){
473-
self.sendBarButton.isEnabled = flag
474-
self.sendSecureBarButton.isEnabled = flag
475-
self.closeBarButton.isEnabled = flag
477+
self.navigationItem.rightBarButtonItem = flag ? self.enableSendButton : self.disableSendButton
478+
476479
self.view.isUserInteractionEnabled = flag
477480
self.navigationController?.navigationBar.layer.zPosition = flag ? 0 : -1
478481
self.blackBackground.isUserInteractionEnabled = flag
479482
self.blackBackground.alpha = flag ? 0 : 0.5
480483
}
481484

482485
//MARK: - IBActions
483-
@IBAction func didPressCancel(_ sender: UIBarButtonItem) {
486+
@objc func didPressCancel(_ sender: UIBarButtonItem) {
484487

485488
if !self.isEdited {
486489
self.dismiss(animated: true, completion: nil)
@@ -906,8 +909,7 @@ extension ComposeViewController: CLTokenInputViewDelegate {
906909
self.isEdited = true
907910
}
908911

909-
self.sendSecureBarButton.isEnabled = true
910-
self.sendBarButton.isEnabled = true
912+
self.navigationItem.rightBarButtonItem = self.enableSendButton
911913

912914
if text!.contains(",") {
913915
let name = text?.replacingOccurrences(of: ",", with: "")
@@ -933,8 +935,7 @@ extension ComposeViewController: CLTokenInputViewDelegate {
933935
}
934936

935937
if self.toField.allTokens.isEmpty && (self.toField.text?.isEmpty)! {
936-
self.sendSecureBarButton.isEnabled = false
937-
self.sendBarButton.isEnabled = false
938+
self.navigationItem.rightBarButtonItem = self.disableSendButton
938939
}
939940

940941
self.contactTableView.isHidden = (view.text?.isEmpty)!
@@ -988,8 +989,7 @@ extension ComposeViewController: CLTokenInputViewDelegate {
988989

989990
func tokenInputView(_ view: CLTokenInputView, didRemove token: CLToken) {
990991
if self.toField.allTokens.isEmpty && (self.toField.text?.isEmpty)! {
991-
self.sendSecureBarButton.isEnabled = false
992-
self.sendBarButton.isEnabled = false
992+
self.navigationItem.rightBarButtonItem = self.disableSendButton
993993
}
994994
}
995995

iOS-Email-Client/Controllers/EmailDetailViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ extension EmailDetailViewController : CriptextFileDelegate, UIDocumentInteractio
811811

812812
}
813813

814-
extension EmailDetailViewController: EventHandlerDelegate {
814+
extension EmailDetailViewController {
815815

816816
func didReceiveEvents(result: EventData.Result) {
817817
guard result.modifiedThreadIds.contains(emailData.threadId) || result.modifiedEmailKeys.contains(where: { (key) -> Bool in

0 commit comments

Comments
 (0)