Skip to content

Commit

Permalink
lint and format
Browse files Browse the repository at this point in the history
  • Loading branch information
jullianm committed Jan 13, 2025
1 parent a4f5c36 commit 2cb70d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ struct NewSystemMessageNotificationBuilder: NotificationBuilder {
break
case let .messageTimerUpdate(timeoutValue):
var timeoutStrValue: String?

if let timeoutValue {
let timerInMilliseconds = Double(timeoutValue)
let timeoutValue = timerInMilliseconds / 1000
let timeout: MessageDestructionTimeoutValue = .init(rawValue: timeoutValue)

timeoutStrValue = timeout.displayString
}

return buildTimerUpdateNotification(timeout: timeoutStrValue)
}

Expand Down Expand Up @@ -148,14 +148,14 @@ struct NewSystemMessageNotificationBuilder: NotificationBuilder {

return content
}

private func buildTimerUpdateNotification(timeout: String?) -> UNMutableNotificationContent {
let content = UNMutableNotificationContent()

if let title = makeTitle() {
content.title = title
}

let bodyFormat: NotificationBody.SystemMessageBodyFormat = if let timeout {
.setMessageTimer(senderName: context.senderName, timeoutValue: timeout)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ struct NewSystemMessageNotificationBodyComposer {
case let .removedYou(senderName):
senderName != nil ? "\(senderName!) removed you" : "Someone removed you"
case let .setMessageTimer(senderName, timeoutValue):
senderName != nil ? "\(senderName!) set the message timer to \(timeoutValue)" : "Someone set the message timer to \(timeoutValue)"
senderName != nil ? "\(senderName!) set the message timer to \(timeoutValue)" :
"Someone set the message timer to \(timeoutValue)"
case let .addedYou(senderName):
// TODO: [WPB-11661]
""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,12 @@ final class NewSystemMessageNotificationBuilderTests: XCTestCase {
break
case .conversationDeleted:
break
case .messageTimerUpdate(let timeoutValue):
case let .messageTimerUpdate(timeoutValue):
if let timeoutValue {
XCTAssertEqual(notificationContent.body, "\(Scaffolding.senderName) set the message timer to \(timeoutValue / 1000) seconds")
XCTAssertEqual(
notificationContent.body,
"\(Scaffolding.senderName) set the message timer to \(timeoutValue / 1000) seconds"
)
} else {
XCTAssertEqual(notificationContent.body, "\(Scaffolding.senderName) turned off the message timer")
}
Expand Down

0 comments on commit 2cb70d1

Please sign in to comment.