Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cc24e4d
Add tests for KeyMethods
Kharchevskyi May 23, 2021
8863f7a
Update Core tests and test scheme
Kharchevskyi May 23, 2021
2123519
Move logic to CreatePrivateKeyViewController
Kharchevskyi May 23, 2021
5685c72
Add UI for CreatePrivateKeyViewController
Kharchevskyi May 26, 2021
d047a84
wip separate setup logic into different controllers
Kharchevskyi May 26, 2021
19bf165
Finalize SetupInitialViewController. Add BackupServiceMock
Kharchevskyi May 31, 2021
7307565
UI updates. Add radio buttons to SetupKeyViewController
Kharchevskyi Jun 1, 2021
99d69bf
Update ui for all pass phrase related controllers
Kharchevskyi Jun 3, 2021
3ae9615
Adopt current functionality to work with pass phrase in memory
Kharchevskyi Jun 3, 2021
e922beb
Add Pass Phrase saving logic
Kharchevskyi Jun 6, 2021
4056936
Polish PassPhrase logic
Kharchevskyi Jun 7, 2021
5e535e1
Merge branch 'master' of github.com:FlowCrypt/flowcrypt-ios into feat…
Kharchevskyi Jun 7, 2021
599bd41
Addd error handling
Kharchevskyi Jun 7, 2021
0e41fdb
Refactor PassPhraseStorage to make it testable. Start working on tests
Kharchevskyi Jun 7, 2021
d900ac8
Rework LocalPassPhraseStorage to keep pass phrases only in memory
Kharchevskyi Jun 8, 2021
cf4df4f
Add tests
Kharchevskyi Jun 8, 2021
4749413
UI fixes for text color
Kharchevskyi Jun 8, 2021
c6f17e9
Add PassPhraseStorage tests
Kharchevskyi Jun 8, 2021
bf99185
Merge master
Kharchevskyi Jun 10, 2021
52e14d6
fixed swiftlint
flowcrypt-machine-user Jun 12, 2021
0325ff0
fixed swiftlint
flowcrypt-machine-user Jun 12, 2021
74afdcb
Fix for saving pass phrase
Kharchevskyi Jun 13, 2021
4693e4f
Merge branch 'feature/issue-197-pass-phrase-memory' of github.com:Flo…
Kharchevskyi Jun 13, 2021
beac9aa
Save only valid pass phrase
Kharchevskyi Jun 16, 2021
512b8aa
Minor fix
Kharchevskyi Jun 16, 2021
529d745
Fix tests
Kharchevskyi Jun 17, 2021
668a787
Merge branch 'master' into feature/issue-197-pass-phrase-memory
tomholub Jun 18, 2021
0290da4
PR fixes
Kharchevskyi Jun 19, 2021
2fdda2f
Change wrong pass phrase error handling
Kharchevskyi Jun 19, 2021
7669fab
Merge branch 'feature/issue-197-pass-phrase-memory' of github.com:Flo…
Kharchevskyi Jun 19, 2021
a45339f
Rename according to PR comments
Kharchevskyi Jun 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 130 additions & 44 deletions FlowCrypt.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

22 changes: 4 additions & 18 deletions FlowCrypt.xcodeproj/xcshareddata/xcschemes/FlowCrypt.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForTesting = "NO"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
Expand Down Expand Up @@ -84,7 +84,8 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO"
language = "en"
region = "GB">
region = "GB"
codeCoverageEnabled = "YES">
<CommandLineArguments>
<CommandLineArgument
argument = "-AppleLanguages (en-US)"
Expand All @@ -96,21 +97,6 @@
</CommandLineArgument>
</CommandLineArguments>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9FDF3640235A1B0100614596"
BuildableName = "FlowCryptUITests.xctest"
BlueprintName = "FlowCryptUITests"
ReferencedContainer = "container:FlowCrypt.xcodeproj">
</BuildableReference>
<LocationScenarioReference
identifier = "London, England"
referenceType = "1">
</LocationScenarioReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
Expand Down
6 changes: 6 additions & 0 deletions FlowCrypt/App/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ extension Logger {

/// log all db migration events
case migration = "Migration"

/// Core related logs
case core = "Core"

/// Setup Flow logs
case setup = "Setup"
}

static func nested<T>(in type: T.Type, with logLabel: LogLabels) -> Logger {
Expand Down
75 changes: 75 additions & 0 deletions FlowCrypt/Common UI/CommonNodesInputs.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//
// CommonNodes.swift
// FlowCrypt
//
// Created by Anton Kharchevskyi on 31.05.2021.
// Copyright © 2021 FlowCrypt Limited. All rights reserved.
//

import FlowCryptUI
import UIKit

extension TextCellNode.Input {
static func loading(with size: CGSize) -> TextCellNode.Input {
.init(
backgroundColor: .backgroundColor,
title: "loading_title".localized + "...",
withSpinner: true,
size: size
)
}
}

extension ButtonCellNode.Input {
static let retry: ButtonCellNode.Input = .init(
title: "retry_title"
.localized
.attributed(.bold(16), color: .white, alignment: .center),
insets: UIEdgeInsets(top: 16, left: 24, bottom: 8, right: 24),
color: .main
)

static let chooseAnotherAccount: ButtonCellNode.Input = .init(
title: "setup_use_another"
.localized
.attributed(
.regular(15),
color: UIColor.colorFor(
darkStyle: .white,
lightStyle: .blueColor
),
alignment: .center
),
insets: .side(8),
color: .backgroundColor
)
}

extension CheckBoxTextNode.Input {
static func common(with text: String, isSelected: Bool) -> CheckBoxTextNode.Input {
let attributedTitle = text
.attributed(.bold(14), color: .mainTextColor, alignment: .center)

let checkboxColor: UIColor = isSelected
? .main
: .lightGray

return CheckBoxTextNode.Input(
title: attributedTitle,
insets: .init(top: 8, left: 16, bottom: 8, right: 16),
preferredSize: CGSize(width: 30, height: 30),
checkBoxInput: CheckBoxNode.Input(
color: checkboxColor,
strokeWidth: 2
)
)
}

static func passPhraseLocally(isSelected: Bool) -> CheckBoxTextNode.Input {
Self.common(with: "setup_save_pass_locally".localized, isSelected: isSelected)
}

static func passPhraseMemory(isSelected: Bool) -> CheckBoxTextNode.Input {
Self.common(with: "setup_save_pass_in_memory".localized, isSelected: isSelected)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import AsyncDisplayKit
import FlowCryptUI

// TODO: - ANTON - Move to FlowCryptUI
// TODO: - Ticket - Move to FlowCryptUI
struct Segment {
let viewController: UIViewController
let title: NSAttributedString
Expand Down
11 changes: 7 additions & 4 deletions FlowCrypt/Controllers/Compose/ComposeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class ComposeViewController: TableNodeViewController {

private let messageSender: MessageGateway
private let notificationCenter: NotificationCenter
private let dataService: DataServiceType & KeyDataServiceType
private let dataService: KeyStorageType
private let decorator: ComposeViewDecoratorType
private let core: Core
private let contactsService: ContactsServiceType
Expand All @@ -59,18 +59,21 @@ final class ComposeViewController: TableNodeViewController {
private var contextToSend = Context()

private var state: State = .main
private let email: String

init(
email: String,
messageSender: MessageGateway = MailProvider.shared.messageSender,
notificationCenter: NotificationCenter = .default,
dataService: DataServiceType & KeyDataServiceType = DataService.shared,
dataService: KeyStorageType = KeyDataStorage(),
decorator: ComposeViewDecoratorType = ComposeViewDecorator(),
input: ComposeViewController.Input = .empty,
core: Core = Core.shared,
cloudContactProvider: CloudContactsProvider = UserContactsProvider(),
userDefaults: UserDefaults = .standard,
contactsService: ContactsServiceType = ContactsService()
) {
self.email = email
self.messageSender = messageSender
self.notificationCenter = notificationCenter
self.dataService = dataService
Expand Down Expand Up @@ -243,7 +246,7 @@ extension ComposeViewController {
?? self.contextToSend.subject
?? "(no subject)"

guard let myPubKey = self.dataService.publicKey else {
guard let myPubKey = self.dataService.publicKey() else {
self.showAlert(message: "compose_no_pub_sender".localized)
return false
}
Expand Down Expand Up @@ -309,7 +312,7 @@ extension ComposeViewController {
to: to,
cc: cc,
bcc: bcc,
from: dataService.email ?? "",
from: email,
subject: subject,
replyToMimeMsg: replyToMimeMsg,
atts: atts
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ extension InboxViewControllerContainer: ASTableDelegate, ASTableDataSource {
switch self.state {
case .loading:
return TextCellNode(
input: self.decorator.loadingInput(with: size)
input: .loading(with: size)
)
case .error(let error):
return TextCellNode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,4 @@ struct InboxViewControllerContainerDecorator {
func retryActionTitle() -> NSAttributedString {
"retry_title".localized.attributed(color: .white)
}

func loadingInput(with size: CGSize) -> TextCellNode.Input {
TextCellNode.Input(
backgroundColor: .backgroundColor,
title: "loading_title".localized,
withSpinner: true,
size: size
)
}
}
28 changes: 8 additions & 20 deletions FlowCrypt/Controllers/Inbox/InboxViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class InboxViewController: ASDKViewController<ASDisplayNode> {
private var state: State = .idle

private let messageProvider: MessagesListProvider
private let decorator: InboxViewDecoratorType
private let decorator: InboxViewDecorator
private let enterpriseServerApi: EnterpriseServerApiType
private let refreshControl = UIRefreshControl()
private let tableNode: ASTableNode
Expand All @@ -64,7 +64,7 @@ final class InboxViewController: ASDKViewController<ASDisplayNode> {
init(
_ viewModel: InboxViewModel,
messageProvider: MessagesListProvider = MailProvider.shared.messageListProvider,
decorator: InboxViewDecoratorType = InboxViewDecorator(),
decorator: InboxViewDecorator = InboxViewDecorator(),
enterpriseServerApi: EnterpriseServerApiType = EnterpriseServerApi()
) {
self.viewModel = viewModel
Expand Down Expand Up @@ -273,8 +273,11 @@ extension InboxViewController {
}

private func btnComposeTap() {
guard let email = DataService.shared.email else {
return
}
TapTicFeedback.generate(.light)
let composeVc = ComposeViewController()
let composeVc = ComposeViewController(email: email)
navigationController?.pushViewController(composeVc, animated: true)
}
}
Expand Down Expand Up @@ -330,17 +333,7 @@ extension InboxViewController: ASTableDataSource, ASTableDelegate {
}

func tableNode(_ tableNode: ASTableNode, nodeBlockForRowAt indexPath: IndexPath) -> ASCellNodeBlock {
let height = tableNode.frame.size.height
- (navigationController?.navigationBar.frame.size.height ?? 0.0)
- safeAreaWindowInsets.top
- safeAreaWindowInsets.bottom

let size = CGSize(
width: tableNode.frame.size.width,
height: max(height, 0)
)

return cellNode(for: indexPath, and: size)
cellNode(for: indexPath, and: visibleSize(for: tableNode))
}

func tableNode(_ tableNode: ASTableNode, didSelectRowAt indexPath: IndexPath) {
Expand Down Expand Up @@ -368,12 +361,7 @@ extension InboxViewController {
case .fetching:
guard let message = self.messages[safe: indexPath.row] else {
return TextCellNode(
input: TextCellNode.Input(
backgroundColor: .backgroundColor,
title: "Loading ...",
withSpinner: true,
size: CGSize(width: 44, height: 44)
)
input: .loading(with: CGSize(width: 44, height: 44))
)
}
return InboxCellNode(message: InboxCellNode.Input(message))
Expand Down
8 changes: 1 addition & 7 deletions FlowCrypt/Controllers/Inbox/InboxViewDecorator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ extension InboxCellNode.Input {
}
}

protocol InboxViewDecoratorType {
func initialNodeInput(for size: CGSize) -> TextCellNode.Input

func emptyStateNodeInput(for size: CGSize, title: String) -> TextCellNode.Input
}

struct InboxViewDecorator: InboxViewDecoratorType {
struct InboxViewDecorator {
func emptyStateNodeInput(for size: CGSize, title: String) -> TextCellNode.Input {
TextCellNode.Input(
backgroundColor: .backgroundColor,
Expand Down
Loading