Skip to content

Commit

Permalink
Merge pull request #197 from Hirobreak/bold
Browse files Browse the repository at this point in the history
Bold Setting and Event Handler
  • Loading branch information
danieltigse authored Sep 20, 2018
2 parents 3944005 + 6862288 commit f272b6b
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 151 deletions.
9 changes: 5 additions & 4 deletions iOS-Email-Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1652,9 +1652,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_NS_ASSERTIONS = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand All @@ -1664,10 +1665,10 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_ENABLE_DEBUG_INFO = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
VALIDATE_PRODUCT = NO;
};
name = Support;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
buildConfiguration = "Support">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
Expand Down
18 changes: 7 additions & 11 deletions iOS-Email-Client/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
<nil key="highlightedColor"/>
</label>
<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">
<rect key="frame" x="240" y="17" width="80" height="16.5"/>
<rect key="frame" x="240" y="16.5" width="80" height="16.5"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="GRk-7K-MUR"/>
</constraints>
Expand Down Expand Up @@ -572,9 +572,6 @@
<navigationItem key="navigationItem" id="krw-PA-Tbd">
<barButtonItem key="leftBarButtonItem" image="close-rounded" id="PUh-NZ-FkO">
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<action selector="didPressCancel:" destination="Rmr-j3-9Sc" id="pso-hq-CFO"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" image="send" id="Y6z-A3-fE9">
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand All @@ -594,7 +591,6 @@
<outlet property="buttonCollapse" destination="cYK-my-H1N" id="XIQ-Uc-lxc"/>
<outlet property="ccField" destination="yYI-7o-3ig" id="N4z-qE-bgu"/>
<outlet property="ccHeightConstraint" destination="IXs-HW-4pm" id="goD-9X-366"/>
<outlet property="closeBarButton" destination="PUh-NZ-FkO" id="Tap-WD-AlC"/>
<outlet property="contactTableView" destination="c58-aV-hT9" id="ilI-ci-0NA"/>
<outlet property="contactTableViewTopConstraint" destination="skq-DN-03B" id="KnZ-Hx-0QL"/>
<outlet property="editorHeightConstraint" destination="BJ6-ET-T1U" id="fyu-nL-dzp"/>
Expand Down Expand Up @@ -973,7 +969,7 @@
<nil key="highlightedColor"/>
</label>
<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">
<rect key="frame" x="295" y="34" width="60" height="15.5"/>
<rect key="frame" x="295" y="34.5" width="60" height="15.5"/>
<constraints>
<constraint firstAttribute="width" constant="60" id="Npk-B4-BKI"/>
</constraints>
Expand Down Expand Up @@ -1284,7 +1280,7 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<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">
<rect key="frame" x="27" y="10.5" width="117" height="23.5"/>
<rect key="frame" x="27" y="11" width="117" height="23.5"/>
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="17"/>
<color key="textColor" red="0.21568627450980393" green="0.22745098039215686" blue="0.27058823529411763" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -1476,7 +1472,7 @@
<nil key="highlightedColor"/>
</label>
<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">
<rect key="frame" x="228" y="47" width="120" height="20.5"/>
<rect key="frame" x="228" y="47.5" width="120" height="20.5"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="Lo0-SR-aHk"/>
</constraints>
Expand Down Expand Up @@ -1760,7 +1756,7 @@
<rect key="frame" x="0.0" y="20" width="375" height="65"/>
<subviews>
<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">
<rect key="frame" x="27" y="21" width="23" height="23.5"/>
<rect key="frame" x="27" y="21.5" width="23" height="23.5"/>
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="17"/>
<color key="textColor" red="0.21568627450980393" green="0.22745098039215686" blue="0.27058823529411763" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -1861,7 +1857,7 @@
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="amW-Di-fUH">
<rect key="frame" x="61" y="13" width="159" height="40"/>
<rect key="frame" x="61" y="13.5" width="159" height="40"/>
<subviews>
<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">
<rect key="frame" x="0.0" y="0.0" width="159" height="22"/>
Expand Down Expand Up @@ -1917,7 +1913,7 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<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">
<rect key="frame" x="27" y="21.5" width="321" height="23.5"/>
<rect key="frame" x="27" y="22" width="321" height="23.5"/>
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="17"/>
<color key="textColor" red="0.72549019607843135" green="0.72549019607843135" blue="0.72549019607843135" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
Expand Down
46 changes: 23 additions & 23 deletions iOS-Email-Client/Controllers/ComposeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class ComposeViewController: UIViewController {
@IBOutlet weak var contactTableView: UITableView!
@IBOutlet weak var contactTableViewTopConstraint: NSLayoutConstraint!

@IBOutlet weak var closeBarButton: UIBarButtonItem!
@IBOutlet weak var attachmentButtonContainerView: UIView!
@IBOutlet weak var buttonCollapse: UIButton!

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

var isEdited = false

var sendBarButton:UIBarButtonItem!
var sendSecureBarButton:UIBarButtonItem!
var attachmentBarButton:MIBadgeButton!

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

var delegate : ComposerSendMailDelegate?

var enableSendButton: UIBarButtonItem!
var disableSendButton: UIBarButtonItem!

//MARK: - View lifecycle
override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -109,9 +108,10 @@ class ComposeViewController: UIViewController {
activeAccount = DBManager.getAccountByUsername(defaults.string(forKey: "activeAccount")!)
fileManager.token = activeAccount.jwt

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

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

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

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

func toggleSendButton(){

}

@objc func onDonePress(_ sender: Any){
switch(sender as? UIView){
case toField:
Expand All @@ -222,8 +227,8 @@ class ComposeViewController: UIViewController {
editorView.becomeFirstResponder()
break
default:
if(self.sendBarButton.isEnabled){
self.didPressSend(sendBarButton)
if(self.navigationItem.rightBarButtonItem == self.enableSendButton){
self.didPressSend(self.enableSendButton)
}
}
}
Expand All @@ -249,8 +254,7 @@ class ComposeViewController: UIViewController {
}

if self.toField.allTokens.isEmpty {
self.sendSecureBarButton.isEnabled = false
self.sendBarButton.isEnabled = false
self.navigationItem.rightBarButtonItem = self.disableSendButton
}
}

Expand Down Expand Up @@ -470,17 +474,16 @@ class ComposeViewController: UIViewController {
}

func toggleInteraction(_ flag:Bool){
self.sendBarButton.isEnabled = flag
self.sendSecureBarButton.isEnabled = flag
self.closeBarButton.isEnabled = flag
self.navigationItem.rightBarButtonItem = flag ? self.enableSendButton : self.disableSendButton

self.view.isUserInteractionEnabled = flag
self.navigationController?.navigationBar.layer.zPosition = flag ? 0 : -1
self.blackBackground.isUserInteractionEnabled = flag
self.blackBackground.alpha = flag ? 0 : 0.5
}

//MARK: - IBActions
@IBAction func didPressCancel(_ sender: UIBarButtonItem) {
@objc func didPressCancel(_ sender: UIBarButtonItem) {

if !self.isEdited {
self.dismiss(animated: true, completion: nil)
Expand Down Expand Up @@ -906,8 +909,7 @@ extension ComposeViewController: CLTokenInputViewDelegate {
self.isEdited = true
}

self.sendSecureBarButton.isEnabled = true
self.sendBarButton.isEnabled = true
self.navigationItem.rightBarButtonItem = self.enableSendButton

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

if self.toField.allTokens.isEmpty && (self.toField.text?.isEmpty)! {
self.sendSecureBarButton.isEnabled = false
self.sendBarButton.isEnabled = false
self.navigationItem.rightBarButtonItem = self.disableSendButton
}

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

func tokenInputView(_ view: CLTokenInputView, didRemove token: CLToken) {
if self.toField.allTokens.isEmpty && (self.toField.text?.isEmpty)! {
self.sendSecureBarButton.isEnabled = false
self.sendBarButton.isEnabled = false
self.navigationItem.rightBarButtonItem = self.disableSendButton
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ extension EmailDetailViewController : CriptextFileDelegate, UIDocumentInteractio

}

extension EmailDetailViewController: EventHandlerDelegate {
extension EmailDetailViewController {

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

0 comments on commit f272b6b

Please sign in to comment.