Skip to content

Commit 204da99

Browse files
author
Ioan Moldovan
authored
#2664 Allow forward without any added text (#2667)
* feat: allow forward without any added text * feat: updated fastlane * fix: stick to ruby 3.3.1 * fix: gem * fix: prelaunch_simulator * fix: build * temp * fix: build * fix: build * fix: build * fix * fix: pr reviews
1 parent 85a4885 commit 204da99

File tree

14 files changed

+136
-100
lines changed

14 files changed

+136
-100
lines changed

.semaphore/semaphore.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ blocks:
3333
- bundle exec fastlane test
3434
- git clone https://github.com/appium/WebDriverAgent.git
3535
- cd WebDriverAgent
36-
- xcodebuild build-for-testing -project WebDriverAgent.xcodeproj -derivedDataPath /var/tmp/derived_data/WebDriverAgent -scheme WebDriverAgentRunner -destination "platform=iphonesimulator,OS=18.4,name=iPhone 16"
36+
- xcodebuild build-for-testing -project WebDriverAgent.xcodeproj -derivedDataPath /var/tmp/derived_data/WebDriverAgent -scheme WebDriverAgentRunner -destination "platform=iphonesimulator,OS=18.5,name=iPhone 16"
3737
epilogue:
3838
always:
3939
commands:

FlowCrypt.xcodeproj/xcshareddata/xcschemes/Debug FlowCrypt.xcscheme

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@
123123
value = "disable"
124124
isEnabled = "YES">
125125
</EnvironmentVariable>
126+
<EnvironmentVariable
127+
key = "DYLD_FALLBACK_LIBRARY_PATH"
128+
value = "/Library/Developer/CoreSimulator/Volumes/iOS_22F77/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.5.simruntime/Contents/Resources/RuntimeRoot/System/Cryptexes/OS/usr/lib/swift"
129+
isEnabled = "YES">
130+
</EnvironmentVariable>
126131
</EnvironmentVariables>
127132
<LocationScenarioReference
128133
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"

FlowCrypt.xcodeproj/xcshareddata/xcschemes/FlowCryptAppTests.xcscheme

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,29 @@
4444
ReferencedContainer = "container:FlowCrypt.xcodeproj">
4545
</BuildableReference>
4646
</BuildableProductRunnable>
47+
<EnvironmentVariables>
48+
<EnvironmentVariable
49+
key = "DYLD_FALLBACK_LIBRARY_PATH"
50+
value = "/Library/Developer/CoreSimulator/Volumes/iOS_22F77/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.5.simruntime/Contents/Resources/RuntimeRoot/System/Cryptexes/OS/usr/lib/swift"
51+
isEnabled = "YES">
52+
</EnvironmentVariable>
53+
</EnvironmentVariables>
4754
</LaunchAction>
4855
<ProfileAction
4956
buildConfiguration = "Debug"
5057
shouldUseLaunchSchemeArgsEnv = "YES"
5158
savedToolIdentifier = ""
5259
useCustomWorkingDirectory = "NO"
5360
debugDocumentVersioning = "YES">
61+
<MacroExpansion>
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "C132B9AF1EC2DBD800763715"
65+
BuildableName = "FlowCrypt.app"
66+
BlueprintName = "FlowCrypt"
67+
ReferencedContainer = "container:FlowCrypt.xcodeproj">
68+
</BuildableReference>
69+
</MacroExpansion>
5470
</ProfileAction>
5571
<AnalyzeAction
5672
buildConfiguration = "Debug">

FlowCrypt/Controllers/Compose/ComposeViewControllerInput.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ struct ComposeMessageInput: Equatable {
3434
case reply(MessageQuoteInfo)
3535
case forward(MessageQuoteInfo)
3636
case draft(MessageQuoteInfo)
37+
38+
var isForward: Bool {
39+
if case .forward = self { return true }
40+
return false
41+
}
3742
}
3843

3944
let type: InputType
@@ -69,6 +74,30 @@ struct ComposeMessageInput: Equatable {
6974
var attachments: [MessageAttachment] {
7075
type.info?.attachments ?? []
7176
}
77+
78+
var quotedText: String {
79+
guard let info = self.type.info else { return "" }
80+
81+
let dateFormatter = DateFormatter()
82+
dateFormatter.dateStyle = .medium
83+
dateFormatter.timeStyle = .none
84+
85+
let date = dateFormatter.string(from: info.sentDate)
86+
87+
dateFormatter.dateStyle = .none
88+
dateFormatter.timeStyle = .short
89+
let time = dateFormatter.string(from: info.sentDate)
90+
91+
let from = info.sender?.formatted ?? "unknown sender"
92+
93+
let text = "\n\n"
94+
+ "compose_quote_from".localizeWithArguments(date, time, from)
95+
+ "\n"
96+
97+
let message = " > " + info.text.replacingOccurrences(of: "\n", with: "\n > ")
98+
99+
return text + message
100+
}
72101
}
73102

74103
extension ComposeMessageInput {

FlowCrypt/Controllers/Compose/ComposeViewDecorator.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -104,30 +104,6 @@ struct ComposeViewDecorator {
104104
text.attributed(.regular(17))
105105
}
106106

107-
func styledQuote(with input: ComposeMessageInput) -> NSAttributedString {
108-
guard let info = input.type.info else { return NSAttributedString(string: "") }
109-
110-
let dateFormatter = DateFormatter()
111-
dateFormatter.dateStyle = .medium
112-
dateFormatter.timeStyle = .none
113-
114-
let date = dateFormatter.string(from: info.sentDate)
115-
116-
dateFormatter.dateStyle = .none
117-
dateFormatter.timeStyle = .short
118-
let time = dateFormatter.string(from: info.sentDate)
119-
120-
let from = info.sender?.formatted ?? "unknown sender"
121-
122-
let text = "\n\n"
123-
+ "compose_quote_from".localizeWithArguments(date, time, from)
124-
+ "\n"
125-
126-
let message = " > " + info.text.replacingOccurrences(of: "\n", with: "\n > ")
127-
128-
return (text + message).attributed(.regular(17))
129-
}
130-
131107
func styledEmptyMessagePasswordInput() -> MessageActionCellNode.Input {
132108
messageActionInput(
133109
text: "compose_password_placeholder".localized,

FlowCrypt/Controllers/Compose/Extensions/ComposeViewController+Nodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ extension ComposeViewController {
153153

154154
func setupTextNode() {
155155
let attributedString = decorator.styledMessage(with: contextToSend.message ?? "")
156-
let styledQuote = decorator.styledQuote(with: input)
156+
let styledQuote = input.quotedText.attributed(.regular(17))
157157

158158
let mutableString = NSMutableAttributedString(attributedString: attributedString)
159159
if input.isQuote, !mutableString.string.contains(styledQuote.string) {

FlowCrypt/Functionality/Services/Compose Message Helper/ComposeMessageHelper.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ final class ComposeMessageHelper {
109109
) async throws -> SendableMsg {
110110
let subject = contextToSend.subject ?? ""
111111

112+
var messageContent = contextToSend.message
112113
if shouldValidate {
113114
onStateChanged?(.validatingMessage)
114115

@@ -131,10 +132,14 @@ final class ComposeMessageHelper {
131132
throw MessageValidationError.emptySubject
132133
}
133134

134-
let hasText = contextToSend.message?.hasContent ?? false
135+
// Allow message forward without any added text
136+
if !(contextToSend.message?.hasContent ?? false) && input.type.isForward {
137+
messageContent = input.quotedText
138+
}
139+
let hasText = messageContent?.hasContent ?? false
135140
let hasAttachments = !contextToSend.attachments.isEmpty
136141

137-
guard hasText || hasAttachments else {
142+
guard hasText || input.type.isForward || hasAttachments else {
138143
throw MessageValidationError.emptyMessage
139144
}
140145

@@ -171,7 +176,7 @@ final class ComposeMessageHelper {
171176
let signingPrv = shouldSign ? try await prepareSigningKey(senderEmail: contextToSend.sender) : nil
172177

173178
return SendableMsg(
174-
text: contextToSend.message ?? "",
179+
text: messageContent ?? "",
175180
html: nil,
176181
to: contextToSend.recipientEmails(type: .to),
177182
cc: contextToSend.recipientEmails(type: .cc),

Gemfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
source 'https://rubygems.org'
22

3-
gem "fastlane", "2.227.2"
3+
# until fastlane supports ruby 3.4
4+
# https://github.com/fastlane/fastlane/issues/29183
45
gem "abbrev"
56
gem "mutex_m"
6-
gem "ostruct"
7+
gem "ostruct"
8+
9+
gem "fastlane", "2.227.2"

appium/config/wdio.live.conf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ config.capabilities = [
1111
hostname: '127.0.0.1',
1212
'appium:automationName': 'XCUITest',
1313
'appium:deviceName': 'iPhone 16',
14-
'appium:platformVersion': '18.2',
14+
'appium:platformVersion': '18.5',
1515
'appium:app': join(process.cwd(), './FlowCrypt.app'),
1616
},
1717
];

appium/config/wdio.mock.conf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ config.capabilities = [
2121
args: ['--mock-fes-api', '--mock-attester-api', '--mock-gmail-api'],
2222
},
2323
'appium:deviceName': 'iPhone 16',
24-
'appium:platformVersion': '18.2',
24+
'appium:platformVersion': '18.5',
2525
'appium:orientation': 'PORTRAIT',
2626
'appium:app': join(process.cwd(), './FlowCrypt.app'),
2727
'appium:simulatorStartupTimeout': 600000,

0 commit comments

Comments
 (0)