-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: added show only encrypted emails filter buttoN * feat: added ui test * fix: pr reviews * fix: toggle crop issue
- Loading branch information
Showing
10 changed files
with
175 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// NotificationExtension.swift | ||
// FlowCrypt | ||
// | ||
// Created by Ioan Moldovan on 10/31/24 | ||
// Copyright © 2017-present FlowCrypt a. s. All rights reserved. | ||
// | ||
|
||
public extension Notification.Name { | ||
static var reloadThreadList: Notification.Name { | ||
return .init(rawValue: "ThreadList.Reload") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// PgpOnlySwitchNode.swift | ||
// FlowCrypt | ||
// | ||
// Created by Ioan Moldovan on 10/31/24 | ||
// Copyright © 2017-present FlowCrypt a. s. All rights reserved. | ||
// | ||
|
||
import AsyncDisplayKit | ||
import FlowCryptCommon | ||
|
||
public final class PgpOnlySwitchNode: CellNode { | ||
|
||
let SHOW_PGP_ONLY_KEY = "SHOW_PGP_ONLY_FLAG" | ||
|
||
private lazy var imageNode: ASImageNode = { | ||
let node = ASImageNode() | ||
let imageConfiguration = UIImage.SymbolConfiguration(font: .systemFont(ofSize: 24, weight: .light)) | ||
node.image = UIImage(systemName: "lock.shield", withConfiguration: imageConfiguration)?.tinted(.main) | ||
return node | ||
}() | ||
|
||
private lazy var toggleNode: SwitchCellNode = { | ||
let input = SwitchCellNode.Input( | ||
isOn: UserDefaults.standard.bool(forKey: SHOW_PGP_ONLY_KEY), | ||
attributedText: "show_only_pgp_messages" | ||
.localized | ||
.attributed(.medium(16), color: .textColor), | ||
accessibilityIdentifier: "aid-toggle-pgp-only-node", | ||
backgroundColor: .clear, | ||
switchJustifyContent: .center | ||
) | ||
return SwitchCellNode(input: input) { isOn in | ||
UserDefaults.standard.setValue(isOn, forKey: self.SHOW_PGP_ONLY_KEY) | ||
NotificationCenter.default.post(name: .reloadThreadList, object: nil) | ||
} | ||
}() | ||
|
||
override public init() { | ||
super.init() | ||
} | ||
|
||
override public func layoutSpecThatFits(_: ASSizeRange) -> ASLayoutSpec { | ||
toggleNode.style.flexGrow = 1 | ||
toggleNode.style.flexShrink = 1 | ||
return ASInsetLayoutSpec( | ||
insets: .deviceSpecificTextInsets(top: 16, bottom: 16), | ||
child: ASStackLayoutSpec.horizontal().then { | ||
$0.spacing = 6 | ||
$0.alignItems = .center | ||
$0.justifyContent = .spaceBetween | ||
$0.children = [imageNode, toggleNode] | ||
} | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
appium/tests/specs/mock/inbox/CheckShowOnlyEncryptedEmails.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { MockApi } from 'api-mocks/mock'; | ||
import { MockApiConfig } from 'api-mocks/mock-config'; | ||
import { MailFolderScreen, MenuBarScreen, SetupKeyScreen, SplashScreen } from '../../../screenobjects/all-screens'; | ||
|
||
describe('INBOX: ', () => { | ||
it('user is able to see only encrypted emails when he clicks show only encrypted emails button', async () => { | ||
const mockApi = new MockApi(); | ||
|
||
mockApi.fesConfig = MockApiConfig.defaultEnterpriseFesConfiguration; | ||
mockApi.ekmConfig = MockApiConfig.defaultEnterpriseEkmConfiguration; | ||
const plainEmailSubject = 'Honor reply-to address - plain'; | ||
const encryptedEmailSubject = 'Encrypted email with public key attached'; | ||
mockApi.addGoogleAccount('[email protected]', { | ||
messages: [plainEmailSubject, encryptedEmailSubject], | ||
}); | ||
|
||
await mockApi.withMockedApis(async () => { | ||
await SplashScreen.mockLogin(); | ||
await SetupKeyScreen.setPassPhrase(); | ||
await MailFolderScreen.checkInboxScreen(); | ||
|
||
// Check if both encrypted & plain emails are present | ||
await MailFolderScreen.checkEmailIsDisplayed(plainEmailSubject); | ||
await MailFolderScreen.checkEmailIsDisplayed(encryptedEmailSubject); | ||
|
||
await MenuBarScreen.clickMenuBtn(); | ||
await MenuBarScreen.clickShowOnlyEncryptedEmailsToggle(); | ||
await browser.pause(1000); | ||
await MenuBarScreen.clickInboxButton(); | ||
|
||
// Now check if plain email is not present | ||
await MailFolderScreen.checkEmailIsNotDisplayed(plainEmailSubject); | ||
}); | ||
}); | ||
}); |